commit perl-local-lib for openSUSE:Factory
Hello community, here is the log from the commit of package perl-local-lib for openSUSE:Factory checked in at 2014-09-17 17:25:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-local-lib (Old) and /work/SRC/openSUSE:Factory/.perl-local-lib.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-local-lib" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-local-lib/perl-local-lib.changes 2014-03-18 13:57:57.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-local-lib.new/perl-local-lib.changes 2014-09-17 17:26:20.000000000 +0200 @@ -1,0 +2,32 @@ +Mon Sep 15 15:44:36 UTC 2014 - coolo@suse.com + +- updated to 2.000014 + - fix taint-mode test in some cases on case insensitive filesystems + + 2.000013 - 2014-08-16 + - fix test failure in ActiveState perl + - better test diagnostics + - fix quoting of spaces for fish shell (rt#95268) + - improve quoting for use with cmd.exe + - fix quoting any arbitrary character when contructing strings for bash + - skip testing use with shells if the shell doesn't work at all + + 2.000012 - 2014-05-12 + - restore build_activate_environment_vars_for, + build_deactivate_environment_vars_for, build_deact_all_environment_vars_for + methods for perlbrew compatibility + - fix transforming relative paths to absolute paths in older perls + - fix quoting for fish shell + + 2.000011 - 2014-04-02 + - more fixes for issue where PERL5LIB Carp is not the same version as in the + local-lib + + 2.000010 - 2014-03-28 + - fix shell test on cygwin + + 2.000_009 - 2014-03-15 + - no longer loads File::Spec, so an upgraded version installed inside a local + lib dir can be used by scripts + +------------------------------------------------------------------- Old: ---- local-lib-2.000008.tar.gz New: ---- local-lib-2.000014.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-local-lib.spec ++++++ --- /var/tmp/diff_new_pack.s5aruZ/_old 2014-09-17 17:26:21.000000000 +0200 +++ /var/tmp/diff_new_pack.s5aruZ/_new 2014-09-17 17:26:21.000000000 +0200 @@ -18,7 +18,7 @@ Name: perl-local-lib -Version: 2.000008 +Version: 2.000014 Release: 0 Summary: Create and Use a local Library Directory for Perl Modules License: Artistic-1.0 or GPL-1.0+ ++++++ local-lib-2.000008.tar.gz -> local-lib-2.000014.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/Changes new/local-lib-2.000014/Changes --- old/local-lib-2.000008/Changes 2014-03-13 17:30:08.000000000 +0100 +++ new/local-lib-2.000014/Changes 2014-09-04 11:49:23.000000000 +0200 @@ -1,5 +1,34 @@ Revision history for local::lib +2.000014 - 2014-09-04 + - fix taint-mode test in some cases on case insensitive filesystems + +2.000013 - 2014-08-16 + - fix test failure in ActiveState perl + - better test diagnostics + - fix quoting of spaces for fish shell (rt#95268) + - improve quoting for use with cmd.exe + - fix quoting any arbitrary character when contructing strings for bash + - skip testing use with shells if the shell doesn't work at all + +2.000012 - 2014-05-12 + - restore build_activate_environment_vars_for, + build_deactivate_environment_vars_for, build_deact_all_environment_vars_for + methods for perlbrew compatibility + - fix transforming relative paths to absolute paths in older perls + - fix quoting for fish shell + +2.000011 - 2014-04-02 + - more fixes for issue where PERL5LIB Carp is not the same version as in the + local-lib + +2.000010 - 2014-03-28 + - fix shell test on cygwin + +2.000_009 - 2014-03-15 + - no longer loads File::Spec, so an upgraded version installed inside a local + lib dir can be used by scripts + 2.000008 - 2014-03-13 - fix --bootstrap option without a path specified diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/MANIFEST new/local-lib-2.000014/MANIFEST --- old/local-lib-2.000008/MANIFEST 2014-03-13 17:30:25.000000000 +0100 +++ new/local-lib-2.000014/MANIFEST 2014-09-04 11:50:06.000000000 +0200 @@ -10,6 +10,7 @@ Makefile.PL MANIFEST This list of files t/bad_variables.t +t/carp-mismatch.t t/classmethod.t t/coderefs_in_inc.t t/de-dup.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/META.json new/local-lib-2.000014/META.json --- old/local-lib-2.000008/META.json 2014-03-13 17:30:25.000000000 +0100 +++ new/local-lib-2.000014/META.json 2014-09-04 11:50:06.000000000 +0200 @@ -4,7 +4,7 @@ "mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter version 2.140640", + "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520", "license" : [ "perl_5" ], @@ -32,7 +32,9 @@ }, "requires" : { "Capture::Tiny" : "0", + "Perl::MinimumVersion" : "1.35", "Test::EOL" : "0", + "Test::MinimumVersion" : "0", "Test::More" : "0.8101", "Test::NoTabs" : "0", "Test::Pod" : "0" @@ -69,5 +71,5 @@ }, "x_IRC" : "irc://irc.perl.org/#local-lib" }, - "version" : "2.000008" + "version" : "2.000014" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/META.yml new/local-lib-2.000014/META.yml --- old/local-lib-2.000008/META.yml 2014-03-13 17:30:25.000000000 +0100 +++ new/local-lib-2.000014/META.yml 2014-09-04 11:50:06.000000000 +0200 @@ -6,7 +6,7 @@ Test::More: '0' configure_requires: {} dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter version 2.140640' +generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,4 +27,4 @@ bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=local-lib license: http://dev.perl.org/licenses/ repository: git://github.com/Perl-Toolchain-Gang/local-lib -version: '2.000008' +version: '2.000014' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/Makefile.PL new/local-lib-2.000014/Makefile.PL --- old/local-lib-2.000008/Makefile.PL 2014-03-13 17:27:36.000000000 +0100 +++ new/local-lib-2.000014/Makefile.PL 2014-09-04 11:47:59.000000000 +0200 @@ -26,6 +26,8 @@ 'Test::Pod' => 0, 'Capture::Tiny' => 0, 'Test::More' => 0.81_01, + 'Test::MinimumVersion' => 0, + 'Perl::MinimumVersion' => 1.35, }, recommends => { 'Test::CPAN::Changes' => 0, @@ -167,7 +169,7 @@ if $status; } -############################################################################## +## BOILERPLATE ############################################################### require ExtUtils::MakeMaker; (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; @@ -178,8 +180,10 @@ ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g; ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g; -$MM_ARGS{LICENSE} = $META{license} - if $eumm_version >= 6.30; +$META{license} = [ $META{license} ] + if $META{license} && !ref $META{license}; +$MM_ARGS{LICENSE} = $META{license}[0] + if $META{license} && $eumm_version >= 6.30; $MM_ARGS{NO_MYMETA} = 1 if $mymeta_broken; $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META } @@ -188,7 +192,7 @@ for (qw(configure build test runtime)) { my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES'; my $r = $MM_ARGS{$key} = { - %{$META{prereqs}{$_}{requires}}, + %{$META{prereqs}{$_}{requires} || {}}, %{delete $MM_ARGS{$key} || {}}, }; defined $r->{$_} or delete $r->{$_} for keys %$r; @@ -206,3 +210,4 @@ if $eumm_version < 6.51_03; ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS); +## END BOILERPLATE ########################################################### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/README new/local-lib-2.000014/README --- old/local-lib-2.000008/README 2014-03-13 17:30:25.000000000 +0100 +++ new/local-lib-2.000014/README 2014-09-04 11:50:06.000000000 +0200 @@ -476,11 +476,11 @@ * Should probably auto-fixup CPAN config if not already done. - * local::lib loads File::Spec. When used to set shell variables, this - isn't a problem. When used inside a perl script, any File::Spec - version inside the local::lib will be ignored. A workaround for this - is using "use lib "$ENV{HOME}/perl5/lib/perl5";" inside the script - instead of using "local::lib" directly. + * On VMS and MacOS Classic (pre-OS X), local::lib loads File::Spec. + This means any File::Spec version installed in the local::lib will + be ignored by scripts using local::lib. A workaround for this is + using "use lib "$local_lib/lib/perl5";" instead of using + "local::lib" directly. * Conflicts with ExtUtils::MakeMaker's "PREFIX" option. "local::lib" uses the "INSTALL_BASE" option, as it has more predictable and sane diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/lib/local/lib.pm new/local-lib-2.000014/lib/local/lib.pm --- old/local-lib-2.000008/lib/local/lib.pm 2014-03-13 17:29:34.000000000 +0100 +++ new/local-lib-2.000014/lib/local/lib.pm 2014-09-04 11:48:41.000000000 +0200 @@ -3,11 +3,88 @@ use strict; use warnings; use Config; -use File::Spec (); -our $VERSION = '2.000008'; # 2.0.8 +our $VERSION = '2.000014'; $VERSION = eval $VERSION; +BEGIN { + *_WIN32 = ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'symbian') + ? sub(){1} : sub(){0}; + # punt on these systems + *_USE_FSPEC = ($^O eq 'MacOS' || $^O eq 'VMS' || $INC{'File/Spec.pm'}) + ? sub(){1} : sub(){0}; +} +our $_DIR_JOIN = _WIN32 ? '\\' : '/'; +our $_DIR_SPLIT = (_WIN32 || $^O eq 'cygwin') ? qr{[\\/]} + : qr{/}; +our $_ROOT = _WIN32 ? do { + my $UNC = qr{[\\/]{2}[^\\/]+[\\/][^\\/]+}; + qr{^(?:$UNC|[A-Za-z]:|)$_DIR_SPLIT}; +} : qr{^/}; +our $_PERL; + +sub _cwd { + my $drive = shift; + if (!$_PERL) { + ($_PERL) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?! + if (_is_abs($_PERL)) { + } + elsif (-x $Config{perlpath}) { + $_PERL = $Config{perlpath}; + } + else { + ($_PERL) = + map { /(.*)/ } + grep { -x $_ } + map { join($_DIR_JOIN, $_, $_PERL) } + split /\Q$Config{path_sep}\E/, $ENV{PATH}; + } + } + local @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; + my $cmd = $drive ? "eval { Cwd::getdcwd(q($drive)) }" + : 'getcwd'; + my $cwd = `"$_PERL" -MCwd -le "print $cmd"`; + chomp $cwd; + if (!length $cwd && $drive) { + $cwd = $drive; + } + $cwd =~ s/$_DIR_SPLIT?$/$_DIR_JOIN/; + $cwd; +} + +sub _catdir { + if (_USE_FSPEC) { + require File::Spec; + File::Spec->catdir(@_); + } + else { + my $dir = join($_DIR_JOIN, @_); + $dir =~ s{($_DIR_SPLIT)(?:\.?$_DIR_SPLIT)+}{$1}g; + $dir; + } +} + +sub _is_abs { + if (_USE_FSPEC) { + require File::Spec; + File::Spec->file_name_is_absolute($_[0]); + } + else { + $_[0] =~ $_ROOT; + } +} + +sub _rel2abs { + my ($dir, $base) = @_; + return $dir + if _is_abs($dir); + + $base = _WIN32 && $dir =~ s/^([A-Za-z]:)// ? _cwd("$1") + : $base ? $base + : _cwd; + return _catdir($base, $dir); +} + sub import { my ($class, @args) = @_; push @args, @ARGV @@ -133,21 +210,21 @@ sub install_base_bin_path { my ($class, $path) = @_; - return File::Spec->catdir($path, 'bin'); + return _catdir($path, 'bin'); } sub install_base_perl_path { my ($class, $path) = @_; - return File::Spec->catdir($path, 'lib', 'perl5'); + return _catdir($path, 'lib', 'perl5'); } sub install_base_arch_path { my ($class, $path) = @_; - File::Spec->catdir($class->install_base_perl_path($path), $_archname); + _catdir($class->install_base_perl_path($path), $_archname); } sub lib_paths_for { my ($class, $path) = @_; my $base = $class->install_base_perl_path($path); - return map { File::Spec->catdir($base, @$_) } @_lib_subdirs; + return map { _catdir($base, @$_) } @_lib_subdirs; } sub _mm_escape_path { @@ -280,6 +357,18 @@ my $self = $_[0]->new->activate($_[1]); $self->build_environment_vars; } +sub build_activate_environment_vars_for { + my $self = $_[0]->new->activate($_[1]); + $self->build_environment_vars; +} +sub build_deactivate_environment_vars_for { + my $self = $_[0]->new->deactivate($_[1]); + $self->build_environment_vars; +} +sub build_deact_all_environment_vars_for { + my $self = $_[0]->new->deactivate_all; + $self->build_environment_vars; +} sub build_environment_vars { my $self = shift; ( @@ -297,6 +386,12 @@ sub setup_local_lib { my $self = shift; + + # if Carp is already loaded, ensure Carp::Heavy is also loaded, to avoid + # $VERSION mismatch errors (Carp::Heavy loads Carp, so we do not need to + # check in the other direction) + require Carp::Heavy if $INC{'Carp.pm'}; + $self->setup_env_hash; @INC = @{$self->inc}; } @@ -331,8 +426,6 @@ $shelltype ||= $self->guess_shelltype; - my $build_method = "build_${shelltype}_env_declaration"; - my $extra = $self->extra; my @envs = ( PATH => $self->bins, @@ -340,6 +433,15 @@ PERL_LOCAL_LIB_ROOT => $self->roots, map { $_ => $extra->{$_} } sort keys %$extra, ); + $self->_build_env_string($shelltype, \@envs); +} + +sub _build_env_string { + my ($self, $shelltype, $envs) = @_; + my @envs = @$envs; + + my $build_method = "build_${shelltype}_env_declaration"; + my $out = ''; while (@envs) { my ($name, $value) = (shift(@envs), shift(@envs)); @@ -351,14 +453,6 @@ && ${$value->[0]} eq $name) { next; } - if ( - !ref $value - and defined $value - ? (defined $ENV{$name} && $value eq $ENV{$name}) - : !defined $ENV{$name} - ) { - next; - } $out .= $self->$build_method($name, $value); } my $wrap_method = "wrap_${shelltype}_output"; @@ -370,21 +464,21 @@ sub build_bourne_env_declaration { my ($class, $name, $args) = @_; - my $value = $class->_interpolate($args, '$%s', '"', '\\%s'); + my $value = $class->_interpolate($args, '${%s}', qr/["\\\$!`]/, '\\%s'); if (!defined $value) { return qq{unset $name;\n}; } - $value =~ s/(^|\G|$_path_sep)\$$name$_path_sep/$1\$$name\${$name+$_path_sep}/g; - $value =~ s/$_path_sep\$$name$/\${$name+$_path_sep}\$$name/; + $value =~ s/(^|\G|$_path_sep)\$\{$name\}$_path_sep/$1\${$name}\${$name+$_path_sep}/g; + $value =~ s/$_path_sep\$\{$name\}$/\${$name+$_path_sep}\${$name}/; qq{${name}="$value"; export ${name};\n} } sub build_csh_env_declaration { my ($class, $name, $args) = @_; - my ($value, @vars) = $class->_interpolate($args, '$%s', '"', '"\\%s"'); + my ($value, @vars) = $class->_interpolate($args, '${%s}', '"', '"\\%s"'); if (!defined $value) { return qq{unsetenv $name;\n}; } @@ -395,9 +489,9 @@ } my $value_without = $value; - if ($value_without =~ s/(?:^|$_path_sep)\$$name(?:$_path_sep|$)//g) { - $out .= qq{if "\$$name" != '' setenv $name "$value";\n}; - $out .= qq{if "\$$name" == '' }; + if ($value_without =~ s/(?:^|$_path_sep)\$\{$name\}(?:$_path_sep|$)//g) { + $out .= qq{if "\${$name}" != '' setenv $name "$value";\n}; + $out .= qq{if "\${$name}" == '' }; } $out .= qq{setenv $name "$value_without";\n}; return $out; @@ -405,7 +499,7 @@ sub build_cmd_env_declaration { my ($class, $name, $args) = @_; - my $value = $class->_interpolate($args, '%%%s%%', qr([()!^"<>&|]), '^%s'); + my $value = $class->_interpolate($args, '%%%s%%', qr(%), '%s'); if (!$value) { return qq{\@set $name=\n}; } @@ -413,10 +507,10 @@ my $out = ''; my $value_without = $value; if ($value_without =~ s/(?:^|$_path_sep)%$name%(?:$_path_sep|$)//g) { - $out .= qq{\@if not "%$name%"=="" set $name=$value\n}; + $out .= qq{\@if not "%$name%"=="" set "$name=$value"\n}; $out .= qq{\@if "%$name%"=="" }; } - $out .= qq{\@set $name=$value_without\n}; + $out .= qq{\@set "$name=$value_without"\n}; return $out; } @@ -441,7 +535,7 @@ sub build_fish_env_declaration { my ($class, $name, $args) = @_; - my $value = $class->_interpolate($args, '$%s', '"', '\\%s'); + my $value = $class->_interpolate($args, '$%s', qr/[\\"' ]/, '\\%s'); if (!defined $value) { return qq{set -e $name;\n}; } @@ -519,7 +613,7 @@ } }; unless (defined $homedir) { - require Carp; + require Carp; require Carp::Heavy; Carp::croak( "Couldn't resolve homedir for " .(defined $user ? $user : 'current user') @@ -531,7 +625,7 @@ sub resolve_relative_path { my ($class, $path) = @_; - $path = File::Spec->rel2abs($path); + _rel2abs($path); } sub ensure_dir_structure_for { @@ -1207,11 +1301,10 @@ =item * Should probably auto-fixup CPAN config if not already done. -=item * local::lib loads L<File::Spec>. When used to set shell variables, -this isn't a problem. When used inside a perl script, any L<File::Spec> -version inside the local::lib will be ignored. A workaround for this is using -C<use lib "$ENV{HOME}/perl5/lib/perl5";> inside the script instead of using -C<local::lib> directly. +=item * On VMS and MacOS Classic (pre-OS X), local::lib loads L<File::Spec>. +This means any L<File::Spec> version installed in the local::lib will be +ignored by scripts using local::lib. A workaround for this is using +C<use lib "$local_lib/lib/perl5";> instead of using C<local::lib> directly. =item * Conflicts with L<ExtUtils::MakeMaker>'s C<PREFIX> option. C<local::lib> uses the C<INSTALL_BASE> option, as it has more predictable and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/t/carp-mismatch.t new/local-lib-2.000014/t/carp-mismatch.t --- old/local-lib-2.000008/t/carp-mismatch.t 1970-01-01 01:00:00.000000000 +0100 +++ new/local-lib-2.000014/t/carp-mismatch.t 2014-05-05 21:27:01.000000000 +0200 @@ -0,0 +1,51 @@ +use strict; +use warnings; + +# something else (presumably a core module that local::lib uses) loads Carp, +# and then later on something loads Carp::Heavy from the local-lib, which is +# at a newer version + +use Carp; +use Test::More tests => 4 + ( $Carp::VERSION < '1.22' ? 0 : 1 ); +use File::Spec; +use File::Path qw(mkpath rmtree); # use legacy versions for backcompat +use local::lib (); + +is $Carp::Heavy::VERSION, undef, 'Carp::Heavy is not yet loaded'; + +# we do not use File::Temp because it loads Carp::Heavy. +my $libdir = File::Spec->catdir(File::Spec->tmpdir, 'tmp-carp-newer-' . $$); +my $carpdir = File::Spec->catdir($libdir, 'lib', 'perl5', 'Carp'); +mkpath($carpdir); + +{ + my $heavy = File::Spec->catfile($carpdir, 'Heavy.pm'); + open my $fh, '>', $heavy or die "failed to open $heavy for writing: $!"; + print $fh "package Carp::Heavy;\nour \$VERSION = '500.0';\n"; + close $fh; +} +{ + # another module, simply to ensure that we got the libdir path correct + my $foo = File::Spec->catfile($carpdir, 'Foo.pm'); + open my $fh, '>', $foo or die "failed to open foo heavy for writing: $!"; + print $fh "package Carp::Foo;\nour \$VERSION = '200.0';\n"; + close $fh; +} + +local::lib->import($libdir); + +require Carp::Foo; +is $Carp::Foo::VERSION, '200.0', + 'some other module was loaded from our local::lib'; + +ok $INC{'Carp/Heavy.pm'}, 'Carp::Heavy has now been loaded'; +is $Carp::Heavy::VERSION, $Carp::VERSION, + 'Carp::Heavy matching Carp was loaded' + unless $Carp::VERSION < '1.22'; # Carp::Heavy namespace did not exist +isnt $Carp::Heavy::VERSION, '500.0', + 'Carp::Heavy was not loaded from our local::lib'; + + +END { + rmtree($libdir) if $libdir; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/t/shell.t new/local-lib-2.000014/t/shell.t --- old/local-lib-2.000008/t/shell.t 2014-03-13 11:17:28.000000000 +0100 +++ new/local-lib-2.000014/t/shell.t 2014-07-26 08:54:49.000000000 +0200 @@ -4,8 +4,10 @@ use File::Spec; use File::Basename qw(dirname); use File::Temp (); +use File::Path; use Config; use local::lib (); +use IPC::Open3 qw(open3); my @ext = $^O eq 'MSWin32' ? (split /\Q$Config{path_sep}/, $ENV{PATHEXT}) : (); sub which { @@ -18,6 +20,19 @@ return $full; } +BEGIN { + *quote_literal = + $^O ne 'MSWin32' + ? sub { $_[0] } + : sub { + my ($text) = @_; + $text =~ s{(\\*)(?="|\z)}{$1$1}g; + $text =~ s{"}{\\"}g; + $text = qq{"$text"}; + return $text; + }; +} + my %shell_path; { my @shell_paths; @@ -32,50 +47,61 @@ ( '/bin/sh', '/bin/csh', $ENV{'ComSpec'}, @shell_paths ); } -my $extra_lib = '-I"' . dirname(dirname($INC{'local/lib.pm'})) . '"'; +my @extra_lib = ('-I' . dirname(dirname($INC{'local/lib.pm'}))); +my $nul = File::Spec->devnull; my @shells; for my $shell ( { name => 'sh', + test => '-c "exit 0"', }, { name => 'dash', + test => '-c "exit 0"', }, { name => 'bash', + test => '-c "exit 0"', }, { name => 'zsh', + test => '-c "exit 0"', }, { name => 'ksh', + test => '-c "exit 0"', }, { name => 'csh', + test => '-c "exit 0"', opt => '-f', }, { name => 'tcsh', + test => '-c "exit 0"', opt => '-f', }, { name => 'fish', + test => '-c "exit 0"', }, { name => 'cmd.exe', opt => '/Q /D /C', + test => '/Q /D /C "exit 0"', ext => 'bat', perl => qq{@"$^X"}, - skip => !$^O eq 'MSWin32', + skip => $^O ne 'MSWin32', }, { name => 'powershell.exe', shell => which('powershell.exe'), opt => '-NoProfile -ExecutionPolicy Unrestricted -File', + test => '-NoProfile -Command "exit 0"', ext => 'ps1', perl => qq{& '$^X'}, - skip => !$^O eq 'MSWin32', + skip => $^O ne 'MSWin32', }, ) { my $name = $shell->{name}; @@ -94,72 +120,132 @@ elsif ($shell->{skip} || !$shell->{shell}) { next; } + elsif ($shell->{test}) { + no warnings 'exec'; + if (system "$shell->{shell} $shell->{test} > $nul 2> $nul") { + diag "$name seems broken, skipping"; + next; + } + } push @shells, $shell; } if (!@shells) { plan skip_all => 'no supported shells found'; } -plan tests => 6*@shells; +my @vars = qw(PATH PERL5LIB PERL_LOCAL_LIB_ROOT PERL_MM_OPT PERL_MB_OPT); +my @strings = ( + 'string', + 'with space', + 'with"quote', + "with'squote", + 'with\\bslash', + 'with%per%cent', +); + +plan tests => @shells * (@vars * 2 + @strings * 2); my $sep = $Config{path_sep}; my $root = File::Spec->rootdir; for my $shell (@shells) { - my $ll = File::Temp->newdir(); - my $ll_dir = local::lib->normalize_path("$ll"); - local $ENV{PERL_LOCAL_LIB_ROOT}; - delete $ENV{PERL_LOCAL_LIB_ROOT}; - local $ENV{PATH} = $root; - local $ENV{PERL5LIB}; - delete $ENV{PERL5LIB}; - my $bin_path = local::lib->install_base_bin_path($ll_dir); + my $ll = local::lib->normalize_path(File::Temp::tempdir(CLEANUP => 1)); + local $ENV{$_} + for @vars; + delete $ENV{$_} + for @vars; + $ENV{PATH} = $root; + my $bin_path = local::lib->install_base_bin_path($ll); mkdir $bin_path; - my $env = call_ll($shell, "$ll"); - is $env->{PERL_LOCAL_LIB_ROOT}, $ll_dir, + my $env = call_ll($shell, $ll); + is $env->{PERL_LOCAL_LIB_ROOT}, $ll, "$shell->{name}: activate root"; like $env->{PATH}, qr/^\Q$bin_path$sep\E/, "$shell->{name}: activate PATH"; - is $env->{PERL5LIB}, local::lib->install_base_perl_path($ll_dir), + is $env->{PERL5LIB}, local::lib->install_base_perl_path($ll), "$shell->{name}: activate PERL5LIB"; + my %install_opts = local::lib->installer_options_for($ll); + for my $var (qw(PERL_MM_OPT PERL_MB_OPT)) { + is $env->{$var}, $install_opts{$var}, + "$shell->{name}: activate $var"; + } - $ENV{$_} = $env->{$_} for qw(PATH PERL5LIB PERL_LOCAL_LIB_ROOT); + $ENV{$_} = $env->{$_} for @vars; $env = call_ll($shell, '--deactivate', "$ll"); - is $env->{PERL_LOCAL_LIB_ROOT}, undef, - "$shell->{name}: deactivate root"; unlike $env->{PATH}, qr/^\Q$bin_path$sep\E/, "$shell->{name}: deactivate PATH"; - is $env->{PERL5LIB}, undef, - "$shell->{name}: deactivate PERL5LIB"; + for my $var (grep { $_ ne 'PATH' } @vars) { + is $env->{$var}, undef, + "$shell->{name}: deactivate $var"; + } + + my $shelltype = do { + local $ENV{SHELL} = $shell->{shell}; + local::lib->guess_shelltype; + }; + for my $string (@strings) { + local $TODO = "$shell->{name}: can't quote strings with percents" + if $shell->{name} eq 'cmd.exe' && $string =~ /%/; + + local $ENV{LL_TEST}; + delete $ENV{LL_TEST}; + my $script = local::lib->_build_env_string($shelltype, [ + LL_TEST => $string, + ]); + my $env = call_shell($shell, $script); + is $env->{LL_TEST}, $string, "$shell->{name}: can quote [$string]"; + + local $TODO = "$shell->{name}: can't test strings with double quotes" + if $shell->{name} eq 'cmd.exe' && $string =~ /"/; + + $ENV{LL_TEST} = 'pre'; + $script = local::lib->_build_env_string($shelltype, [ + LL_TEST => [\"LL_TEST", $string], + ]); + $env = call_shell($shell, $script); + is $env->{LL_TEST}, "pre$sep$string", + "$shell->{name}: can append [$string]"; + } } sub call_ll { my ($info, @options) = @_; - my $option = @options ? '='.join(',', @options) : ''; - local $ENV{SHELL} = $info->{shell}; - my $script - = `"$^X" $extra_lib -Mlocal::lib$option` . "\n" - . qq{$info->{perl} -Mt::lib::ENVDumper -e1\n}; - - my $file = File::Temp->new( - TEMPLATE => 'll-test-script-XXXXX', - TMPDIR => 1, + open my $in, '<', File::Spec->devnull; + open my $err, '>', File::Spec->devnull; + open3 $in, my $out, $err, + $^X, @extra_lib, '-Mlocal::lib', '-', '--no-create', + map { quote_literal($_) } @options + or die "blah"; + my $script = do { local $/; <$out> }; + close $out; + call_shell($info, $script); +} + +sub call_shell { + my ($info, $script) = @_; + $script .= "\n" . qq{$info->{perl} -Mt::lib::ENVDumper -e1\n}; + + my ($fh, $file) = File::Temp::tempfile( + 'll-test-script-XXXXX', + DIR => File::Spec->tmpdir, SUFFIX => '.'.$info->{ext}, + UNLINK => 1, ); - print { $file } $script; - close $file; + print { $fh } $script; + close $fh; my $opt = $info->{opt} ? "$info->{opt} " : ''; my $cmd = qq{"$info->{shell}" $opt"$file"}; - my $out = `$cmd`; + my $output = `$cmd`; if ($?) { diag "script:\n$script"; diag "running:\n$cmd"; - die "failed with code: $?"; + diag "failed with code: $?"; + return {}; } - my $env = eval $out or die "bad output: $@"; + my $env = eval $output or die "bad output: $@"; $env; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/t/taint-mode.t new/local-lib-2.000014/t/taint-mode.t --- old/local-lib-2.000008/t/taint-mode.t 2014-03-13 11:17:28.000000000 +0100 +++ new/local-lib-2.000014/t/taint-mode.t 2014-08-19 14:39:11.000000000 +0200 @@ -6,11 +6,13 @@ use strict; use warnings; -use Test::More tests => 3; +use Cwd; # load before anything else to work around ActiveState bug +use Test::More tests => 4; use File::Temp 'tempfile'; -use Cwd; +use File::Basename qw(basename dirname); use File::Spec; use IPC::Open3; +use Config; use lib 't/lib'; use TempDir; @@ -26,7 +28,12 @@ # Create a script that has taint mode turned on, and tries to use a # local lib to the same temp dir. -my ($fh, $filename) = tempfile('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), UNLINK => 1); +mkdir 't/temp'; +my ($fh, $filename) = tempfile( + 'test_local_lib-XXXXX', + DIR => Cwd::abs_path('t/temp'), + UNLINK => 1, +); print $fh <<"EOM"; #!/usr/bin/perl -T @@ -53,3 +60,34 @@ ok !grep($_ eq $dir2_lib, @libs), 'local::lib not used used in taint script not added to @INC' or diag "searched for '$dir2_lib' in: ", join(', ', map "'$_'", @libs); + +{ + my $perl_file = basename($^X); + if (!File::Spec->file_name_is_absolute($^X)) { + my $perl_dir = dirname($^X); + $ENV{PATH} = join($Config{path_sep}, $ENV{PATH}, $perl_dir); + } + + my ($fh, $filename) = tempfile( + 'test_local_lib-XXXXX', + DIR => Cwd::abs_path('t/temp'), + UNLINK => 1, + ); + + print $fh <<'EOM'; +#!/usr/bin/perl -T +use strict; use warnings; +use local::lib (); +print local::lib::_cwd(); +EOM + close $fh; + + open my $err, '>', File::Spec->devnull + or die "can't open null output: $!"; + my $out; + my $pid = open3($in, $out, $err, $^X, map("-I$_", @INC_CLEAN), '-T', $filename); + my $cwd = do { local $/; <$out> }; + $cwd =~ s/[\r\n]*\z//; + $cwd = File::Spec->canonpath($cwd); + is $cwd, File::Spec->canonpath(Cwd::getcwd()), 'reimplemented cwd matches standard cwd'; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/xt/bootstrap.t new/local-lib-2.000014/xt/bootstrap.t --- old/local-lib-2.000008/xt/bootstrap.t 2014-03-13 11:17:28.000000000 +0100 +++ new/local-lib-2.000014/xt/bootstrap.t 2014-04-03 22:55:17.000000000 +0200 @@ -48,14 +48,14 @@ @perl = $^X unless @perl; -my @modules = ( - [ 'ExtUtils::MakeMaker' => 6.74 ], - [ 'ExtUtils::Install' => 1.43 ], - [ 'Module::Build' => 0.36 ], - [ 'CPAN' => 1.82 ], +my %modules = ( + 'ExtUtils::MakeMaker' => 6.74, + 'ExtUtils::Install' => 1.43, + 'Module::Build' => 0.36, + 'CPAN' => 1.82, ); -plan tests => @perl * (1+@modules); +plan tests => @perl * (1+keys %modules); for my $perl (@perl) { local @INC = @INC; @@ -71,10 +71,12 @@ local $ENV{HOME} = my $home = File::Temp::tempdir('local-lib-home-XXXXX', CLEANUP => 1, TMPDIR => 1); diag "testing bootstrap with $perl"; - for my $module (@modules) { - my $version = check_version($perl, $module->[0]); - if ($version && $version >= $module->[1]) { - diag "Can't test bootstrap of $module->[0], version $version already meets requirement of $module->[1]"; + my %old_versions; + for my $module (sort keys %modules) { + my $version = check_version($perl, $module); + $old_versions{$module} = $version; + if ($version && $version >= $modules{$module}) { + diag "Can't test bootstrap of $module, version $version already meets requirement of $modules{$module}"; } } @@ -94,13 +96,18 @@ local::lib->setup_env_hash_for($ll); - for my $module (@modules) { + for my $module (sort keys %modules) { SKIP: { - my $need_version = $meta->{requires}{$module->[0]} - or skip "$module->[0] not needed for $perl", 1; - my $version = check_version($perl, $module->[0]); - cmp_ok $version, '>=', $module->[1], "bootstrap installed new enough $module->[0]" - or diag "PERL5LIB: $ENV{PERL5LIB}"; + my $need_version = $meta->{requires}{$module} + or skip "$module not needed for $perl", 1; + my $version = check_version($perl, $module); + if (defined $old_versions{$module}) { + cmp_ok $version, '>=', $modules{$module}, "bootstrap upgraded to new enough $module" + or diag "PERL5LIB: $ENV{PERL5LIB}"; + } + else { + is $version, undef, "bootstrap didn't install new module $module"; + } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/xt/install.t new/local-lib-2.000014/xt/install.t --- old/local-lib-2.000008/xt/install.t 2014-03-13 17:13:23.000000000 +0100 +++ new/local-lib-2.000014/xt/install.t 2014-07-26 14:11:26.000000000 +0200 @@ -55,6 +55,13 @@ for my $dir_base (@dirs) { for my $dist_type (sort keys %dist_types) { chdir $orig_dir; + local @ENV{ + 'PERL_MM_OPT', + 'PERL_MB_OPT', + 'PERL_LOCAL_LIB_ROOT', + grep /^MAKE/, keys %ENV + }; + local $ENV{PERL5LIB} = $ENV{PERL5LIB}; my $temp = mk_temp_dir("install-$dist_type-XXXXX"); my $ll_dir = "$dist_type-$dir_base"; my $ll = "$temp/$ll_dir"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000008/xt/release/minimum-version.t new/local-lib-2.000014/xt/release/minimum-version.t --- old/local-lib-2.000008/xt/release/minimum-version.t 2014-01-21 00:42:00.000000000 +0100 +++ new/local-lib-2.000014/xt/release/minimum-version.t 2014-07-25 12:28:40.000000000 +0200 @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More skip_all => 'Broken until RT#89173 is fixed'; +use Perl::MinimumVersion 1.35; use Test::MinimumVersion; all_minimum_version_ok( qq{5.006} ); -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de