[debhelper-devel] [debhelper] 01/03: dh: filter duplicate entries in stamp file

Niels Thykier nthykier at moszumanska.debian.org
Sun Feb 21 11:05:07 UTC 2016


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

nthykier pushed a commit to branch master
in repository debhelper.

commit d872b400fce125ba629e4d3970724d0668b12543
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Feb 21 08:07:01 2016 +0000

    dh: filter duplicate entries in stamp file
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dh b/dh
index f2a2a60..10b2933 100755
--- a/dh
+++ b/dh
@@ -714,13 +714,16 @@ foreach my $i (0..$stoppoint) {
 		next;
 	}
 	if (my $stamp_file = stamp_target($command)) {
-		my @contents;
+		my %seen;
 		next if $dh{NO_ACT};
 		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) {
+		while (my $line = <$fd>) {
+			chomp($line);
+			$seen{$line} = 1;
+		}
+		for my $pkg (grep { not exists $seen{$_} } @todo) {
 			print {$fd} "$pkg\n";
 		}
 		close($fd) or error("close($stamp_file) failed: $!");

-- 
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