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

dpkg-shlibdeps: some accuracy improvements for warnings about unused libraries

* scripts/dpkg-shlibdeps.pl: Handle better the case when the
library found has a different soname than the one used to look up
the library file. Properly affect symbols coming from it to the
soname wanted by the binary, thus avoiding invalid warnings about
unused library.
Raphael Hertzog лет назад: 18
Родитель
Сommit
25546527aa
3 измененных файлов с 19 добавлено и 0 удалено
  1. 8 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 9 0
      scripts/dpkg-shlibdeps.pl

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2008-02-03  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Handle better the case when the
+	library found has a different soname than the one used to look up
+	the library file. Properly affect symbols coming from it to the
+	soname wanted by the binary, thus avoiding invalid warnings about
+	unused library.
+
 2008-01-31  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/dpkg-genchanges.pl: Always list all binary packages in

+ 2 - 0
debian/changelog

@@ -27,6 +27,8 @@ dpkg (1.14.17) UNRELEASED; urgency=low
     files. It's nice for reviewers and mentors.debian.net was using this field
     on source only uploads to display short description of what the package is
     about.
+  * Handle the case when the library has a different SONAME than the one used
+    to find it. Closes: #462413
 
   [ Frank Lichtenheld ]
   * Add a warning in dpkg-buildpackage if the build-dependencies are not

+ 9 - 0
scripts/dpkg-shlibdeps.pl

@@ -125,6 +125,7 @@ foreach my $file (keys %exec) {
     my %libfiles;
     my %altlibfiles;
     my %soname_notfound;
+    my %alt_soname;
     foreach my $soname (@sonames) {
 	my $lib = my_find_library($soname, $obj->{RPATH}, $obj->{format}, $file);
 	unless (defined $lib) {
@@ -194,6 +195,10 @@ foreach my $file (keys %exec) {
 	    } else {
 		# No symbol file found, fall back to standard shlibs
 		my $id = $dumplibs_wo_symfile->parse($lib);
+		if ($id ne $soname) {
+		    warning(_g("%s has an unexpected SONAME (%s)"), $lib, $id);
+		    $alt_soname{$id} = $soname;
+		}
 		push @soname_wo_symfile, $soname;
 		my $libobj = $dumplibs_wo_symfile->get_object($id);
 		# Only try to generate a dependency for libraries with a SONAME
@@ -262,6 +267,10 @@ foreach my $file (keys %exec) {
 		    }
 		}
 	    } else {
+		if (exists $alt_soname{$syminfo->{soname}}) {
+		    # Also count usage on alternate soname
+		    $used_sonames{$alt_soname{$syminfo->{soname}}}++;
+		}
 		$used_sonames{$syminfo->{soname}}++;
 	    }
 	}