diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-08 16:48:29 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-10-08 19:24:10 +0100 |
commit | 7d64947564587518ec007066ac76e0373cb79da8 (patch) | |
tree | a1358d7a9ec0b49e69af87a1eac55e9e3089fa62 /tests/tstunt | |
parent | 7fd4808a58916386f5acab86877cb6c7f7d61c86 (diff) |
Test suite: stunt parsechangelog: fallback
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>
Diffstat (limited to 'tests/tstunt')
-rw-r--r-- | tests/tstunt/Dpkg/Changelog/Parse.pm | 4 | ||||
-rwxr-xr-x | tests/tstunt/dpkg-parsechangelog | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/tstunt/Dpkg/Changelog/Parse.pm b/tests/tstunt/Dpkg/Changelog/Parse.pm index 4d797af..677580b 100644 --- a/tests/tstunt/Dpkg/Changelog/Parse.pm +++ b/tests/tstunt/Dpkg/Changelog/Parse.pm @@ -33,6 +33,8 @@ use Dpkg::Control::Changelog; use base qw(Exporter); our @EXPORT = qw(changelog_parse); +die +(join " ", %ENV)." ?" if $ENV{'DGIT_NO_TSTUNT_CLPARSE'}; + sub changelog_parse { my (%options) = @_; # ignored @@ -47,3 +49,5 @@ sub changelog_parse { return $fields; } + +1; diff --git a/tests/tstunt/dpkg-parsechangelog b/tests/tstunt/dpkg-parsechangelog index f1e75a8..ce2d66d 100755 --- a/tests/tstunt/dpkg-parsechangelog +++ b/tests/tstunt/dpkg-parsechangelog @@ -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 = 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 $!; |