Hello community, here is the log from the commit of package perl-local-lib for openSUSE:Factory checked in at 2017-07-11 08:24:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-local-lib (Old) and /work/SRC/openSUSE:Factory/.perl-local-lib.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-local-lib" Tue Jul 11 08:24:42 2017 rev:15 rq:506099 version:2.000023 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-local-lib/perl-local-lib.changes 2016-05-25 21:27:20.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-local-lib.new/perl-local-lib.changes 2017-07-11 08:24:44.432797394 +0200 @@ -1,0 +2,32 @@ +Fri Jun 9 06:42:51 UTC 2017 - [email protected] + +- updated to 2.000023 + see /usr/share/doc/packages/perl-local-lib/Changes + + 2.000023 - 2017-06-07 + - fix use of 'note' in test for compatibilty with old Test::More + + 2.000022 - 2017-06-07 + - releasing as stable + + 2.000_021 - 2017-04-23 + - account for an empty SHELL variable when detecting shell + - author test cleanups + - bootstrapping option --no-manpages now affects bootstrapping process, not + just later module installs + - cope with home directories with spaces when bootstrapping with old CPAN.pm + + 2.000_020 - 2016-10-18 + - fix handling of inc_version_list + - don't load strict or warnings outside author mode + - load and use Cwd when we're printing and exiting + - use loaded Cwd/Win32::Cwd if it's available + - handle relative paths in current executable + - don't try to run current executable in embedded perl + - handle relative directories better + - fix shell test for powershell 1 and group policy restricted environments + - avoid user init files in shell test + - use safer format to check environment in shell test + - many test cleanups + +------------------------------------------------------------------- Old: ---- local-lib-2.000019.tar.gz New: ---- cpanspec.yml local-lib-2.000023.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-local-lib.spec ++++++ --- /var/tmp/diff_new_pack.DFPaLM/_old 2017-07-11 08:24:45.468651296 +0200 +++ /var/tmp/diff_new_pack.DFPaLM/_new 2017-07-11 08:24:45.468651296 +0200 @@ -1,8 +1,7 @@ -# vim: set ts=4 sw=4 et: # # spec file for package perl-local-lib # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,16 +17,18 @@ Name: perl-local-lib -Version: 2.000019 +Version: 2.000023 Release: 0 +%define cpan_name local-lib Summary: Create and Use a Local Lib/ for Perl Modules with Perl5lib License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl -%define cpan_name local-lib -Source: http://www.cpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz +Url: http://search.cpan.org/dist/local-lib/ +Source0: https://cpan.metacpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz Source1: perl-homedir.sh Source2: perl-homedir.csh -Url: http://search.cpan.org/dist/local-lib/ +Source3: cpanspec.yml +BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros @@ -36,6 +37,9 @@ BuildRequires: perl(ExtUtils::MakeMaker) >= 7.00 BuildRequires: perl(Module::Build) >= 0.360000 Requires: perl(CPAN) >= 1.82 +Requires: perl(ExtUtils::Install) >= 1.43 +Requires: perl(ExtUtils::MakeMaker) >= 7.00 +Requires: perl(Module::Build) >= 0.360000 %{perl_requires} %description @@ -53,6 +57,23 @@ hasn't applied a patch to a module of theirs that you need for your application. +On import, local::lib sets the following environment variables to +appropriate values: + +* PERL_MB_OPT + +* PERL_MM_OPT + +* PERL5LIB + +* PATH + +* PERL_LOCAL_LIB_ROOT + +When possible, these will be appended to instead of overwritten entirely. + +These values are then available for reference by any code after import. + %package -n perl-homedir Summary: Per-user Perl local::lib setup Group: Development/Libraries/Perl @@ -69,30 +90,23 @@ install this package. %prep -%setup -q -n "local-lib-%{version}" -%__chmod 0644 Changes +%setup -q -n %{cpan_name}-%{version} %build -unset PERL_MM_OPT -%__perl Makefile.PL INSTALLDIRS=vendor PREFIX="%{_prefix}" -%__make %{?jobs:-j%{jobs}} +%{__perl} Makefile.PL INSTALLDIRS=vendor +%{__make} %{?_smp_mflags} + +%check +%{__make} test %install -unset PERL_MM_OPT %perl_make_install - -%__chmod 0644 "%{buildroot}%{perl_vendorlib}/local/lib.pm" -%__chmod 0644 "%{buildroot}%{perl_vendorlib}/POD2"/*/"local/lib.pod" -%__chmod 0644 "%{buildroot}%{perl_man3dir}"/POD2::*::local::lib.%{perl_man3ext} - %perl_process_packlist - +# MANUAL BEGIN %__install -d "%{buildroot}%{_sysconfdir}/profile.d" %__install -m0644 "%{SOURCE1}" "%{SOURCE2}" "%{buildroot}%{_sysconfdir}/profile.d/" - -%check -unset PERL_MM_OPT -%__make test +# MANUAL END +%perl_gen_filelist %files %defattr(-,root,root) @@ -102,8 +116,6 @@ %{perl_vendorlib}/lib/core/only.pm %dir %{perl_vendorlib}/local/ %{perl_vendorlib}/local/lib.pm -%dir %{perl_vendorarch}/auto/local -%{perl_vendorarch}/auto/local/lib %doc %{perl_man3dir}/lib::core::only.%{perl_man3ext}%{ext_man} %doc %{perl_man3dir}/local::lib.%{perl_man3ext}%{ext_man} ++++++ cpanspec.yml ++++++ --- #description_paragraphs: 3 #description: |- # override description from CPAN #summary: override summary from CPAN #no_testing: broken upstream sources: - perl-homedir.sh - perl-homedir.csh #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_build: |- # rm unused.files post_install: |- %__install -d "%{buildroot}%{_sysconfdir}/profile.d" %__install -m0644 "%{SOURCE1}" "%{SOURCE2}" "%{buildroot}%{_sysconfdir}/profile.d/" #license: SUSE-NonFree #skip_noarch: 1 #custom_build: |- #./Build build flags=%{?_smp_mflags} --myflag #custom_test: |- #startserver && make test #ignore_requires: Bizarre::Module ++++++ local-lib-2.000019.tar.gz -> local-lib-2.000023.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/Changes new/local-lib-2.000023/Changes --- old/local-lib-2.000019/Changes 2016-04-19 16:48:02.000000000 +0200 +++ new/local-lib-2.000023/Changes 2017-06-07 11:11:52.000000000 +0200 @@ -1,5 +1,31 @@ Revision history for local::lib +2.000023 - 2017-06-07 + - fix use of 'note' in test for compatibilty with old Test::More + +2.000022 - 2017-06-07 + - releasing as stable + +2.000_021 - 2017-04-23 + - account for an empty SHELL variable when detecting shell + - author test cleanups + - bootstrapping option --no-manpages now affects bootstrapping process, not + just later module installs + - cope with home directories with spaces when bootstrapping with old CPAN.pm + +2.000_020 - 2016-10-18 + - fix handling of inc_version_list + - don't load strict or warnings outside author mode + - load and use Cwd when we're printing and exiting + - use loaded Cwd/Win32::Cwd if it's available + - handle relative paths in current executable + - don't try to run current executable in embedded perl + - handle relative directories better + - fix shell test for powershell 1 and group policy restricted environments + - avoid user init files in shell test + - use safer format to check environment in shell test + - many test cleanups + 2.000019 - 2016-04-19 - fix bootstrapping into directory with spaces (PR#4) - fix variable interpolation to work when used with sh -u (RT#112711) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/MANIFEST new/local-lib-2.000023/MANIFEST --- old/local-lib-2.000019/MANIFEST 2016-04-19 16:48:24.000000000 +0200 +++ new/local-lib-2.000023/MANIFEST 2017-06-07 11:12:39.000000000 +0200 @@ -13,7 +13,6 @@ t/bad_variables.t t/carp-mismatch.t t/classmethod.t -t/coderefs_in_inc.t t/de-dup.t t/lib-core-only.t t/lib/ENVDumper.pm @@ -24,14 +23,14 @@ t/subroutine-in-inc.t t/taint-mode.t xt/author/cpan-changes.t -xt/author/eol.t -xt/author/no-tabs.t xt/author/pod-syntax.t xt/bootstrap.t xt/cpan-bootstrap.pl xt/cpan-bootstrap.t xt/install.t xt/lib/dist_util.pm +xt/release/eol.t +xt/release/no-tabs.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) README README file (added by Distar) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/META.json new/local-lib-2.000023/META.json --- old/local-lib-2.000019/META.json 2016-04-19 16:48:24.000000000 +0200 +++ new/local-lib-2.000023/META.json 2017-06-07 11:12:39.000000000 +0200 @@ -4,13 +4,13 @@ "mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150001", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "local-lib", "no_index" : { @@ -68,5 +68,6 @@ }, "x_IRC" : "irc://irc.perl.org/#local-lib" }, - "version" : "2.000019" + "version" : "2.000023", + "x_serialization_backend" : "JSON::PP version 2.94" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/META.yml new/local-lib-2.000023/META.yml --- old/local-lib-2.000019/META.yml 2016-04-19 16:48:24.000000000 +0200 +++ new/local-lib-2.000023/META.yml 2017-06-07 11:12:38.000000000 +0200 @@ -6,7 +6,7 @@ Test::More: '0' configure_requires: {} dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150001' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,4 +27,5 @@ 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.000019' +version: '2.000023' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/Makefile.PL new/local-lib-2.000023/Makefile.PL --- old/local-lib-2.000019/Makefile.PL 2016-04-19 13:33:37.000000000 +0200 +++ new/local-lib-2.000023/Makefile.PL 2016-12-27 20:25:56.000000000 +0100 @@ -94,16 +94,16 @@ DEATH } -my $bootstrapping; my $disable_manpages; +if(my ($x) = grep { /^--no-manpages$/ } @ARGV) { + $disable_manpages = 1; + @ARGV = grep { !/^--no-manpages/ } @ARGV; +} + +my $bootstrapping; if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) { @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV; my ($path) = $x =~ /^--bootstrap(?:=(.*))?$/; - if(my ($x) = grep { /^--no-manpages$/ } @ARGV) { - $disable_manpages = 1; - @ARGV = grep { !/^--no-manpages/ } @ARGV; - } - { local @INC = @INC; unshift(@INC, 'lib'); @@ -127,6 +127,13 @@ } } +if ($disable_manpages) { + $ENV{PERL_MM_OPT} = ($ENV{PERL_MM_OPT}||'') . ' INSTALLMAN1DIR=none INSTALLMAN3DIR=none'; + $ENV{PERL_MB_OPT} = ($ENV{PERL_MB_OPT}||'') . ' --install_path libdoc="" --install_path bindoc=""'; + $MM_ARGS{INSTALLMAN1DIR} = 'none'; + $MM_ARGS{INSTALLMAN3DIR} = 'none'; +} + if ($bootstrapping) { my @modules = grep $requires->{$_}, qw(ExtUtils::MakeMaker ExtUtils::Install Module::Build CPAN); @@ -169,7 +176,7 @@ ## BOILERPLATE ############################################################### require ExtUtils::MakeMaker; -(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; +(do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; # have to do this since old EUMM dev releases miss the eval $VERSION line my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/inc/CPANBootstrapper.pm new/local-lib-2.000023/inc/CPANBootstrapper.pm --- old/local-lib-2.000019/inc/CPANBootstrapper.pm 2016-04-19 13:33:37.000000000 +0200 +++ new/local-lib-2.000023/inc/CPANBootstrapper.pm 2017-01-24 12:19:03.000000000 +0100 @@ -45,6 +45,88 @@ CPAN->import; CPAN::Config->load; + if ($CPAN::VERSION < 1.94_54) { + # CPAN can't download into a directory with spaces. it shells out to + # wget/curl, but doesn't quote the arguments. Change directories beforehand + # and use a relative filename so the command doesn't need quoting. + require Cwd; + require File::Basename; + require File::Path; + my $hosthard = defined &CPAN::FTP::hostdlhard ? 'hostdlhard' : 'hosthard'; + no strict 'refs'; + no warnings 'redefine'; + my $hosthardsub = \&{"CPAN::FTP::$hosthard"}; + *{"CPAN::FTP::$hosthard"} = sub { + my($self,$host_seq,$file,$aslocal,@rest) = @_; + if ($aslocal !~ m{[^a-zA-Z0-9+=_:,./-]}) { + $hosthardsub->(@_); + } + my $cwd = Cwd::cwd(); + my $local_dir = File::Basename::dirname($aslocal); + my $local_file = File::Basename::basename($aslocal); + File::Path::mkpath($local_dir); + my $out; + eval { + chdir $local_dir; + $out = $hosthardsub->($self, $host_seq, $file, $local_file, @rest); + 1; + } or do { + chdir $cwd; + die $@; + }; + chdir $cwd; + if (defined $out && $out eq $local_file) { + return $aslocal; + } + return; + }; + } + + if ($CPAN::VERSION < 1.87_51) { + if (!$CPAN::META->has_inst("Compress::Zlib")) { + # gzip and tar commands shell out without quoting arguments. Wrap them in + # a quoting routine. + no warnings 'redefine'; + my $quote = sub { + map +( + /^"/ ? $_ + : m{[^a-zA-Z0-9+=_:,./-]} ? qq["$_"] + : $_ + ), @_; + }; + + my $gzip = \&CPAN::Tarzip::gzip; + *CPAN::Tarzip::gzip = sub { + $gzip->($_[0], $quote->(@_[1,2])); + }; + my $gunzip = \&CPAN::Tarzip::gunzip; + *CPAN::Tarzip::gunzip = sub { + $gunzip->($_[0], $quote->(@_[1,2])); + }; + my $gtest = \&CPAN::Tarzip::gtest; + *CPAN::Tarzip::gtest = sub { + $gtest->($_[0], $quote->($_[1])); + }; + my $TIEHANDLE = \&CPAN::Tarzip::TIEHANDLE; + *CPAN::Tarzip::TIEHANDLE = sub { + $TIEHANDLE->($_[0], $quote->($_[1])); + }; + } + if (MM->maybe_command($CPAN::Config->{gzip}) + && + MM->maybe_command($CPAN::Config->{tar})) { + my $untar = \&CPAN::Tarzip::untar; + *CPAN::Tarzip::untar = sub { + my ($class, $file) = @_; + # the original untar checks for .gz at the end, so quote it like + # "file.tar".gz + my $gz = $file =~ s/\.gz$//; + $file = qq["$file"] . ($gz ? '.gz' : ''); + $untar->($class, $file); + }; + } + } + # ExtUtils::ParseXS is a prerequisite of Module::Build. Previously, # it included a Build.PL file. If CPAN.pm is configured to prefer # Module::Build (the default), it would see the Build.PL file and assume @@ -53,7 +135,12 @@ # Build.PL anymore, but continue to prefer EUMM as a precaution. $CPAN::Config->{prefer_installer} = "EUMM"; - force('install', @modules); + if (defined ¬est) { + notest('install', @modules); + } + else { + force('install', @modules); + } } sub cmd_disable_manpages { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/lib/local/lib.pm new/local-lib-2.000023/lib/local/lib.pm --- old/local-lib-2.000019/lib/local/lib.pm 2016-04-19 15:00:25.000000000 +0200 +++ new/local-lib-2.000023/lib/local/lib.pm 2017-06-07 11:11:40.000000000 +0200 @@ -1,10 +1,16 @@ package local::lib; use 5.006; -use strict; -use warnings; -use Config; +BEGIN { + if ($ENV{RELEASE_TESTING}) { + require strict; + strict->import; + require warnings; + warnings->import; + } +} +use Config (); -our $VERSION = '2.000019'; +our $VERSION = '2.000023'; $VERSION = eval $VERSION; BEGIN { @@ -14,6 +20,11 @@ *_USE_FSPEC = ($^O eq 'MacOS' || $^O eq 'VMS' || $INC{'File/Spec.pm'}) ? sub(){1} : sub(){0}; } +my $_archname = $Config::Config{archname}; +my $_version = $Config::Config{version}; +my @_inc_version_list = reverse split / /, $Config::Config{inc_version_list}; +my $_path_sep = $Config::Config{path_sep}; + our $_DIR_JOIN = _WIN32 ? '\\' : '/'; our $_DIR_SPLIT = (_WIN32 || $^O eq 'cygwin') ? qr{[\\/]} : qr{/}; @@ -23,27 +34,50 @@ } : qr{^/}; our $_PERL; -sub _cwd { - my $drive = shift; +sub _perl { if (!$_PERL) { - ($_PERL) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?! + # untaint and validate + ($_PERL, my $exe) = $^X =~ /((?:.*$_DIR_SPLIT)?(.+))/; + $_PERL = 'perl' + if $exe !~ /perl/; if (_is_abs($_PERL)) { } - elsif (-x $Config{perlpath}) { - $_PERL = $Config{perlpath}; + elsif (-x $Config::Config{perlpath}) { + $_PERL = $Config::Config{perlpath}; + } + elsif ($_PERL =~ $_DIR_SPLIT && -x $_PERL) { + $_PERL = _rel2abs($_PERL); } else { ($_PERL) = map { /(.*)/ } grep { -x $_ } + map { ($_, _WIN32 ? ("$_.exe") : ()) } map { join($_DIR_JOIN, $_, $_PERL) } - split /\Q$Config{path_sep}\E/, $ENV{PATH}; + split /\Q$_path_sep\E/, $ENV{PATH}; } } + $_PERL; +} + +sub _cwd { + if (my $cwd + = defined &Cwd::sys_cwd ? \&Cwd::sys_cwd + : defined &Cwd::cwd ? \&Cwd::cwd + : undef + ) { + no warnings 'redefine'; + *_cwd = $cwd; + goto &$cwd; + } + my $drive = shift; + return Win32::Cwd() + if _WIN32 && defined &Win32::Cwd && !$drive; 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"`; + my $perl = _perl; + my $cwd = `"$perl" -MCwd -le "print $cmd"`; chomp $cwd; if (!length $cwd && $drive) { $cwd = $drive; @@ -80,7 +114,7 @@ if _is_abs($dir); $base = _WIN32 && $dir =~ s/^([A-Za-z]:)// ? _cwd("$1") - : $base ? $base + : $base ? _rel2abs($base) : _cwd; return _catdir($base, $dir); } @@ -96,8 +130,10 @@ sub import { my ($class, @args) = @_; - push @args, @ARGV - if $0 eq '-'; + if ($0 eq '-') { + push @args, @ARGV; + require Cwd; + } my @steps; my %opts; @@ -191,11 +227,6 @@ sub extra { $_[0]->{extra} ||= {} } sub quiet { $_[0]->{quiet} } -my $_archname = $Config{archname}; -my $_version = $Config{version}; -my @_inc_version_list = reverse split / /, $Config{inc_version_list}; -my $_path_sep = $Config{path_sep}; - sub _as_list { my $list = shift; grep length, map { @@ -217,7 +248,7 @@ [$_version, $_archname], [$_version], [$_archname], - (@_inc_version_list ? \@_inc_version_list : ()), + (map [$_], @_inc_version_list), [], ); @@ -692,7 +723,7 @@ sub guess_shelltype { my $shellbin - = defined $ENV{SHELL} + = defined $ENV{SHELL} && length $ENV{SHELL} ? ($ENV{SHELL} =~ /([\w.]+)$/)[-1] : ( $^O eq 'MSWin32' && exists $ENV{'!EXITCODE'} ) ? 'bash' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/bad_variables.t new/local-lib-2.000023/t/bad_variables.t --- old/local-lib-2.000019/t/bad_variables.t 2015-06-28 10:53:01.000000000 +0200 +++ new/local-lib-2.000023/t/bad_variables.t 2016-10-16 18:30:45.000000000 +0200 @@ -1,7 +1,6 @@ use strict; use warnings; use Test::More tests => 6; -use File::Temp 'tempdir'; use Config; use local::lib (); @@ -9,9 +8,9 @@ delete $ENV{PERL_LOCAL_LIB_ROOT}; -my $dir1 = mk_temp_dir('test_local_lib-XXXXX'); -my $dir2 = mk_temp_dir('test_local_lib-XXXXX'); -my $dir3 = mk_temp_dir('test_local_lib-XXXXX'); +my $dir1 = mk_temp_ll_dir; +my $dir2 = mk_temp_ll_dir; +my $dir3 = mk_temp_ll_dir; ok(!(grep { $dir1 eq $_ } @INC), 'new dir is not already in @INC'); ok(!(grep { $dir1 eq $_ } split /\Q$Config{path_sep}\E/, ($ENV{PERL5LIB}||'')), 'new dir is not already in PERL5LIB'); @@ -34,4 +33,3 @@ ok((grep { /\Q$dir1\E/ } @INC), 'new dir has been added to @INC'); ok((grep { /\Q$dir1\E/ } split /\Q$Config{path_sep}\E/, $ENV{PERL5LIB}), 'new dir has been added to PERL5LIB'); - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/carp-mismatch.t new/local-lib-2.000023/t/carp-mismatch.t --- old/local-lib-2.000019/t/carp-mismatch.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/carp-mismatch.t 2016-10-16 18:29:56.000000000 +0200 @@ -21,6 +21,7 @@ { my $heavy = File::Spec->catfile($carpdir, 'Heavy.pm'); open my $fh, '>', $heavy or die "failed to open $heavy for writing: $!"; + binmode $fh; print $fh "package Carp::Heavy;\nour \$VERSION = '500.0';\n"; close $fh; } @@ -28,6 +29,7 @@ # 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: $!"; + binmode $fh; print $fh "package Carp::Foo;\nour \$VERSION = '200.0';\n"; close $fh; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/classmethod.t new/local-lib-2.000023/t/classmethod.t --- old/local-lib-2.000019/t/classmethod.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/classmethod.t 2016-10-16 18:30:45.000000000 +0200 @@ -1,7 +1,8 @@ use strict; use warnings; use Test::More tests => 7; -use File::Temp; +use lib 't/lib'; +use TempDir; use File::Spec::Functions qw(catdir); use local::lib (); @@ -18,7 +19,7 @@ { my $warn = ''; local $SIG{__WARN__} = sub { $warn .= $_[0] }; - my $dir = File::Temp::tempdir(); + my $dir = mk_temp_dir; my $ll_dir = catdir($dir, 'splat'); $c->ensure_dir_structure_for($ll_dir); ok -d $ll_dir, 'base dir created'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/coderefs_in_inc.t new/local-lib-2.000023/t/coderefs_in_inc.t --- old/local-lib-2.000019/t/coderefs_in_inc.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/coderefs_in_inc.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -use strict; -use warnings; -use Test::More tests => 2; -use lib 't/lib'; -use TempDir; -use Cwd; - -# Test that refs in @INC don't get mangled. - -my $dir = mk_temp_dir('test_local_lib-XXXXX'); - -use local::lib (); -my $code = sub {}; -push(@INC, $code); -local::lib->import($dir); -ok grep({ $_ eq $code } @INC), 'Can find code ref in @INC'; -ok grep({ ref $_ } @INC), 'It really is a ref, not stringified'; - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/de-dup.t new/local-lib-2.000023/t/de-dup.t --- old/local-lib-2.000019/t/de-dup.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/de-dup.t 2016-10-16 18:30:45.000000000 +0200 @@ -3,9 +3,8 @@ use Test::More tests => 2; use lib 't/lib'; use TempDir; -use Cwd; -my $dir = mk_temp_dir('test_local_lib-XXXXX'); +my $dir = mk_temp_ll_dir; use local::lib (); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/lib/ENVDumper.pm new/local-lib-2.000023/t/lib/ENVDumper.pm --- old/local-lib-2.000019/t/lib/ENVDumper.pm 2016-04-19 13:33:37.000000000 +0200 +++ new/local-lib-2.000023/t/lib/ENVDumper.pm 2016-10-15 01:16:14.000000000 +0200 @@ -1,9 +1,58 @@ package ENVDumper; -use Data::Dumper; +use strict; +use warnings; +use Exporter; + +our @EXPORT_OK = qw(dumpenv undump); + +my %trans = ( + "\0" => "\\0", + "\r" => "\\r", + "\n" => "\\n", + "\t" => "\\t", + "\f" => "\\f", + "\b" => "\\b", + "\a" => "\\a", + "\e" => "\\e", + "\\" => "\\\\", +); + +my %reverse = reverse %trans; sub import { - local $Data::Dumper::Terse = 1; - print Dumper(\%ENV); + my ($class, @args) = @_; + if (grep $_ eq '--dump', @args) { + print dumpenv(); + exit 0; + } + goto &Exporter::import; +} + +sub dumpenv { + my $out = ''; + my ($match) = map qr/$_/, join ('|', map quotemeta, sort keys %trans); + for my $key (sort keys %ENV) { + my $value = $ENV{$key}; + $value = '' unless defined $value; + s/($match)/$trans{$1}/g + for ($key, $value); + $out .= "$key\t$value\n"; + } + $out; +} + +sub undump { + my $in = shift || ''; + my $out = {}; + my ($match) = map qr/$_/, join ('|', map quotemeta, sort keys %reverse); + my @lines = split /\r\n?|\n/, $in; + for my $line (@lines) { + my ($key, $value) = split /\t/, $line, 2; + $_ && s/($match)/$reverse{$1}/g + for ($key, $value); + $out->{$key} = $value; + } + $out; } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/lib/TempDir.pm new/local-lib-2.000023/t/lib/TempDir.pm --- old/local-lib-2.000019/t/lib/TempDir.pm 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/lib/TempDir.pm 2016-10-16 18:30:45.000000000 +0200 @@ -3,29 +3,72 @@ use warnings; use base 'Exporter'; -our @EXPORT = qw(mk_temp_dir); +our @EXPORT = qw(mk_temp_dir mk_temp_ll_dir mk_temp_file); use local::lib (); use Cwd; -use File::Temp qw(tempdir); +use File::Spec; +use File::Temp (); -$File::Temp::KEEP_ALL = 1 - if $ENV{LOCAL_LIB_TEST_DEBUG}; +my $temp_root = File::Spec->tmpdir; -sub mk_temp_dir -{ - my $name_template = shift; - - mkdir 't/temp'; - my $path = tempdir($name_template, DIR => Cwd::abs_path('t/temp'), CLEANUP => 1); - local::lib->ensure_dir_structure_for($path, { quiet => 1 }); - # On Win32 the path where the distribution is built usually contains - # spaces. This is a problem for some parts of the CPAN toolchain, so - # local::lib uses the GetShortPathName trick do get an alternate - # representation of the path that doesn't constain spaces. - return ($^O eq 'MSWin32') - ? Win32::GetShortPathName($path) - : $path +if ($ENV{LOCAL_LIB_TEST_DEBUG}) { + $File::Temp::KEEP_ALL = 1; + mkdir 't/temp'; + $temp_root = Cwd::abs_path('t/temp') +} + +# On Win32 the path where the distribution is built usually contains +# spaces. This is a problem for some parts of the CPAN toolchain, so +# local::lib uses the GetShortPathName trick do get an alternate +# representation of the path that doesn't constain spaces. +$temp_root = Win32::GetShortPathName($temp_root) + if $^O eq 'MSWin32'; + +sub _template { + my $i = 0; + my $file = shift; + if (!$file) { + while (my ($p, $f) = caller($i++)) { + next + if $p eq __PACKAGE__; + $file = $f; + $file =~ s{^t[/\\]}{}; + $file =~ s{\.t$}{}; + $file =~ s{[^a-z0-9_-]+}{-}gi; + } + } + 'local-lib-'.($file||'test').'-XXXXXX'; +} + +sub mk_temp_dir { + my $opts = (@_ && ref $_[-1]) ? pop : {}; + my $name_template = _template(shift); + + File::Temp::tempdir( + $name_template, + DIR => $temp_root, + CLEANUP => 1, + %$opts + ); +} + +sub mk_temp_ll_dir { + my $path = mk_temp_dir(@_); + local::lib->ensure_dir_structure_for($path, { quiet => 1 }); + local::lib->normalize_path($path); +} + +sub mk_temp_file { + my $opts = (@_ && ref $_[-1]) ? pop : {}; + my $name_template = _template(shift); + + File::Temp::tempfile( + $name_template, + DIR => $temp_root, + UNLINK => 1, + %$opts, + ); } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/shell.t new/local-lib-2.000023/t/shell.t --- old/local-lib-2.000019/t/shell.t 2016-04-19 13:33:37.000000000 +0200 +++ new/local-lib-2.000023/t/shell.t 2017-06-07 09:10:24.000000000 +0200 @@ -1,13 +1,15 @@ use strict; use warnings; +use lib 't/lib'; use Test::More; use File::Spec; use File::Basename qw(dirname); -use File::Temp (); -use File::Path; +use TempDir; use Config; use local::lib (); use IPC::Open3 qw(open3); +use lib 't/lib'; +use ENVDumper qw(undump); my @ext = $^O eq 'MSWin32' ? (split /\Q$Config{path_sep}/, $ENV{PATHEXT}) : (); sub which { @@ -21,16 +23,16 @@ } 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; - }; + *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; @@ -49,6 +51,7 @@ my @extra_lib = ('-I' . dirname(dirname($INC{'local/lib.pm'}))); my $nul = File::Spec->devnull; +my $perl = local::lib::_perl(); my @shells; for my $shell ( @@ -97,16 +100,26 @@ opt => '/Q /D /C', test => '/Q /D /C "exit 0"', ext => 'bat', - perl => qq{@"$^X"}, + perl => qq{@"$perl"}, skip => $^O ne 'MSWin32', }, { name => 'powershell.exe', shell => which('powershell.exe'), - opt => '-NoProfile -ExecutionPolicy Unrestricted -File', - test => '-NoProfile -Command "exit 0"', + opt => '-Version 2 -NoProfile -ExecutionPolicy Bypass -Command "& { . $args[0]; Exit $LastExitCode }"', + test => q{-Version 2 -NoProfile -ExecutionPolicy Bypass -Command "If ((Get-ExecutionPolicy) -eq 'Unrestricted') { Exit 0 } Exit 1"}, ext => 'ps1', - perl => qq{& '$^X'}, + perl => qq{& '$perl'}, + skip => $^O ne 'MSWin32', + }, + { + name => 'powershell1', + exe => 'powershell.exe', + shell => which('powershell.exe'), + opt => '-NoProfile -Command "& { . $args[0]; Exit $LastExitCode }"', + test => q{-NoProfile -Command "If (-Not (Test-Path variable:PSVersionTable)) { If ((Get-ExecutionPolicy) -eq 'Unrestricted') { exit 0 } } exit 1"}, + ext => 'ps1', + perl => qq{& '$perl'}, skip => $^O ne 'MSWin32', }, ) { @@ -114,7 +127,7 @@ my $exe = $shell->{exe} || $name; $shell->{shell} ||= $shell_path{$exe}; $shell->{ext} ||= $exe; - $shell->{perl} ||= qq{"$^X"}; + $shell->{perl} ||= qq{"$perl"}; if (@ARGV) { next if !grep {$_ eq $name} @ARGV; @@ -130,7 +143,7 @@ elsif ($shell->{test}) { no warnings 'exec'; if (system "$shell->{shell} $shell->{test} > $nul 2> $nul") { - diag "$name seems broken, skipping"; + print "# $name is unusable, skipping\n"; next; } } @@ -156,8 +169,11 @@ my $sep = $Config{path_sep}; my $root = File::Spec->rootdir; +my $home = mk_temp_dir; +$ENV{HOME} = $home; + for my $shell (@shells) { - my $ll = local::lib->normalize_path(File::Temp::tempdir(CLEANUP => 1)); + my $ll = local::lib->normalize_path(mk_temp_dir); local $ENV{$_} for @vars; delete $ENV{$_} @@ -229,7 +245,7 @@ open my $in, '<', File::Spec->devnull; open my $err, '>', File::Spec->devnull; open3 $in, my $out, $err, - $^X, @extra_lib, '-Mlocal::lib', '-', '--no-create', + $perl, @extra_lib, '-Mlocal::lib', '-', '--no-create', map { quote_literal($_) } @options or die "blah"; my $script = do { local $/; <$out> }; @@ -239,14 +255,10 @@ sub call_shell { my ($info, $script) = @_; - $script .= "\n" . qq{$info->{perl} -It/lib -MENVDumper -e1\n}; + $script .= "\n" . qq{$info->{perl} -It/lib -MENVDumper=--dump -e1\n}; - my ($fh, $file) = File::Temp::tempfile( - 'll-test-script-XXXXX', - DIR => File::Spec->tmpdir, - SUFFIX => '.'.$info->{ext}, - UNLINK => 1, - ); + my ($fh, $file) = mk_temp_file({SUFFIX => '.'.$info->{ext}}); + binmode $fh; print { $fh } $script; close $fh; @@ -256,9 +268,9 @@ if ($?) { diag "script:\n$script"; diag "running:\n$cmd"; + diag "output:\n$output"; diag "failed with code: $?"; return {}; } - my $env = eval $output or die "bad output: $@"; - $env; + undump $output; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/stackable.t new/local-lib-2.000023/t/stackable.t --- old/local-lib-2.000019/t/stackable.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/stackable.t 2016-10-16 18:30:45.000000000 +0200 @@ -1,21 +1,22 @@ use strict; use warnings; -use Test::More; +use Test::More tests => 24; use File::Spec; use Config; -plan tests => 24; - use local::lib (); -use lib 't/lib'; use TempDir; +use lib 't/lib'; +use TempDir; delete $ENV{PERL_LOCAL_LIB_ROOT}; -my $dir1 = mk_temp_dir('test_local_lib-XXXXX'); -my $dir2 = mk_temp_dir('test_local_lib-XXXXX'); +my $dir1 = mk_temp_ll_dir; +my $dir2 = mk_temp_ll_dir; -my ($dir1_arch, $dir2_arch) = map { File::Spec->catfile($_, qw'lib perl5', $Config{archname}) } $dir1, $dir2; +my ($dir1_arch, $dir2_arch) = + map { File::Spec->catfile($_, 'lib', 'perl5', $Config{archname}) } + ($dir1, $dir2); my $prev_active = () = local::lib->active_paths; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/subroutine-in-inc.t new/local-lib-2.000023/t/subroutine-in-inc.t --- old/local-lib-2.000019/t/subroutine-in-inc.t 2015-06-28 10:53:01.000000000 +0200 +++ new/local-lib-2.000023/t/subroutine-in-inc.t 2016-10-16 18:30:45.000000000 +0200 @@ -1,24 +1,23 @@ use strict; use warnings FATAL => 'all'; -use Test::More tests => 1; +use Test::More tests => 2; -use File::Spec; -use Cwd; -use lib 't/lib'; use TempDir; +use lib 't/lib'; +use TempDir; use local::lib (); -sub CODE_in_INC() { - return scalar grep { ref eq 'CODE' } @INC; -} - -my $dir = mk_temp_dir('sub-in-INC-XXXXX'); - -my $base = CODE_in_INC; -unshift @INC, sub { () }; -splice @INC, 3, 1, sub { () }; -push @INC, sub { () }; +my $dir = mk_temp_ll_dir; + +my $base = scalar grep { ref eq 'CODE' } @INC; +my $sub = sub { () }; +unshift @INC, $sub; +splice @INC, 3, 1, $sub; +push @INC, $sub; local::lib->import($dir); -is( CODE_in_INC, $base + 3 ); +my $diff = (scalar grep { ref eq 'CODE' } @INC) - $base; +is $diff, 3, "found correct number of code refs in \@INC"; +my $found = scalar grep { $_ eq $sub } @INC; +is $diff, 3, "found correct code refs in \@INC"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/t/taint-mode.t new/local-lib-2.000023/t/taint-mode.t --- old/local-lib-2.000019/t/taint-mode.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/t/taint-mode.t 2016-10-16 18:39:21.000000000 +0200 @@ -8,7 +8,8 @@ use warnings; use Cwd; # load before anything else to work around ActiveState bug use Test::More tests => 4; -use File::Temp 'tempfile'; +use lib 't/lib'; +use TempDir; use File::Basename qw(basename dirname); use File::Spec; use IPC::Open3; @@ -18,61 +19,54 @@ my @INC_CLEAN = @INC; -my $dir1 = mk_temp_dir('used_in_taint-XXXXX'); -my $dir2 = mk_temp_dir('not_used_in_taint-XXXXX'); +my $perl = local::lib::_perl; + +my $dir1 = mk_temp_ll_dir('used_in_taint'); +my $dir2 = mk_temp_ll_dir('not_used_in_taint'); # Set up local::lib environment using our temp dir require local::lib; local::lib->import($dir1); local::lib->import($dir2); -# Create a script that has taint mode turned on, and tries to use a -# local lib to the same temp dir. -mkdir 't/temp'; -my ($fh, $filename) = tempfile( - 'test_local_lib-XXXXX', - DIR => Cwd::abs_path('t/temp'), - UNLINK => 1, -); +{ + # Create a script that has taint mode turned on, and tries to use a + # local lib to the same temp dir. + my ($fh, $filename) = mk_temp_file; + binmode $fh; -print $fh <<"EOM"; + print $fh <<"EOM"; #!/usr/bin/perl -T use strict; use warnings; use local::lib "\Q$dir1\E"; print "\$_\\n" for \@INC; EOM -close $fh; + close $fh; -open my $in, '<', File::Spec->devnull; -my $pid = open3($in, my $out, undef, $^X, map("-I$_", @INC_CLEAN), '-T', $filename); -my @libs = <$out>; -s/[\r\n]*\z// for @libs; -close $out; -waitpid $pid, 0; -is $?, 0, 'test script ran without error'; - -my $dir1_lib = local::lib->install_base_perl_path($dir1); -ok grep($_ eq $dir1_lib, @libs), - 'local::lib used in taint script added to @INC' - or diag "searched for '$dir1_lib' in: ", join(', ', map "'$_'", @libs); - -my $dir2_lib = local::lib->install_base_perl_path($dir2); -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); + open my $in, '<', File::Spec->devnull + or die "can't open null input: $!"; + my $pid = open3($in, my $out, undef, $perl, map("-I$_", @INC_CLEAN), '-T', $filename); + binmode $out; + my @libs = <$out>; + s/[\r\n]*\z// for @libs; + close $out; + waitpid $pid, 0; + is $?, 0, 'test script ran without error'; + + my $dir1_lib = local::lib->install_base_perl_path($dir1); + ok grep($_ eq $dir1_lib, @libs), + 'local::lib used in taint script added to @INC' + or diag "searched for '$dir1_lib' in: ", join(', ', map "'$_'", @libs); + + my $dir2_lib = local::lib->install_base_perl_path($dir2); + 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, - ); + my ($fh, $filename) = mk_temp_file; + binmode $fh; print $fh <<'EOM'; #!/usr/bin/perl -T @@ -82,10 +76,13 @@ EOM close $fh; + open my $in, '<', File::Spec->devnull + or die "can't open null input: $!"; 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 $pid = open3($in, $out, $err, $perl, map("-I$_", @INC_CLEAN), '-T', $filename); + binmode $out; my $cwd = do { local $/; <$out> }; $cwd =~ s/[\r\n]*\z//; $cwd = File::Spec->canonpath($cwd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/author/eol.t new/local-lib-2.000023/xt/author/eol.t --- old/local-lib-2.000019/xt/author/eol.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/xt/author/eol.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -use strict; -use warnings; -use Test::More; - -use Test::EOL; -all_perl_files_ok({ trailing_whitespace => 1 }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/author/no-tabs.t new/local-lib-2.000023/xt/author/no-tabs.t --- old/local-lib-2.000019/xt/author/no-tabs.t 2015-09-02 12:20:10.000000000 +0200 +++ new/local-lib-2.000023/xt/author/no-tabs.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -use strict; -use warnings; -use Test::More; - -use Test::NoTabs; -all_perl_files_ok(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/bootstrap.t new/local-lib-2.000023/xt/bootstrap.t --- old/local-lib-2.000019/xt/bootstrap.t 2016-04-19 13:33:36.000000000 +0200 +++ new/local-lib-2.000023/xt/bootstrap.t 2016-12-27 20:24:13.000000000 +0100 @@ -1,16 +1,16 @@ use strict; use warnings; +use lib 't/lib', 'xt/lib'; use Test::More 0.81_01; use IPC::Open3; -use File::Temp; +use TempDir; use File::Spec; use File::Path qw(rmtree); use File::Basename qw(dirname); use local::lib (); use ExtUtils::MakeMaker; use Cwd qw(cwd); -use lib 'xt/lib'; use dist_util; sub check_version { @@ -53,7 +53,7 @@ chdir $dist_dir; -@perl = $^X +@perl = local::lib::_perl unless @perl; my %modules = ( @@ -87,12 +87,14 @@ } } - for my $home_tmpl ('local-lib-home-XXXXX', 'local-lib-home with space-XXXXX') { + my $home_base = mk_temp_dir('home-base'); + + for my $home_tmpl ('home', 'spaces in home') { delete $ENV{PERL5LIB}; delete $ENV{PERL_LOCAL_LIB_ROOT}; delete $ENV{PERL_MM_OPT}; delete $ENV{PERL_MB_OPT}; - local $ENV{HOME} = my $home = File::Temp::tempdir($home_tmpl, CLEANUP => 1, TMPDIR => 1); + local $ENV{HOME} = my $home = "$home_base/$home_tmpl"; my $ll = File::Spec->catdir($home, 'local-lib'); note "local::lib dir is $ll"; @@ -101,7 +103,8 @@ unlink 'Makefile'; open my $null_in, '<', File::Spec->devnull; - my $pid = open3 $null_in, my $out, undef, $perl, 'Makefile.PL', '--bootstrap='.$ll; + my $pid = open3 $null_in, my $out, undef, + $perl, 'Makefile.PL', '--bootstrap='.$ll, '--no-manpages'; while (my $line = <$out>) { note $line if $verbose || $line =~ /^Running |^\s.* -- (?:NOT OK|OK|NA|TIMED OUT)$/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/cpan-bootstrap.pl new/local-lib-2.000023/xt/cpan-bootstrap.pl --- old/local-lib-2.000019/xt/cpan-bootstrap.pl 2015-11-21 20:25:54.000000000 +0100 +++ new/local-lib-2.000023/xt/cpan-bootstrap.pl 2016-10-16 19:10:11.000000000 +0200 @@ -16,6 +16,16 @@ }; } +my %block_load = map { (my $f = "$_.pm") =~ s{::}{/}g; $f => 1 } qw( + CPAN::Config + File::HomeDir +); +unshift @INC, sub { + die "Can't locate $_[1] in \@INC (\@INC contains: @INC).\n" + if $block_load{$_[1]}; + (); +}; + require CPAN; my %config = %{ $CPAN::Config } = ( urllist => ["$url"], @@ -29,6 +39,11 @@ CPAN->import; *CPAN::Distribution::check_integrity = sub { 1 }; +*CPAN::HandleConfig::home = sub { $ENV{HOME} }; +*CPAN::HandleConfig::cpan_config_dir_candidates = sub { "$ENV{HOME}/.cpan" }; +*CPAN::HandleConfig::cpan_home_dir_candidates = sub { "$ENV{HOME}/.cpan" }; +*CPAN::HandleConfig::cpan_data_home = sub { "$ENV{HOME}/.cpan" }; +*CPAN::HandleConfig::cpan_home = sub { "$ENV{HOME}/.cpan" }; CPAN::Config->load; %{ $CPAN::Config } = ( %config, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/cpan-bootstrap.t new/local-lib-2.000023/xt/cpan-bootstrap.t --- old/local-lib-2.000019/xt/cpan-bootstrap.t 2015-11-21 20:35:09.000000000 +0100 +++ new/local-lib-2.000023/xt/cpan-bootstrap.t 2016-10-18 19:11:01.000000000 +0200 @@ -19,16 +19,16 @@ plan tests => 2; } +use lib 't/lib', 'xt/lib'; use File::Spec; -use File::Temp; +use TempDir; use POSIX (); use Digest::SHA; use Digest::MD5; use Data::Dumper; -use lib 'xt/lib'; use dist_util; -my $local_cpan = File::Temp::tempdir('local-lib-CPAN-XXXXX', TMPDIR => 1); +my $local_cpan = mk_temp_dir('CPAN'); note "building fake cpan ($local_cpan)"; mkdir "$local_cpan/authors"; mkdir "$local_cpan/authors/id"; @@ -44,7 +44,7 @@ my ($real_mod) = grep -e, map { "$_/$file_name" } @{$ll_core->inc}; next unless $real_mod; - my $dist = File::Temp->newdir("$dist_name-fake-XXXXXX"); + my $dist = mk_temp_dir("$dist_name-fake"); writefile "$dist/Makefile.PL", <<"END_MAKEFILEPL"; use strict; use warnings; @@ -123,7 +123,7 @@ 1; END_MODLIST -my $home = File::Temp::tempdir('local-lib-HOME-XXXXX', TMPDIR => 1); +my $home = mk_temp_dir('HOME'); my $ll_root = File::Spec->catdir($home, 'perl5'); my $cpan_url = do { @@ -139,6 +139,13 @@ my %env = $ll_core->build_environment_vars; $env{LOCAL_LIB_CPAN_TEST} = $ll_root; $env{HOME} = $home; + $env{HOMEDRIVE} = undef; + $env{HOMEPATH} = undef; + $env{USERPROFILE} = undef; + $env{PREFIX} = undef; + $env{INSTALL_BASE} = undef; + $env{MAKEFLAGS} = undef; + $env{PASTHRU} = undef; $env{CPAN_MIRROR} = $cpan_url; $env{PERL_MM_USE_DEFAULT} = 1; @@ -148,7 +155,7 @@ for grep { !defined $env{$_} } keys %env; note "running CPAN.pm bootstrap"; - cap_system $^X, "xt/cpan-bootstrap.pl"; + cap_system local::lib::_perl, "xt/cpan-bootstrap.pl"; }; $out =~ /^#+\s*ENVIRONMENT\s*#+\s*\n(.*?)\n#+\s*END ENVIRONMENT\s*#+\s*\n/ms; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/install.t new/local-lib-2.000023/xt/install.t --- old/local-lib-2.000019/xt/install.t 2015-11-21 20:36:57.000000000 +0100 +++ new/local-lib-2.000023/xt/install.t 2016-10-16 18:41:38.000000000 +0200 @@ -7,7 +7,8 @@ use Cwd; use Config; -use lib 't/lib'; use TempDir; +use lib 't/lib'; +use TempDir; use local::lib (); @@ -28,13 +29,15 @@ my %dist_types = ( EUMM => sub { open my $fh, '>', 'Makefile.PL' or die "can't create Makefile.PL: $!"; + binmode $fh; print $fh 'use ExtUtils::MakeMaker; WriteMakefile( NAME => "EUMM" );'; close $fh; - system($^X, 'Makefile.PL') && die "Makefile.PL failed"; + system(local::lib::_perl, 'Makefile.PL') && die "Makefile.PL failed"; system($Config{make}, 'install') && die "$Config{make} install failed"; }, MB => sub { open my $fh, '>', 'Build.PL' or die "can't create Build.PL: $!"; + binmode $fh; print $fh <<END_BUILD; use Module::Build; Module::Build->new( @@ -44,8 +47,8 @@ )->create_build_script; END_BUILD close $fh; - system($^X, 'Build.PL') && die "Build.PL failed"; - system($^X, 'Build', 'install') && die "Build install failed"; + system(local::lib::_perl, 'Build.PL') && die "Build.PL failed"; + system(local::lib::_perl, 'Build', 'install') && die "Build install failed"; }, ); @@ -62,17 +65,18 @@ grep /^MAKE/, keys %ENV }; local $ENV{PERL5LIB} = $ENV{PERL5LIB}; - my $temp = mk_temp_dir("install-$dist_type-XXXXX"); + my $temp = mk_temp_dir("install-$dist_type"); my $ll_dir = "$dist_type-$dir_base"; my $ll = "$temp/$ll_dir"; mkpath(File::Spec->canonpath($ll)); local::lib->import($ll, '--quiet'); - my $dist_dir = mk_temp_dir("source-$dist_type-XXXXX"); + my $dist_dir = mk_temp_dir("source-$dist_type"); chdir $dist_dir; mkdir 'lib'; open my $fh, '>', "lib/$dist_type.pm"; + binmode $fh; print $fh '1;'; close $fh; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/lib/dist_util.pm new/local-lib-2.000023/xt/lib/dist_util.pm --- old/local-lib-2.000019/xt/lib/dist_util.pm 2015-11-21 20:35:20.000000000 +0100 +++ new/local-lib-2.000023/xt/lib/dist_util.pm 2016-10-16 18:42:05.000000000 +0200 @@ -5,13 +5,14 @@ use File::Copy qw(copy); use File::Find (); use File::Spec (); -use File::Temp (); +use TempDir; use IPC::Open3; use File::Basename qw(dirname basename fileparse); use Cwd qw(cwd); use File::Path qw(mkpath rmtree); use Config; use IO::File; +use local::lib (); use Exporter; *import = \&Exporter::import; our @EXPORT = qw(make_dist make_dist_dir cap_system tar writefile); @@ -47,7 +48,7 @@ } sub make_dist_dir { - my $dist_dir = shift || File::Temp::tempdir('local-lib-dist-XXXXX', TMPDIR => 1); + my $dist_dir = shift || mk_temp_dir; copy 'Makefile.PL', "$dist_dir/Makefile.PL"; { open my $fh, '>', "$dist_dir/META.yml"; } File::Find::find({ no_chdir => 1, wanted => sub { @@ -70,7 +71,7 @@ my $dist_dir = make_dist_dir(); my $cwd = cwd; chdir $dist_dir; - cap_system $^X, 'Makefile.PL'; + cap_system local::lib::_perl, 'Makefile.PL'; cap_system $Config{make}, 'manifest'; cap_system $Config{make}, 'distdir', "DISTVNAME=$distvname"; tar($distvname, $dist); @@ -86,12 +87,10 @@ my $parent = dirname($dir); my $tar = shift || do { local $^W; - (File::Temp::tempdir( - "$basename-XXXXX", - SUFFIX => '.tar.gz', - TMPDIR => 1, - OPEN => 0, - ))[1]; + (mk_temp_file($basename, { + SUFFIX => '.tar.gz', + OPEN => 0, + }))[1]; }; my $cwd = cwd; chdir $parent; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/release/eol.t new/local-lib-2.000023/xt/release/eol.t --- old/local-lib-2.000019/xt/release/eol.t 1970-01-01 01:00:00.000000000 +0100 +++ new/local-lib-2.000023/xt/release/eol.t 2016-10-16 19:51:18.000000000 +0200 @@ -0,0 +1,6 @@ +use strict; +use warnings; +use Test::More ($ENV{RELEASE_TESTING} ? () : (skip_all => 'release testing only')); + +use Test::EOL; +all_perl_files_ok({ trailing_whitespace => 1 }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/local-lib-2.000019/xt/release/no-tabs.t new/local-lib-2.000023/xt/release/no-tabs.t --- old/local-lib-2.000019/xt/release/no-tabs.t 1970-01-01 01:00:00.000000000 +0100 +++ new/local-lib-2.000023/xt/release/no-tabs.t 2016-10-16 19:51:07.000000000 +0200 @@ -0,0 +1,6 @@ +use strict; +use warnings; +use Test::More ($ENV{RELEASE_TESTING} ? () : (skip_all => 'release testing only')); + +use Test::NoTabs; +all_perl_files_ok('.');
