[kernel-team] 02/47: Add script to reassign misassigned kernel bugs

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Dec 21 00:30:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository kernel-team.

commit b09ef8475b9c0a14e00a06070982aa07d9c8cedc
Author: Ben Hutchings <benh at debian.org>
Date:   Sun Aug 1 21:23:23 2010 +0000

    Add script to reassign misassigned kernel bugs
    
    svn path=/people/benh/; revision=16032
---
 scripts/benh/bts-reassign-to-linux-2.6 | 101 +++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/scripts/benh/bts-reassign-to-linux-2.6 b/scripts/benh/bts-reassign-to-linux-2.6
new file mode 100755
index 0000000..8149ff4
--- /dev/null
+++ b/scripts/benh/bts-reassign-to-linux-2.6
@@ -0,0 +1,101 @@
+#!/usr/bin/python
+
+# Copyright 2010 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+import debianbts  # for query only
+import os
+import re
+
+DRY_RUN = False
+VERBOSE = True
+
+# Simple wrapper for the bts command
+class BtsTransaction(object):
+    def __init__(self):
+        self._cmds = []
+    def execute(self, *args):
+        cmd = ' '.join("'%s'" % arg for arg in args)
+        self._cmds.append(cmd)
+        if VERBOSE:
+            print cmd
+    def commit(self):
+        if not DRY_RUN:
+            pipe = os.popen('bts 2>&1 >/dev/null ' + ' , '.join(self._cmds),
+                            'r')
+            message = pipe.read()
+            if pipe.close():
+                raise BtsError(message.rstrip())
+        self._cmds = []
+    def rollback(self):
+        self._cmds = []
+    def reassign(self, *args):
+        self.execute('reassign', *args)
+    def found(self, *args):
+        self.execute('found', *args)
+    def fixed(self, *args):
+        self.execute('fixed', *args)
+class BtsError(EnvironmentError):
+    pass
+
+def reassign(txn, report):
+    if report.source == 'linux-2.6':
+        if report.found_versions:
+            txn.reassign(report.bug_num, 'linux-2.6', report.found_versions[0])
+        else:
+            txn.reassign(report.bug_num, 'linux-2.6')
+        for i in range(1, 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 \
+            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+)'
+                          % report.package,
+                          log[0]['body'])
+        if match:
+            txn.reassign(report.bug_num, 'linux-2.6', match.group(1))
+        else:
+            txn.reassign(report.bug_num, 'linux-2.6')
+    else:
+        raise ValueError('source package for report %d is %s'
+                         % (report.bug_num, report.source))
+
+def reassign_numbered(nn):
+    txn = BtsTransaction()
+    for report in debianbts.get_status(nn):
+        reassign(txn, report)
+    txn.commit()
+
+if __name__ == '__main__':
+    import getopt, sys
+    opts, args = getopt.getopt(sys.argv[1:], 'hnqv',
+                               ['help', 'dry-run', 'quiet', 'verbose'])
+    for opt, _ in opts:
+        if opt == '-h' or opt == '--help':
+            print 'Usage: bts-reassign-to-linux-2.6 [--verbose|--quiet] [--dry-run] <bug#> ...'
+            sys.exit(0)
+        elif opt == '-n' or opt == '--dry-run':
+            DRY_RUN = True
+        elif opt == '-q' or opt == '--quiet':
+            VERBOSE = False
+        elif opt == '-v' or opt == '--verbose':
+            VERBOSE = True
+    reassign_numbered([int(arg) for arg in args])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git



More information about the Kernel-svn-changes mailing list