[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. eda668423fa87898c59d1075118693714aa5a053

Mika Pflüger debian at mikapflueger.de
Fri Dec 23 10:25:51 UTC 2011


The following commit has been merged in the master branch:
commit 4295173ad46165531c2a17a812f8b3ec342b7da1
Author: Mika Pflüger <debian at mikapflueger.de>
Date:   Thu Nov 17 19:50:07 2011 +0100

    piuparts-analyze: Remove binNMU-parts from version numbers
    
    The BTS only tracks source versions, so remove binNMU-part from
    package versions when comparing with versions from the BTS

diff --git a/debian/changelog b/debian/changelog
index 7842e04..7313e00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,8 +18,10 @@ piuparts (0.42) UNRELEASED; urgency=low
   * *.py: Add vim modeline.
 
   [ Mika Pflüger ]
-  * piuparts-analyze.py: Rewrite to use python-debianbts to analyze if bugs
-    are filed already.
+  * piuparts-analyze.py:
+    - Rewrite to use python-debianbts to analyze if bugs are filed already.
+    - The BTS only tracks source versions, so remove binNMU-part from
+      package versions when comparing with versions from the BTS
   * debian/control: Add python-apt and python-debianbts to piuparts depends.
 
   [ Scott Schaefer ]
diff --git a/piuparts-analyze.py b/piuparts-analyze.py
index f5a13eb..f28afb3 100644
--- a/piuparts-analyze.py
+++ b/piuparts-analyze.py
@@ -64,6 +64,16 @@ def package_version(log):
     return os.path.basename(log).split("_", 1)[1].rstrip('.log')
 
 
+def package_source_version(log):
+    version = package_version(log)
+    possible_binnmu_part = version.rsplit('+',1)[-1]
+    if possible_binnmu_part.startswith('b') and possible_binnmu_part[1:].isdigit():
+        # the package version contains a binnmu-part which is not part of the source version
+        # and therefore not accepted/tracked by the bts. Remove it.
+        version = version.rsplit('+',1)[0]
+    return version
+
+
 def extract_errors(log):
     """This pretty stupid implementation is basically just 'grep -i error', and then
     removing the timestamps and the name of the chroot and the package version itself."""
@@ -143,7 +153,7 @@ def bts_update_found(bugnr, newversion):
 def mark_logs_with_reported_bugs():
     for failed_log in find_logs("fail"):
         pname = package_name(failed_log)
-        pversion = package_version(failed_log)
+        pversion = package_source_version(failed_log)
         failed_errors = extract_errors(failed_log)
         moved = False
         for bug in piuparts_bugs_in(pname):
@@ -161,7 +171,7 @@ def mark_logs_with_reported_bugs():
                         print('%s/%s: Maybe the bug was filed earlier: %d against %s/%s'
                               % (pname, pversion, bug, pname, bug_version))
                     for bugged_log in bugged_logs:
-                        old_pversion = package_version(bugged_log)
+                        old_pversion = package_source_version(bugged_log)
                         bugged_errors = extract_errors(bugged_log)
                         if (apt_pkg.version_compare(old_pversion, bug_version) == 0 # old_pversion == bug_version
                             and

-- 
piuparts git repository



More information about the Piuparts-commits mailing list