[Reproducible-commits] [misc] 01/01: unreproducible-installed: add script.

Mattia Rizzolo mattia at mapreri.org
Mon Jul 27 19:05:27 UTC 2015


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

mapreri-guest pushed a commit to branch master
in repository misc.

commit ecff4f15a1958ef6f0ff056cc3d858ba475abda0
Author: Valentin Lorentz <progval at progval.net>
Date:   Mon Jul 27 20:54:00 2015 +0200

    unreproducible-installed: add script.
---
 unreproducible-installed | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/unreproducible-installed b/unreproducible-installed
new file mode 100644
index 0000000..eeef418
--- /dev/null
+++ b/unreproducible-installed
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+
+# Written in 2015 by Valentin Lorentz <progval at progval.net
+#
+# To the extent possible under law, the author(s) have dedicated all copyright
+# and related and neighboring rights to this software to the public domain
+# worldwide. This software is distributed without any warranty.
+# You should have received a copy of the CC0 Public Domain Dedication along
+# with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+
+import os
+import sys
+import json
+import time
+import os.path
+import subprocess
+
+if sys.version_info[0] >= 3: # Python 3
+    from urllib.request import urlopen
+else: # Python 2
+    from urllib2 import urlopen
+
+URL = 'https://reproducible.debian.net/reproducible.json'
+SAVE_TO = '/tmp/reproducible.json'
+FILE_NAMES = ('./reproducible.json', SAVE_TO)
+MAX_AGE = 60*60
+
+for filename in FILE_NAMES:
+    if os.path.isfile(filename) and \
+            os.path.getmtime(filename) + MAX_AGE > time.time():
+        # If this file is recent enough, read it
+        with open(filename) as fd:
+            data = json.load(fd)
+        break
+else: # If no recent file has been found, download the data
+    response = urlopen(URL).read()
+    if os.path.isfile(SAVE_TO):
+        os.unlink(SAVE_TO)
+    with open(SAVE_TO, 'a') as fd:
+        fd.write(response)
+    data = json.loads(response)
+
+unreproducible = {x['package'] for x in data if x['status'] != 'reproducible'}
+
+dpkg_output = subprocess.check_output(['dpkg', '-l'], universal_newlines=True)
+dpkg_list = dpkg_output.split('\n')[5:] # Split lines and remove headers
+installed = {x.split('  ')[1].split(':')[0] for x in dpkg_list if x}
+
+for package in sorted(installed & unreproducible):
+    print(package)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git



More information about the Reproducible-commits mailing list