Просмотр исходного кода

dpkg-shlibdeps: fix find_symbols_file to choose the right symbols file

* scripts/dpkg-shlibdeps.pl (find_symbols_file): When libraries
are found in non-packaged files, first try to find the
corresponding symbols file in the build tree containing that
library. On the opposite, don't look up symbols files in debian/*
build directories for libraries found in installed packages (build
trees are scanned first and thus if they contain a needed library
dpkg-shlibdeps will find the library there and not in an installed
package).
Raphael Hertzog лет назад: 18
Родитель
Сommit
d9c09384a3
3 измененных файлов с 32 добавлено и 7 удалено
  1. 11 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 19 7
      scripts/dpkg-shlibdeps.pl

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2008-01-03  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl (find_symbols_file): When libraries
+	are found in non-packaged files, first try to find the
+	corresponding symbols file in the build tree containing that
+	library. On the opposite, don't look up symbols files in debian/*
+	build directories for libraries found in installed packages (build
+	trees are scanned first and thus if they contain a needed library
+	dpkg-shlibdeps will find the library there and not in an installed
+	package).
+
 2008-01-03  Guillem Jover  <guillem@debian.org>
 
 	* scripts/dpkg-buildpackage.pl: Do not automatically enable '-j'

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ dpkg (1.14.15) UNRELEASED; urgency=low
   * Blacklist armel-specific symbols in dpkg-gensymbols. Reported by Riku
     Voipio. Closes: #457964
   * Fix typos in various manpages. Patch from A. Costa. Closes: #458276
+  * Make dpkg-shlibdeps choose the right symbols files when we have several
+    debian/*/DEBIAN/symbols for a given soname. Closes: #458860
 
   [ Guillem Jover ]
   * Move compression related variables to a new Dpkg::Compression module.

+ 19 - 7
scripts/dpkg-shlibdeps.pl

@@ -160,7 +160,7 @@ foreach my $file (keys %exec) {
 	    my $dpkg_symfile;
 	    if ($packagetype eq "deb") {
 		# Use fine-grained dependencies only on real deb
-		$dpkg_symfile = find_symbols_file($pkg, $soname);
+		$dpkg_symfile = find_symbols_file($pkg, $soname, $lib);
 		if (defined $dpkg_symfile) {
 		    # Load symbol information
 		    print "Using symbols file $dpkg_symfile for $soname\n" if $debug;
@@ -520,12 +520,24 @@ sub extract_from_shlibs {
 }
 
 sub find_symbols_file {
-    my ($pkg, $soname) = @_;
-    foreach my $file (@pkg_symbols,
-	"/etc/dpkg/symbols/$pkg.symbols.$host_arch",
-	"/etc/dpkg/symbols/$pkg.symbols",
-	"$admindir/info/$pkg.symbols")
-    {
+    my ($pkg, $soname, $libfile) = @_;
+    my @files;
+    if ($pkg eq "") {
+	# If the file is not packaged, try to find out the symbols 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 @files, "$pkg_root/DEBIAN/symbols";
+	}
+	# Fallback to other symbols files but it shouldn't be necessary
+	push @files, @pkg_symbols;
+    } else {
+	push @files, "/etc/dpkg/symbols/$pkg.symbols.$host_arch",
+	    "/etc/dpkg/symbols/$pkg.symbols",
+	    "$admindir/info/$pkg.symbols";
+    }
+
+    foreach my $file (@files) {
 	if (-e $file and symfile_has_soname($file, $soname)) {
 	    return $file;
 	}