diff --git a/osc-check_repo.py b/osc-check_repo.py index 0786256b..9a721263 100644 --- a/osc-check_repo.py +++ b/osc-check_repo.py @@ -262,13 +262,19 @@ def _check_repo_group(self, id_, requests, opts): for rq in packs: if fetched[rq.request_id]: continue - # we need to call it to fetch the good repos to download - # but the return value is of no interest right now. - self.checkrepo.is_buildsuccess(rq) - i = self._check_repo_download(rq, opts) - if rq.error: - print 'ERROR (ALREADY ACEPTED?):', rq.error - rq.updated = True + i = set() + if rq.action_type == 'delete': + # for delete requests we only care for toignore + i = self._check_repo_toignore(rq, opts) + else: + # we need to call it to fetch the good repos to download + # but the return value is of no interest right now. + self.checkrepo.is_buildsuccess(rq) + i = self._check_repo_download(rq, opts) + if rq.error: + print 'ERROR (ALREADY ACEPTED?):', rq.error + rq.updated = True + toignore.update(i) # Detect cycles into the current Factory graph after we update the diff --git a/osclib/checkrepo.py b/osclib/checkrepo.py index c268db6e..1e20d84b 100644 --- a/osclib/checkrepo.py +++ b/osclib/checkrepo.py @@ -57,6 +57,8 @@ class Request(object): self.error = None self.build_excluded = False self.is_cached = False + self.action_type = 'submit' # assume default + self.downloads = [] if element: self.load(element) @@ -66,11 +68,16 @@ class Request(object): self.request_id = int(element.get('id')) action = element.find('action') - self.src_project = action.find('source').get('project') - self.src_package = action.find('source').get('package') - self.revision = action.find('source').get('rev') - self.tgt_project = action.find('target').get('project') - self.tgt_package = action.find('target').get('package') + self.action_type = action.get('type') + source = action.find('source') + if source is not None: + self.src_project = source.get('project') + self.src_package = source.get('package') + self.revision = source.get('rev') + target = action.find('target') + if target is not None: + self.tgt_project = target.get('project') + self.tgt_package = target.get('package') # The groups are in the CheckRepo object. self.group = self.request_id @@ -290,20 +297,21 @@ class CheckRepo(object): self.change_review_state(request_id, 'declined', message=msg) return requests - # Accept requests that are not SUBMIT type. - # XXX TODO - DELETE requests need to be managed here too. - action = actions[0] - action_type = action.get('type') - if action_type != 'submit': - msg = 'Unchecked request type %s' % action_type + rq = Request(element=request) + + if rq.action_type != 'submit' and rq.action_type != 'delete': + msg = 'Unchecked request type %s' % rq.action_type print 'ACCEPTED', msg self.change_review_state(request_id, 'accepted', message=msg) return requests - rq = Request(element=request) rq.group = self.grouped.get(request_id, request_id) requests.append(rq) + if rq.action_type == 'delete': + # only track the target package + return requests + # Get source information about the SR: # - Source MD5 # - Entries (.tar.gz, .changes, .spec ...) and MD5 diff --git a/osclib/cycle.py b/osclib/cycle.py index 85f812d8..c443f229 100644 --- a/osclib/cycle.py +++ b/osclib/cycle.py @@ -231,6 +231,9 @@ class CycleDetector(object): def cycles(self, requests, project='openSUSE:Factory', repository='standard', arch='x86_64'): """Detect cycles in a specific repository.""" + # filter submit requests + requests = [ rq for rq in requests if rq.action_type == 'submit' ] + # Detect cycles - We create the full graph from _builddepinfo. factory_graph = self._get_builddepinfo_graph(project, repository, arch) factory_cycles = factory_graph.cycles()