[kernel] r19090 - people/benh

Ben Hutchings benh at alioth.debian.org
Thu Jun 7 05:16:54 UTC 2012


Author: benh
Date: Thu Jun  7 05:16:51 2012
New Revision: 19090

Log:
Update for renaming of linux-latest-2.6 and prepare for renaming of linux-2.6

Added:
   people/benh/bts-reassign-to-linux
      - copied, changed from r19011, people/benh/bts-reassign-to-linux-2.6

Copied and modified: people/benh/bts-reassign-to-linux (from r19011, people/benh/bts-reassign-to-linux-2.6)
==============================================================================
--- people/benh/bts-reassign-to-linux-2.6	Sat May 19 15:31:36 2012	(r19011, copy source)
+++ people/benh/bts-reassign-to-linux	Thu Jun  7 05:16:51 2012	(r19090)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright 2010 Ben Hutchings
+# Copyright 2010, 2012 Ben Hutchings
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,6 +19,9 @@
 import debianbts  # for query only
 import os
 import re
+import apt_pkg
+
+apt_pkg.init_system()
 
 DRY_RUN = False
 VERBOSE = True
@@ -51,30 +54,49 @@
 class BtsError(EnvironmentError):
     pass
 
+def linux_source_name(version):
+    if (apt_pkg.version_compare(version, '3.2.19-1') > 0 and
+        apt_pkg.version_compare(version, '3.3') < 0 or
+        apt_pkg.version_compare(version, '3.4.1-1') > 0):
+        return 'linux'
+    else:
+        return 'linux-2.6'
+
 def reassign(txn, report):
-    if (report.source.startswith('linux-2.6') or
+    if (report.source == 'linux' or
+        report.source.startswith('linux-2.6') or
         (report.source == '' and report.package.startswith('linux-image-'))):
         if report.found_versions:
-            txn.reassign(report.bug_num, 'linux-2.6', report.found_versions[0])
+            newest = None
+            for version in report.found_versions:
+                if '/' in version:
+                    _, version = version.split('/')
+                if newest is None or apt_pkg.check_dep(version, '>', newest):
+                    newest = version
+            txn.reassign(report.bug_num,
+                         'src:' + linux_source_name(newest), newest)
         else:
-            txn.reassign(report.bug_num, 'linux-2.6')
-        for i in range(1, len(report.found_versions)):
+            txn.reassign(report.bug_num, 'src:linux')
+        for i in range(0, len(report.found_versions)):
             txn.found(report.bug_num, report.found_versions[i])
         for i in range(0, len(report.fixed_versions)):
             txn.fixed(report.bug_num, report.fixed_versions[i])
-    elif report.source == 'linux-latest-2.6' or \
+    elif report.source == 'linux-latest' or \
+            report.source == 'linux-latest-2.6' or \
             report.source == 'linux-2.6, linux-latest-2.6':
         log = debianbts.get_bug_log(report.bug_num)
         match = re.search(r'\n'
                           r'Versions of packages %s depends on:\n'
                           r'(?:.+\n)*'
-                          r'ii\s+linux-\w+-2.6.\d+-[\w\-]+\s+(\S+)'
+                          r'ii\s+linux-\w+-\d+.\d+(?:.\d+)?-[\w\-]+\s+(\S+)'
                           % report.package,
                           log[0]['body'])
         if match:
-            txn.reassign(report.bug_num, 'linux-2.6', match.group(1))
+            txn.reassign(report.bug_num,
+                         'src:' + linux_source_name(match.group(1)),
+                         match.group(1))
         else:
-            txn.reassign(report.bug_num, 'linux-2.6')
+            txn.reassign(report.bug_num, 'src:linux')
     else:
         raise ValueError('source package for report %d is "%s"'
                          % (report.bug_num, report.source))



More information about the Kernel-svn-changes mailing list