Package list debian-goodies / 1493a5a
Imported Debian version 0.23 Javier Fernandez-Sanguino 9 years ago
19 changed file(s) with 1202 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 There is no substantial documentation yet. Volunteer authors are
1 more than welcome. Here are some examples to get you started.
2
3 # Search all files in specified packages for a regex
4 $ dgrep <pattern> <package>...
5
6 # Search through all files in all installed packages for a regex
7 $ dgrep <pattern> '.*'
8
9 # Same, but also search inside compressed files
10 $ dzgrep <pattern> '.*'
11
12 # Calculate the total disk space usage of all files contained in all
13 # installed packages whose names begin with 'lib'
14 $ dglob -0f ^lib | xargs -0 du -c | awk '{sum += $1} END {print sum}'
15
16 # Fetch most recent version of package
17 $ debget <package>
18
19 # Fetch a specific version of package
20 $ debget <package>=<version>
0 #!/usr/bin/python
1
2 import sys
3 import os
4 import re
5
6 if os.getuid() != 0:
7 sys.stderr.write('This program must be run as root\n')
8 sys.stderr.write('in order to collect information about all open file descriptors\n')
9 sys.exit(1)
10
11 def main():
12 process = None
13 processes = {}
14 for line in os.popen('lsof +L1 -F n').readlines():
15 field, data = line[0], line[1:-1]
16
17 if field == 'p':
18 process = processes.setdefault(data,Process(int(data)))
19 elif field == 'n':
20 process.files.append(data)
21
22 toRestart = filter(lambda process: process.needsRestart(),
23 processes.values())
24 print "Found %d processes using old versions of upgraded files" % len(toRestart)
25
26 if len(toRestart) == 0:
27 sys.exit(0)
28
29 programs = {}
30 for process in toRestart:
31 programs.setdefault(process.program, [])
32 programs[process.program].append(process)
33
34 print "(%d distinct programs)" % len(programs)
35
36 packages = {}
37 #dpkgQuery = 'dpkg-query --search ' + ' '.join(programs.keys())
38 diverted = None
39 dpkgQuery = 'dpkg --search ' + ' '.join(programs.keys())
40 for line in os.popen(dpkgQuery).readlines():
41 if line.startswith('local diversion'):
42 continue
43
44 m = re.match('^diversion by (\S+) (from|to): (.*)$', line)
45 if m:
46 if m.group(2) == 'from':
47 diverted = m.group(3)
48 continue
49 if not diverted:
50 raise 'Weird error while handling diversion'
51 packagename, program = m.group(1), diverted
52 else:
53 packagename, program = line[:-1].split(': ')
54
55 packages.setdefault(packagename,Package(packagename))
56 packages[packagename].processes.extend(programs[program])
57
58 print "(%d distinct packages)" % len(packages)
59
60 if len(packages) == 0:
61 sys.exit(0)
62
63 for package in packages.values():
64 if package == 'util-linux':
65 continue
66 #dpkgQuery = 'dpkg-query --listfiles ' + package.name
67 dpkgQuery = 'dpkg --listfiles ' + package.name
68 for line in os.popen(dpkgQuery).readlines():
69 path = line[:-1]
70 if path.startswith('/etc/init.d/'):
71 if path.endswith('.sh'):
72 continue
73 package.initscripts.append(path)
74
75 restartable = []
76 nonrestartable = []
77 restartCommands = []
78 for package in packages.values():
79 if len(package.initscripts) > 0:
80 restartable.append(package)
81 restartCommands.extend(map(lambda s: s + ' restart',package.initscripts))
82 else:
83 nonrestartable.append(package)
84
85 print
86 print "Of these, %d seem to contain init scripts which can be used to restart them:" % len(restartable)
87 print '\n'.join(restartCommands)
88 print
89
90 if len(nonrestartable) == 0:
91 sys.exit(0)
92
93 print "Here are the others:"
94 for package in nonrestartable:
95 print package.name + ':'
96 for process in package.processes:
97 print "\t%s\t%s" % (process.pid,process.program)
98
99 class Process:
100 def __init__(self, pid):
101 self.pid = pid
102 self.files = []
103
104 try:
105 self.program = self.cleanFile(os.readlink('/proc/%d/exe' % self.pid))
106 except OSError, e:
107 if e.errno != 2:
108 raise
109
110 def cleanFile(self, f):
111 # /proc/pid/exe has all kinds of junk in it sometimes
112 null = f.find('\0')
113 if null != -1:
114 f = f[:null]
115 return re.sub('( \(deleted\)|.dpkg-new).*$','',f)
116
117 def needsRestart(self):
118 for f in self.files:
119 if f.endswith('.dpkg-new'):
120 return 1
121 return 0
122
123 class Package:
124 def __init__(self, name):
125 self.name = name
126 self.initscripts = []
127 self.processes = []
128
129 if __name__ == '__main__':
130 main()
0 #!/bin/sh -e
1
2 for pkgspec in $*; do
3 version=$(apt-get -q2 -s --reinstall install "$pkgspec" | grep ^Inst | sed -ne '$s/^.*\[\(.*\)\].*$/\1/p')
4 echo "($pkgspec -> $version)"
5 aptdata=$(apt-get -q2 --print-uris --reinstall install "$pkgspec" | tail -1)
6 url=$(echo "$aptdata" | sed -e "s/^'\([^']*\)'.*$/\1/")
7 file=$(echo "$aptdata" | sed -e "s/^'[^']*' \([^ ]*\).*$/\1/")
8 curl "$url" > "$file"
9 done
0 =head1 NAME
1
2 debget - Fetch a .deb for a package in APT's database
3
4 =head1 SYNOPSIS
5
6 B<debget> I<package> [I<package> ...]
7
8 =head1 DESCRIPTION
9
10 B<debget> fetches a .deb for one or more packages from an Debian mirror.
11 It uses apt-get(1) to find out the URL so it will download the same version
12 from the same server as I<apt-get> would do. The .deb will be downloaded with
13 curl(1) and stored in your current working directory.
14
15 =head1 AUTHOR
16
17 Matt Zimmerman <mdz@debian.org>
18
19 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
20
21 =head1 COPYRIGHT AND LICENCE
22
23 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
24
25 This program is free software; you can redistribute it and/or modify
26 it under the terms of the GNU General Public License as published by
27 the Free Software Foundation; either version 2, or (at your option)
28 any later version.
29
30 On Debian systems, a copy of the GNU General Public License may be
31 found in /usr/share/common-licenses/GPL.
32
33 =head1 SEE ALSO
34
35 apt-get(1), curl(1)
0 debian-goodies (0.23) unstable; urgency=low
1
2 * Man page for popbugs from Jochen Voss <voss@debian.org> (Closes:
3 #227094)
4
5 -- Matt Zimmerman <mdz@debian.org> Wed, 14 Jan 2004 21:10:42 -0800
6
7 debian-goodies (0.22) unstable; urgency=low
8
9 * Fix typo, improve description in dglob(1) (Closes: #224561)
10
11 -- Matt Zimmerman <mdz@debian.org> Fri, 19 Dec 2003 23:38:26 -0800
12
13 debian-goodies (0.21) unstable; urgency=low
14
15 * Fix program name in popbugs usage message (Closes: #224490)
16
17 -- Matt Zimmerman <mdz@debian.org> Fri, 19 Dec 2003 08:03:59 -0800
18
19 debian-goodies (0.20) unstable; urgency=low
20
21 * Updated man page for dpigs, and new man page for dglob, from Frank
22 Lichtenheld <frank@lichtenheld.de> (Closes: #224394)
23 * Enhance dglob to accept some grep-dctrl options, and update the man
24 page appropriately
25
26 -- Matt Zimmerman <mdz@debian.org> Thu, 18 Dec 2003 09:54:30 -0800
27
28 debian-goodies (0.19) unstable; urgency=low
29
30 * Actually install those nice man pages (really Closes: #163823)
31
32 -- Matt Zimmerman <mdz@debian.org> Wed, 17 Dec 2003 17:48:36 -0800
33
34 debian-goodies (0.18) unstable; urgency=low
35
36 * Include man pages for debget, dgrep and dpigs from Frank Lichtenheld
37 <frank@lichtenheld.de> (Closes: #163823)
38 * Implement option parsing in dpigs, because it confuses everyone to
39 pass options to head(1) directly (Closes: #212926)
40 * Fix checkrestart to deal with the garbage that comes from
41 /proc/pid/exe sometimes (null bytes, etc.)
42 * Teach checkrestart about dpkg's habit of spitting out diversion
43 information in response to a --search query (Closes: #211785)
44
45 -- Matt Zimmerman <mdz@debian.org> Tue, 16 Dec 2003 17:12:50 -0800
46
47 debian-goodies (0.17) unstable; urgency=low
48
49 * Remove empty /usr/sbin directory (Closes: #205450)
50 * Enhance debian-goodies to give a hint about needing popularity-contest
51 if the data isn't present, and automatically launch sensible-browser
52 (use "popbugs -o -" to get the old behaviour) (Closes: #205662)
53 * Depends: python (>= 2.3), as we use NamedTemporaryFile
54
55 -- Matt Zimmerman <mdz@debian.org> Fri, 15 Aug 2003 21:35:16 -0400
56
57 debian-goodies (0.16) unstable; urgency=low
58
59 * Fix another buglet in popbugs where it would incorrectly parse
60 bugscan's inconsistent HTML
61
62 -- Matt Zimmerman <mdz@debian.org> Thu, 14 Aug 2003 12:26:16 -0400
63
64 debian-goodies (0.15) unstable; urgency=low
65
66 * Fix a bug in popbugs where it would misparse things when the block was
67 surrounded by a <font> tag
68
69 -- Matt Zimmerman <mdz@debian.org> Wed, 13 Aug 2003 17:34:56 -0400
70
71 debian-goodies (0.14) unstable; urgency=low
72
73 * Minor formatting changes to checkrestart
74 * New program, popbugs, which sorts and filters the RC bug list based on
75 data from popularity-contest
76 * Suggests: popularity-contest
77
78 -- Matt Zimmerman <mdz@debian.org> Wed, 13 Aug 2003 17:30:59 -0400
79
80 debian-goodies (0.13) unstable; urgency=low
81
82 * Fix checkrestart to not fail on certain types of bogus data in /proc,
83 specifically, when readlink() gives ENOENT.
84
85 -- Matt Zimmerman <mdz@debian.org> Mon, 19 May 2003 19:00:53 -0400
86
87 debian-goodies (0.12) unstable; urgency=low
88
89 * Fix typo-bug which caused a lot of false positives in checkrestart
90
91 -- Matt Zimmerman <mdz@debian.org> Fri, 2 May 2003 16:17:27 -0400
92
93 debian-goodies (0.11) unstable; urgency=low
94
95 * s/dpkg-query/dpkg/ on dglob as well
96 * Fix checkrestart to exclude certain common init scripts which don't
97 actually restart a service
98
99 -- Matt Zimmerman <mdz@debian.org> Fri, 2 May 2003 15:32:49 -0400
100
101 debian-goodies (0.10) unstable; urgency=low
102
103 * Modify checkrestart to use dpkg rather than dpkg-query, so that it can be
104 used on stable and does not require a dependency on newer dpkg
105
106 -- Matt Zimmerman <mdz@debian.org> Fri, 2 May 2003 10:19:15 -0400
107
108 debian-goodies (0.9) unstable; urgency=low
109
110 * Add dependencies on lsof and python
111
112 -- Matt Zimmerman <mdz@debian.org> Wed, 30 Apr 2003 14:20:54 -0400
113
114 debian-goodies (0.8) unstable; urgency=low
115
116 * New program, checkrestart, which informs about running processes using old
117 versions of upgraded files (such as shared libraries)
118
119 -- Matt Zimmerman <mdz@debian.org> Wed, 30 Apr 2003 13:53:25 -0400
120
121 debian-goodies (0.7) unstable; urgency=low
122
123 * Add new program, debman, by Colin Watson <cjwatson@debian.org>
124 (Closes: #176295)
125
126 -- Matt Zimmerman <mdz@debian.org> Sat, 11 Jan 2003 15:12:05 -0500
127
128 debian-goodies (0.6) unstable; urgency=low
129
130 * Make debget use curl instead of wget, because it supports file: URIs,
131 which are often used in sources.list. (Closes: #176263)
132
133 -- Matt Zimmerman <mdz@debian.org> Sat, 11 Jan 2003 12:32:28 -0500
134
135 debian-goodies (0.5) unstable; urgency=low
136
137 * Add an explicit --help option for dgrep, so that it doesn't invoke
138 grep with the --help option (Closes: #173430)
139
140 -- Matt Zimmerman <mdz@debian.org> Tue, 17 Dec 2002 08:42:45 -0500
141
142 debian-goodies (0.4) unstable; urgency=low
143
144 * Fix debget to do the right thing if the requested deb has uninstalled
145 dependencies
146
147 -- Matt Zimmerman <mdz@debian.org> Sun, 15 Dec 2002 19:21:32 -0500
148
149 debian-goodies (0.3) unstable; urgency=low
150
151 * Switch debget from using python-apt to calling apt-get. The things
152 that it really needs aren't exposed by the python-apt API, and this
153 makes it possible to use the same version specifications used with
154 apt-get install (/stable, =1.2.0-1, etc.). However, it may refuse to
155 work if you have packages in broken states.
156
157 -- Matt Zimmerman <mdz@debian.org> Sat, 7 Dec 2002 12:11:44 -0500
158
159 debian-goodies (0.2) unstable; urgency=low
160
161 * Fix indentation of description (Closes: #162983)
162
163 -- Matt Zimmerman <mdz@debian.org> Tue, 1 Oct 2002 10:00:32 -0400
164
165 debian-goodies (0.1) unstable; urgency=low
166
167 * Initial Release.
168
169 -- Matt Zimmerman <mdz@debian.org> Sat, 21 Sep 2002 23:19:11 -0400
170
0 Source: debian-goodies
1 Section: utils
2 Priority: optional
3 Maintainer: Matt Zimmerman <mdz@debian.org>
4 Build-Depends-Indep: debhelper (>> 3.0.0)
5 Standards-Version: 3.5.2
6
7 Package: debian-goodies
8 Architecture: all
9 Depends: grep-dctrl, curl, python (>= 2.3), lsof
10 Suggests: popularity-contest
11 Conflicts: debget
12 Replaces: debget
13 Description: Small toolbox-style utilities for Debian systems
14 These programs are designed to integrate with standard shell tools,
15 extending them to operate on the Debian packaging system.
16 .
17 dgrep - Search all files in specified packages for a regex
18 dglob - Generate a list of package names which match a pattern
19 .
20 These are also included, because they are useful and don't justify
21 their own packages:
22 .
23 debget - Fetch a .deb for a package in APT's database
24 dpigs - Show which installed packages occupy the most space
25 debman - Easily view man pages from a binary .deb without extracting
26 checkrestart - Help to find and restart processes which are using old
27 versions of upgraded files (such as libraries)
28 popbugs - Display a customized release-critical bug list based on
29 packages you use (using popularity-contest data)
0 This package was debianized by Matt Zimmerman <mdz@debian.org> on
1 Thu, 29 Aug 2002 13:51:41 -0400.
2
3 It has no home other than Debian.
4
5 Upstream Author(s): Matt Zimmerman <mdz@debian.org>
6
7 Copyright:
8
9 # Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>
10
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
14 # any later version.
15
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 # 02111-1307, USA.
25 #
26
27 On Debian systems, a copy of the GNU General Public License may be
28 found in /usr/share/common-licenses/GPL.
0 usr/bin
0 #!/usr/bin/make -f
1 # Sample debian/rules that uses debhelper.
2 # GNU copyright 1997 to 1999 by Joey Hess.
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 # This is the debhelper compatibility version to use.
8 export DH_COMPAT=3
9
10
11
12 build: build-stamp
13
14 build-stamp:
15 dh_testdir
16
17 for prog in debget dglob dgrep dpigs; do pod2man $$prog.pod > $$prog.1; done
18
19 touch build-stamp
20
21 clean:
22 dh_testdir
23 dh_testroot
24 rm -f build-stamp
25
26 dh_clean
27
28 install: build
29 dh_testdir
30 dh_testroot
31 dh_clean -k
32 dh_installdirs
33
34 # Add here commands to install the package into debian/debian-goodies.
35 install -d $(CURDIR)/debian/debian-goodies/usr/bin
36 install -m 755 dgrep dglob debget dpigs debman checkrestart popbugs \
37 $(CURDIR)/debian/debian-goodies/usr/bin
38 for grepname in dzgrep degrep dfgrep; do \
39 ln -s dgrep $(CURDIR)/debian/debian-goodies/usr/bin/$$grepname; \
40 done
41
42 # Build architecture-dependent files here.
43 # We have nothing to do by default.
44 binary-arch: build install
45
46 # Build architecture-independent files here.
47 binary-indep: build install
48 dh_testdir
49 dh_testroot
50 # dh_installdebconf
51 dh_installdocs README
52 # dh_installexamples
53 # dh_installmenu
54 # dh_installlogrotate
55 # dh_installemacsen
56 # dh_installpam
57 # dh_installmime
58 # dh_installinit
59 # dh_installcron
60 dh_installman debget.1 debman.1 dglob.1 dgrep.1 dpigs.1 popbugs.1
61 # dh_installinfo
62 # dh_undocumented
63 dh_installchangelogs
64 dh_link
65 dh_compress
66 dh_fixperms
67 dh_installdeb
68 # dh_perl
69 dh_gencontrol
70 dh_md5sums
71 dh_builddeb
72
73 binary: binary-indep binary-arch
74 .PHONY: build clean binary-indep binary-arch binary install configure
0 #! /bin/sh -e
1
2 # debman - read a man page from an uninstalled Debian package file (.deb)
3
4 # Copyright (C) 2003 Colin Watson <cjwatson@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 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
20
21 usage () {
22 if [ "$1" -eq 1 ]; then
23 FD=2
24 else
25 FD=1
26 fi
27 cat >&$FD <<EOF
28 Usage: debman [options] [-- man(1) options] <man page name> ...
29
30 Options should be exactly one of:
31 -f package.deb read pages from package.deb archive
32 -p package download .deb for package and read pages
33 from there
34 EOF
35 exit "$1"
36 }
37
38 ARGS=`getopt -l help,filename:,package: -o hf:p: -n debman -- "$@"`
39 eval set -- "$ARGS"
40
41 FILENAME=
42 PACKAGE=
43
44 while :; do
45 case "$1" in
46 -h|--help)
47 usage 0
48 ;;
49 -f|--filename)
50 FILENAME="$2"
51 shift 2
52 ;;
53 -p|--package)
54 PACKAGE="$2"
55 shift 2
56 ;;
57 --)
58 shift
59 break
60 ;;
61 *)
62 echo "debman: Internal error in option parsing" >&2
63 exit 1
64 ;;
65 esac
66 done
67
68 if ( [ -n "$FILENAME" ] && [ -n "$PACKAGE" ] ) || \
69 ( [ -z "$FILENAME" ] && [ -z "$PACKAGE" ] ); then
70 usage 1
71 fi
72
73 if test $# -lt 1; then
74 usage 1
75 fi
76
77 # Directory names are duplicated with and without ./ in order to cope with
78 # old .debs whose data.tar.gz components had a slightly different format.
79 MANDIRS='usr/share/man usr/X11R6/man ./usr/share/man ./usr/X11R6/man'
80
81 TEMPDIR=`mktemp -dt debman.XXXXXXXXXX`
82 trap 'rm -rf "$TEMPDIR"' EXIT ERR HUP INT QUIT TERM
83
84 if [ -n "$PACKAGE" ]; then
85 (cd "$TEMPDIR" && debget "$PACKAGE")
86 # There should be at most one file in $TEMPDIR now.
87 FILENAME="`find \"$TEMPDIR\" -name \*.deb -print`"
88 if [ -z "$FILENAME" ]; then
89 echo "Failed to fetch package $PACKAGE; exiting." >&2
90 exit 1
91 fi
92 fi
93
94 # Ignore errors from tar (though not dpkg). They'll generally just be of the
95 # form "tar: usr/share/man: Not found in archive". If they're something
96 # else, then man will fail to find the page anyway.
97
98 dpkg --fsys-tarfile "$FILENAME" | \
99 (tar -C "$TEMPDIR" -xf - $MANDIRS 2>/dev/null || true)
100
101 MANPATH="$TEMPDIR/usr/share/man:$TEMPDIR/usr/X11R6/man" man "$@"
102
103 # vi: expandtab
0 .TH DEBMAN 1 "11 January 2003"
1 .SH NAME
2 debman \- read man pages from uninstalled packages
3 .SH SYNOPSIS
4 .B debman
5 .B \-f
6 .I filename
7 .RB [ \-\-
8 .IR "man(1) options" ]
9 .I name
10 .br
11 .B debman
12 .B \-p
13 .I package
14 .RB [ \-\-
15 .IR "man(1) options" ]
16 .I name
17 .SH DESCRIPTION
18 .B debman
19 extracts a Debian package into a temporary directory and displays manual
20 pages from it.
21 If the
22 .B \-f
23 option is used, it will use a local
24 .I .deb
25 file; if the
26 .B \-p
27 option is used, it will download the named package using
28 .BR debget .
29 .SH ENVIRONMENT
30 .B debman
31 intentionally ignores any
32 .RB $ MANPATH
33 environment variable that might be set, and constructs its own such that
34 only manual pages within the package will be displayed.
35 .SH AUTHOR
36 .B debman
37 was written by Colin Watson <cjwatson@debian.org>.
38 .SH "SEE ALSO"
39 .BR debget (1)
0 #!/bin/sh -e
1
2 # dglob - Expand package names matching a pattern and conditions
3
4 # Copyright (C) 2001 Matt Zimmerman <mdz@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 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
20 #
21
22 ARGS=`getopt -o af0reiXv -n dglob -- "$@"`
23 eval set -- "$ARGS"
24
25
26 filter="grep-dctrl -FStatus ' installed'"
27 expand="cat"
28 grep_dctrl_options=""
29 while true; do
30 case "$1" in
31 -a) filter="cat" ; shift ;;
32 -0) SEP=0 ; shift ;;
33 -r|-e|-i|-X|-v) grep_dctrl_options="$grep_dctrl_options $1"; shift ;;
34 -f) expand="xargs dpkg --listfiles | perl -nl${SEP}e 'print if -f'"
35 shift
36 ;;
37
38 --) shift ; break ;;
39 esac
40 done
41
42 eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1" \
43 | (eval $expand)
0 =head1 NAME
1
2 dglob - Expand package names or files matching a pattern
3
4 =head1 SYNOPSIS
5
6 B<dglob> [B<-a>] I<pattern>
7
8 B<dglob> [B<-0>] B<-f> I<pattern>
9
10 =head1 DESCRIPTION
11
12 B<dglob> searches for packages whose names match a pattern, and can
13 either output their names, or a list of the files they contain. Per
14 default, only installed packages are matched, unless you use the B<-a>
15 option (see L<"OPTIONS">). The list of packages is written to stdout,
16 one package per line.
17
18 grep-dctrl(1) is used to search the list of packages, so you should
19 refer to its documentation for information on how patterns are
20 matched. By default, all packages whose name contains the given
21 string will be matched, but several options are available to modify
22 this behavior (see L<"OPTIONS">).
23
24 If you use dglob with the B<-f> option, all files in the matched packages
25 are listed instead of their names. Only existing, plain (i.e. no symlinks,
26 directories or other special ones) files are listed. The filenames are
27 written to stdout, one file per line. You can use the B<-0> option to
28 get the filenames separated by '\0' instead of a newline.
29
30 =head1 OPTIONS
31
32 B<dglob> suppports the following options:
33
34 =over 4
35
36 =item B<-a>
37
38 Search through all available packages, not just installed ones.
39
40 =item B<-f>
41
42 List all files in the matched packages. This list only installed (i.e.
43 locallly existing) files from installed packages, so using it together
44 with B<-a> is rather pointless.
45
46 =item B<-0>
47
48 When listing files (with B<-f>) use '\0' as a separator instead of
49 a newline. When specified without B<-f>, this options does nothing.
50
51 =item B<-r>, B<-e>, B<-i>, B<-X>, B<-v>
52
53 These options are passed directly to grep-dctrl(1) to modify how the
54 pattern is matched. See grep-dctrl(1).
55
56 =back
57
58 =head1 FILES
59
60 =over 4
61
62 =item F</var/lib/dpkg/status>
63
64 dpkg(8) status file, which serves as source for the list of available
65 and installed packages.
66
67 =back
68
69 =head1 AUTHOR
70
71 Matt Zimmerman <mdz@debian.org>
72
73 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
74
75 =head1 COPYRIGHT AND LICENCE
76
77 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
78
79 This program is free software; you can redistribute it and/or modify
80 it under the terms of the GNU General Public License as published by
81 the Free Software Foundation; either version 2, or (at your option)
82 any later version.
83
84 On Debian systems, a copy of the GNU General Public License may be
85 found in /usr/share/common-licenses/GPL.
86
87 =head1 SEE ALSO
88
89 grep-dctrl(1), dpkg(8)
0 #!/bin/sh
1
2 # dgrep -- grep through files belonging to an installed Debian package
3
4 # Copyright (C) 2001 Matt Zimmerman <mdz@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 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
20
21 set -e
22
23 prog=`echo $0 | sed 's|.*/d||'`
24
25 case "$prog" in
26 grep|egrep|fgrep|zgrep) ;;
27 *) echo >&2 "dpkg-grep: Unrecognized invocation: $0"; exit 1 ;;
28 esac
29
30 # Option parser modeled after the one in zgrep from GNU grep
31
32 recursive=0
33 opts=""
34 pat=""
35 after_args=""
36 while test $# -ne 0; do
37 case "$1" in
38 --recursive|--d*=recurse) echo >&2 "recursive grep not supported"
39 exit 1
40 ;;
41 --d*=skip) ;;
42 --d*=read) echo >&2 "--directories=read not supported"; exit 1 ;;
43 --help)
44 echo "Usage: dgrep [most grep options] <pattern> <package>..."; exit 0 ;;
45 --*) ;;
46 -*)
47 case "$1" in
48 -*r*) echo >&2 "recursive grep not supported"; exit 1 ;;
49 esac
50 ;;
51 esac
52 case "$after_args$1" in
53 -[ef]) opts="$opts $1"; shift; pat=$1 ;;
54 -[ABCdm]) opts="$opts $1 $2"; shift ;;
55 --) opts="$opts $1"; after_args=1 ;;
56 -*) opts="$opts $1" ;;
57 *)
58 if test -z "$pat"; then
59 pat=$1
60 else
61 break
62 fi
63 ;;
64 esac
65 shift
66 done
67
68 exec dglob -0f "$@" | xargs -0r $prog $opts $pat
0 =head1 NAME
1
2 dgrep, degrep, dfgrep, dzgrep -- grep through files belonging to an installed Debian package
3
4 =head1 SYNOPSIS
5
6 B<dgrep> [I<most grep options>] I<pattern> I<package>...
7
8 B<dgrep> B<--help>
9
10 =head1 DESCRIPTION
11
12 B<dgrep> invokes grep(1) on each file in one or more installed Debian
13 packages.
14
15 It passes the I<package> argument(s) to dglob(1) to retrieve a list of files
16 in those packages. You can use POSIX regular expressions for the package
17 names.
18
19 If B<dgrep> is invoked as B<degrep>, B<dfgrep> or B<dzgrep> then egrep(1),
20 fgrep(1) or zgrep(1) is used instead of B<grep>.
21
22 =head1 OPTIONS
23
24 B<dgrep> supports most of grep(1)'s options. Please refer to your
25 B<grep> documentation (i.e. the manpage or the texinfo manual) for
26 a complete listing. Only a few options are excluded because they do not
27 conform with the intended behaviour, see the list below.
28
29 =head2 Options of grep that are not supported by dgrep
30
31 =over 4
32
33 =item B<-r>, B<--recursive>, B<-d> I<recurse>, B<--directories>=I<recurse>
34
35 =item B<-d> I<read>, B<--directories>=I<read>
36
37 B<dgrep> searches only in the "normal" files of a package. It skips all
38 directories and symlinks. Therefor the options of
39 grep that are specific to directories are not supported.
40
41 =back
42
43 =head1 AUTHOR
44
45 Matt Zimmerman <mdz@debian.org>
46
47 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
48
49 =head1 COPYRIGHT AND LICENCE
50
51 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
52
53 This program is free software; you can redistribute it and/or modify
54 it under the terms of the GNU General Public License as published by
55 the Free Software Foundation; either version 2, or (at your option)
56 any later version.
57
58 On Debian systems, a copy of the GNU General Public License may be
59 found in /usr/share/common-licenses/GPL.
60
61 =head1 SEE ALSO
62
63 grep(1), egrep(1), fgrep(1), zgrep(1), dglob(1), regex(7), dpkg(8)
0 #!/bin/sh
1
2 set -e
3
4 Usage() {
5 echo "Usage: dpigs [options]"
6 echo
7 echo "Options:"
8 echo " -n, --lines=N"
9 echo " Display the N largest packages on the system (default 10)."
10 echo " -s, --status=status-file"
11 echo " Use status-file instead of the default dpkg status file."
12 echo " -h, --help"
13 echo " Display this message."
14 }
15
16 LINES=10
17 # grep-status provides a default
18 STATUS=
19
20 OPTS=$(getopt -o n:s:h --long lines:,status:,help -- "$@")
21 eval set -- "$OPTS"
22
23 while true; do
24 case "$1" in
25 -n|--lines)
26 LINES="$2"
27 shift 2
28 ;;
29 -s|--status)
30 STATUS="$2"
31 shift 2
32 ;;
33 -h|--help)
34 Usage
35 exit 0
36 ;;
37 --)
38 shift
39 break
40 ;;
41 *)
42 Usage
43 exit 1
44 ;;
45 esac
46 done
47
48 grep-status -nsInstalled-size,Package -F Status ' installed' $STATUS \
49 | perl -p00l12 -e 's/\n/ /' \
50 | sort -rn \
51 | head --lines=$LINES
0 =head1 NAME
1
2 dpigs - Show which installed packages occupy the most space
3
4 =head1 SYNOPSIS
5
6 B<dpigs> [I<options>]
7
8 =head1 DESCRIPTION
9
10 B<dpigs> sorts the installed packages by size and outputs the largest
11 ones. Per default dpigs displays the largest 10 packages. You can change
12 this value by using the B<-n> option (see L<"OPTIONS">). The information
13 is taken from the dpkg status file with grep-status(1).
14
15 =head1 OPTIONS
16
17 =over 4
18
19 =item B<-h>, B<--help>
20
21 Display some usage information and exit.
22
23 =item B<-n>, B<--lines>=I<N>
24
25 Display the N largest packages on the system (default 10).
26
27 =item B<-s>, B<--status>=I<FILE>
28
29 Use I<FILE> instead of the default dpkg status file (which is
30 F</var/lib/dpkg/status> currently).
31
32 =back
33
34 =head1 AUTHOR
35
36 Matt Zimmerman <mdz@debian.org>
37
38 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
39
40 =head1 COPYRIGHT AND LICENCE
41
42 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
43
44 This program is free software; you can redistribute it and/or modify
45 it under the terms of the GNU General Public License as published by
46 the Free Software Foundation; either version 2, or (at your option)
47 any later version.
48
49 On Debian systems, a copy of the GNU General Public License may be
50 found in /usr/share/common-licenses/GPL.
51
52 =head1 SEE ALSO
53
54 dpkg(8), grep-status(1)
0 #!/usr/bin/python
1
2 #
3 # popbugs - Find RC bugs in packages you commonly use
4 # Matt Zimmerman <mdz@debian.org> 2001
5 #
6
7 import sys
8 import re
9 import os
10 import urllib2
11 import tempfile
12 import getopt
13
14 usage = '''Usage: popbugs [{-o|--output=} {outputfile|-}] [popularity-contest log]\n'''
15
16 popconfile = '/var/log/popularity-contest'
17 bugurl = 'http://bugs.debian.org/release-critical/other/all.html'
18 outputfile = None
19
20 try:
21 opts, args = getopt.getopt(sys.argv[1:], "ho:",
22 ["help","output="])
23 except getopt.GetoptError:
24 sys.stderr.write(usage)
25 sys.exit(2)
26 for o, a in opts:
27 if o in ("-h", "--help"):
28 sys.stdout.write(usage)
29 sys.exit()
30 elif o in ("-o", "--output"):
31 outputfile = a
32
33 if len(args) > 1:
34 popconfile = args[0]
35 else:
36 if not os.path.exists(popconfile):
37 if not os.path.exists('/usr/sbin/popularity-contest'):
38 sys.stderr.write('''
39 The popularity-contest package does not appear to be installed.
40 This program requires the data collected from popularity-contest
41 in order to work.
42
43 ''')
44 sys.exit(1)
45
46 sys.stderr.write('''
47 There is no popularity-contest data present on your system. This
48 probably means that popularity-contest has not yet run since it
49 was installed. Try running /etc/cron.weekly/popularity-contest by
50 hand to collect some data.
51
52 ''')
53 sys.exit(1)
54
55 if outputfile == None:
56 output = tempfile.NamedTemporaryFile(suffix='.html')
57 outputfile = output.name
58 view = 1
59 elif outputfile == '-':
60 output = sys.stdout
61 view = 0
62 else:
63 output = open(outputfile, 'w')
64 view = 0
65
66 class Package:
67 def __init__(self, name, atime):
68 self.name = name
69 self.atime = atime
70
71 packages = {}
72 pkglist = []
73 popcon = open(popconfile,'r')
74 for line in popcon.readlines():
75 if len(line) == 0 or line.find(':') != -1:
76 continue
77
78 fields = line.split()
79 if len(fields) != 4:
80 continue
81 if (fields[0] == 'POPULARITY-CONTEST-0' or
82 fields[0] == 'END-POPULARITY-CONTEST-0'):
83 continue
84
85 (atime, ctime, package, pathname) = fields
86 # if pathname == '<NOFILES>' or pathname == '<RECENT-CTIME>':
87 # continue
88
89 packages[package] = Package(package,atime)
90 pkglist.append(packages[package])
91
92 popcon.close()
93
94 page = urllib2.urlopen(bugurl).readlines()
95
96 while page:
97 line = page.pop(0)
98 output.write(line)
99 if line.startswith('<pre>'):
100 break
101
102 packagere = re.compile('^<a name="([^"]+)"><strong>Package:.*')
103 while page:
104 m = packagere.match(page[0])
105 if m:
106 html = ''
107 while page:
108 line = page.pop(0)
109 html += line
110
111 if line == '\n' or (page and packagere.match(page[0])):
112 # another paragraph started with no newline
113 break
114
115 pkgname = m.group(1)
116
117 if pkgname in packages:
118 packages[pkgname].html = html
119 else:
120 if page[0].startswith('</pre>'):
121 break
122 page.pop(0)
123
124 pkglist.sort(lambda a,b: -cmp(a.atime,b.atime))
125 for package in pkglist:
126 if hasattr(package,'html'):
127 output.write(package.html)
128 output.write('\n')
129
130 output.writelines(page)
131
132 output.flush()
133
134 if view:
135 os.system('sensible-browser file://' + outputfile)
0 .\" popbugs.1 - find RC bugs in packages you commonly use
1 .\" Copyright (C) 2004 Jochen Voss
2 .\" Everybody is allowed to distribute this manual page,
3 .\" to modify it, and to distribute modifed versions of it.
4 .TH popbugs 1 "January 10 2004" "debian\-goodies" "debian\-goodies"
5 .SH NAME
6 popbugs \- find RC bugs in packages you commonly use
7 .SH SYNOPSIS
8 .B popbugs
9 .RI [ options "] [" "popularity\-contest log" ]
10 .SH DESCRIPTION
11 The
12 .B popbugs
13 program fetches the list of release critical bugs from the
14 Debian bug tracking system on the internet.
15 It correlates the bug log with the
16 .B popularity\-contest
17 data from your system to obtain a list of release critical bugs
18 in packages, which are commonly used on your system.
19 Normally this list is displayed in a web browser.
20 Helping to resolve these bugs is a good idea,
21 if you want to see your favourite programs in the next
22 stable release of Debian.
23 .SH OPTIONS
24 .TP
25 .BI \-h
26 .TP
27 .BI \-\-help
28 Show a very short usage message.
29 .TP
30 .BI \-o outputfile
31 .TP
32 .BI \-\-output= outputfile
33 Place the output in
34 .I outputfile
35 instead of displaying it in a browser.
36 .SH SEE ALSO
37 .BR rc\-alert (1),
38 .BR popularity\-contest (8)
39 .SH AUTOR
40 The
41 .B popbugs
42 program is copyright \(co 2001 Matt Zimmerman <mdz@debian.org>.
43 This manual page is copyright \(co 2004 Jochen Vo\(ss <voss@debian.org>.