summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2019-08-16 17:55:10 +0000
committerNiels Thykier <niels@thykier.net>2019-08-16 18:10:16 +0000
commit6bf914b4eb15578a4f48dafae3ac16d95eddc55a (patch)
tree20bdcb2ca8fa1eb4c518854dd120802d97b91a4a
parent510a167418385616eb8017f595e07222f809da33 (diff)
downloaddebhelper-6bf914b4eb15578a4f48dafae3ac16d95eddc55a.tar.gz
dh_makeshlibs: Avoid including omitted libraries in the udeb on auto-detection
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog4
-rwxr-xr-xdh_makeshlibs38
2 files changed, 38 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 23a94e74..b9560aec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,10 @@ debhelper (12.5) UNRELEASED; urgency=medium
on IRC.
* dh_makeshlibs: Fix bug where --no-add-udeb could trigger the
auto-detection code. (Closes: #934891)
+ * dh_makeshlibs: When using the auto-detection of udeb, automatically
+ exclude "udeb:" lines for libraries omitted from the udeb. At the
+ same time, verbosely fail if the udeb contains a library not present
+ in the deb (overridable with --add-udeb). (Closes: #934889)
[ Frank Schaefer ]
* dh_installmodules: Also lok for compressed kernel modules
diff --git a/dh_makeshlibs b/dh_makeshlibs
index ddefa475..e8b27445 100755
--- a/dh_makeshlibs
+++ b/dh_makeshlibs
@@ -162,8 +162,9 @@ Create an additional line for udebs in the shlibs file and use I<udeb> as the
package name for udebs to depend on instead of the regular library package.
This is option is only useful for special cases such as when debhelper
-cannot auto-detect package name of the udeb package or when the udeb
-will contain libraries from multiple deb packages.
+cannot auto-detect package name of the udeb package, when the udeb
+will contain libraries from multiple deb packages, or when the udeb
+contains libraries B<not> present in the deb package.
=item B<--no-add-udeb>
@@ -201,7 +202,7 @@ Generates a shlibs file that looks something like:
=cut
-my $shlibs_udeb;
+my ($shlibs_udeb, %known_udeb_solibs);
init(options => {
"m=s", => \$dh{M_PARAMS},
@@ -279,6 +280,18 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $guessed_udeb = "${package}-udeb";
$udeb_name = $guessed_udeb if is_known_package($guessed_udeb) and is_udeb($guessed_udeb);
}
+ if (defined($udeb_name)) {
+ for my $so_data (_all_so_files($udeb_name, tmpdir($udeb_name))) {
+ my ($path, $library, $major) = @{$so_data};
+ $known_udeb_solibs{$udeb_name}{"${library}\x1f${major}"} = 1;
+ }
+ # If the udeb contains no SO files, then we there
+ if (not exists($known_udeb_solibs{$udeb_name})) {
+ error("The udeb $shlibs_udeb does not contain any shared libraries but --add-udeb=$shlibs_udeb was passed!?")
+ if defined($shlibs_udeb);
+ $udeb_name = undef;
+ }
+ }
for my $so_data (_all_so_files($package, $tmp)) {
my ($lib_file, $library, $major) = @{$so_data};
push(@lib_files, $lib_file) if compat(11);
@@ -330,16 +343,33 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! $seen{$line}) {
$seen{$line}=1;
push(@deb_lines, $line);
- if (defined($udeb_name) && $udeb_name ne '') {
+ if (defined($udeb_name) && (defined($shlibs_udeb) or exists($known_udeb_solibs{$udeb_name}{"${library}\x1f${major}"}))) {
my $udeb_deps = $deps;
$udeb_deps =~ s/\Q$package\E/$udeb_name/e;
$line="udeb: $library $major $udeb_deps";
push @udeb_lines, $line;
+ delete($known_udeb_solibs{$udeb_name}{"${library}\x1f${major}"});
}
}
}
}
+ if (not defined($shlibs_udeb) and defined($udeb_name)) {
+ my $issues = 0;
+ for my $lib_key (sort(keys(%{$known_udeb_solibs{$udeb_name}}))) {
+ my ($library, $major) = split(qr/\x1f/, $lib_key);
+ warning("$udeb_name contains SO library $library (version $major) but $package does not contain a similar library!?");
+ $issues = 1;
+ }
+ if ($issues) {
+ $ok = 0;
+ warning("Rejecting the generated shlibs file for $udeb_name!");
+ warning("Hint: Either add the missing libraries to $package, remove them from $udeb_name, or");
+ warning("Hint: (if this difference is expected) pass \"--add-udeb=$udeb_name\" to dh_makeshlibs.");
+ warning("Hint: In the latter case, you *may* also need to combine it with \"-p$package\"");
+ }
+ }
+
if ($shlibs_file) {
install_dir("$tmp/DEBIAN");
install_file($shlibs_file, "$tmp/DEBIAN/shlibs");