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

* scripts/dpkg-shlibdeps: start using objdump as opposed to ldd, this
works much more cleanly, works with libc5, and allows from better
error reporting. Also corrected checks on shlibs.local, which wasn't
really being parsed, it now works as advertised.
* scripts/{dpkg-gencontrol,dpkg-source,controllib.pl}: fixed references
to old style build dep fields to match current policy ammendment

Ben Collins лет назад: 27
Родитель
Сommit
602b165ef4
6 измененных файлов с 86 добавлено и 35 удалено
  1. 9 0
      ChangeLog
  2. 5 1
      debian/changelog
  3. 2 2
      scripts/controllib.pl
  4. 1 1
      scripts/dpkg-gencontrol.pl
  5. 68 30
      scripts/dpkg-shlibdeps.pl
  6. 1 1
      scripts/dpkg-source.pl

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+Mon Oct 25 11:55:35 EDT 1999 Ben Collins <bcollins.debian.org>
+
+  * scripts/dpkg-shlibdeps: start using objdump as opposed to ldd, this
+    works much more cleanly, works with libc5, and allows from better
+    error reporting. Also corrected checks on shlibs.local, which wasn't
+    really being parsed, it now works as advertised.
+  * scripts/{dpkg-gencontrol,dpkg-source,controllib.pl}: fixed references
+    to old style build dep fields to match current policy ammendment
+
 Mon Oct 25 17:12:34 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
 
   * gettextize dselect

+ 5 - 1
debian/changelog

@@ -32,7 +32,11 @@ dpkg (1.4.1.19) unstable; urgency=low
     package that contains the generated output from this file (.ps, .html
     and .info), includes doc-base support. Internals.sgml is also not
     generated on the binary-arch target, and is no longer "byhand"
- 
+  * scripts/dpkg-shlibdeps: start using objdump as opposed to ldd, this
+    works much more cleanly, works with libc5, and allows from better
+    error reporting. Also corrected checks on shlibs.local, which wasn't
+    really being parsed, it now works as advertised.
+
  -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
 
 dpkg (1.4.1.18) unstable; urgency=low

+ 2 - 2
scripts/controllib.pl

@@ -2,8 +2,8 @@
 $parsechangelog= 'dpkg-parsechangelog';
 
 grep($capit{lc $_}=$_, qw(Pre-Depends Standards-Version Installed-Size
-			  Build-Depends Build-Indep-Depends
-			  Build-Conflicts Build-Indep-Conflicts));
+			  Build-Depends Build-Depends-Indep
+			  Build-Conflicts Build-Conflicts-Indep));
 
 
 $substvar{'Format'}= 1.6;

+ 1 - 1
scripts/dpkg-gencontrol.pl

