chiark / gitweb /
Test suite: Fix entirely-broken tstunt PERLLIB arrangements
[dgit.git] / tests / tstunt / dpkg-parsechangelog
index f1e75a88fa14320ae047fbba03f8e83f8fa78769..4d7cdf84fb3ad426e31ab755dfc3e5e69d3fe682 100755 (executable)
@@ -18,11 +18,24 @@ $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 = 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;
+    }
+    die if $ENV{'DGIT_NO_TSTUNT_CLPARSE'}++;
+    exec 'dpkg-parsechangelog', @orgargv;
+}
 
 use strict;
 open C, $infile or die $!;