diff options
Diffstat (limited to 'scripts/dpkg-shlibdeps.pl')
-rwxr-xr-x | scripts/dpkg-shlibdeps.pl | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 06df8c2cb..625c59991 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -53,7 +53,7 @@ use constant { my @depfields = qw(Suggests Recommends Depends Pre-Depends); my $i = 0; my %depstrength = map { $_ => $i++ } @depfields; -textdomain("dpkg-dev"); +textdomain('dpkg-dev'); my $shlibsoverride = '/etc/dpkg/shlibs.override'; my $shlibsdefault = '/etc/dpkg/shlibs.default'; @@ -70,7 +70,7 @@ my @pkg_dir_to_search = (); my $host_arch = get_host_arch(); my (@pkg_shlibs, @pkg_symbols, @pkg_root_dirs); -if (-d "debian") { +if (-d 'debian') { push @pkg_symbols, glob 'debian/*/DEBIAN/symbols'; push @pkg_shlibs, glob 'debian/*/DEBIAN/shlibs'; my %uniq = map { guess_pkg_root_dir($_) => 1 } (@pkg_symbols, @pkg_shlibs); @@ -135,13 +135,13 @@ foreach (@ARGV) { } } -scalar keys %exec || usageerr(_g("need at least one executable")); +scalar keys %exec || usageerr(_g('need at least one executable')); my $control = Dpkg::Control::Info->new(); my $fields = $control->get_source(); -my $bd_value = deps_concat($fields->{"Build-Depends"}, $fields->{"Build-Depends-Arch"}); +my $bd_value = deps_concat($fields->{'Build-Depends'}, $fields->{'Build-Depends-Arch'}); my $build_deps = deps_parse($bd_value, build_dep => 1, reduce_arch => 1); -error(_("error occurred while parsing %s"), "Build-Depends/Build-Depends-Arch") +error(_('error occurred while parsing %s'), 'Build-Depends/Build-Depends-Arch') unless defined $build_deps; my %dependencies; @@ -182,10 +182,10 @@ foreach my $file (keys %exec) { my $msg = _g("couldn't find library %s needed by %s (ELF " . "format: '%s'; RPATH: '%s')"); if (scalar(split_soname($soname))) { - errormsg($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}})); + errormsg($msg, $soname, $file, $obj->{format}, join(':', @{$obj->{RPATH}})); $error_count++; } else { - warning($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}})); + warning($msg, $soname, $file, $obj->{format}, join(':', @{$obj->{RPATH}})); } next; } @@ -216,7 +216,7 @@ foreach my $file (keys %exec) { # it's because it's in the process of being built # Empty package name will lead to consideration of symbols # file from the package being built only - $file2pkg->{$lib} = [""]; + $file2pkg->{$lib} = ['']; print "No associated package found for $lib\n" if $debug; } @@ -229,7 +229,7 @@ foreach my $file (keys %exec) { { $haslocaldep = 1; } - if ($packagetype eq "deb" and not $haslocaldep) { + if ($packagetype eq 'deb' and not $haslocaldep) { # Use fine-grained dependencies only on real deb # and only if the dependency is not provided by shlibs.local $symfile_path = find_symbols_file($pkg, $soname, $lib); @@ -266,7 +266,7 @@ foreach my $file (keys %exec) { my $libobj = $objdump_cache{$lib}; my $id = $dumplibs_wo_symfile->add_object($libobj); if (($id ne $soname) and ($id ne $lib)) { - warning(_g("%s has an unexpected SONAME (%s)"), $lib, $id); + warning(_g('%s has an unexpected SONAME (%s)'), $lib, $id); $alt_soname{$id} = $soname; } push @soname_wo_symfile, $soname; @@ -287,8 +287,8 @@ foreach my $file (keys %exec) { $ignore++ unless scalar(split_soname($soname)); # 3/ when we have been asked to do so $ignore++ if $ignore_missing_info; - error(_g("no dependency information found for %s " . - "(used by %s)"), $lib, $file) + error(_g('no dependency information found for %s ' . + '(used by %s)'), $lib, $file) unless $ignore; } } @@ -315,19 +315,19 @@ foreach my $file (keys %exec) { my $disable_warnings = scalar(keys(%soname_notfound)); my $in_public_dir = 1; if (my $relname = relative_to_pkg_root($file)) { - my $parent_dir = "/" . dirname($relname); + my $parent_dir = '/' . dirname($relname); $in_public_dir = (grep { $parent_dir eq $_ } @librarypaths) ? 1 : 0; } else { - warning(_g("binaries to analyze should already be " . + warning(_g('binaries to analyze should already be ' . "installed in their package's directory")); } print "Analyzing all undefined symbols\n" if $debug > 1; foreach my $sym ($obj->get_undefined_dynamic_symbols()) { my $name = $sym->{name}; if ($sym->{version}) { - $name .= "\@$sym->{version}"; + $name .= '@' . "$sym->{version}"; } else { - $name .= "\@Base"; + $name .= '@' . 'Base'; } print " Looking up symbol $name\n" if $debug > 1; my %symdep = $symfile->lookup_symbol($name, \@sonames); @@ -361,10 +361,10 @@ foreach my $file (keys %exec) { or (!$in_public_dir and $nb_warnings < 1)) { if ($in_public_dir) { - warning(_g("symbol %s used by %s found in none of the " . - "libraries"), $print_name, $file); + warning(_g('symbol %s used by %s found in none of the ' . + 'libraries'), $print_name, $file); } else { - warning(_g("%s contains an unresolvable reference to " . + warning(_g('%s contains an unresolvable reference to ' . "symbol %s: it's probably a plugin"), $file, $print_name); } @@ -386,9 +386,9 @@ foreach my $file (keys %exec) { } } } - warning(P_("%d similar warning has been skipped (use -v to see it)", - "%d other similar warnings have been skipped (use -v to see " . - "them all)", $nb_skipped_warnings), $nb_skipped_warnings) + warning(P_('%d similar warning has been skipped (use -v to see it)', + '%d other similar warnings have been skipped (use -v to see ' . + 'them all)', $nb_skipped_warnings), $nb_skipped_warnings) if $nb_skipped_warnings; foreach my $soname (@sonames) { # Adjust minimal version of dependencies with information @@ -413,7 +413,7 @@ foreach my $file (keys %exec) { next if ($soname =~ /^libm\.so\.\d+$/ and scalar grep(/^libstdc\+\+\.so\.\d+/, @sonames)); next unless ($warnings & WARN_NOT_NEEDED); - warning(_g("%s should not be linked against %s (it uses none of " . + warning(_g('%s should not be linked against %s (it uses none of ' . "the library's symbols)"), $file, $soname); } } @@ -426,22 +426,22 @@ foreach my $soname (keys %global_soname_needed) { next if ($soname =~ /^libm\.so\.\d+$/ and scalar( grep(/^libstdc\+\+\.so\.\d+/, keys %global_soname_needed))); next unless ($warnings & WARN_DEP_AVOIDABLE); - warning(P_("package could avoid a useless dependency if %s was not " . + warning(P_('package could avoid a useless dependency if %s was not ' . "linked against %s (it uses none of the library's symbols)", - "package could avoid a useless dependency if %s were not " . + 'package could avoid a useless dependency if %s were not ' . "linked against %s (they use none of the library's symbols)", scalar @{$global_soname_needed{$soname}}), - join(" ", @{$global_soname_needed{$soname}}), $soname); + join(' ', @{$global_soname_needed{$soname}}), $soname); } } # Quit now if any missing libraries if ($error_count >= 1) { - my $note = _g("Note: libraries are not searched in other binary packages " . + my $note = _g('Note: libraries are not searched in other binary packages ' . "that do not have any shlibs or symbols file.\nTo help dpkg-shlibdeps " . - "find private libraries, you might need to set LD_LIBRARY_PATH."); - error(P_("cannot continue due to the error above", - "cannot continue due to the errors listed above", + 'find private libraries, you might need to set LD_LIBRARY_PATH.'); + error(P_('cannot continue due to the error above', + 'cannot continue due to the errors listed above', $error_count) . "\n" . $note); } @@ -450,10 +450,10 @@ my $fh; if ($stdout) { $fh = \*STDOUT; } else { - open(my $new_fh, ">", "$varlistfile.new") || + open(my $new_fh, '>', "$varlistfile.new") || syserr(_g("open new substvars file \`%s'"), "$varlistfile.new"); if (-e $varlistfile) { - open(my $old_fh, "<", $varlistfile) || + open(my $old_fh, '<', $varlistfile) || syserr(_g("open old varlist file \`%s' for reading"), $varlistfile); foreach my $entry (grep { not m/^\Q$varnameprefix\E:/ } (<$old_fh>)) { print($new_fh $entry) || @@ -504,9 +504,9 @@ sub filter_deps { } foreach my $field (reverse @depfields) { - my $dep = ""; + 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}{$_}) { @@ -521,7 +521,7 @@ foreach my $field (reverse @depfields) { } if ($dep) { my $obj = deps_parse($dep); - error(_g("invalid dependency got generated: %s"), $dep) unless defined $obj; + error(_g('invalid dependency got generated: %s'), $dep) unless defined $obj; $obj->sort(); print $fh "$varnameprefix:$field=$obj\n"; } @@ -529,7 +529,7 @@ foreach my $field (reverse @depfields) { # Replace old file by new one if (!$stdout) { - close($fh) || syserr(_g("cannot close %s"), "$varlistfile.new"); + close($fh) || syserr(_g('cannot close %s'), "$varlistfile.new"); rename("$varlistfile.new",$varlistfile) || syserr(_g("install new varlist file \`%s'"), $varlistfile); } @@ -541,15 +541,15 @@ if (!$stdout) { sub version { printf _g("Debian %s version %s.\n"), $progname, $version; - printf _g(" + printf _g(' This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. -"); +'); } sub usage { printf _g( -"Usage: %s [<option>...] <executable>|-e<executable> [<option>...]") +'Usage: %s [<option>...] <executable>|-e<executable> [<option>...]') . "\n\n" . _g( "Positional options (order is significant): <executable> include dependencies for <executable>, @@ -572,9 +572,9 @@ sub usage { -?, --help show this help message. --version show the version.") . "\n\n" . _g( -"Dependency fields recognized are: +'Dependency fields recognized are: %s -"), $progname, join("/",@depfields); +'), $progname, join('/', @depfields); } sub get_min_version_from_deps { @@ -628,7 +628,7 @@ sub update_dependency_version { sub add_shlibs_dep { my ($soname, $pkg, $libfile) = @_; my @shlibs = ($shlibslocal, $shlibsoverride); - if ($pkg eq "") { + if ($pkg eq '') { # If the file is not packaged, try to find out the shlibs file in # the package being built where the lib has been found my $pkg_root = guess_pkg_root_dir($libfile); @@ -638,7 +638,7 @@ sub add_shlibs_dep { # Fallback to other shlibs files but it shouldn't be necessary push @shlibs, @pkg_shlibs; } else { - my $control_file = get_control_path($pkg, "shlibs"); + my $control_file = get_control_path($pkg, 'shlibs'); push @shlibs, $control_file if defined $control_file; } push @shlibs, $shlibsdefault; @@ -682,7 +682,7 @@ sub extract_from_shlibs { } # Open shlibs file $shlibfile = "./$shlibfile" if $shlibfile =~ m/^\s/; - open(my $shlibs_fh, "<", $shlibfile) || + open(my $shlibs_fh, '<', $shlibfile) || syserr(_g("unable to open shared libs info file \`%s'"), $shlibfile); my $dep; while (<$shlibs_fh>) { @@ -716,7 +716,7 @@ sub extract_from_shlibs { sub find_symbols_file { my ($pkg, $soname, $libfile) = @_; my @files; - if ($pkg eq "") { + if ($pkg eq '') { # If the file is not packaged, try to find out the symbols file in # the package being built where the lib has been found my $pkg_root = guess_pkg_root_dir($libfile); @@ -728,7 +728,7 @@ sub find_symbols_file { } else { push @files, "/etc/dpkg/symbols/$pkg.symbols.$host_arch", "/etc/dpkg/symbols/$pkg.symbols"; - my $control_file = get_control_path($pkg, "symbols"); + my $control_file = get_control_path($pkg, 'symbols'); push @files, $control_file if defined $control_file; } @@ -747,8 +747,8 @@ sub symfile_has_soname { return $symfile_has_soname_cache{$file}{$soname}; } - open(my $symfile_fh, "<", $file) || - syserr(_g("cannot open file %s"), $file); + open(my $symfile_fh, '<', $file) || + syserr(_g('cannot open file %s'), $file); my $result = 0; while (<$symfile_fh>) { if (/^\Q$soname\E /) { @@ -782,8 +782,8 @@ sub my_find_library { $path =~ s/\$ORIGIN/$origin/g; $path =~ s/\$\{ORIGIN\}/$origin/g; } else { - warning(_g("\$ORIGIN is used in RPATH of %s and the corresponding " . - "directory could not be identified due to lack of DEBIAN " . + warning(_g('$ORIGIN is used in RPATH of %s and the corresponding ' . + 'directory could not be identified due to lack of DEBIAN ' . "sub-directory in the root of package's build tree"), $execfile); } } @@ -811,7 +811,7 @@ sub my_find_library { # Fallback in the root directory if we have not found what we were # looking for in the packages - $file = find_library($lib, \@RPATH, $format, ""); + $file = find_library($lib, \@RPATH, $format, ''); return $file if defined($file); return; @@ -828,28 +828,28 @@ sub find_packages { $pkgmatch->{$_} = $cached_pkgmatch{$_}; } else { push @files, $_; - $cached_pkgmatch{$_} = [""]; # placeholder to cache misses too. - $pkgmatch->{$_} = [""]; # might be replaced later on + $cached_pkgmatch{$_} = ['']; # placeholder to cache misses too. + $pkgmatch->{$_} = ['']; # might be replaced later on } } return $pkgmatch unless scalar(@files); - my $pid = open(my $dpkg_fh, "-|"); - syserr(_g("cannot fork for %s"), "dpkg --search") unless defined($pid); + my $pid = open(my $dpkg_fh, '-|'); + syserr(_g('cannot fork for %s'), 'dpkg --search') unless defined($pid); if (!$pid) { # Child process running dpkg --search and discarding errors close STDERR; - open STDERR, ">", "/dev/null"; - $ENV{LC_ALL} = "C"; - exec("dpkg", "--search", "--", @files) - || syserr(_g("unable to execute %s"), "dpkg"); + open STDERR, '>', '/dev/null'; + $ENV{LC_ALL} = 'C'; + exec('dpkg', '--search', '--', @files) + || syserr(_g('unable to execute %s'), 'dpkg'); } while (defined($_ = <$dpkg_fh>)) { chomp($_); if (m/^local diversion |^diversion by/) { - warning(_g("diversions involved - output may be incorrect")); + warning(_g('diversions involved - output may be incorrect')); print(STDERR " $_\n") - || syserr(_g("write diversion info to stderr")); + || syserr(_g('write diversion info to stderr')); } elsif (m/^([-a-z0-9+.:, ]+): (\/.*)$/) { $cached_pkgmatch{$2} = $pkgmatch->{$2} = [ split(/, /, $1) ]; } else { |