[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.44-647-gaf1a481

Andreas Beckmann debian at abeckmann.de
Sun Jun 3 07:10:51 UTC 2012


The following commit has been merged in the develop branch:
commit 7f253b03323f92de9e932396f21c3a932de949dd
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sat Jun 2 13:19:19 2012 +0200

    t-a: write BTS links to a .bug file per failed .log
    
    Write a <package>_<version>.bug file with a link ot the BTS whenever
    a log is moved to affected/ or bugged/ (or can't because the version
    in the bug(s) found did not match).
    This can be picked up by the detect_well_known_errors script and
    inserted into the generated *.tpl.
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index f61ad99..248e073 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -82,6 +82,7 @@ piuparts (0.45) UNRELEASED; urgency=low
   * piuparts-analyze.py:
     - Don't report further bugs/versions if we found a match.
     - Classify logs with bugs filed into /bugged/ or /affected/.
+    - Write .bug files with links to the BTS.
   * Remove known_circular_depends from piuparts.conf handling.
   * Remove static list known_circular_depends from piuparts.conf.
 
diff --git a/piuparts-analyze.py b/piuparts-analyze.py
index 7203915..e25f0f8 100644
--- a/piuparts-analyze.py
+++ b/piuparts-analyze.py
@@ -130,9 +130,19 @@ def get_bug_versions(bug):
     return list(reversed(sorted([x.rsplit('/', 1)[-1] for x in debianbts.get_status((bug,))[0].found_versions], cmp=apt_pkg.version_compare))) or ['~']
 
 
-def move_to_bugged(failed_log, bugged="bugged"):
-    print("Moving %s to %s" % (failed_log, bugged))
+def write_bug_file(failed_log, bugs):
+    if bugs:
+        f = file(os.path.splitext(failed_log)[0] + '.bug', "w")
+        for bug in bugs:
+            f.write('<a href="http://bugs.debian.org/%s" target="_blank">#%s</a>\n' % (bug, bug))
+        f.close()
+
+
+def move_to_bugged(failed_log, bugged="bugged", bug=None):
+    print("Moving %s to %s (#%s)" % (failed_log, bugged, bug))
     os.rename(failed_log, os.path.join(bugged, os.path.basename(failed_log)))
+    if bug is not None:
+        write_bug_file(os.path.join(bugged, os.path.basename(failed_log)), [bug])
 
 
 def mark_bugged_version(failed_log, bugged_log):
@@ -167,7 +177,7 @@ def mark_logs_with_reported_bugs():
                 bugged = "bugged"
             found_versions = get_bug_versions(bug)
             if pversion in found_versions:
-                move_to_bugged(failed_log, bugged)
+                move_to_bugged(failed_log, bugged, bug)
                 moved = True
                 break
             for bug_version in found_versions:
@@ -192,6 +202,8 @@ def mark_logs_with_reported_bugs():
                                 moved = True
                                 bts_update_found(bug, pversion)
                                 break
+        if not moved:
+            write_bug_file(failed_log, abugs + bugs)
 
 
 def report_packages_with_many_logs():

-- 
piuparts git repository



More information about the Piuparts-commits mailing list