Package: apt-listchanges
Version: 2.75
Severity: wishlist
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu hardy ubuntu-patch

In Ubuntu, we've applied the attached patch to achieve the following:

* apt-listchanges/apt_listchanges.py:
  LP bug closing format support
  Teach HTML output about Launchpad bug-closing syntax per
  https://wiki.ubuntu.com/ClosingBugsFromChangelog (relaxed slightly to
  try to catch people talking about bugs as well as closing them). Tweak
  Debian bug-closing syntax to try to prevent both triggering on the same
  text.

* preinst: cleanup of leftover AptListChangesGtk.pyc files
  remove some leftover files from old (non-debian) versions 
  of apt-listchanges 

It would be nice if you could consider those patches. The launchpad
bug syntax is sometimes seen in debian package changelogs too so it
might be valeuable to the users. The preinst change is only needed on
ubuntu system, but it is cheap and would mean I can drop the delta
entirely and just sync the unmodified apt-listchanges package from
debian.

Thanks,
 Michael


-- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'gutsy')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-14-generic (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
diff -Nru /tmp/bihys36CVa/apt-listchanges-2.75/apt-listchanges/apt_listchanges.py /tmp/dx7FAc6FX5/apt-listchanges-2.75ubuntu1/apt-listchanges/apt_listchanges.py
--- /tmp/bihys36CVa/apt-listchanges-2.75/apt-listchanges/apt_listchanges.py	2007-11-18 23:59:25.000000000 +0100
+++ /tmp/dx7FAc6FX5/apt-listchanges-2.75ubuntu1/apt-listchanges/apt_listchanges.py	2007-11-21 18:07:58.000000000 +0100
@@ -269,7 +269,12 @@
 class html:
     suffix = '.html'
 
-    bug_stanza_re = re.compile(r'(?:closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*|#\d+)', re.I)
+    # LP bug-closing format requires the colon after "LP", but many people
+    # say "LP #123456" when talking informally about bugs.
+    lp_bug_stanza_re = re.compile(r'(?:lp:?\s+\#\d+(?:,\s*\#\d+)*)', re.I)
+    lp_bug_re        = re.compile('(?P<linktext>#(?P<bugnum>\d+))', re.I)
+    lp_bug_fmt       = r'<a href="https://launchpad.net/bugs/\g<bugnum>">\g<linktext></a>'
+    bug_stanza_re = re.compile(r'(?:closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*|(?<!">)#\d+)', re.I)
     bug_re        = re.compile('(?P<linktext>#?(?P<bugnum>\d+))', re.I)
     bug_fmt       = r'<a href="http://bugs.debian.org/\g<bugnum>">\g<linktext></a>'
     # regxlib.com
@@ -298,6 +303,7 @@
                 '&', '&amp;').replace(
                 '<', '&lt;').replace(
                 '>', '&gt;')
+            line = self.lp_bug_stanza_re.sub(lambda m: self.lp_bug_re.sub(self.lp_bug_fmt, m.group(0)), line)
             line = self.bug_stanza_re.sub(lambda m: self.bug_re.sub(self.bug_fmt, m.group(0)), line)
             line = self.email_re.sub(r'<a href="mailto:\g<0>">\g<0></a>', line)
             htmltext.write(line + '\n')
diff -Nru /tmp/bihys36CVa/apt-listchanges-2.75/debian/preinst /tmp/dx7FAc6FX5/apt-listchanges-2.75ubuntu1/debian/preinst
--- /tmp/bihys36CVa/apt-listchanges-2.75/debian/preinst	2007-05-11 23:09:56.000000000 +0200
+++ /tmp/dx7FAc6FX5/apt-listchanges-2.75ubuntu1/debian/preinst	2007-11-21 18:07:58.000000000 +0100
@@ -9,6 +9,8 @@
     rm -f /usr/lib/site-python/apt_listchanges.pyc
     rm -f /usr/lib/site-python/DebianControlParser.pyo
     rm -f /usr/lib/site-python/DebianControlParser.pyc
+    rm -f /usr/lib/site-python/AptListChangesGtk.pyo
+    rm -f /usr/lib/site-python/AptListChangesGtk.pyc
 fi
 
 if [ -f $hook.disabled ]; then

Reply via email to