[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

NEWS.Debian revisited



The first time I brought this up the idea was well-received, but bogged
own a little bit in arguments (mainly from Matt Zimmerman I think) that
it would be better to keep the news in the changelog and highlight it
somehow.

In the meantime, I have added NEWS.Debian files to two of my packages,
using a format that is a valid debian changelog. Basically, think of a
typical debian changelog, remove the bullets, and use full paragraphs
for each news item, separated by blank lines.

I would like to get support into apt-listchanges for displaying those news
entries. I can think of two useful modes and a variation:

1. Display only news items, no changelogs.

2. Display changelogs and news items
   a. List all the new news first, at the top.
   b. List new news right before a package's changelog entry.

What to display should be configurable of course. If we decided to make
apt-listchanges part of the base system, it might be good to change the
default behavior to 1.

Matt, do you have strong feelings against separate NEWS.Debian files, or
would something like this be accepted, if it were done right and you
were given a patch?

I still haven't learned python, but here is a simple implementation of
2b.  It does make it twice as slow, but I don't see a good way around
that anyway.  Maybe someone who can speak python would like to pick up
on this and implement 1 (easy) and 2a (hard)?

--- apt_listchanges.py~	2002-09-11 22:17:11.000000000 -0400
+++ /usr/lib/site-python/apt_listchanges.py	2002-09-11 22:58:02.000000000 -0400
@@ -46,7 +46,7 @@
         return 0
 
 changelog_header = re.compile('^\S+ \((?P<version>.*)\) .*;.*urgency=(?P<urgency>\w+).*')
-def extract_changelog(deb, version=None):
+def extract_changelog(deb, version=None, filetypes=['NEWS', 'changelog']):
     """Extract changelog entries later than version from deb.
     returns (text, urgency) where urgency is the highest urgency
     of the entries selected"""
@@ -57,40 +57,43 @@
     
     binpackage = pkgdata.Package
     srcpackage = pkgdata.source()
-
-    changelog_filenames = changelog_variations('changelog.Debian')
-    changelog_filenames_nodebian = changelog_variations('changelog')
-
-    found = 0
-    changes = None
+    
     urgency = numeric_urgency('low')
-    for filenames in [changelog_filenames, changelog_filenames_nodebian]:
-         extract_command = "dpkg-deb --fsys-tarfile %s \
-         | tar -xO --exclude '*/doc/*/*/*' -f - %s 2>/dev/null \
-         | zcat -f" % (deb, string.join(filenames))
-
-         if (found > 0): break
-
-         changes = ''
-         for line in os.popen(extract_command).readlines():
-             if line.startswith('tar:') or line.startswith('dpkg-deb'):
-                 # XXX, keep track of errors
-                 continue
-
-             found = 1
-
-             if version:
-                 match = changelog_header.match(line)
-                 if match:
-                     if apt_pkg.VersionCompare(match.group('version'),
-                                              version) > 0:
-                         urgency = min(numeric_urgency(match.group('urgency')),
-                                       urgency)
-                     else:
-                         break
-             changes += line
+    combined_changes = ''
+    for filetype in filetypes:
+        filenames = changelog_variations("%s.Debian" % filetype)
+        filenames_nodebian = changelog_variations(filetype)
+
+        found = 0
+        for filenames in [filenames, filenames_nodebian]:
+            extract_command = "dpkg-deb --fsys-tarfile %s \
+            | tar -xO --exclude '*/doc/*/*/*' -f - %s 2>/dev/null \
+            | zcat -f" % (deb, string.join(filenames))
+
+            if (found > 0): break
+
+            changes = ''
+            for line in os.popen(extract_command).readlines():
+                if line.startswith('tar:') or line.startswith('dpkg-deb'):
+                    # XXX, keep track of errors
+                    continue
+
+                found = 1
+
+                if version:
+                    match = changelog_header.match(line)
+                    if match:
+                        if apt_pkg.VersionCompare(match.group('version'),
+                                                 version) > 0:
+                            urgency = min(numeric_urgency(match.group('urgency')),
+                                          urgency)
+                        else:
+                            break
+                changes += line
+		
+        combined_changes += changes
 
-    return (changes, urgency)
+    return (combined_changes, urgency)
 
 class Config:
     def __init__(self):

-- 
see shy jo

Attachment: pgpLmxxAoIO4L.pgp
Description: PGP signature


Reply to: