Improve check phase in staging plugin
It now checks not only for changed packages but also for changes in build state.
This commit is contained in:
parent
ab06ddf6e0
commit
deecc15713
@ -49,6 +49,56 @@ def _staging_check(self, project, check_everything, opts):
|
|||||||
print >>sys.stderr, 'Error: Has local modifications: %s/%s'%(project, pkg)
|
print >>sys.stderr, 'Error: Has local modifications: %s/%s'%(project, pkg)
|
||||||
ret = 1
|
ret = 1
|
||||||
continue
|
continue
|
||||||
|
if ret == 1:
|
||||||
|
print >>sys.stderr, "Error: Check for local changes failed"
|
||||||
|
else:
|
||||||
|
print "Check for local changes passed"
|
||||||
|
|
||||||
|
# Check for regressions
|
||||||
|
print "Getting build status"
|
||||||
|
# Get staging project results
|
||||||
|
f = show_prj_results_meta(apiurl, project)
|
||||||
|
root = ET.fromstring(''.join(f))
|
||||||
|
# Get parent project results
|
||||||
|
f = show_prj_results_meta(apiurl, re.sub(r":Staging:[^:]*$", "", project))
|
||||||
|
p_root = ET.fromstring(''.join(f))
|
||||||
|
print "Comparing build statuses"
|
||||||
|
|
||||||
|
# Iterate through all repos/archs
|
||||||
|
if root.find('result') != None:
|
||||||
|
for results in root.findall('result'):
|
||||||
|
if results.get("state") not in [ "published", "unpublished" ]:
|
||||||
|
print >>sys.stderr, "Warning: Building not finished yet for %s/%s (%s)!"%(results.get("repository"),results.get("arch"),results.get("state"))
|
||||||
|
ret |= 2
|
||||||
|
# Find coresponding set of results in parent project
|
||||||
|
p_results = p_root.find("result[@repository='%s'][@arch='%s']"%(results.get("repository"),results.get("arch")))
|
||||||
|
if p_results == None:
|
||||||
|
print >>sys.stderr, "Error: Inconsistent setup!"
|
||||||
|
ret |= 4
|
||||||
|
else:
|
||||||
|
# Iterate through packages
|
||||||
|
for node in results:
|
||||||
|
result = node.get("code")
|
||||||
|
# Skip not rebuilt
|
||||||
|
if result in [ "blocked", "building", "disabled" "excluded", "finished", "unpublished", "published" ]:
|
||||||
|
next
|
||||||
|
# Get status of package in parent project
|
||||||
|
p_node = p_results.find("status[@package='%s']"%(node.get("package")))
|
||||||
|
if p_node == None:
|
||||||
|
p_result = None
|
||||||
|
else:
|
||||||
|
p_result = p_node.get("code")
|
||||||
|
# Skip packages not built in parent project
|
||||||
|
if p_result in [ None, "disabled", "excluded" ]:
|
||||||
|
next
|
||||||
|
# Find regressions
|
||||||
|
if result in [ "broken", "failed", "unresolvable" ] and result != p_result:
|
||||||
|
print >>sys.stderr, "Error: Regression (%s -> %s) in package '%s' in %s/%s!"%(p_result, result, node.get("package"),results.get("repository"),results.get("arch"))
|
||||||
|
ret |= 8
|
||||||
|
# Find fixed builds
|
||||||
|
if result in [ "succeeded" ] and result != p_result:
|
||||||
|
print "Package '%s' fixed (%s -> %s) in staging for %s/%s."%(node.get("package"), p_result, result, results.get("repository"),results.get("arch"))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _staging_create(self, sr, opts):
|
def _staging_create(self, sr, opts):
|
||||||
@ -276,7 +326,7 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
self._staging_create(sr, opts)
|
self._staging_create(sr, opts)
|
||||||
elif cmd in ['check']:
|
elif cmd in ['check']:
|
||||||
project = args[1]
|
project = args[1]
|
||||||
self._staging_check(project, staging_check_everything, opts)
|
return self._staging_check(project, staging_check_everything, opts)
|
||||||
elif cmd in ['remove', 'r']:
|
elif cmd in ['remove', 'r']:
|
||||||
project = args[1]
|
project = args[1]
|
||||||
self._staging_remove(project, opts)
|
self._staging_remove(project, opts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user