[perl-openssl-defaults] 01/04: Make dependants determine the ABI level at runtime

ntyni at debian.org ntyni at debian.org
Thu Dec 22 13:31:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

ntyni pushed a commit to branch master
in repository perl-openssl-defaults.

commit a27813f4bf3df672a8dc85e48b3f32ccecf31a59
Author: Niko Tyni <ntyni at debian.org>
Date:   Thu Dec 22 11:12:03 2016 +0200

    Make dependants determine the ABI level at runtime
    
    Reusing the ABI level information from perl-openssl-defaults
    when building other packages was wrong: there is no guarantee
    that the currently installed libssl-dev matches the one that
    perl-openssl-defaults was built against.
    
    Rather, do the same objdump dance to determine the current ABI level
    and use that.
    
    As a consequence, we don't need to store the ABI level anywhere
    in the perl-openssl-defaults binary package any longer, other
    than the encoded virtual package we Provide.
---
 debian/README.Debian        |  4 ++--
 debian/clean                |  1 -
 debian/dh_perl_openssl      | 20 +++-----------------
 debian/get-libssl-abi       | 28 ++++++++++++++++++++++++++++
 debian/install              |  7 ++-----
 debian/perl-openssl.make    |  3 +++
 debian/perl-openssl.make.in |  3 ---
 debian/rules                | 11 ++---------
 8 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index ced3554..8e10821 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -35,6 +35,6 @@ debian/control.
 
 packages not using debhelper:
 
-Include /usr/lib/<triplet>/perl-opensl-defaults/perl-openssl.make in debian rules and use
-PERL_OPENSSL_ABI_VERSION.
+Include /usr/share/perl-openssl-defaults/perl-openssl.make in debian
+rules and use PERL_OPENSSL_ABI_VERSION.
 
diff --git a/debian/clean b/debian/clean
index 8771ef1..88cc8c6 100644
--- a/debian/clean
+++ b/debian/clean
@@ -1,3 +1,2 @@
 debian/dh_perl_openssl.1
-debian/perl-openssl.make
 debian/openssl-abiversion
diff --git a/debian/dh_perl_openssl b/debian/dh_perl_openssl
index 69ec303..31b7363 100755
--- a/debian/dh_perl_openssl
+++ b/debian/dh_perl_openssl
@@ -5,26 +5,12 @@ use warnings;
 
 use Debian::Debhelper::Dh_Lib;
 
-my $openssl_abi_level;
-
 init();
 
-my $host_multiarch = dpkg_architecture_value("DEB_HOST_MULTIARCH");
-my $abifile = "/usr/lib/${host_multiarch}/perl-openssl-defaults/perl-openssl.make";
-
-open(ABI, '<', $abifile)
-    or die("Cannot open $abifile for reading: $!");
-while (<ABI>) {
-    chomp;
-    next if /^\s*#/;
-    /PERL_OPENSSL_ABI_VERSION=(.+)/ and do {
-        $openssl_abi_level = $1;
-        last;
-    }
-}
-close ABI;
+my $cmd = '/usr/share/perl-openssl-defaults/get-libssl-abi';
+my $openssl_abi_level = qx{$cmd};
 
