diff --git a/core/check_meta_service.py b/core/check_meta_service.py index 27c522c6606cc1cca662c89c75a3dd315f1d08c4..a18ecded5f2652009d318989cfb7de86714bb19f 100644 --- a/core/check_meta_service.py +++ b/core/check_meta_service.py @@ -695,6 +695,28 @@ class CheckMetaPull(object): log.info("******CHECK PR RULE********") log.info("check pr rule finished,please wait other check!!!") + def _check_pr_master(self, change_file): + ''' + check add pkg is master + params + chang_file : modified file abs path + ''' + log.info("******CHECK PR MASTER PKGNAME*********") + failed_msg = [] + for file in change_file: + path_info = self._get_path_info(file) + pkg_name = path_info[0] + if 'master' in file: + log.error("check failed this pkg:{} in master branch".format(pkg_name)) + failed_msg.append(pkg_name) + failed_flag = True + else: + log.info("check success this pkg:{}".format(pkg_name)) + if failed_flag: + log.error("this below pkgs in master branch:{}".format(failed_msg)) + raise SystemExit("*******CHECK PR MASTER PKGNAME ERROR:please check your PR*******") + log.info("******CHECK PR MASTER PKGNAME*********") + def do_all(self): """ @@ -703,6 +725,7 @@ class CheckMetaPull(object): if self.prid and self.token: release_management_data = self._release_management_tree() change_result, complete_change_result = self._get_all_change_file() + self._check_pr_master(change_result) pr_check_result = self._check_pr_rule(release_management_data, complete_change_result) self._check_private_sig_pkg(change_result) check_result = self._check_service_meta(change_result) diff --git a/core/check_release_management.py b/core/check_release_management.py index c38fdc3eab5733a70d19fe5654195be39e5dc57b..182451def9331d166b61df24a133b5c4cbc63342 100644 --- a/core/check_release_management.py +++ b/core/check_release_management.py @@ -465,25 +465,26 @@ class CheckReleaseManagement(object): for branch,pkgs in add_infos.items(): log.info('check branch:{} add pkgs obs_from check running...'.format(branch)) for pkg in pkgs: - branch = branch.replace("-",":") if pkg['obs_from']: if 'Multi-Version' in branch: + c_branch = branch.replace("_",":") from_result = self._find_master_meta_path(pkg, ctype='multi-from') else: + c_branch = branch.replace("-",":") from_result = self._find_master_meta_path(pkg) if from_result: error_flag = True - if error_infos.get(branch,[]): - error_infos[branch].append(pkg) + if error_infos.get(c_branch,[]): + error_infos[c_branch].append(pkg) else: - error_infos[branch] = [pkg] - if pkg['obs_to'] != branch: + error_infos[c_branch] = [pkg] + if pkg['obs_to'] != c_branch: error_flag = True log.error("pkg name:{2} Wrong obs_to: in !!!".format(pkg['obs_to'],branch,pkg['name'])) - if error_infos.get(branch,[]): - error_infos[branch].append(pkg) + if error_infos.get(c_branch,[]): + error_infos[c_branch].append(pkg) else: - error_infos[branch] = [pkg] + error_infos[c_branch] = [pkg] if error_infos: log.error("some errors in your commit,please check: {}".format(error_infos)) return error_flag @@ -710,6 +711,7 @@ class CheckReleaseManagement(object): error_names.remove(pkg['name']) break if error_names: + log.error("branch:{}----{}".format(branch,error_names)) error_flag =True for pkg in pkgs: if pkg['name'] in error_names: @@ -842,11 +844,11 @@ class CheckReleaseManagement(object): same_pkg[branch].append(new['name']) new_pkg[branch].append(new['name']) change_infos[branch] = new_msgs - for branch,pkgs in change_infos.items(): - if pkgs: - log.info("change in:{}".format(branch)) - for pkg in pkgs: - log.info(pkg) + # for branch,pkgs in change_infos.items(): + # if pkgs: + # log.info("change in:{}".format(branch)) + # for pkg in pkgs: + # log.info(pkg) if error_pkg_flag: log.error("May be {0} should not be delete".format(error_pkg)) raise SystemExit("ERROR: Please check your PR")