rev 3564 - scripts

Pierre Habouzit madcoder at costa.debian.org
Mon Apr 17 14:36:15 UTC 2006


Author: madcoder
Date: 2006-04-17 14:36:10 +0000 (Mon, 17 Apr 2006)
New Revision: 3564

Modified:
   scripts/bzlink.py
Log:
 * Fix blocks regexp: we don't want to catch full '------' lines.
 * Now parse the "modifications" block (which is what we really want to track
   the bugzilla current bug status !)


Now the cool hacks can begin. I'm thinking of:
 * using BTS usertags to keep track of bugs.kde.org bugs status.
 * automatically append additional comments to the debian bug report.

I also have to think of a way to map KDE #bugs to BTS ones. Since we can't
tag bugs.kde.org ones, we can only use the "forwarded" stats of our
bugs to have the mapping done. I guess this can be easily done by greping
into the debbugs DB, or by querying aba's ldap.



Modified: scripts/bzlink.py
===================================================================
--- scripts/bzlink.py	2006-04-17 14:12:07 UTC (rev 3563)
+++ scripts/bzlink.py	2006-04-17 14:36:10 UTC (rev 3564)
@@ -7,7 +7,8 @@
         self.args = (reason)
 
 class BzMsg:
-    _blocksRegex = re.compile(r"(^-------[^\n]*-------)\n", re.MULTILINE)
+    _blocksRegex = re.compile(r"(^------- [^\n]* -------)\n", re.MULTILINE)
+    _modifRegex  = re.compile(r"^ *([^ |]*)\|([^| ]*) *\|(.*)$")
 
     def __init__(self, fp):
         self.msg = email.message_from_file(fp)
@@ -16,6 +17,7 @@
         self.bug = -1
         self.blocks = {}
         self.additional = None
+        self.modifs = {}
 
         self._parse()
 
@@ -64,9 +66,24 @@
                 self.additional = "%s\n\n%s" % (k, v)
 
     def _parseBzChanges(self, s):
-        pass
+        modifs = []
+        for l in s.splitlines():
+            m = BzMsg._modifRegex.match(l)
+            if not m:
+                continue
+            what    = m.group(1)
+            removed = m.group(2)
+            added   = m.group(3)
+            if len(what) is 0:
+                w, r, a = modifs[-1]
+                modifs[-1] = w, r+removed, a+added
+            else:
+                modifs.append((what, removed, added))
 
+        for (w, r, a) in modifs:
+            self.modifs[w] = r, a
 
 bzm = BzMsg(sys.stdin)
 print "Bug Number: #%i\n" % (bzm.bug)
 print bzm.additional
+print bzm.modifs




More information about the pkg-kde-commits mailing list