chiark / gitweb /
Test suite: stunt parsechangelog: fallback
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 15:48:29 +0000 (16:48 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 18:24:10 +0000 (19:24 +0100)
Fall back to system implementation if command line options are
requested that we don't understand.  This is a bit fiddly - we need to
strip the stunt entry out of PATH and also out of PERLLIB.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/tstunt/Dpkg/Changelog/Parse.pm
tests/tstunt/dpkg-parsechangelog

index 4d797af3c99017042012ff3a46feeeb3521f30e0..677580bb048793e51d653398e40ae1247e268999 100644 (file)
@@ -33,6 +33,8 @@ use Dpkg::Control::Changelog;
 use base qw(Exporter);
 our @EXPORT = qw(changelog_parse);
 
 use base qw(Exporter);
 our @EXPORT = qw(changelog_parse);
 
+die +(join " ", %ENV)." ?" if $ENV{'DGIT_NO_TSTUNT_CLPARSE'};
+
 sub changelog_parse {
     my (%options) = @_; # ignored
 
 sub changelog_parse {
     my (%options) = @_; # ignored
 
@@ -47,3 +49,5 @@ sub changelog_parse {
 
     return $fields;
 }
 
     return $fields;
 }
+
+1;
index f1e75a88fa14320ae047fbba03f8e83f8fa78769..ce2d66dcab3c32b26f3578da9c26df57cddcaad9 100755 (executable)
@@ -18,11 +18,24 @@ $SIG{__WARN__} = sub { die $_[0]; }; # no use of system, so we avoid #793471
 
 my $infile = "debian/changelog";
 
 
 my $infile = "debian/changelog";
 
+my @orgargv = @ARGV;
+
 if (@ARGV && $ARGV[0] =~ s/^-l//) {
     $infile = shift @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 $!;
 
 use strict;
 open C, $infile or die $!;