From 602b165ef418fa1dd6031ff33b6e6e47e801e581 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Mon, 25 Oct 1999 16:26:42 +0000 Subject: [PATCH] * 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 --- ChangeLog | 9 ++++ debian/changelog | 6 ++- scripts/controllib.pl | 4 +- scripts/dpkg-gencontrol.pl | 2 +- scripts/dpkg-shlibdeps.pl | 98 ++++++++++++++++++++++++++------------ scripts/dpkg-source.pl | 2 +- 6 files changed, 86 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19dffc39..faf30512 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Oct 25 11:55:35 EDT 1999 Ben Collins + + * 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 * gettextize dselect diff --git a/debian/changelog b/debian/changelog index 6d1de825..817e7d25 100644 --- a/debian/changelog +++ b/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 UNRELEASED dpkg (1.4.1.18) unstable; urgency=low diff --git a/scripts/controllib.pl b/scripts/controllib.pl index 40e1552a..6f9cedd1 100755 --- a/scripts/controllib.pl +++ b/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; diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index a0693608..b7b086c4 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/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); diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 76bf66b5..ded32460 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/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 (

) { - 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 (

) { 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+$//; diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 3d76548b..e15e9d79 100755 --- a/scripts/dpkg-source.pl +++ b/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); -- 2.39.5