chiark / gitweb /
Test suite: stunt parsechangelog: Some commented-out debugging
[dgit.git] / tests / tstunt / dpkg-parsechangelog
index 2e0360da112c2793532d752ff1bfc6944d782490..6a9198abb21caccb7b0dc5f5e25fb901e9c08867 100755 (executable)
 # sys     0m0.012s
 # $
 
-die if @ARGV;
+$SIG{__WARN__} = sub { die $_[0]; }; # no use of system, so we avoid #793471
+
+my $infile = "debian/changelog";
+
+#print STDERR ">@ARGV<\n";
+
+my @orgargv = @ARGV;
+
+if (@ARGV && $ARGV[0] =~ s/^-l//) {
+    $infile = shift @ARGV;
+}
+
+if (@ARGV) {
+    my $strip = $0;
+    $strip =~ s#/[^/]+$## or die "$0 ?";
+    foreach my $k (qw(PATH PERLLIB)) {
+       my @opath = defined $ENV{$k} ? split /\:/, $ENV{$k} : ();
+       my @npath = grep { $_ ne $strip } @opath;
+       @npath != @opath  or die "$0 $k ".($ENV{$k}//"(undef)")." ?";
+       $ENV{$k} = join ':', @npath;
+       delete $ENV{$k} if !@npath;
+    }
+    die if $ENV{'DGIT_NO_TSTUNT_CLPARSE'}++;
+    exec 'dpkg-parsechangelog', @orgargv;
+}
 
 use strict;
-open C, "debian/changelog" or die $!;
+open C, $infile or die $!;
 
 $!=0; $_ = <C>;
 m/^(\S+) \(([^()]+)\) (\S+)\; urgency=(\S+)$/ or die "$!, $_ ?";
@@ -38,7 +62,8 @@ for (;;) {
 Maintainer: $1
 Date: $2
 END
-        last;
+       print "Timestamp: " or die $!;
+       exec qw(date +%s -d), $2; die $!;
     } elsif (m/^ --\s*$/) {
        last;
     } elsif (!m/\S/) {