diff options
author | Niels Thykier <niels@thykier.net> | 2018-01-02 14:08:08 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2018-01-02 14:08:08 +0000 |
commit | 486dc1195346ed6aa35dae7e3ef35b4c4d37b7ee (patch) | |
tree | 4ab32c97249991b4b1ddc47f617fcd1a66678238 | |
parent | 33788cb6ce471f5ee4b02444414a20163e428a25 (diff) | |
download | debhelper-486dc1195346ed6aa35dae7e3ef35b4c4d37b7ee.tar.gz |
dh: Isolate some (now) "compat 9"-only code
Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-x | dh | 75 |
1 files changed, 30 insertions, 45 deletions
@@ -696,52 +696,37 @@ my ($rules_targets, $full_sequence) = optimize_sequence(\%sequences, \%completed_sequences ); - -# Lazy cache of the result of optimize_sequence on the "build" -# sequence -my $optimized_build_seq; -foreach my $package (@packages) { - my @log; - if (compat(9)) { - @log = load_log($package, \%logged); - } elsif (exists($stamp_file{$package})) { - if (not defined($optimized_build_seq)) { - # Expand "build" so we can accurately filter out - # everything (admittedly, it is bit of an over - # approximation) - # Related bug: #851071 - my (undef, $seq) = optimize_sequence(\%sequences, 'build', 1); - $optimized_build_seq = $seq; +if (compat(9)) { + foreach my $package (@packages) { + my @log = load_log($package, \%logged); + if ($dh{AFTER}) { + # Run commands in the sequence that come after the + # specified command. + $startpoint{$package} = command_pos($dh{AFTER}, @{$full_sequence}) + 1; + # Write a dummy log entry indicating that the specified + # command was, in fact, run. This handles the case where + # no commands remain to run after it, communicating to + # future dh instances that the specified command should not + # be run again. + write_log($full_sequence->[$startpoint{$package} - 1], $package); } - @log = @{$optimized_build_seq}; - # We do not need %logged in compat 10 - } - if ($dh{AFTER}) { - # Run commands in the sequence that come after the - # specified command. - $startpoint{$package} = command_pos($dh{AFTER}, @{$full_sequence}) + 1; - # Write a dummy log entry indicating that the specified - # command was, in fact, run. This handles the case where - # no commands remain to run after it, communicating to - # future dh instances that the specified command should not - # be run again. - write_log($full_sequence->[$startpoint{$package}-1], $package); - } - elsif ($dh{REMAINING}) { - # Start at the beginning so all remaining commands will get - # run. - $startpoint{$package}=0; - } - else { - # Find the last logged command that is in the sequence, and - # continue with the next command after it. If no logged - # command is in the sequence, we're starting at the beginning.. - $startpoint{$package}=0; -COMMAND: foreach my $command (reverse @log) { - foreach my $i (0..$#{$full_sequence}) { - if ($command eq $full_sequence->[$i]) { - $startpoint{$package}=$i+1; - last COMMAND; + elsif ($dh{REMAINING}) { + # Start at the beginning so all remaining commands will get + # run. + $startpoint{$package} = 0; + } + else { + # Find the last logged command that is in the sequence, and + # continue with the next command after it. If no logged + # command is in the sequence, we're starting at the beginning.. + $startpoint{$package} = 0; + COMMAND: + foreach my $command (reverse @log) { + foreach my $i (0 .. $#{$full_sequence}) { + if ($command eq $full_sequence->[$i]) { + $startpoint{$package} = $i + 1; + last COMMAND; + } } } } |