[Reproducible-commits] [misc] 01/01: unreproducible-installed: Add CLI arguments to select suite and statuses + exclude FTBFS by default.

Valentin Lorentz progval-guest at moszumanska.debian.org
Tue Aug 18 15:19:00 UTC 2015


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

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

commit 4706a6176315e58e87024ef4eb668a3f59736dfa
Author: Valentin Lorentz <progval at progval.net>
Date:   Tue Aug 18 17:20:14 2015 +0200

    unreproducible-installed: Add CLI arguments to select suite and statuses + exclude FTBFS by default.
---
 unreproducible-installed | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/unreproducible-installed b/unreproducible-installed
index e854032..455391a 100755
--- a/unreproducible-installed
+++ b/unreproducible-installed
@@ -24,6 +24,8 @@ else: # Python 2
 IGNORE_REPORTED = True
 DEFAULT_SAVE_TO = '/tmp/reproducible.json'
 DEFAULT_FILE_NAMES = ('./reproducible.json', DEFAULT_SAVE_TO)
+DEFAULT_SUITES = ['unstable']
+DEFAULT_EXCLUDED_STATUSES = ['reproducible', 'FTBFS']
 
 parser = argparse.ArgumentParser(
     description='Lists unreproducible packages installed on this system.')
@@ -46,6 +48,15 @@ npy_group.add_argument('--ignore-with-bugs', action='store_true',
 npy_group.add_argument('--package-notes-file', type=str,
     default=os.path.join(os.path.dirname(__file__), '../notes/packages.yml'),
     help='File containing packages notes, used with --ignore-with-bugs.')
+filter_group = parser.add_argument_group('filters')
+filter_group.add_argument('--suite', type=str, action='append',
+    help='The suite where to look packages for. Use this option multiple '
+         'times to look in multiple suites. "any" looks in all suites. '
+         'Defaults to "%s".' % ', '.join(DEFAULT_SUITES))
+filter_group.add_argument('--exclude-status', type=str, action='append',
+    help='The package status to remove. Use this option multiple times to '
+         'exclude many. Defaults to "%s".' %
+         ', '.join(DEFAULT_EXCLUDED_STATUSES))
 
 def find_data(args):
     """Search for the reproducible.json file and load it."""
@@ -78,15 +89,24 @@ def download_data(args):
         fd.write(response)
     return json.loads(response)
 
-def get_unreproducible(args):
+def filter_packages(args):
     data = find_data(args)
     if not data:
         data = download_data(args)
 
+    filters = []
+
+    suites = frozenset(args.suite or DEFAULT_SUITES)
+    if 'any' not in suites:
+        filters.append(lambda x:x['suite'] in suites)
+
+    exclude_statuses = frozenset(args.exclude_status or
+                                 DEFAULT_EXCLUDED_STATUSES)
+    filters.append(lambda x:x['status'] not in exclude_statuses)
+
     unreproducible = {x['package']
                       for x in data
-                      if x['status'] != 'reproducible'
-                      and x['suite'] == 'unstable'} # we only care about unstable
+                      if all(f(x) for f in filters)}
     return unreproducible
 
 def get_installed_packages(args):
@@ -98,7 +118,7 @@ def get_installed_packages(args):
     return installed
 
 def main(args):
-    unreproducible = get_unreproducible(args)
+    unreproducible = filter_packages(args)
 
     if args.ignore_with_bugs:
         import yaml

-- 
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