Quellcode durchsuchen

dpkg-shlibdeps: handle the case where the same binary is listed multiple times

* scripts/dpkg-shlibdeps.pl: When the same binary is passed
several times as parameters (associated to different fields),
associate it to the most important field.
Raphael Hertzog vor 18 Jahren
Ursprung
Commit
f52f2a333e
3 geänderte Dateien mit 21 neuen und 2 gelöschten Zeilen
  1. 3 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 16 2
      scripts/dpkg-shlibdeps.pl

+ 3 - 0
ChangeLog

@@ -4,6 +4,9 @@
 	duplicated dependencies in fields of lesser priority. Dependencies
 	duplicated dependencies in fields of lesser priority. Dependencies
 	coming from shlibs files have no associated version and this case
 	coming from shlibs files have no associated version and this case
 	wasn't handled properly.
 	wasn't handled properly.
+	* scripts/dpkg-shlibdeps.pl: When the same binary is passed
+	several times as parameters (associated to different fields),
+	associate it to the most important field.
 
 
 2008-01-14  Raphael Hertzog  <hertzog@debian.org>
 2008-01-14  Raphael Hertzog  <hertzog@debian.org>
 
 

+ 2 - 0
debian/changelog

@@ -33,6 +33,8 @@ dpkg (1.14.16) UNRELEASED; urgency=low
   * Add support of Dm-Upload-Allowed field. Closes: #453400
   * Add support of Dm-Upload-Allowed field. Closes: #453400
   * Fix dpkg-shlibdeps's filtering of duplicated dependencies in fields of
   * Fix dpkg-shlibdeps's filtering of duplicated dependencies in fields of
     lesser priority (when -d is used).
     lesser priority (when -d is used).
+  * Fix behaviour of dpkg-shlibdeps when the same binary was passed multiple
+    times for use in different dependency fields (-d option).
 
 
   [ Updated manpages translations ]
   [ Updated manpages translations ]
   * Fix typo in French. Closes: #460021
   * Fix typo in French. Closes: #460021

+ 16 - 2
scripts/dpkg-shlibdeps.pl

@@ -72,7 +72,14 @@ foreach (@ARGV) {
 	defined($depstrength{$dependencyfield}) ||
 	defined($depstrength{$dependencyfield}) ||
 	    warning(_g("unrecognised dependency field \`%s'"), $dependencyfield);
 	    warning(_g("unrecognised dependency field \`%s'"), $dependencyfield);
     } elsif (m/^-e(.*)$/) {
     } elsif (m/^-e(.*)$/) {
-	$exec{$1} = $dependencyfield;
+	if (exists $exec{$1}) {
+	    # Affect the binary to the most important field
+	    if ($depstrength{$dependencyfield} > $depstrength{$exec{$1}}) {
+		$exec{$1} = $dependencyfield;
+	    }
+	} else {
+	    $exec{$1} = $dependencyfield;
+	}
     } elsif (m/^--ignore-missing-info$/) {
     } elsif (m/^--ignore-missing-info$/) {
 	$ignore_missing_info = 1;
 	$ignore_missing_info = 1;
     } elsif (m/^-t(.*)$/) {
     } elsif (m/^-t(.*)$/) {
@@ -84,7 +91,14 @@ foreach (@ARGV) {
     } elsif (m/^-/) {
     } elsif (m/^-/) {
 	usageerr(_g("unknown option \`%s'"), $_);
 	usageerr(_g("unknown option \`%s'"), $_);
     } else {
     } else {
-	$exec{$_} = $dependencyfield;
+	if (exists $exec{$_}) {
+	    # Affect the binary to the most important field
+	    if ($depstrength{$dependencyfield} > $depstrength{$exec{$_}}) {
+		$exec{$_} = $dependencyfield;
+	    }
+	} else {
+	    $exec{$_} = $dependencyfield;
+	}
     }
     }
 }
 }