[debhelper-devel] [debhelper] 01/01: dh: Isolate some (now) "compat 9"-only code

Niels Thykier nthykier at moszumanska.debian.org
Tue Jan 2 14:09:36 UTC 2018


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 486dc1195346ed6aa35dae7e3ef35b4c4d37b7ee
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jan 2 14:08:08 2018 +0000

    dh: Isolate some (now) "compat 9"-only code
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh | 75 ++++++++++++++++++++++++++++------------------------------------------
 1 file changed, 30 insertions(+), 45 deletions(-)

diff --git a/dh b/dh
index 537d5e7..0945d17 100755
--- a/dh
+++ b/dh
@@ -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;
+					}
 				}
 			}
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list