diff options
author | Niels Thykier <niels@thykier.net> | 2019-08-17 08:02:25 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2019-08-17 08:03:06 +0000 |
commit | e1b3f5f78e6230a7ef161c08d1d204dad0777442 (patch) | |
tree | 4643381376717231abe2d695080d116d7371615b | |
parent | aa3bf822ff200d6cf47e60ad348f6b745828f7a2 (diff) | |
download | debhelper-e1b3f5f78e6230a7ef161c08d1d204dad0777442.tar.gz |
Rewrite special-casing of ELF tools (dh_strip etc.) via an elf-tools sequence
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r-- | debhelper.pod | 10 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rwxr-xr-x | dh | 45 | ||||
-rw-r--r-- | lib/Debian/Debhelper/Sequence/elf_tools.pm | 14 |
5 files changed, 60 insertions, 19 deletions
diff --git a/debhelper.pod b/debhelper.pod index dca9a572..8ef49ce6 100644 --- a/debhelper.pod +++ b/debhelper.pod @@ -952,6 +952,16 @@ abbreviated command parameters. At the same time, B<dh> now optimizes out calls to redundant B<dh_*> helpers even when passed long command line options. +=item - + +The ELF related debhelper tools (B<dh_dwz>, B<dh_strip>, B<dh_makeshlibs>, +B<dh_shlibdeps>) are now only run for arch dependent packages by default +(i.e. they are excluded from B<*-indep> targets and are passed B<-a> +by default). + +If you need them for B<*-indep> targets, you can add an explicit +Build-Depends on B<dh-sequence-elf-tools>. + =back =back diff --git a/debian/changelog b/debian/changelog index f3939ce0..d25d70db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,14 @@ debhelper (12.5) UNRELEASED; urgency=medium doc/PROGRAMMING document (in the debhelper source) if they are considering to make their addon compatible with these requirements. (Closes: #836699) + * dh,elf_tools.pm: Extract the ELF related debhelper tools (dh_strip, + dh_dwz, dh_makeshlibs, dh_shlibdeps) into their own addon called + "elf-tools" enabled by the default. + * debian/control: Provide dh-sequence-elf-tools. + * dh: In compat 13, the "elf-tools" addon is considered an implicit + "arch-only" addon (i.e. they are only available in "-arch" sequences + and are always passed a "-a"). If you need the ELF tools for arch:all + packages, please add an explicit Builds-Depends on dh-sequence-elf-tools. [ Frank Schaefer ] * dh_installmodules: Also lok for compressed kernel modules diff --git a/debian/control b/debian/control index cf598526..4041e335 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ Uploaders: Niels Thykier <niels@thykier.net>, Build-Depends: dpkg-dev (>= 1.18.0~), perl:any, po4a, + dh-sequence-elf-tools, Rules-Requires-Root: no Standards-Version: 4.4.0 Testsuite: autopkgtest-pkg-perl @@ -49,6 +50,7 @@ Replaces: dh-systemd (<< 1.38) Suggests: dh-make Provides: ${dh:CompatLevels}, dh-sequence-dwz, + dh-sequence-elf-tools, dh-sequence-installinitramfs, dh-sequence-systemd, Multi-Arch: foreign @@ -419,19 +419,9 @@ qw{ dh_fixperms dh_missing }); -my @ba=(map { - { - 'command' => $_, - 'command-options' => [], - 'sequence-limitation' => SEQUENCE_TYPE_ARCH_ONLY, - } -} ( - (!compat(11) ? qw(dh_dwz) : qw()), -qw{ - dh_strip - dh_makeshlibs - dh_shlibdeps -})); + +# Looking for dh_dwz, dh_strip, dh_makeshlibs, dh_shlibdeps (et al)? They are +# in the elf-tools addon. my @b=qw{ dh_installdeb dh_gencontrol @@ -455,7 +445,7 @@ sub _add_sequence { _add_sequence('build', SEQUENCE_ARCH_INDEP_SUBSEQUENCES, @bd); _add_sequence('install', SEQUENCE_ARCH_INDEP_SUBSEQUENCES, to_rules_target("build"), @i); -_add_sequence('binary', SEQUENCE_ARCH_INDEP_SUBSEQUENCES, to_rules_target("install"), @ba, @b); +_add_sequence('binary', SEQUENCE_ARCH_INDEP_SUBSEQUENCES, to_rules_target("install"), @b); _add_sequence('clean', SEQUENCE_NO_SUBSEQUENCES, @bd_minimal, qw{ dh_auto_clean dh_clean @@ -664,10 +654,28 @@ sub list_addons { sub _compute_addons { my ($sequence_name, @addon_requests_from_args) = @_; - my (@enabled_addons, %disabled_addons, %enabled, $bd_dh_sequences_ref); + my (@enabled_addons, %disabled_addons, %enabled); my @addon_requests; my $sequence_type = sequence_type($sequence_name); + my %addon_constraints = %{ Debian::Debhelper::Dh_Lib::bd_dh_sequences() }; + + # Inject elf-tools early as other addons rely on their presence and it historically + # has been considered a part of the "core" sequence. + if (exists($addon_constraints{'elf-tools'})) { + # Explicitly requested; respect that + push(@addon_requests, '+elf-tools'); + } elsif (compat(12, 1)) { + # In compat 12 and earlier, we only inject the sequence if there are arch + # packages present. + push(@addon_requests, '+elf-tools') if getpackages('arch'); + } else { + # In compat 13, we always inject the addon if not explicitly requested and + # then flag it as arch_only + push(@addon_requests, '+elf-tools'); + $addon_constraints{'elf-tools'} = SEQUENCE_TYPE_ARCH_ONLY if not exists($addon_constraints{'elf-tools'}); + } + # Order is important; DH_EXTRA_ADDONS must come before everything # else; then comes built-in and finally argument provided add-ons # requests. @@ -683,9 +691,8 @@ sub _compute_addons { push(@addon_requests, '+systemd') if compat(10, 1); push(@addon_requests, '+build-stamp'); } - $bd_dh_sequences_ref = Debian::Debhelper::Dh_Lib::bd_dh_sequences(); - for my $addon_name (sort(keys(%{$bd_dh_sequences_ref}))) { - my $addon_type = $bd_dh_sequences_ref->{$addon_name}; + for my $addon_name (sort(keys(%addon_constraints))) { + my $addon_type = $addon_constraints{$addon_name}; if ($addon_type eq 'both' or $sequence_type eq 'both' or $addon_type eq $sequence_type) { push(@addon_requests, "+${addon_name}"); } @@ -720,7 +727,7 @@ sub _compute_addons { return map { { 'name' => $_, - 'addon-type' => $bd_dh_sequences_ref->{$_} // 'both', + 'addon-type' => $addon_constraints{$_} // SEQUENCE_TYPE_BOTH, } } @enabled_addons; } diff --git a/lib/Debian/Debhelper/Sequence/elf_tools.pm b/lib/Debian/Debhelper/Sequence/elf_tools.pm new file mode 100644 index 00000000..2780bc9e --- /dev/null +++ b/lib/Debian/Debhelper/Sequence/elf_tools.pm @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +insert_after('dh_missing', 'dh_strip'); +if (not compat(11)) { + insert_before('dh_strip', 'dh_dwz'); +} +insert_after('dh_strip', 'dh_makeshlibs'); +insert_after('dh_makeshlibs', 'dh_shlibdeps'); + +1;
\ No newline at end of file |