+2008-06-23 Timothy G Abbott <tabbott@MIT.EDU>
+
+ * scripts/dpkg-divert.pl: Add new option --listpackage to
+ dpkg-divert.
+ * man/dpkg-divert.1: Document new option.
+
2008-06-22 Raphael Hertzog <hertzog@debian.org>
* man/dpkg.1, man/dpkg-query.1: Clarify lisf of packages displayed
Sven Joachim <svenjoac@gmx.de>
Sven Rudolph <sr1@loom.sax.de>
Thomas Morin <thomas.morin@enst-bretagne.fr>
+Timothy G Abbott <tabbott@MIT.EDU>
Tom Lees <tom@lpsg.demon.co.uk>
Tomas Pospisek <tpo_deb@sourcepole.ch>
Topi Miettinen <Topi.Miettinen@nic.fi>
* Document -A option in dpkg-buildpackage(1). Closes: #482834
* Add some warning concerning the available file and the related commands.
They are mostly obsolete for APT users. Closes: #481185
+ * Add new option --listpackage to dpkg-divert. Thanks to Timothy G Abbott
+ <tabbott@MIT.EDU> for the patch. Closes: #485012
[ Pierre Habouzit ]
* Add a --query option to update-alternatives. Closes: #336091, #441904
.BI \-\-list " glob-pattern"
List diversions matching \fIglob-pattern\fP.
.TP
+.BI \-\-listpackage " file"
+Print the name of the package that diverts \fIfile\fP. Prints LOCAL if
+\fIfile\fP is locally diverted and nothing if \fIfile\fP is not diverted.
+.TP
.BI \-\-truename " file"
Print the real name for a diverted file.
.
[--add] <file> add a diversion.
--remove <file> remove the diversion.
--list [<glob-pattern>] show file diversions.
+ --listpackage <file> show what package diverts the file.
--truename <file> return the diverted file.
Options:
} elsif (m/^--list$/) {
&checkmanymodes;
$mode= 'list';
+ } elsif (m/^--listpackage$/) {
+ &checkmanymodes;
+ $mode= 'listpackage';
} elsif (m/^--truename$/) {
&checkmanymodes;
$mode= 'truename';
}
print $file, "\n";
exit(0);
+} elsif ($mode eq 'listpackage') {
+ @ARGV == 1 || &badusage(sprintf(_g("--%s needs a single argument"), $mode));
+ $file= $ARGV[0];
+ for (my $i = 0; $i <= $#contest; $i++) {
+ next unless $file eq $contest[$i];
+ if ($package[$i] eq ':') {
+ # indicate package is local using something not in package namespace
+ print "LOCAL\n";
+ } else {
+ print $package[$i], "\n";
+ }
+ exit(0);
+ }
+ # print nothing if file is not diverted
+ exit(0);
} else {
&quit(sprintf(_g("internal error - bad mode \`%s'"), $mode));
}