support delete requests

we track the target package to download the toignore tracking
This commit is contained in:
Stephan Kulow 2014-07-17 11:36:05 +02:00
parent b8cd627da1
commit 3b14b96a66
3 changed files with 36 additions and 19 deletions

View File

@ -262,6 +262,11 @@ def _check_repo_group(self, id_, requests, opts):
for rq in packs:
if fetched[rq.request_id]:
continue
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)
@ -269,6 +274,7 @@ def _check_repo_group(self, id_, requests, 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

View File

@ -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

View File

@ -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()