Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
cperlivp: support -d DESTDIR
Browse files Browse the repository at this point in the history
See [cperl #305]
  • Loading branch information
rurban committed Jul 14, 2017
1 parent 3f655dc commit 1276c2b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -62,7 +62,10 @@ script:
- if [ "${TRAVIS_OS_NAME}" = "linux" -o -z "`echo $CONFIGURE_OPTION | grep 'DDEBUGGING'
2>/dev/null`" ]; then
if [ -n "$DEPLOY" ]; then
TEST_JOBS=4 make -s -j4 all test_harness && make install DESTDIR=$HOME/cperl-inst ;
make -s -j4 all &&
TEST_JOBS=4 make -s -j4 test_harness &&
make -s -j4 install DESTDIR=$HOME/cperl-inst &&
./perl -Ilib $HOME/cperl-inst/usr/local/bin/cperlivp -p -d $HOME/cperl-inst ;
else
TEST_JOBS=4 make -s -j4 test_harness ;
fi
Expand Down
10 changes: 7 additions & 3 deletions dist/Module-CoreList/lib/Module/CoreList/Utils.pm
Expand Up @@ -5,7 +5,7 @@ use warnings;
use vars qw[$VERSION %utilities];
use Module::CoreList;

$VERSION = '5.20170621c';
$VERSION = '5.20170714c';
$VERSION =~ s/c$//;

sub utilities {
Expand Down Expand Up @@ -1355,7 +1355,9 @@ our %delta :const = (
},
'5.026001c' => {
delta_from => '5.026000c',
changed => {},
changed => {
'cperlivp' => 1,
},
removed => {}
},
5.027000 => {
Expand All @@ -1379,7 +1381,9 @@ our %delta :const = (
},
'5.027001c' => {
delta_from => '5.027000c',
changed => {},
changed => {
'cperlivp' => 1,
},
removed => {}
},
);
Expand Down
16 changes: 16 additions & 0 deletions pod/perlcdelta.pod
Expand Up @@ -406,6 +406,22 @@ See L<[cperl #283]|https://github.com/perl11/cperl/issues/283>

=back

=head1 Utility Changes

=head2 L<cperlivp>

=over 4

=item *

Add support for C<-d DESTDIR>, e.g. after

make -s -j4 install DESTDIR=$HOME/cperl-inst
cd $HOME/cperl-inst/usr/local/bin &&
./cperl cperlivp -p -d $HOME/cperl-inst

=back

=head1 Testing

XXX Any significant changes to the testing of a freshly built perl should be
Expand Down
2 changes: 1 addition & 1 deletion t/porting/customized.dat
Expand Up @@ -99,7 +99,7 @@ Math::BigInt cpan/Math-BigInt/t/upgrade.t 7c15cac7f321ca396648ec45da6389a1283e15
Math::BigInt cpan/Math-BigInt/t/upgradef.t 06610e9883ce805bcd6543ab959a9826f598eb40
Math::BigInt cpan/Math-BigInt/t/with_sub.t c040328e223df6f56250f5d67dcb2c9a2f23c110
Module::CoreList dist/Module-CoreList/lib/Module/CoreList.pm 8f6dbe0b0501877ebea7b56bbd178481db8706f6
Module::CoreList dist/Module-CoreList/lib/Module/CoreList/Utils.pm 9d45f1f4cef5fec976f46ef0325b6a317e6c6c02
Module::CoreList dist/Module-CoreList/lib/Module/CoreList/Utils.pm d013ed514d49e14ac007743cb5b05fc2a624a321
Module::Metadata cpan/Module-Metadata/t/lib/GeneratePackage.pm 502ffbe2609947430e6aa1a3df8064b3fef3e086
Net::Domain cpan/libnet/lib/Net/Cmd.pm 70a007c38833667ad47ea8059c37c1b7d1c77b6c
Net::Domain cpan/libnet/lib/Net/Domain.pm 73f78880a95de5372bb234f37c386f52e43795d9
Expand Down
23 changes: 18 additions & 5 deletions utils/cperlivp.PL
Expand Up @@ -31,7 +31,7 @@ print "Extracting $file (with variable substitutions)\n"
print OUT <<"!GROK!THIS!";
$Config{'startperl'}
eval 'exec $Config{'perlpath'} -S \$0 \${1+"\$@"}'
if \$running_under_some_shell;
if 0;
!GROK!THIS!

print OUT "\n# cperlivp $^V\n";
Expand All @@ -47,9 +47,10 @@ sub usage {
print << " EOUSAGE";
Usage:
$0 [-p] [-v] | [-h]
$0 [-p] [-v] | [-h] | [-d DESTDIR]
-p Print a preface before each test telling what it will test.
-d destdir
-v Verbose mode in which extra information about test results
is printed. Test failures always print out some extra information
regardless of whether or not this switch is set.
Expand All @@ -60,18 +61,22 @@ Usage:
use vars qw(%opt); # allow testing with older versions (do not use our)
@opt{ qw/? H h P p V v/ } = qw(0 0 0 0 0 0 0);
@opt{ qw/? H h P p V v d/ } = qw(0 0 0 0 0 0 0 0);
while ($ARGV[0] =~ /^-/) {
$ARGV[0] =~ s/^-//;
for my $flag (split(//,$ARGV[0])) {
usage() if '?' =~ /\Q$flag/;
usage() if 'h' =~ /\Q$flag/;
usage() if 'H' =~ /\Q$flag/;
usage("unknown flag: '$flag'") unless 'HhPpVv' =~ /\Q$flag/;
usage("unknown flag: '$flag'") unless 'HhPpVvd' =~ /\Q$flag/;
warn "$0: '$flag' flag already set\n" if $opt{$flag}++;
}
shift;
if ($opt{d}) {
$opt{d} = shift;
die "destdir $opt{d} does not exist\n" unless -d $opt{d};
}
}
$opt{p}++ if $opt{P};
Expand Down Expand Up @@ -105,6 +110,7 @@ print "## Checking Perl binary via variable '\$perlpath' = $perlpath.\n" if $opt
my $label = 'Executable perl binary';
$perlpath = "$opt{d}/$perlpath" if $opt{d};
if (-x $perlpath) {
print "## Perl binary '$perlpath' appears executable.\n" if $opt{'v'};
print "ok 1 $label\n";
Expand Down Expand Up @@ -141,13 +147,20 @@ else {
}
$tests_total++;
if ($opt{d}) {
unshift @INC, "$opt{d}/$Config{archlib}", "$opt{d}/$Config{privlib}";
}
# We have the right perl and version, so now reset @INC so we ignore
# PERL5LIB and '.'
{
local $ENV{PERL5LIB};
my $perl_V = qx($perlpath -V);
$perl_V =~ s{.*\@INC:\n}{}ms;
@INC = grep { length && $_ ne '.' } split ' ', $perl_V;
if ($opt{d}) {
@INC = map { m{^$opt{d}} ? $_ : "$opt{d}/$_" } @INC;
}
}
print "## Checking roots of the Perl library directory tree via variable '\@INC'.\n" if $opt{'p'};
Expand All @@ -166,7 +179,7 @@ foreach (@INC) {
$INC_total++;
}
$label = '@INC directoreis exist';
$label = '@INC directories exist';
if ($INC_total == $INC_there) {
print "ok 3 $label\n";
$pass__total++;
Expand Down

0 comments on commit 1276c2b

Please sign in to comment.