Skip to content
Commits on Source (4)
......@@ -9,6 +9,7 @@ debhelper (11.1.6) UNRELEASED; urgency=medium
attempt to make pkgfile() use "DEB_TARGET_ARCH{,_OS}"
(see 11.1.5~alpha1). Thanks to Andreas Beckmann for reporting
the issue. (Closes: #891546)
* dh: Refactor handling of sequences to simplify some code paths.
-- Niels Thykier <niels@thykier.net> Mon, 26 Feb 2018 19:32:52 +0000
......
......@@ -452,8 +452,6 @@ $sequences{clean} = [@bd_minimal, qw{
}];
$sequences{'build-indep'} = [@bd];
$sequences{'build-arch'} = [@bd];
if (! compat(8)) {
# From v9, sequences take standard rules targets into account.
$sequences{build} = [to_rules_target("build-arch"), to_rules_target("build-indep")];
$sequences{'install-indep'} = [to_rules_target("build-indep"), @i];
$sequences{'install-arch'} = [to_rules_target("build-arch"), @i];
......@@ -461,16 +459,6 @@ if (! compat(8)) {
$sequences{'binary-indep'} = [to_rules_target("install-indep"), @b];
$sequences{'binary-arch'} = [to_rules_target("install-arch"), @ba, @b];
$sequences{binary} = [to_rules_target("install"), to_rules_target("binary-arch"), to_rules_target("binary-indep")];
}
else {
$sequences{build} = [@bd];
$sequences{'install'} = [@{$sequences{build}}, @i];
$sequences{'install-indep'} = [@{$sequences{'build-indep'}}, @i];
$sequences{'install-arch'} = [@{$sequences{'build-arch'}}, @i];
$sequences{binary} = [@{$sequences{install}}, @ba, @b];
$sequences{'binary-indep'} = [@{$sequences{'install-indep'}}, @b];
$sequences{'binary-arch'} = [@{$sequences{'install-arch'}}, @ba, @b];
}
# Additional command options
my %command_opts;
......
......@@ -45,9 +45,9 @@ sub unpack_sequence {
my $command = shift(@{$current_sequence});
my $rules_target=extract_rules_target_name($command);
next if (defined($rules_target) and exists($completed_sequences->{$rules_target}));
if (defined($rules_target) &&
if (defined($rules_target) && ($always_inline ||
! exists($non_inlineable_targets{$rules_target}) &&
! defined(rules_explicit_target($rules_target))) {
! defined(rules_explicit_target($rules_target)))) {
# inline the sequence for this implicit target.
push(@stack, $current_sequence);
......
......@@ -46,8 +46,21 @@ my %sequences = (
'binary' => [to_rules_target("install"), to_rules_target("binary-arch"), to_rules_target("binary-indep")],
);
my %sequences_unpacked = (
'build-indep' => [@bd],
'build-arch' => [@bd],
'build' => [@bd],
plan tests => 11;
'install-indep' => [@bd, @i],
'install-arch' => [@bd, @i],
'install' => [@bd, @i],
'binary-indep' => [@bd, @i, @b],
'binary-arch' => [@bd, @i, @ba, @b],
'binary' => [@bd, @i, @ba, @b],
);
plan tests => 11 + 3 * scalar(keys(%sequences));
# We will horse around with %EXPLICIT_TARGETS in this test; it should
# definitely not attempt to read d/rules or the test will be break.
......@@ -56,27 +69,27 @@ $Debian::Debhelper::SequencerUtil::RULES_PARSED = 1;
is_deeply(
[unpack_sequence(\%sequences, 'build')],
[[], [@bd]],
[[], $sequences_unpacked{'build'}],
'Inlined build sequence matches build-indep/build-arch');
is_deeply(
[unpack_sequence(\%sequences, 'install')],
[[], [@bd, @i]],
[[], $sequences_unpacked{'install'}],
'Inlined install sequence matches build-indep/build-arch + install commands');
is_deeply(
[unpack_sequence(\%sequences, 'binary-arch')],
[[], [@bd, @i, @ba, @b]],
[[], $sequences_unpacked{'binary-arch'}],
'Inlined binary-arch sequence has all the commands');
is_deeply(
[unpack_sequence(\%sequences, 'binary-indep')],
[[], [@bd, @i, @b]],
[[], $sequences_unpacked{'binary-indep'}],
'Inlined binary-indep sequence has all the commands except @bd');
is_deeply(
[unpack_sequence(\%sequences, 'binary')],
[[], [@bd, @i, @ba, @b]],
[[], $sequences_unpacked{'binary'}],
'Inlined binary sequence has all the commands');
......@@ -100,9 +113,17 @@ is_deeply(
is_deeply(
[unpack_sequence(\%sequences, 'build')],
[[], [@bd]],
[[], $sequences_unpacked{'build'}],
'build sequence is inlineable');
# Compat <= 8 ignores explicit targets!
for my $seq_name (sort(keys(%sequences))) {
is_deeply(
[unpack_sequence(\%sequences, $seq_name, 1)],
[[], $sequences_unpacked{$seq_name}],
"Compat <= 8 ignores explicit build target in sequence ${seq_name}");
}
}
{
......@@ -114,6 +135,14 @@ is_deeply(
# Unfortunately, unpack_sequence cannot show that.
[[to_rules_target('install-arch')], [@bd, @i, @ba, @b]],
'Inlined binary sequence has all the commands');
# Compat <= 8 ignores explicit targets!
for my $seq_name (sort(keys(%sequences))) {
is_deeply(
[unpack_sequence(\%sequences, $seq_name, 1)],
[[], $sequences_unpacked{$seq_name}],
"Compat <= 8 ignores explicit install-arch target in sequence ${seq_name}");
}
}
{
......@@ -133,4 +162,12 @@ is_deeply(
$actual,
$expected,
'Inlined binary sequence has all the commands');
# Compat <= 8 ignores explicit targets!
for my $seq_name (sort(keys(%sequences))) {
is_deeply(
[unpack_sequence(\%sequences, $seq_name, 1)],
[[], $sequences_unpacked{$seq_name}],
"Compat <= 8 ignores explicit build + install-arch targets in sequence ${seq_name}");
}
}