[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible_json.py: Write .bz2 versions as well. (Closes: #859254)

Holger Levsen holger at layer-acht.org
Mon Apr 3 12:58:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit c0ebfbc8df77d5a982f1b1897c2114c735a9b8db
Author: Chris Lamb <lamby at debian.org>
Date:   Sat Apr 1 19:17:24 2017 +0100

    reproducible_json.py: Write .bz2 versions as well. (Closes: #859254)
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_json.py | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/bin/reproducible_json.py b/bin/reproducible_json.py
index 33e0fb3..cfb6e95 100755
--- a/bin/reproducible_json.py
+++ b/bin/reproducible_json.py
@@ -14,6 +14,7 @@ from reproducible_common import *
 
 from apt_pkg import version_compare
 import aptsources.sourceslist
+import bz2
 import json
 import os
 import tempfile
@@ -105,19 +106,18 @@ for row in result:
 
 output4tracker = list(crossarch.values())
 
-# normal json
-tmpfile = tempfile.mkstemp(dir=os.path.dirname(REPRODUCIBLE_JSON))[1]
-with open(tmpfile, 'w') as fd:
-    json.dump(output, fd, indent=4, sort_keys=True)
-os.rename(tmpfile, REPRODUCIBLE_JSON)
-os.chmod(REPRODUCIBLE_JSON, 0o644)
-
-# json for tracker.d.o, thanks to #785531
-tmpfile = tempfile.mkstemp(dir=os.path.dirname(REPRODUCIBLE_TRACKER_JSON))[1]
-with open(tmpfile, 'w') as fd:
-    json.dump(output4tracker, fd, indent=4, sort_keys=True)
-os.rename(tmpfile, REPRODUCIBLE_TRACKER_JSON)
-os.chmod(REPRODUCIBLE_TRACKER_JSON, 0o644)
-
-log.info(DEBIAN_URL + '/reproducible.json and /reproducible-tracker.json have been updated.')
-
+for data, fn, target in (
+    (output, open, REPRODUCIBLE_JSON),
+    (output, bz2.BZ2File, REPRODUCIBLE_JSON + '.bz2'),
+
+    # json for tracker.d.o, thanks to #785531
+    (output4tracker, open, REPRODUCIBLE_TRACKER_JSON),
+    (output4tracker, bz2.BZ2File, REPRODUCIBLE_TRACKER_JSON + '.bz2'),
+):
+    tmpfile = tempfile.mkstemp()[1]
+    with fn(tmpfile, 'w') as fd:
+        json.dump(data, fd, indent=4, sort_keys=True)
+    os.rename(tmpfile, target)
+    os.chmod(target, 0o644)
+
+    log.info("%s/%s has been updated.", DEBIAN_URL, target)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list