chiark / gitweb /
Test suite: stunt parsechangelog: fallback
[dgit.git] / tests / tstunt / dpkg-parsechangelog
index c45b12465f462721bec1245d6729b888359afa5d..ce2d66dcab3c32b26f3578da9c26df57cddcaad9 100755 (executable)
 # sys     0m0.012s
 # $
 
+$SIG{__WARN__} = sub { die $_[0]; }; # no use of system, so we avoid #793471
+
 my $infile = "debian/changelog";
 
+my @orgargv = @ARGV;
+
 if (@ARGV && $ARGV[0] =~ s/^-l//) {
     $infile = shift @ARGV;
 }
 
-die if @ARGV;
+if (@ARGV) {
+    my $strip = $0;
+    $strip =~ s#/[^/]+$## or die "$0 ?";
+    foreach my $k (qw(PATH PERLLIB)) {
+       my @opath = split /\:/, $ENV{$k};
+       my @npath = grep { $_ ne $strip } @opath;
+       @npath != @opath  or die "$0 $k $ENV{$k} ?";
+       $ENV{$k} = join ':', @npath;
+    }
+    die if $ENV{'DGIT_NO_TSTUNT_CLPARSE'}++;
+    exec 'dpkg-parsechangelog', @orgargv;
+}
 
 use strict;
 open C, $infile or die $!;