-die("no PERL_OPENSSL_ABI_VERSION found in $abifile") if !defined $openssl_abi_level;
+die("can't extract OpenSSL ABI version with $cmd") if !defined $openssl_abi_level;
 
 for my $package (@{ $dh{DOPACKAGES} }) {
   addsubstvar($package, 'perl:Depends', "perl-openssl-abi-${openssl_abi_level}", undef);
diff --git a/debian/get-libssl-abi b/debian/get-libssl-abi
new file mode 100755
index 0000000..968d685
--- /dev/null
+++ b/debian/get-libssl-abi
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# read SONAME version from /usr/lib/<triplet>/libssl.so
+
+DEB_HOST_GNU_TYPE=${DEB_HOST_GNU_TYPE:-$(dpkg-architecture -qDEB_HOST_GNU_TYPE)}
+DEB_HOST_MULTIARCH=${DEB_HOST_MULTIARCH:-$(dpkg-architecture -qDEB_HOST_MULTIARCH)}
+
+SOFILE=/usr/lib/${DEB_HOST_MULTIARCH}/libssl.so
+OBJDUMP=${DEB_HOST_MULTIARCH}-objdump
+
+if [ ! -r "$SOFILE" ]; then
+    echo "Can't read '$SOFILE', aborting" 1>&2
+    exit 1
+fi
+
+if ! which "$OBJDUMP" >/dev/null 2>&1; then
+    echo "Can't run '$OBJDUMP', aborting" 1>&2
+    exit 1
+fi
+
+SONAME=$("$OBJDUMP" -p "$SOFILE" | perl -ne '/SONAME\s+libssl\.so\.(.+)/ and print $1')
+
+if [ ! -n "$SONAME" ]; then
+    echo "Could not parse SONAME from the output of '$OBJDUMP' '$SOFILE', aborting" 1>&2
+    exit 2
+fi
+
+echo "$SONAME"
diff --git a/debian/install b/debian/install
old mode 100755
new mode 100644
index 6786763..b01c860
--- a/debian/install
+++ b/debian/install
@@ -1,7 +1,4 @@
-#!/bin/sh
-DEB_HOST_MULTIARCH=${DEB_HOST_MULTIARCH:-$(dpkg-architecture -qDEB_HOST_MULTIARCH)}
-cat <<EOF
-debian/perl-openssl.make /usr/lib/${DEB_HOST_MULTIARCH}/perl-openssl-defaults
+debian/perl-openssl.make /usr/share/perl-openssl-defaults
+debian/get-libssl-abi    /usr/share/perl-openssl-defaults
 debian/dh_perl_openssl   /usr/bin
 debian/perl_openssl.pm   /usr/share/perl5/Debian/Debhelper/Sequence
-EOF
diff --git a/debian/perl-openssl.make b/debian/perl-openssl.make
new file mode 100644
index 0000000..90d1aec
--- /dev/null
+++ b/debian/perl-openssl.make
@@ -0,0 +1,3 @@
+# find out the ABI version for generating a perl-openssl-abi-* dependency.
+# See #848113.
+PERL_OPENSSL_ABI_VERSION=$(shell /usr/share/perl-openssl-defaults/get-libssl-abi)
diff --git a/debian/perl-openssl.make.in b/debian/perl-openssl.make.in
deleted file mode 100644
index 854dc47..0000000
--- a/debian/perl-openssl.make.in
+++ /dev/null
@@ -1,3 +0,0 @@
-# the ABI version for generating a perl-openssl-abi-* dependency.
-# See #848113.
-PERL_OPENSSL_ABI_VERSION=@PERL_OPENSSL_ABI_VERSION@
diff --git a/debian/rules b/debian/rules
index 70bc36e..5057165 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,25 +1,18 @@
 #!/usr/bin/make -f
 
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
-OBJDUMP = $(DEB_HOST_GNU_TYPE)-objdump
 CC      = $(DEB_HOST_GNU_TYPE)-gcc
-SOFILE  = /usr/lib/$(DEB_HOST_MULTIARCH)/libssl.so
 
 # this number comes from the SONAME of libssl.so
 # it is used for the Provides: perl-openssl-abi-XX relationship
 # see #848113
 
-debian/openssl-abiversion: $(SOFILE)
-	$(OBJDUMP) -p $< | perl -ne '/SONAME\s+libssl\.so\.(.+)/ and print $$1' > $@
+debian/openssl-abiversion: debian/get-libssl-abi
+	$< > $@
 	# fail if we could not extract the SONAME
 	[ -s $@ ]
 
-debian/perl-openssl.make: debian/perl-openssl.make.in debian/openssl-abiversion
-	sed 's/@PERL_OPENSSL_ABI_VERSION@/$(shell cat debian/openssl-abiversion)/' \
-	 $< > $@
-
 debian/dh_perl_openssl.1: debian/dh_perl_openssl
 	pod2man $< $@
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/perl-openssl-defaults.git



More information about the Pkg-perl-cvs-commits mailing list