Преглед изворни кода

dpkg-shlibdeps: try harder to identify the package providing a library

If the library is an unpackaged symlink, then try to identify the package
via the realpath associated to the symlink.
Raphael Hertzog пре 18 година
родитељ
комит
65135f5f70
3 измењених фајлова са 23 додато и 3 уклоњено
  1. 5 1
      ChangeLog
  2. 3 0
      debian/changelog
  3. 15 2
      scripts/dpkg-shlibdeps.pl

+ 5 - 1
ChangeLog

@@ -1,7 +1,11 @@
 2007-11-22  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/dpkg-shlibdeps.pl: Add more debug messages. Accept empty
-	dependencies in shlibs files again.
+	dependencies in shlibs files again. When symlinks to libraries are
+	not found by "dpkg -S", try the same on the realpath of the
+	library as fallback before deciding that it's a library being
+	built.
+
 
 2007-11-21  Raphael Hertzog  <hertzog@debian.org>
 

+ 3 - 0
debian/changelog

@@ -8,6 +8,9 @@ dpkg (1.14.10) UNRELEASED; urgency=low
   * Add more debug messages to dpkg-shlibdeps to ease collecting information
     in case of problems.
   * dpkg-shlibdeps now accepts again empty dependencies in shlibs files.
+  * dpkg-shlibdeps will try harder to identify packages providing a library
+    by looking up dpkg -S on the realpath of any symlink to a library.
+    Closes: #452339
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)

+ 15 - 2
scripts/dpkg-shlibdeps.pl

@@ -5,6 +5,7 @@ use warnings;
 
 use English;
 use POSIX qw(:errno_h :signal_h);
+use Cwd qw(realpath);
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning error failure syserr usageerr);
@@ -95,22 +96,34 @@ foreach my $file (keys %exec) {
 
     # Load symbols files for all needed libraries (identified by SONAME)
     my %libfiles;
+    my %altlibfiles;
     foreach my $soname (@sonames) {
 	my $lib = my_find_library($soname, $obj->{RPATH}, $obj->{format}, $file);
 	failure(_g("couldn't find library %s (note: only packages with " .
 	           "'shlibs' files are looked into)."), $soname)
 	    unless defined($lib);
 	$libfiles{$lib} = $soname;
+	if (-l $lib) {
+	    $altlibfiles{realpath($lib)} = $soname;
+	}
 	print "Library $soname found in $lib\n" if $debug;
     }
-    my $file2pkg = find_packages(keys %libfiles);
+    my $file2pkg = find_packages(keys %libfiles, keys %altlibfiles);
     my $symfile = Dpkg::Shlibs::SymbolFile->new();
     my $dumplibs_wo_symfile = Dpkg::Shlibs::Objdump->new();
     my @soname_wo_symfile;
     foreach my $lib (keys %libfiles) {
 	my $soname = $libfiles{$lib};
+	if (not exists $file2pkg->{$lib} and -l $lib) {
+	    # If the lib found is an unpackaged symlink, we try a fallback
+	    # on the realpath() first, maybe this one is part of a package
+	    my $reallib = realpath($lib);
+	    if (exists $file2pkg->{$reallib}) {
+		$file2pkg->{$lib} = $file2pkg->{$reallib};
+	    }
+	}
 	if (not exists $file2pkg->{$lib}) {
-	    # If the library is not available in an installed package,
+	    # If the library is really not available in an installed package,
 	    # it's because it's in the process of being built
 	    # Empty package name will lead to consideration of symbols
 	    # file from the package being built only