Selaa lähdekoodia

dpkg-shlibdeps: do not fail if it can't find unversioned libraries

Skip the check on symbols when some libs were not found because one
can not be sure that the symbols was not provided by the missing
library. Also improve the corresponding error message which is
downgraded to a warning for unversioned libraries.
Raphael Hertzog 18 vuotta sitten
vanhempi
commit
45cc1441b3
3 muutettua tiedostoa jossa 30 lisäystä ja 4 poistoa
  1. 8 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 19 4
      scripts/dpkg-shlibdeps.pl

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2007-11-28  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Do not fail if it
+	can't find unversioned libraries, just output a warning.
+	Consequently skip the check on symbols when some libs were not
+	found because one can not be sure that the symbols was not
+	provided by the missing library.
+
 2007-11-28  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/dpkg-shlibdeps.pl (find_packages): Make sure to always

+ 3 - 0
debian/changelog

@@ -6,6 +6,9 @@ dpkg (1.14.12) UNRELEASED; urgency=low
   * Dpkg::Shlibs::find_library() now returns canonicalized paths.
   * dpkg-shlibdeps always tries the realpath() of a lib as fallback when
     trying to identify the package of a lib (and not only for symlinks).
+  * dpkg-shlibdeps doesn't fail any more if it can't find unversioned
+    libraries on the presumption that they are just private libraries. Outputs
+    a warning instead.
 
  -- Guillem Jover <guillem@debian.org>  Sat, 24 Nov 2007 07:38:13 +0200
 

+ 19 - 4
scripts/dpkg-shlibdeps.pl

@@ -97,11 +97,22 @@ foreach my $file (keys %exec) {
     # Load symbols files for all needed libraries (identified by SONAME)
     my %libfiles;
     my %altlibfiles;
+    my %soname_notfound;
     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);
+	unless (defined $lib) {
+	    $soname_notfound{$soname} = 1;
+	    my $msg = _g("couldn't find library %s needed by %s (its RPATH is '%s').\n" .
+			 "Note: libraries are not searched in other binary packages " .
+			 "that do not have any shlibs file.\nTo help dpkg-shlibdeps " .
+			 "find private libraries, you might need to set LD_LIBRARY_PATH.");
+	    if (scalar(split_soname($soname))) {
+		failure($msg, $soname, $file, join(":", @{$obj->{RPATH}}));
+	    } else {
+		warning($msg, $soname, $file, join(":", @{$obj->{RPATH}}));
+	    }
+	    next;
+	}
 	$libfiles{$lib} = $soname;
 	my $reallib = realpath($lib);
 	if ($reallib ne $lib) {
@@ -187,6 +198,9 @@ foreach my $file (keys %exec) {
     my %used_sonames = map { $_ => 0 } @sonames;
     my $nb_warnings = 0;
     my $nb_skipped_warnings = 0;
+    # Disable warnings about missing symbols when we have not been able to
+    # find all libs
+    my $disable_warnings = scalar(keys(%soname_notfound));
     foreach my $sym ($obj->get_undefined_dynamic_symbols()) {
 	my $name = $sym->{name};
 	if ($sym->{version}) {
@@ -214,6 +228,7 @@ foreach my $file (keys %exec) {
 	} else {
 	    my $syminfo = $dumplibs_wo_symfile->locate_symbol($name);
 	    if (not defined($syminfo)) {
+		next if $disable_warnings;
 		# Complain about missing symbols only for executables
 		# and public libraries
 		if ($obj->is_executable() or $obj->is_public_library()) {
@@ -239,7 +254,7 @@ foreach my $file (keys %exec) {
 	    "them all)."), $nb_skipped_warnings) if $nb_skipped_warnings;
     # Warn about un-NEEDED libraries
     foreach my $soname (@sonames) {
-	unless ($used_sonames{$soname}) {
+	unless ($soname_notfound{$soname} or $used_sonames{$soname}) {
 	    warning(_g("%s shouldn't be linked with %s (it uses none of its " .
 	               "symbols)."), $file, $soname);
 	}