Package: devscripts Tags: patch Severity: wishlist Attached is a Python program called dd-list, which produces pretty listings of Debian packages and their maintainers, useful for when giving advance warning of mass-filing of bugs, or library transitions, or such. For example:
J. Random Developer <[EMAIL PROTECTED]>
j-random-package
j-random-other
Diana Hacker <[EMAIL PROTECTED]>
fun-package
more-fun-package
This should be more readable than the usual listing of package names
only, so I ask for it to be included in devscripts.
dd-list.1
Description: Troff document
#!/usr/bin/python
#
# Copyright 2005 Lars Wirzenius
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# You may contact the author at <[EMAIL PROTECTED]>.
"""Produce nicely formatted lists of .deb packages and their maintainers."""
VERSION = "1.0"
import getopt, os, re, sys
def get_developer_given_package(package_name):
developer = None
source_name = None
mheader = "Maintainer:"
pheader = "Package:"
f = os.popen("apt-cache showsrc '%s'" % package_name, "r")
for line in f:
if line[:len(mheader)] == mheader:
developer = line[len(mheader):].strip()
elif line[:len(pheader)] == pheader:
source_name = line[len(pheader):].strip()
f.close()
return developer, source_name
pat = re.compile(r"^(?P<name>.*)\s+<.*@(?P<domain>.*)>\s*$")
def parse_developer(developer):
m = pat.match(developer.lower())
if m and m.group("domain") != "lists.debian.org":
name = m.group("name").split()
name.reverse()
return name, developer
elif m:
return m.group("name").split(), developer
else:
return developer, developer
def sort_developers(developers):
list = map(parse_developer, developers)
list.sort()
return map(lambda t: t[-1], list)
def help():
print """\
Usage: dd-list [-hiV] [--help] [--stdin] [--version] [package ...]
-h, --help
Print this help text.
-i, --stdin
Read package names from the standard input.
-V, --version
Print version (it's %s by the way).
""" % VERSION
def main():
use_stdin = False
try:
opts, args = getopt.getopt(sys.argv[1:], "hiV",
["help",
"stdin",
"version"])
except getopt.GetoptError, detail:
sys.stderr.write("dd-list: %s\n" % detail)
sys.exit(1)
for opt, optarg in opts:
if opt in ["-h", "--help"]:
help()
return
elif opt in ["-i", "--stdin"]:
use_stdin = True
elif opt in ["-V", "--version"]:
print "dd-list version %s" % VERSION
return
if use_stdin:
package_names = []
for line in sys.stdin:
package_names += line.split()
else:
package_names = args
errors = 0
dict = {}
for package_name in package_names:
developer, source_name = get_developer_given_package(package_name)
if developer:
if not dict.has_key(developer):
dict[developer] = []
dict[developer].append(source_name)
else:
sys.stderr.write("E: Unknown package: " + package_name)
errors = 1
developers = sort_developers(dict.keys())
for developer in developers:
print developer
packages = dict[developer]
packages.sort()
for package in packages:
print " ", package
print
sys.exit(errors)
if __name__ == "__main__":
main()

