From: Raphael Hertzog Date: Thu, 3 Jan 2008 20:28:01 +0000 (+0100) Subject: dpkg-shlibdeps: adjust the search order of shlibs files X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68a495083cd68a19af3eb17ae90a9dcfc81c0c4c;p=dpkg dpkg-shlibdeps: adjust the search order of shlibs files * scripts/dpkg-shlibdeps.pl (add_shlibs_dep): Use the same logic as find_symbols_files to find shlibs files. Check debian/*/DEBIAN/shlibs only when the library has not been found in an installed package, and give precedence to the shlibs provided by the binary package where the library has been found. Replaces the previous work-around that gave precedence to the package that contained the binary. * man/dpkg-shlibdeps.1: Document the above change in the shlibs search order. --- diff --git a/ChangeLog b/ChangeLog index 1d442cd9..2d795fbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,16 @@ trying to find a library. * man/dpkg-shlibdeps.1: Document the new -S option. + * scripts/dpkg-shlibdeps.pl (add_shlibs_dep): Use the same logic + as find_symbols_files to find shlibs files. Check + debian/*/DEBIAN/shlibs only when the library has not been found in + an installed package, and give precedence to the shlibs provided + by the binary package where the library has been found. Replaces + the previous work-around that gave precedence to the package + that contained the binary. + * man/dpkg-shlibdeps.1: Document the above change in the shlibs + search order. + 2008-01-03 Guillem Jover * scripts/dpkg-buildpackage.pl: Do not automatically enable '-j' diff --git a/man/dpkg-shlibdeps.1 b/man/dpkg-shlibdeps.1 index 0039e106..f7cdf3bd 100644 --- a/man/dpkg-shlibdeps.1 +++ b/man/dpkg-shlibdeps.1 @@ -53,6 +53,9 @@ Shared library information generated by the current build process that also invo .BR dpkg\-shlibdeps . They are generated by .BR dpkg\-gensymbols (1). +They are only used if the library is found in a package's build tree. The +symbols file in that build tree takes precedence over symbols files from +other binary packages. .IP /etc/dpkg/symbols/\fIpackage\fR.symbols.\fIarch\fR .IP /etc/dpkg/symbols/\fIpackage\fR.symbols Per-system overriding shared library dependency information. @@ -89,6 +92,9 @@ Per-system overriding shared library dependency information. .IP debian/*/DEBIAN/shlibs Shared library information generated by the current build process that also invoked .BR dpkg\-shlibdeps . +They are only used if the library is found in a package's build tree. The +shlibs file in that build tree takes precedence over shlibs files from +other binary packages. .IP \fIadmindir\fR/info/\fIpackage\fR.shlibs Package-provided shared library dependency information. Unless overridden, \fIadmindir\fR is /var/lib/dpkg. diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index e62f515e..4488def5 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -103,7 +103,6 @@ my %shlibs; my $cur_field; foreach my $file (keys %exec) { - my $pkg_root = guess_pkg_root_dir($file); $cur_field = $exec{$file}; print "Scanning $file (for $cur_field field)\n" if $debug; @@ -187,7 +186,7 @@ foreach my $file (keys %exec) { my $libobj = $dumplibs_wo_symfile->get_object($id); # Only try to generate a dependency for libraries with a SONAME if ($libobj->is_public_library() and not - add_shlibs_dep($soname, $pkg, $pkg_root)) { + add_shlibs_dep($soname, $pkg, $lib)) { # This failure is fairly new, try to be kind by # ignoring as many cases that can be safely ignored my $ignore = 0; @@ -451,12 +450,21 @@ sub update_dependency_version { } sub add_shlibs_dep { - my ($soname, $pkg, $pkg_root) = @_; + my ($soname, $pkg, $libfile) = @_; my @shlibs = ($shlibslocal, $shlibsoverride); - # Make sure the shlibs of the current package is analyzed before the - # shlibs of other binary package from the same source - push @shlibs, "$pkg_root/DEBIAN/shlibs" if defined($pkg_root); - push @shlibs, @pkg_shlibs, "$admindir/info/$pkg.shlibs", $shlibsdefault; + if ($pkg eq "") { + # If the file is not packaged, try to find out the shlibs file in + # the package being built where the lib has been found + my $pkg_root = guess_pkg_root_dir($libfile); + if (defined $pkg_root) { + push @shlibs, "$pkg_root/DEBIAN/shlibs"; + } + # Fallback to other shlibs files but it shouldn't be necessary + push @shlibs, @pkg_shlibs; + } else { + push @shlibs, "$admindir/info/$pkg.shlibs"; + } + push @shlibs, $shlibsdefault; print "Looking up shlibs dependency of $soname provided by '$pkg'\n" if $debug; foreach my $file (@shlibs) { next if not -e $file;