ソースを参照

Add --truename option.

Adam Heath 25 年 前
コミット
f0861f5a89
共有4 個のファイルを変更した25 個の追加1 個の削除を含む
  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>
 Sat Dec 23 21:40:32 CST 2000 Adam Heath <doogie@debian.org>
 
 
   * main/dpkg.8:  Document COLUMNS environment variable.
   * main/dpkg.8:  Document COLUMNS environment variable.

+ 1 - 0
debian/changelog

@@ -1,5 +1,6 @@
 dpkg (1.8.0) unstable; urgency=low
 dpkg (1.8.0) unstable; urgency=low
 
 
+  * Add --truename option to dpkg-divert.  Closes: #68489.
   * Documented COLUMNS in dpkg(8).  Closes: #77001.
   * Documented COLUMNS in dpkg(8).  Closes: #77001.
   * Modified DPKG_C_GCC_TRY_WARNS() to call AC_SUBST, so that we can
   * 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
     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]
 [options]
 --list
 --list
 .I <glob-pattern>
 .I <glob-pattern>
+.B dpkg-divert
+[options] --truename
+.I <file>
+.br
 .SH DESCRIPTION
 .SH DESCRIPTION
 File `diversions' are a way of forcing dpkg not to install a file into its
 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
 location, but to a `diverted' location. Diversions can be used through the
@@ -26,7 +30,8 @@ contains those files.
 .B dpkg-divert
 .B dpkg-divert
 is the utility used to set up and update the list of diversions. It
 is the utility used to set up and update the list of diversions. It
 functions in three basic modes - adding, removing, and listing diversions.
 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.
 (listed below) may also be specified.
 .SH OPTIONS
 .SH OPTIONS
 .TP
 .TP

+ 14 - 0
scripts/dpkg-divert.pl

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