If any goodrepo have no missing, the request have no missings.

This commit is contained in:
Alberto Planas 2015-02-24 17:57:19 +01:00
parent 9e4a8083b2
commit 5a6ffa6505
2 changed files with 18 additions and 33 deletions

View File

@ -201,8 +201,14 @@ def _check_repo_group(self, id_, requests, debug=False):
request.updated = True request.updated = True
for rq in requests: for rq in requests:
# Check if there are any goodrepo without missing packages
missing_repos = set(rq.missings.keys())
if any(r not in missing_repos for r in rq.goodrepos):
continue
smissing = [] smissing = []
for package in rq.missings: all_missing_packages = {item for sublist in rq.missings.values() for item in sublist}
for package in all_missing_packages:
alreadyin = False alreadyin = False
for t in packs: for t in packs:
if package == t.tgt_package: if package == t.tgt_package:

View File

@ -58,7 +58,7 @@ class Request(object):
self.verifymd5 = verifymd5 self.verifymd5 = verifymd5
self.group = group self.group = group
self.goodrepos = goodrepos if goodrepos else [] self.goodrepos = goodrepos if goodrepos else []
self.missings = missings if missings else [] self.missings = missings if missings else {}
self.is_shadow = is_shadow self.is_shadow = is_shadow
self.shadow_src_project = shadow_src_project self.shadow_src_project = shadow_src_project
@ -93,7 +93,7 @@ class Request(object):
# Assigned in is_buildsuccess # Assigned in is_buildsuccess
self.goodrepos = [] self.goodrepos = []
self.missings = [] self.missings = {}
# Detect if the request comes from Factory to a openSUSE # Detect if the request comes from Factory to a openSUSE
# release, and adjust the source and target projects # release, and adjust the source and target projects
@ -705,28 +705,6 @@ class CheckRepo(object):
return False return False
def get_missings(self, request):
"""Get the list of packages that are in missing status."""
missings = set()
# XXX TODO - This piece is contained in
# is_buildsuccess(). Integrate both.
repos_to_check = self.repositories_to_check(request)
for repository in repos_to_check:
for arch in repository.findall('arch'):
if arch.attrib['arch'] not in ('i586', 'x86_64'):
continue
if 'missing' in arch.attrib:
for package in arch.attrib['missing'].split(','):
if not self.is_binary(
request.src_project,
repository.attrib['name'],
arch.attrib['arch'],
package):
missings.add(package)
return sorted(missings)
def is_buildsuccess(self, request): def is_buildsuccess(self, request):
"""Return True if the request is correctly build """Return True if the request is correctly build
@ -750,17 +728,18 @@ class CheckRepo(object):
return False return False
result = False result = False
missings = set()
alldisabled = True alldisabled = True
foundbuilding = None foundbuilding = None
foundfailed = None foundfailed = None
for repository in repos_to_check: for repository in repos_to_check:
repo_name = repository.attrib['name']
self.debug("checking repo", ET.tostring(repository)) self.debug("checking repo", ET.tostring(repository))
isgood = True isgood = True
founddisabled = False founddisabled = False
r_foundbuilding = None r_foundbuilding = None
r_foundfailed = None r_foundfailed = None
missings = []
for arch in repository.findall('arch'): for arch in repository.findall('arch'):
if arch.attrib['arch'] not in ('i586', 'x86_64'): if arch.attrib['arch'] not in ('i586', 'x86_64'):
continue continue
@ -768,10 +747,10 @@ class CheckRepo(object):
for package in arch.attrib['missing'].split(','): for package in arch.attrib['missing'].split(','):
if not self.is_binary( if not self.is_binary(
request.src_project, request.src_project,
repository.attrib['name'], repo_name,
arch.attrib['arch'], arch.attrib['arch'],
package): package):
missings.add(package) missings.append(package)
if arch.attrib['result'] not in ('succeeded', 'excluded'): if arch.attrib['result'] not in ('succeeded', 'excluded'):
isgood = False isgood = False
if arch.attrib['result'] == 'excluded' and arch.attrib['arch'] == 'x86_64': if arch.attrib['result'] == 'excluded' and arch.attrib['arch'] == 'x86_64':
@ -782,9 +761,9 @@ class CheckRepo(object):
# Sometimes an unknown status is equivalent to # Sometimes an unknown status is equivalent to
# disabled, but we map it as failed to have a human # disabled, but we map it as failed to have a human
# check (no autoreject) # check (no autoreject)
r_foundfailed = repository.attrib['name'] r_foundfailed = repo_name
if arch.attrib['result'] == 'building': if arch.attrib['result'] == 'building':
r_foundbuilding = repository.attrib['name'] r_foundbuilding = repo_name
if arch.attrib['result'] == 'outdated': if arch.attrib['result'] == 'outdated':
msg = "%s's sources were changed after submissions and the old sources never built. Please resubmit" % request.src_package msg = "%s's sources were changed after submissions and the old sources never built. Please resubmit" % request.src_package
print 'DECLINED', msg print 'DECLINED', msg
@ -796,7 +775,7 @@ class CheckRepo(object):
if not founddisabled: if not founddisabled:
alldisabled = False alldisabled = False
if isgood: if isgood:
_goodrepo = (request.src_project, repository.attrib['name']) _goodrepo = (request.src_project, repo_name)
self.debug("good repo", _goodrepo) self.debug("good repo", _goodrepo)
if _goodrepo not in request.goodrepos: if _goodrepo not in request.goodrepos:
request.goodrepos.append(_goodrepo) request.goodrepos.append(_goodrepo)
@ -805,8 +784,8 @@ class CheckRepo(object):
foundbuilding = r_foundbuilding foundbuilding = r_foundbuilding
if r_foundfailed: if r_foundfailed:
foundfailed = r_foundfailed foundfailed = r_foundfailed
if missings:
request.missings = sorted(missings) request.missings[repo_name] = missings
if result: if result:
return True return True