def request_repository_pairs(self, request, action): if str2bool( Config.get(self.apiurl, action.tgt_project).get('repo_checker-project-skip', 'False')): # Do not change message as this should only occur in requests # targeting multiple projects such as in maintenance workflow in # which the message should be set by other actions. self.logger.debug('skipping review of action targeting {}'.format( action.tgt_project)) return True repository = self.project_repository(action.tgt_project) if not repository: self.review_messages['declined'] = ERROR_REPO_SPECIFIED.format( action.tgt_project) return False repository_pairs = [] # Assumes maintenance_release target project has staging disabled. staging = Config.get(self.apiurl, action.tgt_project).get('staging') if staging: api = self.staging_api(staging) stage_info = api.packages_staged.get(action.tgt_package) if not stage_info or str(stage_info['rq_id']) != str( request.reqid): self.logger.info('{} not staged'.format(request.reqid)) return None if not self.force and not self.staging_build_failure_check( api, stage_info['prj']): self.logger.info( '{} not ready due to staging build failure(s)'.format( request.reqid)) return None # Staging setup is convoluted and thus the repository setup does not # contain a path to the target project. Instead the ports repository # is used to import the target prjconf. As such the staging group # repository must be explicitly layered on top of target project. repository_pairs.append([stage_info['prj'], repository]) repository_pairs.extend( repository_path_expand(self.apiurl, action.tgt_project, repository)) else: # Find a repository which links to target project "main" repository. repository = repository_path_search(self.apiurl, action.src_project, action.tgt_project, repository) if not repository: self.review_messages['declined'] = ERROR_REPO_SPECIFIED.format( action.tgt_project) return False repository_pairs.extend( repository_path_expand(self.apiurl, action.src_project, repository)) return repository_pairs
def project_repository(self, project): repository = Config.get(self.apiurl, project).get('main-repo') if not repository: self.logger.debug('no main-repo defined for {}'.format(project)) search_project = 'openSUSE:Factory' for search_repository in ('snapshot', 'standard'): repository = repository_path_search( self.apiurl, project, search_project, search_repository) if repository: self.logger.debug('found chain to {}/{} via {}'.format( search_project, search_repository, repository)) break return repository
def project_repository(self, project): repository = Config.get(self.apiurl, project).get('main-repo') if not repository: self.logger.debug('no main-repo defined for {}'.format(project)) search_project = 'openSUSE:Factory' for search_repository in ('snapshot', 'standard'): repository = repository_path_search( self.apiurl, project, search_project, search_repository) if repository: self.logger.debug('found chain to {}/{} via {}'.format( search_project, search_repository, repository)) break return repository
def request_repository_pairs(self, request, action): if str2bool(Config.get(self.apiurl, action.tgt_project).get('repo_checker-project-skip', 'False')): # Do not change message as this should only occur in requests # targeting multiple projects such as in maintenance workflow in # which the message should be set by other actions. self.logger.debug('skipping review of action targeting {}'.format(action.tgt_project)) return True repository = self.project_repository(action.tgt_project) if not repository: self.review_messages['declined'] = ERROR_REPO_SPECIFIED.format(action.tgt_project) return False repository_pairs = [] # Assumes maintenance_release target project has staging disabled. staging = Config.get(self.apiurl, action.tgt_project).get('staging') if staging: api = self.staging_api(staging) stage_info = api.packages_staged.get(action.tgt_package) if not stage_info or str(stage_info['rq_id']) != str(request.reqid): self.logger.info('{} not staged'.format(request.reqid)) return None if not self.force and not self.staging_build_failure_check(api, stage_info['prj']): self.logger.info('{} not ready due to staging build failure(s)'.format(request.reqid)) return None # Staging setup is convoluted and thus the repository setup does not # contain a path to the target project. Instead the ports repository # is used to import the target prjconf. As such the staging group # repository must be explicitly layered on top of target project. repository_pairs.append([stage_info['prj'], repository]) repository_pairs.extend(repository_path_expand(self.apiurl, action.tgt_project, repository)) else: # Find a repository which links to target project "main" repository. repository = repository_path_search( self.apiurl, action.src_project, action.tgt_project, repository) if not repository: self.review_messages['declined'] = ERROR_REPO_SPECIFIED.format(action.tgt_project) return False repository_pairs.extend(repository_path_expand(self.apiurl, action.src_project, repository)) return repository_pairs
def check_action_maintenance_release(self, request, action): # No reason to special case patchinfo since same source and target # projects which is all that repo_checker cares about. if action.tgt_project in self.checked_targets: return True target_config = Config.get(self.apiurl, action.tgt_project) if str2bool(target_config.get('repo_checker-project-skip', 'False')): # Do not change message as this should only occur in requests # targeting multiple projects such as in maintenance workflow in # which the message should be set by other actions. self.logger.debug('skipping review of action targeting {}'.format( action.tgt_project)) return True repository = target_config.get('main-repo') if not repository: raise Exception('Missing main-repo in OSRT:Config') # Find a repository which links to target project "main" repository. repository = repository_path_search(self.apiurl, action.src_project, action.tgt_project, repository) if not repository: raise Exception('Missing repositories') repository_pairs = repository_path_expand(self.apiurl, action.src_project, repository) self.checked_targets.add(action.tgt_project) archs = set(target_archs(self.apiurl, action.src_project, repository)) arch_whitelist = target_config.get('repo_checker-arch-whitelist', None) if arch_whitelist: archs = set(arch_whitelist.split(' ')).intersection(archs) if not self.repository_check(repository_pairs, archs): return None self.review_messages['accepted'] = 'install check passed' return True