~ubuntu-branches/ubuntu/maverick/python-debian/maverick

« back to all changes in this revision

Viewing changes to examples/deb822/grep-maintainer

  • Committer: Bazaar Package Importer
  • Author(s): John Wright
  • Date: 2008-04-30 23:58:24 UTC
  • mfrom: (1.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080430235824-iq9mp0fbd0efmruv
Tags: 0.1.10
* debian_bundle/deb822.py, tests/test_deb822.py:
  - Do not cache _CaseInsensitiveString objects, since it causes case
    preservation issues under certain circumstances (Closes: #473254)
  - Add a test case
* debian_bundle/deb822.py:
  - Add support for fixed-length subfields in multivalued fields.  I updated
    the Release and PdiffIndex classes to use this.  The default behavior for
    Release is that of apt-ftparchive, just because it's simpler.  Changing
    the behavior to resemble dak requires simply setting the
    size_field_behavior attribute to 'dak'.  (Ideally, deb822 would detect
    which behavior to use if given an actual Release file as input, but this
    is not implemented yet.)  (Closes: #473259)
  - Add support for Checksums-{Sha1,Sha256} multivalued fields in Dsc and
    Changes classes
* debian/control:
  - "python" --> "Python" in the Description field
  - Change the section to "python"

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
# grep-maintainer
 
4
# Copyright (C) 2007 Stefano Zacchiroli <zack@debian.org>
 
5
#
 
6
# This program is free software: you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation, either version 3 of the License, or
 
9
# (at your option) any later version.
 
10
 
 
11
"""Dumb maintainer-based grep for the dpkg status file."""
 
12
 
 
13
import re
 
14
import sys
 
15
from debian_bundle import deb822
 
16
 
 
17
try:
 
18
    maint_RE = re.compile(sys.argv[1])
 
19
except IndexError:
 
20
    print >>sys.stderr, "Usage: grep-maintainer REGEXP"
 
21
    sys.exit(1)
 
22
except re.error, e:
 
23
    print >>sys.stderr, "Error in the regexp: %s" % (e,)
 
24
    sys.exit(1)
 
25
 
 
26
for pkg in deb822.Packages.iter_paragraphs(file('/var/lib/dpkg/status')):
 
27
    if pkg.has_key('Maintainer') and maint_RE.search(pkg['maintainer']):
 
28
        print pkg['package']
 
29