Quellcode durchsuchen

Add --truename option.

Adam Heath vor 25 Jahren
Ursprung
Commit
f0861f5a89
4 geänderte Dateien mit 25 neuen und 1 gelöschten Zeilen
  1. 4 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 6 1
      scripts/dpkg-divert.8
  4. 14 0
      scripts/dpkg-divert.pl

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Sat Dec 23 22:24:23 CST 2000 Adam Heath <doogie@debian.org>
+
+  * scripts/dpkg-divert.pl: Add --truename option.
+
 Sat Dec 23 21:40:32 CST 2000 Adam Heath <doogie@debian.org>
 
   * main/dpkg.8:  Document COLUMNS environment variable.

+ 1 - 0
debian/changelog

@@ -1,5 +1,6 @@
 dpkg (1.8.0) unstable; urgency=low
 
+  * Add --truename option to dpkg-divert.  Closes: #68489.
   * Documented COLUMNS in dpkg(8).  Closes: #77001.
   * Modified DPKG_C_GCC_TRY_WARNS() to call AC_SUBST, so that we can
     use the result of the test during build time.  Closes: Bug#75138

+ 6 - 1
scripts/dpkg-divert.8

@@ -14,6 +14,10 @@ dpkg-divert -- override a package's version of a file
 [options]
 --list
 .I <glob-pattern>
+.B dpkg-divert
+[options] --truename
+.I <file>
+.br
 .SH DESCRIPTION
 File `diversions' are a way of forcing dpkg not to install a file into its
 location, but to a `diverted' location. Diversions can be used through the
@@ -26,7 +30,8 @@ contains those files.
 .B dpkg-divert
 is the utility used to set up and update the list of diversions. It
 functions in three basic modes - adding, removing, and listing diversions.
-The options are --add, --remove, and --list, respectively. Other options
+The options are --add, --remove, and --list, respectively. Additionally,
+it can print out the real name for a diverted file. Other options
 (listed below) may also be specified.
 .SH OPTIONS
 .TP

+ 14 - 0
scripts/dpkg-divert.pl

@@ -25,6 +25,7 @@ Usage:
  dpkg-divert [options] [--add] <file>               - add a diversion
  dpkg-divert [options] --remove <file>              - remove the diversion
  dpkg-divert [options] --list [<glob-pattern>]      - show file diversions
+ dpkg-divert [options] --truname <file>             - return the diverted file
 
 Options: 
     --package <package>        name of the package whose copy of <file>
@@ -82,6 +83,9 @@ while (@ARGV) {
     } elsif (m/^--list$/) {
         &checkmanymodes;
         $mode= 'list';
+    } elsif (m/^--truename$/) {
+        &checkmanymodes;
+        $mode= 'truename';
     } elsif (m/^--divert$/) {
         @ARGV || &badusage("--divert needs a divert-to argument");
         $divertto= shift(@ARGV);
@@ -177,6 +181,16 @@ if ($mode eq 'add') {
         print &infon($i),"\n";
     }
     exit(0);
+} elsif ($mode eq 'truename') {
+    @ARGV == 1 || &badusage("--truename needs a single argument");
+    $file= $ARGV[0];
+    for ($i=0; $i<=$#contest; $i++) {
+	next unless $file eq $contest[$i];
+	print $altname[$i], "\n";
+	exit(0);
+    }
+    print $file, "\n";
+    exit(0);
 } else {
     &quit("internal error - bad mode \`$mode'");
 }