summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexport_for_udd.py54
1 files changed, 35 insertions, 19 deletions
diff --git a/export_for_udd.py b/export_for_udd.py
index 8f331ca..86171a6 100755
--- a/export_for_udd.py
+++ b/export_for_udd.py
@@ -8,6 +8,18 @@ import json
def main():
db = PatchTrackerDB()
packages = []
+ previous = {}
+
+ # Load data from previous calculations
+ for fn in sys.argv[1:]:
+ with open(fn) as f:
+ data = json.load(f)
+ for line in data:
+ previous[(line['package'], line['version'])] = \
+ {'series_type': line['series_type'],
+ 'nondebian': line['nondebian'],
+ 'patches': line['patches']}
+
try:
i = 0
for package, suite, version in db.enumerate_packages():
@@ -20,29 +32,33 @@ def main():
print >> sys.stderr, "%d %s %s %s" % (i, package, suite, version)
i += 1
- try:
- dh = db.makeDiffHandler(package, version)
- series = dh.series(ghost=True)
- if series:
- series_type = series.style
- else:
- series_type = "no_series"
+ if (package, version) not in previous:
+ prev_package = previous[(package, version)] = {}
try:
- nondebian_diff = dh.nondebiandir(ghost=True)
- nondebian = nondebian_diff.diffstat().lines()
- except AttributeError:
- # This means that the handler is a DebTarHandler
- nondebian = [0, 0, 0]
- except PackageWithoutDiffException:
- # The package is native
- series_type = "native"
- nondebian = [0, 0, 0]
+ dh = db.makeDiffHandler(package, version)
+ series = dh.series(ghost=True)
+ if series:
+ prev_package['series_type'] = series.style
+ else:
+ prev_package['series_type'] = "no_series"
+ try:
+ nondebian_diff = dh.nondebiandir(ghost=True)
+ prev_package['nondebian'] = nondebian_diff.diffstat().lines()
+ except AttributeError:
+ # This means that the handler is a DebTarHandler
+ prev_package['nondebian'] = [0, 0, 0]
+ except PackageWithoutDiffException:
+ # The package is native
+ prev_package['series_type'] = "native"
+ prev_package['nondebian'] = [0, 0, 0]
- patches = [(patch, patch_data.diffstat().lines()) for (patch, patch_data) in series]
+ prev_package['patches'] = [(patch, patch_data.diffstat().lines()) for (patch, patch_data) in series]
+ prev_package = previous[(package, version)]
packages.append({'package': package, 'suite': suite, 'version': version,
- 'series_type': series_type, 'nondebian': nondebian,
- 'patches': patches})
+ 'series_type': prev_package['series_type'],
+ 'nondebian': prev_package['nondebian'],
+ 'patches': prev_package['patches']})
# This is mainly intended for debugging: if you want to interrupt the
# process, you still can obtain the JSON with the packages processed so far.