[Reproducible-commits] [misc] 04/05: clean-notes: check whether all the bugs listed in notes.git are usertagged

Mattia Rizzolo mapreri-guest at moszumanska.debian.org
Wed Jan 7 00:11:56 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 8e869f533f9ec274823f9b538908ccc1fc1a0549
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue Jan 6 23:34:01 2015 +0100

    clean-notes: check whether all the bugs listed in notes.git are usertagged
---
 clean-notes | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/clean-notes b/clean-notes
index bde7c15..4f39ccf 100755
--- a/clean-notes
+++ b/clean-notes
@@ -70,8 +70,30 @@ def load_notes():
         notes = yaml.load(fd)
     return notes
 
+def check_bugs(bugs):
+    """
+    This function check whether all the bugs listed in notes.git are usertagged
+
+    This `bugs` is a list of tuples: (package, bug_id)
+    """
+    bugs_list = sorted([x[1] for x in bugs])
+    bugs_package = {x[1]: x[0] for x in bugs}
+    ids = 'id='
+    for bug in bugs_list[:-1]:
+        ids += str(bug) + ' OR id='
+    ids += str(bugs_list[-1])
+    rows = query_udd("""SELECT id FROM bugs_usertags WHERE
+                     email='reproducible-builds at lists.alioth.debian.org' AND (
+                     %s )""" % ids)
+    print(rows)
+    for bug in bugs_list:
+        if bug not in rows:
+            warning("bug #" + str(bug) + " in package " + bugs_package[bug] +
+                    " is not usertagged")
+
 def find_old_notes(testedpkgs, notes):
     toremove = []
+    listed_bugs = []
     for pkg in sorted(notes, key=lambda x: str(x)):
         if 'version' not in notes[pkg]:
             warning("There is no version set for the package " + pkg)
@@ -93,6 +115,11 @@ def find_old_notes(testedpkgs, notes):
                                        str(notes[pkg]['version'])) > 0:
                 if not args.quiet:
                     print("The package " + pkg + " has a new tested version")
+        if 'bugs' in notes[pkg]:
+            for bug in notes[pkg]['bugs']:
+                listed_bugs.append((str(pkg), int(bug)))
+    if args.db:
+        check_bugs(listed_bugs)
     return toremove
 
 def is_virtual_package(package):
@@ -201,12 +228,13 @@ def write_out(notes):
         fd.write(out.encode('utf-8'))
 
 if __name__ == '__main__':
+    if args.db:
+        conn = start_udd_connection()
     testedpkgs = load_reproducible_status()
     notes = load_notes()
     toremove = find_old_notes(testedpkgs, notes)
     notes = cleanup_notes(notes, toremove)
     if args.db:
-        conn = start_udd_connection()
         bugs = get_bugs()
         bugs = parse_bugs(bugs)
         notes = join_notes_bugs(notes, bugs)

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