From 3f179bf13081f9dde0535a17864ceeba685ab907 Mon Sep 17 00:00:00 2001
From: Tom Anderson <[email protected]>
Date: Wed, 8 Jan 2020 12:11:56 -0800
Subject: [PATCH 2/2] Fix compatibility for Chromium
* Add debug() and g_() functions in case the system dpkg doesn't have it.
* Implement List::Util::any and List::Util::none for older versions of perl.
---
scripts/dpkg-shlibdeps.pl | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index e3d8c7200..654dfa898 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -21,11 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-use strict;
use warnings;
use feature qw(state);
-use List::Util qw(any none);
+use List::Util qw(reduce);
use Cwd qw(realpath);
use File::Basename qw(dirname);
@@ -51,6 +50,11 @@ use constant {
WARN_NOT_NEEDED => 4,
};
+sub none (&@) { my $code=shift; reduce { $a && !$code->(local $_ = $b) } 1, @_; }
+sub any (&@) { my $code=shift; reduce { $a || $code->(local $_ = $b) } 0, @_; }
+
+sub g_ { return shift; }
+
# By increasing importance
my @depfields = qw(Suggests Recommends Depends Pre-Depends);
my $i = 0; my %depstrength = map { $_ => $i++ } @depfields;
@@ -153,6 +157,11 @@ sub ignore_pkgdir {
return any { $path =~ /^\Q$_\E/ } @pkg_dir_to_ignore;
}
+sub debug {
+ my $level = shift;
+ print @_ if $level <= $debug;
+}
+
if (-d 'debian') {
push @pkg_symbols, grep { !ignore_pkgdir($_) } glob 'debian/*/DEBIAN/symbols';
push @pkg_shlibs, grep { !ignore_pkgdir($_) } glob 'debian/*/DEBIAN/shlibs';
@@ -198,18 +207,17 @@ foreach my $file (keys %exec) {
my %soname_notfound;
my %alt_soname;
foreach my $soname (@sonames) {
- my @libs = my_find_library($soname, $obj->{RPATH}, $obj->{exec_abi}, $file);
+ my @libs = my_find_library($soname, $obj->{RPATH}, $obj->{exec_abi} || $obj->{format}, $file);
unless (scalar @libs) {
$soname_notfound{$soname} = 1;
$global_soname_notfound{$soname} = 1;
my $msg = g_('cannot find library %s needed by %s (ELF ' .
"format: '%s' abi: '%s'; RPATH: '%s')");
- my $exec_abi = unpack 'H*', $obj->{exec_abi};
if (scalar(split_soname($soname))) {
- errormsg($msg, $soname, $file, $obj->{format}, $exec_abi, join(':', @{$obj->{RPATH}}));
+ errormsg($msg, $soname, $file, $obj->{format}, join(':', @{$obj->{RPATH}}));
$error_count++;
} else {
- warning($msg, $soname, $file, $obj->{format}, $exec_abi, join(':', @{$obj->{RPATH}}));
+ warning($msg, $soname, $file, $obj->{format}, join(':', @{$obj->{RPATH}}));
}
next;
}
--
2.25.0.rc1.283.g88dfdc4193-goog