diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-04-04 23:06:07 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-04-05 10:02:45 +0200 |
commit | 1a7ad0e80b2e6ad18aeee48d6155e2beada67308 (patch) | |
tree | 8406c24594ac5ea994455588cb617a2c968f9dfd /bin | |
parent | bb4ee336717a94a48029c256ccda0cb893307abb (diff) | |
download | jenkins.debian.net-1a7ad0e80b2e6ad18aeee48d6155e2beada67308.tar.xz |
reproducible debian: add results from most recent package versions only to r-tracker.json
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_json.py | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/bin/reproducible_json.py b/bin/reproducible_json.py index e9afd4fb..8d150306 100755 --- a/bin/reproducible_json.py +++ b/bin/reproducible_json.py @@ -12,10 +12,13 @@ from reproducible_common import * +from apt_pkg import version_compare +import aptsources.sourceslist import json import os import tempfile + output = [] output4tracker = [] @@ -34,9 +37,11 @@ keys = ['package', 'version', 'suite', 'architecture', 'status', 'build_date'] crossarchkeys = ['package', 'version', 'suite', 'status'] archdetailkeys = ['architecture', 'version', 'status', 'build_date'] -# crossarch is a dictionary of all packages used to build a summary of the package's test results -# across all archs (for suite=unstable only) +# crossarch is a dictionary of all packages used to build a summary of the +# package's test results across all archs (for suite=unstable only) crossarch = {} + +crossarchversions = {} for row in result: pkg = dict(zip(keys, row)) log.debug(pkg) @@ -47,31 +52,56 @@ for row in result: package = pkg['package'] if package in crossarch: - # compare statuses to get cross-arch package status status1 = crossarch[package]['status'] status2 = pkg['status'] newstatus = '' - if 'FTBFS' in [status1, status2]: - newstatus = 'FTBFS' - elif 'unreproducible' in [status1, status2]: - newstatus = 'unreproducible' - elif 'reproducible' in [status1, status2]: - newstatus = 'reproducible' + # compare the versions (only keep most up to date!) + version1 = crossarch[package]['version'] + version2 = pkg['version'] + versionscompared = version_compare(version1, version2); + + # if version1 > version2, + # skip the package results we are currently inspecting + if (versionscompared > 0): + break + + # if version1 < version2, + # delete the package results with the older version + elif (versionscompared < 0): + newstatus = status2 + # remove the old package information from the list + archlist = crossarch[package]['architecture_details'] + newarchlist = [a for a in archlist if a['version'] != version1] + crossarch[package]['architecture_details'] = newarchlist + + # if version1 == version 2, + # we are comparing status for the same (most recent) version else: - newstatus = 'depwait' - - # update the crossarch status + if 'FTBFS' in [status1, status2]: + newstatus = 'FTBFS' + elif 'unreproducible' in [status1, status2]: + newstatus = 'unreproducible' + elif 'reproducible' in [status1, status2]: + newstatus = 'reproducible' + else: + newstatus = 'depwait' + + # update the crossarch status and version crossarch[package]['status'] = newstatus + crossarch[package]['version'] = version2 # add arch specific test results to architecture_details list - crossarch[package]['architecture_details'].append({key:pkg[key] for key in archdetailkeys}) + newarchdetails = {key:pkg[key] for key in archdetailkeys} + crossarch[package]['architecture_details'].append(newarchdetails) + else: # add package to crossarch crossarch[package] = {key:pkg[key] for key in crossarchkeys} - crossarch[package]['architecture_details'] = [{key:pkg[key] for key in archdetailkeys}] + crossarch[package]['architecture_details'] = \ + [{key:pkg[key] for key in archdetailkeys}] output4tracker = list(crossarch.values()) |