@@ -46,7 +46,7 @@ $i=100;grep($fieldimps{$_}=$i--,
           qw(Package Version Section Priority Architecture Essential
              Pre-Depends Depends Recommends Suggests Optional Conflicts Replaces
              Provides Installed-Size Maintainer Source Description Build-Depends
-             Build-Indep-Depends  Build-Conflicts Build-Indep-Conflicts));
+             Build-DependsIndep  Build-Conflicts Build-Conflicts-Indep));
 
 while (@ARGV) {
     $_=shift(@ARGV);

+ 68 - 30
scripts/dpkg-shlibdeps.pl

@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 $dpkglibdir= ".";
-$version= '1.3.7'; # This line modified by Makefile
+$version= '1.3.8'; # This line modified by Makefile
 
 use POSIX;
 use POSIX qw(:errno_h :signal_h);
@@ -88,44 +88,83 @@ sub isbin {
 
 for ($i=0;$i<=$#exec;$i++) {
     if (!isbin ($exec[$i])) { next; }
-    defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
-    if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
-    $nthisldd=0;
+    defined($c= open(P,"-|")) || syserr("cannot fork for objdump");
+    if (!$c) { exec("objdump","-p","--",$exec[$i]); syserr("cannot exec objdump"); }
     while (<P>) {
-    	chomp;
-	if (m,^\s+(\S+)\s+\=\>\s+\1$,) {
-	    # shared libraries depend on themselves (unsure why)
-	    # Only under old ld.so
-	    $nthisldd++;
-	} elsif (m,\s+statically linked(\s+\(ELF\))?$,) {
-	    $nthisldd++;
-	} elsif (m,^\s+(\S+)\.so\.(\S+)\s+=>\s+(/\S+)(\s+\(0x.+\))?$,) {
-	    push(@libname,$1); push(@libsoname,$2); push(@libpath,$3);
+	chomp;
+	if (m,^\s*NEEDED\s+(\S+)\.so\.(\S+)$,) {
+	    push(@libname,$1); push(@libsoname,$2);
 	    push(@libf,$execf[$i]);
-	    push(@libpaths,$3) if !$libpathadded{$3}++;
-	    $nthisldd++;
-	} else {
-	    &warn("unknown output from ldd on \`$exec[$i]': \`$_'");
+	    push(@libfiles,"$1.so.$2");
 	}
     }
-    close(P); $? && subprocerr("ldd on \`$exec[$i]'");
-    $nthisldd || &warn("ldd on \`$exec[$i]' gave nothing on standard output");
+    close(P); $? && subprocerr("objdump on \`$exec[$i]'");
 }
 
-if ($#libpaths >= 0) {
-    grep(s/\[\?\*/\\$&/g, @libpaths);
+# Now: See if it is in this package.  See if it is in any other package.
+sub searchdir {
+    my $dir = shift;
+    if(opendir(DIR, $dir)) {
+	my @dirents = readdir(DIR);
+	closedir(DIR);
+	for (@dirents) {
+	    if ( -f "$dir/$_/DEBIAN/shlibs" ) {
+		push(@curshlibs, "$dir/$_/DEBIAN/shlibs");
+		next;
+	    } elsif ( $_ !~ /^\./ && -d "$dir/$_" ) {
+		&searchdir("$dir/$_");
+	    }
+	}
+    }
+}
+
+$searchdir = $exec[0];
+$curpackdir = "debian/tmp";
+do { $searchdir =~ s,/[^/]*$,,; } while($searchdir =~ m,/, && ! -d "$searchdir/DEBIAN");
+if ($searchdir =~ m,/,) {
+    $curpackdir = $searchdir;
+    $searchdir =~ s,/[^/]*,,;
+    &searchdir($searchdir);
+}
+
+if ($#curshlibs >= 0) {
+    PRELIB: for ($i=0;$i<=$#libname;$i++) {
+	for my $shlibsfile (@curshlibs) {
+	    if(scanshlibsfile($shlibsfile, $libname[$i], $libsoname[$i], $libf[$i])) {
+		splice(@libname, $i, 1);
+		splice(@libsoname, $i, 1);
+		splice(@libf, $i, 1);
+		splice(@libfiles, $i, 1);
+		$i--;
+		next PRELIB;
+	    }
+	}
+	if(scanshlibsfile($shlibsdefault,$libname[$i],$libsoname[$i],$libf[$i])
+	    || scanshlibsfile($shlibsoverride,$libname[$i],$libsoname[$i],$libf[$i])) {
+	    splice(@libname, $i, 1);
+	    splice(@libsoname, $i, 1);
+	    splice(@libf, $i, 1);
+	    splice(@libfiles, $i, 1);
+	    $i--;
+	    next PRELIB;
+	}
+    }
+}
+
+if ($#libfiles >= 0) {
+    grep(s/\[\?\*/\\$&/g, @libname);
     defined($c= open(P,"-|")) || syserr("cannot fork for dpkg --search");
     if (!$c) {
         close STDERR; # we don't need to see dpkg's errors
 	open STDERR, "> /dev/null";
-        exec("dpkg","--search","--",@libpaths); syserr("cannot exec dpkg");
+        exec("dpkg","--search","--",map {"*/$_"} @libfiles); syserr("cannot exec dpkg");
     }
     while (<P>) {
        chomp;
        if (m/^local diversion |^diversion by/) {
            &warn("diversions involved - output may be incorrect");
            print(STDERR " $_\n") || syserr("write diversion info to stderr");
-       } elsif (m=^(\S+(, \S+)*): (/.+)$=) {
+       } elsif (m=^(\S+(, \S+)*): /.+/([^/]+)$=) {
            $pathpackages{$+}= $1;
        } else {
            &warn("unknown output from dpkg --search: \`$_'");
@@ -135,22 +174,20 @@ if ($#libpaths >= 0) {
 }
 
 LIB: for ($i=0;$i<=$#libname;$i++) {
-    scanshlibsfile($shlibslocal,$libname[$i],$libsoname[$i],$libf[$i]) && next;
-    scanshlibsfile($shlibsoverride,$libname[$i],$libsoname[$i],$libf[$i]) && next;
-    if (!defined($pathpackages{$libpath[$i]})) {
-        &warn("could not find any packages for $libpath[$i]".
+    if (!defined($pathpackages{$libfiles[$i]})) {
+        &warn("could not find any packages for $libfiles[$i]".
               " ($libname[$i].so.$libsoname[$i])");
     } else {
-        @packages= split(/, /,$pathpackages{$libpath[$i]});
+        @packages= split(/, /,$pathpackages{$libfiles[$i]});
         for $p (@packages) {
             scanshlibsfile("$shlibsppdir/$p$shlibsppext",
                            $libname[$i],$libsoname[$i],$libf[$i])
                 && next LIB;
         }
     }
-    scanshlibsfile($shlibsdefault,$libname[$i],$libsoname[$i],$libf[$i]) && next;
+    scanshlibsfile($shlibslocal,$libname[$i],$libsoname[$i],$libf[$i]) && next;
     &warn("unable to find dependency information for ".
-          "shared library $libname[$i] (soname $libsoname[$i], path $libpath[$i], ".
+          "shared library $libname[$i] (soname $libsoname[$i], path $libfiles[$i], ".
           "dependency field $libf[$i])");
 }
 
@@ -171,6 +208,7 @@ sub scanshlibsfile {
             next;
         }
         next if $1 ne $ln || $2 ne $lsn;
+        return 1 if $fn eq "debian/$curpackdir/DEBIAN/shlibs";
         $da= $';
         for $dv (split(/,/,$da)) {
             $dv =~ s/^\s+//; $dv =~ s/\s+$//;

+ 1 - 1
scripts/dpkg-source.pl

@@ -59,7 +59,7 @@ General options: -h                  print this message
 $i = 100;
 grep ($fieldimps {$_} = $i--,
       qw (Source Version Binary Maintainer Architecture Standards-Version
-          Build-Depends Build-Indep-Depends Build-Conflicts Build-Indep-Conflicts));
+          Build-Depends Build-Depends-Indep Build-Conflicts Build-Conflicts-Indep));
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_=shift(@ARGV);