From: Raphael Hertzog Date: Thu, 22 Nov 2007 11:16:56 +0000 (+0100) Subject: dpkg-shlibdeps: try harder to identify the package providing a library X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65135f5f7090ddf6c8709659f69e740440f2e91a;p=dpkg 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. --- diff --git a/ChangeLog b/ChangeLog index bd9ba19b..b5eb5dd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ 2007-11-22 Raphael Hertzog * 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 diff --git a/debian/changelog b/debian/changelog index 5cfc8898..5b14a49a 100644 --- a/debian/changelog +++ b/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) diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 6120b668..5930eb78 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/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