[Reproducible-commits] [misc] 01/01: clean-notes: reorder section to put the args parsing at the top, and add a --ignore-duplicates option to disable the duplication check. warning, with that enabled the duplicated will be silently removed

Mattia Rizzolo mapreri-guest at moszumanska.debian.org
Tue Mar 10 21:35:46 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 18ea941cf48cdfe1677c02b280273495eab0da5e
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue Mar 10 22:33:56 2015 +0100

    clean-notes: reorder section to put the args parsing at the top, and add a --ignore-duplicates option to disable the duplication check. warning, with that enabled the duplicated will be silently removed
---
 clean-notes | 94 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 49 insertions(+), 45 deletions(-)

diff --git a/clean-notes b/clean-notes
index 15c8237..d7d6cd8 100755
--- a/clean-notes
+++ b/clean-notes
@@ -19,6 +19,53 @@ import argparse
 import psycopg2
 import requests
 
+
+reproducible_json = 'https://reproducible.debian.net/reproducible.json'
+# [{package: xxx, suite: sid, version: 0.0.0, status: reproducible}, {...}]
+
+notes_yaml = 'packages.yml'
+# {package_name: {version: 0.0.0, comments: "blablabla", bugs: [111, 222],
+#  issues: [issue1, issue2]}, {...}}
+
+description = """Housekeep the packages.yml file from the notes.git repository.
+
+This script is also able to show you other information:
+* missing-version: list notes without version
+* fixed-magically: list notes which version is marked as reproducible
+* new-tested-version: there is a new version tested in jenkins, but the package
+  is not reproducible anyway...
+* missing-usertagged: list usertagged bugs but not listed in the notes
+* not-usertagged: list bugs listed in notes but without usertags
+"""
+parser = argparse.ArgumentParser(description=description,
+                                 formatter_class=argparse.RawTextHelpFormatter)
+parser.add_argument('-e', '--enable', action='append', default=[],
+                    help="enable a particular view (choose from above)")
+parser.add_argument('-d', '--disable', action='append', default=[],
+                    help="disable a particular view (choose from above)")
+parser.add_argument("--ignore-duplicates", action="store_true",
+                    help="ATTENTION! This option remove any duplicated field present in the file!")
+parser.add_argument("-v", "--verbose", action="store_true")
+parser.add_argument("-n", "--dry-run", action="store_true")
+
+if __name__ == '__main__':
+    args = parser.parse_args()
+
+    disabled_features = [
+        'fixed-magically',
+        'new-tested-version',
+        'missing-version',
+        'missing-usertagged',
+        'not-usertagged',
+        ]
+    args.disable.extend(disabled_features)
+    for feature in args.enable:
+        if feature in args.disable:
+            args.disable.remove(feature)
+
+    if args.verbose:
+        print(args)
+
 # pyyaml does not check for duplicates when reading yaml.
 #
 # This is bad because it means that one either has to check for duplicates
@@ -77,52 +124,9 @@ def compose_mapping_node(self, anchor):
     end_event = self.get_event()
     node.end_mark = end_event.end_mark
     return node
-yaml.composer.Composer.compose_mapping_node = compose_mapping_node
-
-reproducible_json = 'https://reproducible.debian.net/reproducible.json'
-# [{package: xxx, suite: sid, version: 0.0.0, status: reproducible}, {...}]
-
-notes_yaml = 'packages.yml'
-# {package_name: {version: 0.0.0, comments: "blablabla", bugs: [111, 222],
-#  issues: [issue1, issue2]}, {...}}
-
-description = """Housekeep the packages.yml file from the notes.git repository.
-
-This script is also able to show you other information:
-* missing-version: list notes without version
-* fixed-magically: list notes which version is marked as reproducible
-* new-tested-version: there is a new version tested in jenkins, but the package
-  is not reproducible anyway...
-* missing-usertagged: list usertagged bugs but not listed in the notes
-* not-usertagged: list bugs listed in notes but without usertags
-"""
-parser = argparse.ArgumentParser(description=description,
-                                 formatter_class=argparse.RawTextHelpFormatter)
-parser.add_argument('-e', '--enable', action='append', default=[],
-                    help="enable a particular view (choose from above)")
-parser.add_argument('-d', '--disable', action='append', default=[],
-                    help="disable a particular view (choose from above)")
-parser.add_argument("-v", "--verbose", action="store_true")
-parser.add_argument("-n", "--dry-run", action="store_true")
-
-if __name__ == '__main__':
-    args = parser.parse_args()
-
-    disabled_features = [
-        'fixed-magically',
-        'new-tested-version',
-        ]
-    #    'missing-version',
-    #    'missing-usertagged',
-    #    'not-usertagged',
-    args.disable.extend(disabled_features)
-    for feature in args.enable:
-        if feature in args.disable:
-            args.disable.remove(feature)
-
-    if args.verbose:
-        print(args)
 
+if not args.ignore_duplicates:
+    yaml.composer.Composer.compose_mapping_node = compose_mapping_node
 
 def error(*objs):
     print("ERROR: ", *objs, file=sys.stderr)

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