our $dpkglibdir;
BEGIN {
$version="1.14.4"; # This line modified by Makefile
- $dpkglibdir="/usr/lib/dpkg"; # This line modified by Makefile
+ $dpkglibdir="."; # This line modified by Makefile
push(@INC,$dpkglibdir);
}
require 'controllib.pl';
while (@ARGV) {
$_=shift(@ARGV);
if (m/^-p([-+0-9a-z.]+)$/) {
- $oppackage= $1;
+ $oppackage= $1;
} elsif (m/^-c(\d)?$/) {
$compare = defined($1) ? $1 : 1;
} elsif (m/^-d$/) {
push @files, glob($file);
}
} elsif (m/^-p(.*)/) {
- &error(sprintf(_g("Illegal package name \`%s'"), $1));
+ &error(sprintf(_g("Illegal package name \`%s'"), $1));
} elsif (m/^-P(.*)$/) {
- $packagebuilddir = $1;
- $packagebuilddir =~ s{/+$}{};
+ $packagebuilddir = $1;
+ $packagebuilddir =~ s{/+$}{};
} elsif (m/^-O$/) {
- $stdout= 1;
+ $stdout= 1;
} elsif (m/^-O(.+)$/) {
- $output= $1;
+ $output= $1;
} elsif (m/^-(h|-help)$/) {
- &usage; exit(0);
+ &usage; exit(0);
} elsif (m/^--version$/) {
- &version; exit(0);
+ &version; exit(0);
} else {
- &usageerr(sprintf(_g("unknown option \`%s'"), $_));
+ &usageerr(sprintf(_g("unknown option \`%s'"), $_));
}
}
parsecontrolfile($controlfile);
my @packages = grep(m/^C /, keys %p2i);
@packages==1 ||
- &error(sprintf(_g("must specify package since control info has many (%s)"), "@packages"));
+ &error(sprintf(_g("must specify package since control info has many (%s)"), "@packages"));
$oppackage = $packages[0];
$oppackage =~ s/^C //;
}
my $libdir = "$packagebuilddir$path";
$libdir =~ s{/+}{/}g;
next if not -d $libdir;
- opendir(DIR, "$libdir") ||
+ opendir(DIR, "$libdir") ||
syserr(sprintf(_g("Can't read directory %s: %s"), $libdir, $!));
push @files, grep {
/(\.so\.|\.so$)/ &&
if ($compare) {
use File::Temp;
use Digest::MD5;
- # Compare
+ # Compare
if ($symfile->has_new_libs($ref_symfile)) {
warning(_g("new libraries appeared in the symbols file."));
$exitcode = 4 if ($compare >= 4);
$md5_after->addfile($after);
if ($md5_before->hexdigest() ne $md5_after->hexdigest()) {
if (defined($ref_symfile->{file})) {
- warning(sprintf(_g("%s doesn't match completely %s\n"),
+ warning(sprintf(_g("%s doesn't match completely %s\n"),
$output, $ref_symfile->{file}));
} else {
warning(sprintf(_g("no debian/symbols file used as basis for generating %s\n"), $output));
our $host_arch= `dpkg-architecture -qDEB_HOST_ARCH`;
chomp $host_arch;
-my @depfields= qw(Suggests Recommends Depends Pre-Depends); # By increasing importance
+# By increasing importance
+my @depfields= qw(Suggests Recommends Depends Pre-Depends);
my $i=0; my %depstrength = map { $_ => $i++ } @depfields;
require 'controllib.pl';
my (@pkg_shlibs, @pkg_symbols);
if (-d "debian") {
find sub {
- push @pkg_shlibs, $File::Find::name if ($File::Find::name =~ m{/DEBIAN/shlibs$});
- push @pkg_symbols, $File::Find::name if ($File::Find::name =~ m{/DEBIAN/symbols$});
+ push @pkg_shlibs, $File::Find::name
+ if ($File::Find::name =~ m{/DEBIAN/shlibs$});
+ push @pkg_symbols, $File::Find::name
+ if ($File::Find::name =~ m{/DEBIAN/symbols$});
}, "debian";
}
my ($stdout, %exec);
foreach (@ARGV) {
if (m/^-T(.*)$/) {
- $varlistfile= $1;
+ $varlistfile= $1;
} elsif (m/^-p(\w[-:0-9A-Za-z]*)$/) {
- $varnameprefix= $1;
+ $varnameprefix= $1;
} elsif (m/^-L(.*)$/) {
- $shlibslocal= $1;
+ $shlibslocal= $1;
} elsif (m/^-O$/) {
- $stdout= 1;
+ $stdout= 1;
} elsif (m/^-(h|-help)$/) {
- usage(); exit(0);
+ usage(); exit(0);
} elsif (m/^--version$/) {
- version(); exit(0);
+ version(); exit(0);
} elsif (m/^--admindir=(.*)$/) {
- $admindir = $1;
- -d $admindir ||
- error(sprintf(_g("administrative directory '%s' does not exist"),
- $admindir));
+ $admindir = $1;
+ -d $admindir ||
+ error(sprintf(_g("administrative directory '%s' does not exist"),
+ $admindir));
} elsif (m/^-d(.*)$/) {
- $dependencyfield= capit($1);
- defined($depstrength{$dependencyfield}) ||
- warning(sprintf(_g("unrecognised dependency field \`%s'"), $dependencyfield));
+ $dependencyfield= capit($1);
+ defined($depstrength{$dependencyfield}) ||
+ warning(sprintf(_g("unrecognised dependency field \`%s'"), $dependencyfield));
} elsif (m/^-e(.*)$/) {
$exec{$1} = $dependencyfield;
} elsif (m/^-t(.*)$/) {
- $packagetype = $1;
+ $packagetype = $1;
} elsif (m/-v$/) {
$debug = 1;
} elsif (m/^-/) {
- usageerr(sprintf(_g("unknown option \`%s'"), $_));
+ usageerr(sprintf(_g("unknown option \`%s'"), $_));
} else {
$exec{$_} = $dependencyfield;
}
$used_sonames{$symdep->{soname}}++;
foreach my $subdep (split /\s*,\s*/, $d) {
if (exists $dependencies{$cur_field}{$subdep} and
- defined($dependencies{$cur_field}{$subdep}))
+ defined($dependencies{$cur_field}{$subdep}))
{
- if ($dependencies{$cur_field}{$subdep} eq '' or
+ if ($dependencies{$cur_field}{$subdep} eq '' or
vercmp($m, $dependencies{$cur_field}{$subdep}) > 0)
{
$dependencies{$cur_field}{$subdep} = $m;
my $syminfo = $dumplibs_wo_symfile->locate_symbol($name);
if (not defined($syminfo)) {
my $print_name = $name;
- $print_name =~ s/\@Base$//; # Drop the default suffix for readability
+ # Drop the default suffix for readability
+ $print_name =~ s/\@Base$//;
warning(sprintf(
- _g("symbol %s used by %s found in none of the libraries."),
+ _g("symbol %s used by %s found in none of the libraries."),
$print_name, $file)) unless $sym->{weak};
} else {
$used_sonames{$syminfo->{soname}}++;
$fh = \*STDOUT;
} else {
open(NEW, ">", "$varlistfile.new") ||
- syserr(sprintf(_g("open new substvars file \`%s'"), "$varlistfile.new"));
+ syserr(sprintf(_g("open new substvars file \`%s'"), "$varlistfile.new"));
if (-e $varlistfile) {
- open(OLD, "<", $varlistfile) ||
+ open(OLD, "<", $varlistfile) ||
syserr(sprintf(_g("open old varlist file \`%s' for reading"), $varlistfile));
- foreach my $entry (grep { not /^\Q$varnameprefix\E:/ } (<OLD>)) {
+ foreach my $entry (grep { not m/^\Q$varnameprefix\E:/ } (<OLD>)) {
print(NEW $entry) ||
syserr(sprintf(_g("copy old entry to new varlist file \`%s'"), "$varlistfile.new"));
}
}
$fh = \*NEW;
-}
+}
-# Write out the shlibs substvars
+# Write out the shlibs substvars
my %depseen;
foreach my $field (reverse @depfields) {
my $dep = "";
if (exists $dependencies{$field} and scalar keys %{$dependencies{$field}}) {
- $dep = join ", ",
+ $dep = join ", ",
map {
# Translate dependency templates into real dependencies
if ($dependencies{$field}{$_}) {
}
s/\s+/ /g;
$_;
- } grep {
+ } grep {
# Don't include dependencies if they are already
# mentionned in a higher priority field
if (not defined($depseen{$_})) {
$depseen{$_} = $dependencies{$field}{$_};
1;
} else {
- # Since dependencies can be versionned, we have to
+ # Since dependencies can be versionned, we have to
# verify if the dependency is stronger than the
# previously seen one
if (vercmp($depseen{$_}, $dependencies{$field}{$_}) > 0) {
if (!$stdout) {
close($fh);
rename("$varlistfile.new",$varlistfile) ||
- syserr(sprintf(_g("install new varlist file \`%s'"), $varlistfile));
+ syserr(sprintf(_g("install new varlist file \`%s'"), $varlistfile));
}
##
sub add_shlibs_dep {
my ($soname, $pkg) = @_;
foreach my $file ($shlibslocal, $shlibsoverride, @pkg_shlibs,
- "$admindir/info/$pkg.shlibs")
+ "$admindir/info/$pkg.shlibs")
{
next if not -e $file;
my $dep = extract_from_shlibs($soname, $file);
}
# Open shlibs file
$shlibfile = "./$shlibfile" if $shlibfile =~ m/^\s/;
- open(SHLIBS, "<", $shlibfile) || syserr(sprintf(_g("unable to open shared libs info file \`%s'"), $shlibfile));
+ open(SHLIBS, "<", $shlibfile)
+ || syserr(sprintf(_g("unable to open shared libs info file \`%s'"), $shlibfile));
my $dep;
while (<SHLIBS>) {
- s/\s*\n$//; next if m/^\#/;
- if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)\s+(\S.*\S)\s*$/) {
- warning(sprintf(_g("shared libs info file \`%s' line %d: bad line \`%s'"), $shlibfile, $., $_));
- next;
- }
+ s/\s*\n$//;
+ next if m/^\#/;
+ if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)\s+(\S.*\S)\s*$/) {
+ warning(sprintf(_g("shared libs info file \`%s' line %d: bad line \`%s'"), $shlibfile, $., $_));
+ next;
+ }
my $type = defined($1) ? $1 : "deb";
next if $type ne $packagetype;
if (($libname eq $2) && ($libversion eq $3)) {
foreach my $file (@pkg_symbols,
"/etc/dpkg/symbols/$pkg.symbols.$host_arch",
"/etc/dpkg/symbols/$pkg.symbols",
- "$admindir/info/$pkg.symbols")
+ "$admindir/info/$pkg.symbols")
{
if (-e $file and symfile_has_soname($file, $soname)) {
return $file;
close STDERR;
open STDERR, ">", "/dev/null";
$ENV{LC_ALL} = "C";
- exec("dpkg", "--search", "--", @files) or syserr(_g("cannot exec dpkg"));;
+ exec("dpkg", "--search", "--", @files)
+ || syserr(_g("cannot exec dpkg"));
}
while(defined($_ = <DPKG>)) {
chomp($_);
if (m/^local diversion |^diversion by/) {
warning(_g("diversions involved - output may be incorrect"));
- print(STDERR " $_\n") || syserr(_g("write diversion info to stderr"));
+ print(STDERR " $_\n")
+ || syserr(_g("write diversion info to stderr"));
} elsif (m/^([^:]+): (\S+)$/) {
$pkgmatch->{$2} = [ split(/, /, $1) ];
} else {