summaryrefslogtreecommitdiff
path: root/dh
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-01-09 10:28:52 +0000
committerNiels Thykier <niels@thykier.net>2016-01-09 16:12:08 +0000
commitbca06f8d784fb0d6ac6f1358fc1ea2366fbb774e (patch)
treebcdec53c5b46b71135680d2123a3c5e749919eac /dh
parent084fcd326b9d058ebaef14b5b76fade652062f90 (diff)
downloaddebhelper-bca06f8d784fb0d6ac6f1358fc1ea2366fbb774e.tar.gz
dh+compat 10: Drop sequence ctrl and logs
In compat 10, drop the manual sequence ctrl arguments and the debhelper sequence logs. Instead do a simple stamp file to skip the build part if already done. The primary advantage is that now the binary target can trivially be re-run, which makes debugging easier/faster. Closes: #510855 Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh')
-rwxr-xr-xdh58
1 files changed, 52 insertions, 6 deletions
diff --git a/dh b/dh
index 4d93563b..4cf45151 100755
--- a/dh
+++ b/dh
@@ -249,7 +249,8 @@ option to ensure they only work on architecture dependent packages.
=head1 DEPRECATED OPTIONS
The following options are deprecated. It's much
-better to use override targets instead.
+better to use override targets instead. They are B<not> available
+in compat 10.
=over 4
@@ -354,16 +355,19 @@ if ($sequence eq 'debian/rules' ||
# Definitions of sequences.
+my $build_stamp_file = 'debian/debhelper-build-stamp';
my %sequences;
my @bd_minimal = qw{
dh_testdir
};
-my @bd = qw{
+my @bd = (qw{
dh_testdir
dh_auto_configure
dh_auto_build
dh_auto_test
-};
+},
+ "create-stamp ${build_stamp_file}",
+);
my @i = (qw{
dh_testroot
dh_prep
@@ -621,8 +625,25 @@ while (@ARGV_orig) {
# Figure out at what point in the sequence to start for each package.
my %logged;
my %startpoint;
+my %stamp_file;
+
+if ( -f $build_stamp_file) {
+ open(my $fd, '<', $build_stamp_file) or error("open($build_stamp_file, ro) failed: $!");
+ while (my $line = <$fd>) {
+ chomp($line);
+ $stamp_file{$line} = 1;
+ }
+ close($fd);
+}
+
foreach my $package (@packages) {
- my @log=load_log($package, \%logged);
+ my @log;
+ if (compat(9)) {
+ @log = load_log($package, \%logged);
+ } elsif (exists($stamp_file{$package})) {
+ @log = @bd;
+ # We do not need %logged in compat 10
+ }
if ($dh{AFTER}) {
# Run commands in the sequence that come after the
# specified command.
@@ -691,6 +712,18 @@ foreach my $i (0..$stoppoint) {
run("debian/rules", $rules_target);
next;
}
+ if (my $stamp_file = stamp_target($command)) {
+ my @contents;
+ open(my $fd, '+>>', $stamp_file) or error("open($stamp_file, rw) failed: $!");
+ # Seek to the beginning
+ seek($fd, 0, 0) or error("seek($stamp_file) failed: $!");
+ @contents = map { chomp } <$fd>;
+ for my $pkg (@todo) {
+ print {$fd} "$pkg\n";
+ }
+ close($fd) or error("close($stamp_file) failed: $!");
+ next;
+ }
# Check for override targets in debian/rules, and run instead of
# the usual command. (The non-arch-specific override is tried first,
@@ -804,12 +837,13 @@ sub run_override {
run("debian/rules", $override);
delete $ENV{DH_INTERNAL_OPTIONS};
delete $ENV{DH_INTERNAL_OVERRIDE};
+ complex_doit("rm","-f","debian/*.debhelper.log") if not compat(9);
# Update log for overridden command now that it has
# finished successfully.
# (But avoid logging for dh_clean since it removes
# the log earlier.)
- if (! $dh{NO_ACT} && $command ne 'dh_clean') {
+ if (! $dh{NO_ACT} && $command ne 'dh_clean' && compat(9)) {
write_log($command, @todo);
commit_override_log(@todo);
}
@@ -853,6 +887,14 @@ sub rules_target {
}
}
+sub stamp_target {
+ my ($command) = @_;
+ if ($command =~ s/^create-stamp\s+//) {
+ return $command;
+ }
+ return;
+}
+
sub rules {
return "debian/rules ".join(" ", @_);
}
@@ -922,7 +964,11 @@ sub rules_explicit_target {
sub warn_deprecated {
foreach my $deprecated ('until', 'after', 'before', 'remaining') {
if (defined $dh{uc $deprecated}) {
- warning("The --$deprecated option is deprecated. Use override targets instead.");
+ if (compat(9)) {
+ warning("The --$deprecated option is deprecated. Use override targets instead.");
+ } else {
+ error("The --$deprecated option is not supported in compat 10+. Use override targets instead.");
+ }
}
}
}