diff -Nru liblocal-lib-perl-2.000018/Changes liblocal-lib-perl-2.000019/Changes --- liblocal-lib-perl-2.000018/Changes 2015-10-29 17:10:38.000000000 +0000 +++ liblocal-lib-perl-2.000019/Changes 2016-04-19 14:48:02.000000000 +0000 @@ -1,5 +1,10 @@ Revision history for local::lib +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) + - author test enhancements + 2.000018 - 2015-10-29 - repair CPAN.pm bootstrapping broken by extraneous prerequisite. - ensure directories are created in correct order to avoid errors diff -Nru liblocal-lib-perl-2.000018/debian/changelog liblocal-lib-perl-2.000019/debian/changelog --- liblocal-lib-perl-2.000018/debian/changelog 2016-01-03 18:45:11.000000000 +0000 +++ liblocal-lib-perl-2.000019/debian/changelog 2016-06-13 20:49:42.000000000 +0000 @@ -1,3 +1,21 @@ +liblocal-lib-perl (2.000019-1) unstable; urgency=medium + + * Team upload. + + [ Salvatore Bonaccorso ] + * debian/control: Use HTTPS transport protocol for Vcs-Git URI + + [ gregor herrmann ] + * debian/copyright: change Copyright-Format 1.0 URL to HTTPS. + + [ Lucas Kanashiro ] + * Import upstream version 2.000019 + * Declare compliance with Debian policy 3.9.8 + * debian/control: Update build dependencies + * Update Debian packaging copyright + + -- Lucas Kanashiro Mon, 13 Jun 2016 16:36:11 -0300 + liblocal-lib-perl (2.000018-1) unstable; urgency=medium * Import upstream versions 2.000015, 2.000018. diff -Nru liblocal-lib-perl-2.000018/debian/control liblocal-lib-perl-2.000019/debian/control --- liblocal-lib-perl-2.000018/debian/control 2016-01-03 18:45:11.000000000 +0000 +++ liblocal-lib-perl-2.000019/debian/control 2016-06-13 20:49:42.000000000 +0000 @@ -11,12 +11,9 @@ Build-Depends: debhelper (>= 9), libmodule-build-perl, perl (>= 5.21.6) -Build-Depends-Indep: libcapture-tiny-perl, - libperl-minimumversion-perl (>= 1.35), - libtest-minimumversion-perl -Standards-Version: 3.9.6 +Standards-Version: 3.9.8 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/liblocal-lib-perl.git -Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/liblocal-lib-perl.git +Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/liblocal-lib-perl.git Homepage: https://metacpan.org/release/local-lib Package: liblocal-lib-perl diff -Nru liblocal-lib-perl-2.000018/debian/copyright liblocal-lib-perl-2.000019/debian/copyright --- liblocal-lib-perl-2.000018/debian/copyright 2016-01-03 18:45:11.000000000 +0000 +++ liblocal-lib-perl-2.000019/debian/copyright 2016-06-13 20:49:42.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: local-lib Upstream-Contact: Matt S Trout Source: https://metacpan.org/release/local-lib @@ -22,6 +22,7 @@ Copyright: 2009, 2010, Jonathan Yu 2010-2014, Salvatore Bonaccorso 2010-2016, gregor herrmann + 2016, Lucas Kanashiro License: Artistic or GPL-1+ License: Artistic diff -Nru liblocal-lib-perl-2.000018/inc/CheckVersion.pm liblocal-lib-perl-2.000019/inc/CheckVersion.pm --- liblocal-lib-perl-2.000018/inc/CheckVersion.pm 2015-09-02 10:20:10.000000000 +0000 +++ liblocal-lib-perl-2.000019/inc/CheckVersion.pm 2016-04-19 11:33:37.000000000 +0000 @@ -1,4 +1,4 @@ -package inc::CheckVersion; +package CheckVersion; use strict; use warnings; diff -Nru liblocal-lib-perl-2.000018/inc/CPANBootstrapper.pm liblocal-lib-perl-2.000019/inc/CPANBootstrapper.pm --- liblocal-lib-perl-2.000018/inc/CPANBootstrapper.pm 1970-01-01 00:00:00.000000000 +0000 +++ liblocal-lib-perl-2.000019/inc/CPANBootstrapper.pm 2016-04-19 11:33:37.000000000 +0000 @@ -0,0 +1,111 @@ +package CPANBootstrapper; +use strict; +use warnings; + +sub import { + my ($class, $op) = @_; + + die "no operation specified!\n" + unless $op; + my $do = $class->can("cmd_$op") + or die "invalid operation $op\n"; + $do->(@ARGV); + exit 0; +} + +sub cmd_init_config { + require ExtUtils::MakeMaker; + my $done; + my $orig = ExtUtils::MakeMaker->can("prompt"); + no warnings 'once', 'redefine'; + *ExtUtils::MakeMaker::prompt = sub ($;$) { + if (!$done && $_[0] =~ /manual configuration/) { + $done++; + return "no"; + } + return $orig->(@_); + }; + require CPAN; + CPAN->import; + $CPAN::Config->{urllist} = ["http://www.cpan.org/"]; + + CPAN::Config->load; + unless ($done || -w $CPAN::Config->{keep_source_where}) { + my $save = $CPAN::Config->{urllist}; + delete @{$CPAN::Config}{keys %$CPAN::Config}; + $CPAN::Config->{urllist} = $save; + CPAN::Config->init; + } +} + +sub cmd_install { + my @modules = @_; + package main; + require CPAN; + CPAN->import; + CPAN::Config->load; + + # 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 + # MB was a prerequisite. This introduces a circular dependency, which would + # break installation. None of Module::Build's prerequisites include a + # Build.PL anymore, but continue to prefer EUMM as a precaution. + $CPAN::Config->{prefer_installer} = "EUMM"; + + force('install', @modules); +} + +sub cmd_disable_manpages { + require CPAN; + CPAN->import; + CPAN::HandleConfig->load; + $CPAN::Config->{makepl_arg} = 'INSTALLMAN1DIR=none INSTALLMAN3DIR=none'; + $CPAN::Config->{buildpl_arg} = '--install_path libdoc="" --install_path bindoc=""'; + CPAN::Config->commit; +} + +# make sure that the user doesn't have any existing CPAN config that'll +# cause us problems for the next few steps. +sub cmd_check { + my $cpan_version = shift; + # if CPAN loads this, it calls into CPAN::Shell which tries to run + # autoconfiguration. if it doesn't exist, we don't care + eval { require File::HomeDir; }; + require CPAN; + + # Need newish CPAN.pm for this, ergo skip it if that version of CPAN isn't + # installed yet. + # It will already be installed by the time we reach here if bootstrapping, + # otherwise, if we're running from CPAN then it will be installed soon + # enough, and we'll come back here.. + if (eval { require CPAN::HandleConfig; } ) { + CPAN::HandleConfig->require_myconfig_or_config; + if ( $CPAN::Config ) { + for my $setting (qw( + makepl_arg make_install_arg + mbuild_arg mbuild_install_arg mbuildpl_arg + )) { + my $value = $CPAN::Config->{$setting} or next; + if ($setting =~ /^make/ + ? $value =~ /(?:PREFIX|INSTALL_BASE)/ + : $value =~ /(?:--prefix|--install_base)/ + ) { + die <<"DEATH"; +WHOA THERE! It looks like you've got $CPAN::Config->{$setting} set in +your CPAN config. This is known to cause problems with local::lib. Please +either remove this setting or clear out your .cpan directory. +DEATH + } + } + } + } + else { + # Explode if it looks like requiring CPAN::HandleConfig should + # have worked, but didn't. + die $@ + if $CPAN::VERSION >= $cpan_version; + } +} + +1; diff -Nru liblocal-lib-perl-2.000018/inc/CPAN.pm liblocal-lib-perl-2.000019/inc/CPAN.pm --- liblocal-lib-perl-2.000018/inc/CPAN.pm 2015-09-02 10:20:30.000000000 +0000 +++ liblocal-lib-perl-2.000019/inc/CPAN.pm 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -package inc::CPAN; -use strict; -use warnings; - -sub import { - my ($class, $op) = @_; - - die "no operation specified!\n" - unless $op; - my $do = $class->can("cmd_$op") - or die "invalid operation $op\n"; - $do->(@ARGV); - exit 0; -} - -sub cmd_init_config { - require ExtUtils::MakeMaker; - my $done; - my $orig = ExtUtils::MakeMaker->can("prompt"); - no warnings 'once', 'redefine'; - *ExtUtils::MakeMaker::prompt = sub ($;$) { - if (!$done && $_[0] =~ /manual configuration/) { - $done++; - return "no"; - } - return $orig->(@_); - }; - require CPAN; - CPAN->import; - $CPAN::Config->{urllist} = ["http://www.cpan.org/"]; - - CPAN::Config->load; - unless ($done || -w $CPAN::Config->{keep_source_where}) { - my $save = $CPAN::Config->{urllist}; - delete @{$CPAN::Config}{keys %$CPAN::Config}; - $CPAN::Config->{urllist} = $save; - CPAN::Config->init; - } -} - -sub cmd_install { - my @modules = @_; - package main; - require CPAN; - CPAN->import; - CPAN::Config->load; - - # 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 - # MB was a prerequisite. This introduces a circular dependency, which would - # break installation. None of Module::Build's prerequisites include a - # Build.PL anymore, but continue to prefer EUMM as a precaution. - $CPAN::Config->{prefer_installer} = "EUMM"; - - force('install', @modules); -} - -sub cmd_disable_manpages { - require CPAN; - CPAN->import; - CPAN::HandleConfig->load; - $CPAN::Config->{makepl_arg} = 'INSTALLMAN1DIR=none INSTALLMAN3DIR=none'; - $CPAN::Config->{buildpl_arg} = '--install_path libdoc="" --install_path bindoc=""'; - CPAN::Config->commit; -} - -# make sure that the user doesn't have any existing CPAN config that'll -# cause us problems for the next few steps. -sub cmd_check { - my $cpan_version = shift; - # if CPAN loads this, it calls into CPAN::Shell which tries to run - # autoconfiguration. if it doesn't exist, we don't care - eval { require File::HomeDir; }; - require CPAN; - - # Need newish CPAN.pm for this, ergo skip it if that version of CPAN isn't - # installed yet. - # It will already be installed by the time we reach here if bootstrapping, - # otherwise, if we're running from CPAN then it will be installed soon - # enough, and we'll come back here.. - if (eval { require CPAN::HandleConfig; } ) { - CPAN::HandleConfig->require_myconfig_or_config; - if ( $CPAN::Config ) { - for my $setting (qw( - makepl_arg make_install_arg - mbuild_arg mbuild_install_arg mbuildpl_arg - )) { - my $value = $CPAN::Config->{$setting} or next; - if ($setting =~ /^make/ - ? $value =~ /(?:PREFIX|INSTALL_BASE)/ - : $value =~ /(?:--prefix|--install_base)/ - ) { - die <<"DEATH"; -WHOA THERE! It looks like you've got $CPAN::Config->{$setting} set in -your CPAN config. This is known to cause problems with local::lib. Please -either remove this setting or clear out your .cpan directory. -DEATH - } - } - } - } - else { - # Explode if it looks like requiring CPAN::HandleConfig should - # have worked, but didn't. - die $@ - if $CPAN::VERSION >= $cpan_version; - } -} - -1; diff -Nru liblocal-lib-perl-2.000018/lib/local/lib.pm liblocal-lib-perl-2.000019/lib/local/lib.pm --- liblocal-lib-perl-2.000018/lib/local/lib.pm 2015-10-29 17:10:32.000000000 +0000 +++ liblocal-lib-perl-2.000019/lib/local/lib.pm 2016-04-19 13:00:25.000000000 +0000 @@ -4,7 +4,7 @@ use warnings; use Config; -our $VERSION = '2.000018'; +our $VERSION = '2.000019'; $VERSION = eval $VERSION; BEGIN { @@ -478,14 +478,14 @@ sub build_bourne_env_declaration { my ($class, $name, $args) = @_; - my $value = $class->_interpolate($args, '${%s}', qr/["\\\$!`]/, '\\%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} } @@ -1421,7 +1421,7 @@ IRC: - Join #local-lib on irc.perl.org. + Join #toolchain on irc.perl.org. =head1 AUTHOR diff -Nru liblocal-lib-perl-2.000018/maint/Makefile.PL.include liblocal-lib-perl-2.000019/maint/Makefile.PL.include --- liblocal-lib-perl-2.000018/maint/Makefile.PL.include 2015-09-02 10:20:10.000000000 +0000 +++ liblocal-lib-perl-2.000019/maint/Makefile.PL.include 2015-11-21 20:03:55.000000000 +0000 @@ -11,6 +11,6 @@ manifest_include lib => '.pod'; manifest_include inc => '.pm'; -manifest_include '' => 'cpan-configure.pl'; +manifest_include xt => 'cpan-bootstrap.pl'; 1; diff -Nru liblocal-lib-perl-2.000018/Makefile.PL liblocal-lib-perl-2.000019/Makefile.PL --- liblocal-lib-perl-2.000018/Makefile.PL 2015-10-29 10:41:51.000000000 +0000 +++ liblocal-lib-perl-2.000019/Makefile.PL 2016-04-19 11:33:37.000000000 +0000 @@ -21,15 +21,12 @@ } }, develop => { requires => { + 'Module::Build' => '0.36', 'Test::EOL' => 0, 'Test::NoTabs' => 0, 'Test::Pod' => 0, 'Capture::Tiny' => 0, 'Test::More' => 0.81_01, - 'Test::MinimumVersion' => 0, - 'Perl::MinimumVersion' => 1.35, - }, - recommends => { 'Test::CPAN::Changes' => 0, }, }, @@ -123,7 +120,7 @@ } for my $module (grep { $_ ne 'perl' } keys %$requires) { my $need_v = $requires->{$module} or next; - my $res = system($^X, '-Minc::CheckVersion', '-', $module, $need_v); + my $res = system($^X, '-Iinc', '-MCheckVersion', '-', $module, $need_v); $res >>= 8; if ($res == 0 || $res == 1) { $requires->{$module} = undef; @@ -140,8 +137,8 @@ *init_PERL = sub { my $self = shift; $self->SUPER::init_PERL(@_); - $self->{PERL} .= ' -I$(INSTALLPRIVLIB)'; - $self->{FULLPERL} .= ' -I$(INSTALLPRIVLIB)'; + $self->{PERL} .= ' "-I$(INSTALLPRIVLIB)"'; + $self->{FULLPERL} .= ' "-I$(INSTALLPRIVLIB)"'; }; } @@ -149,22 +146,22 @@ local $ENV{PERL_MM_USE_DEFAULT} = 1; if (@modules || $disable_manpages) { - system($^X, '-Minc::CPAN=init_config'); + system($^X, '-Iinc', '-MCPANBootstrapper=init_config'); } if (@modules) { - system($^X, '-Minc::CPAN=install', '-', $_) + system($^X, '-Iinc', '-MCPANBootstrapper=install', '-', $_) for @modules; } if (grep { $_ eq 'CPAN' } @modules ) { system($^X, '-MCPAN', '-e', 'CPAN::Config->load;CPAN::Config->commit;'); } if ($disable_manpages) { - system($^X, '-Minc::CPAN=disable_manpages'); + system($^X, '-Iinc', '-MCPANBootstrapper=disable_manpages'); } } if (!$ENV{PERL5_CPANM_IS_RUNNING}) { - my $status = system $^X, '-Minc::CPAN=check', '-', + my $status = system $^X, '-Iinc', '-MCPANBootstrapper=check', '-', $META{prereqs}{runtime}{requires}{CPAN}; exit $status if $status; diff -Nru liblocal-lib-perl-2.000018/MANIFEST liblocal-lib-perl-2.000019/MANIFEST --- liblocal-lib-perl-2.000018/MANIFEST 2015-10-29 17:11:28.000000000 +0000 +++ liblocal-lib-perl-2.000019/MANIFEST 2016-04-19 14:48:24.000000000 +0000 @@ -1,7 +1,7 @@ Changes eg/scripted_install.pl inc/CheckVersion.pm -inc/CPAN.pm +inc/CPANBootstrapper.pm lib/lib/core/only.pm lib/local/lib.pm lib/POD2/DE/local/lib.pod @@ -25,11 +25,13 @@ t/taint-mode.t xt/author/cpan-changes.t xt/author/eol.t -xt/author/minimum-version.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 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 -Nru liblocal-lib-perl-2.000018/META.json liblocal-lib-perl-2.000019/META.json --- liblocal-lib-perl-2.000018/META.json 2015-10-29 17:11:28.000000000 +0000 +++ liblocal-lib-perl-2.000019/META.json 2016-04-19 14:48:24.000000000 +0000 @@ -27,14 +27,11 @@ "requires" : {} }, "develop" : { - "recommends" : { - "Test::CPAN::Changes" : "0" - }, "requires" : { "Capture::Tiny" : "0", - "Perl::MinimumVersion" : "1.35", + "Module::Build" : "0.36", + "Test::CPAN::Changes" : "0", "Test::EOL" : "0", - "Test::MinimumVersion" : "0", "Test::More" : "0.8101", "Test::NoTabs" : "0", "Test::Pod" : "0" @@ -71,5 +68,5 @@ }, "x_IRC" : "irc://irc.perl.org/#local-lib" }, - "version" : "2.000018" + "version" : "2.000019" } diff -Nru liblocal-lib-perl-2.000018/META.yml liblocal-lib-perl-2.000019/META.yml --- liblocal-lib-perl-2.000018/META.yml 2015-10-29 17:11:28.000000000 +0000 +++ liblocal-lib-perl-2.000019/META.yml 2016-04-19 14:48:24.000000000 +0000 @@ -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.000018' +version: '2.000019' diff -Nru liblocal-lib-perl-2.000018/README liblocal-lib-perl-2.000019/README --- liblocal-lib-perl-2.000018/README 2015-10-29 17:11:28.000000000 +0000 +++ liblocal-lib-perl-2.000019/README 2016-04-19 14:48:24.000000000 +0000 @@ -535,7 +535,7 @@ SUPPORT IRC: - Join #local-lib on irc.perl.org. + Join #toolchain on irc.perl.org. AUTHOR Matt S Trout http://www.shadowcat.co.uk/ diff -Nru liblocal-lib-perl-2.000018/t/lib/ENVDumper.pm liblocal-lib-perl-2.000019/t/lib/ENVDumper.pm --- liblocal-lib-perl-2.000018/t/lib/ENVDumper.pm 2015-09-02 10:20:10.000000000 +0000 +++ liblocal-lib-perl-2.000019/t/lib/ENVDumper.pm 2016-04-19 11:33:37.000000000 +0000 @@ -1,4 +1,4 @@ -package t::lib::ENVDumper; +package ENVDumper; use Data::Dumper; sub import { diff -Nru liblocal-lib-perl-2.000018/t/pipeline.t liblocal-lib-perl-2.000019/t/pipeline.t --- liblocal-lib-perl-2.000018/t/pipeline.t 2015-05-28 00:13:50.000000000 +0000 +++ liblocal-lib-perl-2.000019/t/pipeline.t 2016-04-19 11:33:37.000000000 +0000 @@ -5,9 +5,11 @@ use local::lib (); { - package local::lib; - - { package Foo; sub foo { -$_[1] } sub bar { $_[1]+2 } sub baz { $_[1]+3 } } - my $foo = bless({}, 'Foo'); - Test::More::ok($foo->${pipeline qw(foo bar baz)}(10) == -15); + package Foo; + sub new { bless {}, $_[0] } + sub foo { -$_[1] } + sub bar { $_[1]+2 } + sub baz { $_[1]+3 } } + +is +Foo->new->${local::lib::pipeline qw(foo bar baz)}(10), -15; diff -Nru liblocal-lib-perl-2.000018/t/shell.t liblocal-lib-perl-2.000019/t/shell.t --- liblocal-lib-perl-2.000018/t/shell.t 2015-09-30 15:16:36.000000000 +0000 +++ liblocal-lib-perl-2.000019/t/shell.t 2016-04-19 11:33:37.000000000 +0000 @@ -57,6 +57,12 @@ test => '-c "exit 0"', }, { + name => 'sh -u', + exe => 'sh', + opt => '-u', + test => '-c "exit 0"', + }, + { name => 'dash', test => '-c "exit 0"', }, @@ -105,13 +111,14 @@ }, ) { my $name = $shell->{name}; - $shell->{shell} ||= $shell_path{$name}; - $shell->{ext} ||= $name; + my $exe = $shell->{exe} || $name; + $shell->{shell} ||= $shell_path{$exe}; + $shell->{ext} ||= $exe; $shell->{perl} ||= qq{"$^X"}; if (@ARGV) { next if !grep {$_ eq $name} @ARGV; - my $exec = $shell->{shell} ||= which($name); + my $exec = $shell->{shell} ||= which($exe); if (!$exec) { warn "unable to find executable for $name"; next; @@ -232,7 +239,7 @@ sub call_shell { my ($info, $script) = @_; - $script .= "\n" . qq{$info->{perl} -Mt::lib::ENVDumper -e1\n}; + $script .= "\n" . qq{$info->{perl} -It/lib -MENVDumper -e1\n}; my ($fh, $file) = File::Temp::tempfile( 'll-test-script-XXXXX', diff -Nru liblocal-lib-perl-2.000018/xt/author/minimum-version.t liblocal-lib-perl-2.000019/xt/author/minimum-version.t --- liblocal-lib-perl-2.000018/xt/author/minimum-version.t 2015-09-02 10:20:10.000000000 +0000 +++ liblocal-lib-perl-2.000019/xt/author/minimum-version.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -use strict; -use warnings; - -use Perl::MinimumVersion 1.35; -use Test::MinimumVersion; -all_minimum_version_ok( qq{5.006} ); diff -Nru liblocal-lib-perl-2.000018/xt/bootstrap.t liblocal-lib-perl-2.000019/xt/bootstrap.t --- liblocal-lib-perl-2.000018/xt/bootstrap.t 2015-09-02 10:20:10.000000000 +0000 +++ liblocal-lib-perl-2.000019/xt/bootstrap.t 2016-04-19 11:33:36.000000000 +0000 @@ -5,11 +5,13 @@ use IPC::Open3; use File::Temp; use File::Spec; -use File::Path qw(mkpath); +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 { my ($perl, $module) = @_; @@ -42,33 +44,14 @@ } } +my $dist_dir = make_dist_dir; my $cwd = cwd; -my $tempdir = File::Temp::tempdir('local-lib-source-XXXXX', CLEANUP => 1, TMPDIR => 1); -END { chdir $cwd } - -my @files = qw( - Makefile.PL - lib/local/lib.pm - inc/CPAN.pm - inc/CheckVersion.pm -); -for my $file (@files) { - my $dest = File::Spec->catfile($tempdir, $file); - mkpath(dirname($dest)); - my $content = do { - local $/; - open my $fh, '<:raw', $file - or die "can't read $file $!"; - <$fh>; - }; - $content =~ s{.*do 'maint/Makefile.PL\.include'.*}{}; - open my $fh, '>:raw', $dest - or die "can't write $dest $!"; - print { $fh } $content; - close $fh; +END { + chdir $cwd; + rmtree $dist_dir; } -chdir $tempdir; +chdir $dist_dir; @perl = $^X unless @perl; @@ -80,7 +63,7 @@ 'CPAN' => '1.82', # sudo support + CPAN::HandleConfig ); -plan tests => @perl * (2+2*keys %modules); +plan tests => @perl * 2 * (2+2*keys %modules); for my $perl (@perl) { local @INC = @INC; @@ -93,7 +76,6 @@ delete $ENV{PERL_LOCAL_LIB_ROOT}; delete $ENV{PERL_MM_OPT}; delete $ENV{PERL_MB_OPT}; - local $ENV{HOME} = my $home = File::Temp::tempdir('local-lib-home-XXXXX', CLEANUP => 1, TMPDIR => 1); diag "testing bootstrap with $perl"; my %old_versions; @@ -105,57 +87,63 @@ } } - my $ll = File::Spec->catdir($home, 'local-lib'); - - unlink 'MYMETA.yml'; - unlink 'META.yml'; - unlink 'Makefile'; - - open my $null_in, '<', File::Spec->devnull; - my $pid = open3 $null_in, my $out, undef, $perl, 'Makefile.PL', '--bootstrap='.$ll; - while (my $line = <$out>) { - note $line - if $verbose || $line =~ /^Running |^\s.* -- (?:NOT OK|OK|NA|TIMED OUT)$/; - } - waitpid $pid, 0; + for my $home_tmpl ('local-lib-home-XXXXX', 'local-lib-home with space-XXXXX') { + 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); + + my $ll = File::Spec->catdir($home, 'local-lib'); + note "local::lib dir is $ll"; + + unlink 'MYMETA.yml'; + unlink 'Makefile'; + + open my $null_in, '<', File::Spec->devnull; + my $pid = open3 $null_in, my $out, undef, $perl, 'Makefile.PL', '--bootstrap='.$ll; + while (my $line = <$out>) { + note $line + if $verbose || $line =~ /^Running |^\s.* -- (?:NOT OK|OK|NA|TIMED OUT)$/; + } + waitpid $pid, 0; - is $?, 0, 'Makefile.PL ran successfully'; + is $?, 0, 'Makefile.PL ran successfully'; - ok -e 'Makefile', 'Makefile created'; + ok -e 'Makefile', 'Makefile created'; - my $prereqs = {}; - open my $fh, '<', 'Makefile' - or die "Unable to open Makefile: $!"; + my $prereqs = {}; + open my $fh, '<', 'Makefile' + or die "Unable to open Makefile: $!"; - while (<$fh>) { - last if /MakeMaker post_initialize section/; - my ($p) = m{^[\#]\s+PREREQ_PM\s+=>\s+(.+)} - or next; + while (<$fh>) { + last if /MakeMaker post_initialize section/; + my ($p) = m{^[\#]\s+PREREQ_PM\s+=>\s+(.+)} + or next; - while ( $p =~ m/(?:\s)([\w\:]+)=>(?:q\[(.*?)\]|undef),?/g ) { - $prereqs->{$1} = $2; + while ( $p =~ m/(?:\s)([\w\:]+)=>(?:q\[(.*?)\]|undef),?/g ) { + $prereqs->{$1} = $2; + } } - } - close $fh; + close $fh; - local::lib->setup_env_hash_for($ll); + local::lib->setup_env_hash_for($ll); - for my $module (sort keys %modules) { - my $version = check_version($perl, $module); - my $old_v = $old_versions{$module}; - my $want_v = $modules{$module}; - if (defined $old_v) { - is $prereqs->{$module}, ($old_v >= $want_v ? undef : $want_v), - "prereqs correct for $module"; - cmp_ok $version, '>=', $want_v, "bootstrap upgraded to new enough $module" - or diag "PERL5LIB: $ENV{PERL5LIB}"; - } - else { - ok !exists $prereqs->{$module}, - "$module not listed as prereq"; - is $version, undef, "bootstrap didn't install new module $module"; + for my $module (sort keys %modules) { + my $version = check_version($perl, $module); + my $old_v = $old_versions{$module}; + my $want_v = $modules{$module}; + if (defined $old_v) { + is $prereqs->{$module}, ($old_v >= $want_v ? undef : $want_v), + "prereqs correct for $module"; + cmp_ok $version, '>=', $want_v, "bootstrap upgraded to new enough $module" + or diag "PERL5LIB: $ENV{PERL5LIB}"; + } + else { + ok !exists $prereqs->{$module}, + "$module not listed as prereq"; + is $version, undef, "bootstrap didn't install new module $module"; + } } } } - -unlink 'Makefile'; diff -Nru liblocal-lib-perl-2.000018/xt/cpan-bootstrap.pl liblocal-lib-perl-2.000019/xt/cpan-bootstrap.pl --- liblocal-lib-perl-2.000018/xt/cpan-bootstrap.pl 1970-01-01 00:00:00.000000000 +0000 +++ liblocal-lib-perl-2.000019/xt/cpan-bootstrap.pl 2015-11-21 19:25:54.000000000 +0000 @@ -0,0 +1,58 @@ +use strict; +use warnings; +no warnings qw(redefine once); + +my $url = $ENV{CPAN_MIRROR}; +my $ll_root = $ENV{LOCAL_LIB_CPAN_TEST}; + +require ExtUtils::MakeMaker; +{ + my $orig = \&ExtUtils::MakeMaker::prompt; + *ExtUtils::MakeMaker::prompt = sub ($;$) { + if ($_[0] =~ /manual configuration/) { + return "no"; + } + $orig->(@_); + }; +} + +require CPAN; +my %config = %{ $CPAN::Config } = ( + urllist => ["$url"], + install_help => 'manual', + check_sigs => 0, + shell => ( + $^O eq 'MSWin32' ? ($ENV{COMSPEC} || 'cmd.exe') + : ($ENV{SHELL} || '/bin/sh') + ), +); + +CPAN->import; +*CPAN::Distribution::check_integrity = sub { 1 }; +CPAN::Config->load; +%{ $CPAN::Config } = ( + %config, + install_help => 'local::lib', +); +CPAN::Config->init; + +require Data::Dumper; +$Data::Dumper::Useqq = 1; +$Data::Dumper::Terse = 1; + +print join "\n", + '', + '####### ENVIRONMENT ###########', + (map { + my $k = $_; + my $v = $ENV{$_}; + $v = Data::Dumper::Dumper($v) + if $v =~ /[^ -~]/; + sprintf '%-20s %s', $k, $v; + } sort keys %ENV), + '####### END ENVIRONMENT #######', + '####### INC ###################', + @INC, + '####### END INC ###############', + '', +; diff -Nru liblocal-lib-perl-2.000018/xt/cpan-bootstrap.t liblocal-lib-perl-2.000019/xt/cpan-bootstrap.t --- liblocal-lib-perl-2.000018/xt/cpan-bootstrap.t 1970-01-01 00:00:00.000000000 +0000 +++ liblocal-lib-perl-2.000019/xt/cpan-bootstrap.t 2015-11-21 19:35:09.000000000 +0000 @@ -0,0 +1,167 @@ +use strict; +use warnings; + +use Test::More 0.81_01; +use ExtUtils::MakeMaker; +use local::lib (); + +my $ll_core; + +BEGIN { + $ll_core = local::lib->new->deactivate_all; + my ($pm) = grep { -e } map { "$_/CPAN.pm" } @{ $ll_core->inc }; + plan skip_all => qq{CPAN.pm not available in core perl} + unless $pm; + my $vd = my $v = MM->parse_version($pm) || 0; + $v =~ tr/_//d; + plan skip_all => qq{CPAN.pm $vd doesn't have built in local::lib support} + if $v < 1.9600; + plan tests => 2; +} + +use File::Spec; +use File::Temp; +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); +note "building fake cpan ($local_cpan)"; +mkdir "$local_cpan/authors"; +mkdir "$local_cpan/authors/id"; +mkdir "$local_cpan/modules/"; + +my %modules; +make_dist "$local_cpan/authors/id/local-lib-bootstrap.tar.gz"; +$modules{'local::lib'} = 'local-lib-bootstrap.tar.gz'; + +for my $module (qw(ExtUtils::MakeMaker ExtUtils::Install Module::Build CPAN)) { + (my $dist_name = $module) =~ s{::}{-}g; + (my $file_name = "$module.pm") =~ s{::}{/}g; + my ($real_mod) = grep -e, map { "$_/$file_name" } @{$ll_core->inc}; + next + unless $real_mod; + my $dist = File::Temp->newdir("$dist_name-fake-XXXXXX"); + writefile "$dist/Makefile.PL", <<"END_MAKEFILEPL"; +use strict; +use warnings; +BEGIN { + die "PERL_MM_OPT not set to local::lib" + unless \$ENV{PERL_MM_OPT} && \$ENV{LOCAL_LIB_CPAN_TEST} + && \$ENV{PERL_MM_OPT} =~ /\\Q\$ENV{LOCAL_LIB_CPAN_TEST}/; +} + +use ExtUtils::MakeMaker; +WriteMakefile(NAME => '$module'); + +END_MAKEFILEPL + mkdir "$dist/lib"; + my $dir = "$dist/lib"; + my @parts = split /::/, $module; + pop @parts; + for my $part (@parts) { + $dir .= "/$part"; + mkdir $dir; + } + writefile "$dist/lib/$file_name", <<"END_PM"; +package $module; +\$VERSION = 9999; +require "$real_mod"; +END_PM + tar $dist, "$local_cpan/authors/id/$dist_name-fake.tar.gz"; + $modules{$module} = "$dist_name-fake.tar.gz"; +} + +my %checksums; +for my $file (values %modules) { + my $full_file = "$local_cpan/authors/id/$file"; + $checksums{$file} = { + 'mtime' => POSIX::strftime('%Y-%M-%D', gmtime), + 'size' => -s $full_file, + 'md5' => Digest::MD5->new->addfile(do { + open my $fh, '<', $full_file or die "$!"; + $fh; + })->hexdigest, + 'sha256' => Digest::SHA->new(256)->addfile($full_file, 'b')->hexdigest, + }; +} + +writefile "$local_cpan/authors/id/CHECKSUMS", + Data::Dumper->new([\%checksums], ['cksum'])->Indent(1)->Sortkeys(1)->Dump; + +writefile "$local_cpan/authors/01mailrc.txt.gz", <<'END_MAILRC'; +alias LOCAL "Local " +END_MAILRC + +my $packages = join "\n", map "$_ 9999 $modules{$_}", sort keys %modules; + +writefile "$local_cpan/modules/02packages.details.txt.gz", <<"END_PACKAGES"; +File: 02packages.details.txt +URL: http://www.perl.com/CPAN/modules/02packages.details.txt +Description: Package names found in directory authors/id/ +Columns: package name, version, path +Intended-For: Automated fetch routines, namespace documentation. +Written-By: local::lib test +Line-Count: 2 +Last-Updated: Wed, 21 Oct 2015 22:41:02 GMT + +$packages +END_PACKAGES + +writefile "$local_cpan/modules/03modlist.data.gz", <<"END_MODLIST"; +File: 03modlist.data +Description: Empty module list +Modcount: 0 +Written-By: PAUSE version 1.005 +Date: Thu, 03 Apr 2014 04:17:11 GMT + +package CPAN::Modulelist; +sub data { {} } +1; +END_MODLIST + +my $home = File::Temp::tempdir('local-lib-HOME-XXXXX', TMPDIR => 1); +my $ll_root = File::Spec->catdir($home, 'perl5'); + +my $cpan_url = do { + my ($vol, $path) = File::Spec->splitpath($local_cpan, 1); + my @dirs = File::Spec->splitdir($path); + shift @dirs; + unshift @dirs, $vol + if length $vol; + join '/', "file://", @dirs; +}; + +my $out = do { + my %env = $ll_core->build_environment_vars; + $env{LOCAL_LIB_CPAN_TEST} = $ll_root; + $env{HOME} = $home; + $env{CPAN_MIRROR} = $cpan_url; + $env{PERL_MM_USE_DEFAULT} = 1; + + local @ENV{keys %env} = values %env; + + delete $ENV{$_} + for grep { !defined $env{$_} } keys %env; + + note "running CPAN.pm bootstrap"; + cap_system $^X, "xt/cpan-bootstrap.pl"; +}; + +$out =~ /^#+\s*ENVIRONMENT\s*#+\s*\n(.*?)\n#+\s*END ENVIRONMENT\s*#+\s*\n/ms; +my %env = "$1" =~ /^(\w+)\s*(.*)$/mg; +$out =~ /^#+\s*INC\s*#+\s*\n(.*?)\n#+\s*END INC\s*#+\s*\n/ms; +my @inc = "$1" =~ /([^\r\n]+)/g; + +my $failed; +ok -e "$ll_root/lib/perl5/local/lib.pm", + 'local::lib was installed' + or $failed++; +like $inc[0], qr{^\Q$ll_root\E}, + 'local::lib was activated' + or $failed++; +diag $out + if $failed; diff -Nru liblocal-lib-perl-2.000018/xt/lib/dist_util.pm liblocal-lib-perl-2.000019/xt/lib/dist_util.pm --- liblocal-lib-perl-2.000018/xt/lib/dist_util.pm 1970-01-01 00:00:00.000000000 +0000 +++ liblocal-lib-perl-2.000019/xt/lib/dist_util.pm 2015-11-21 19:35:20.000000000 +0000 @@ -0,0 +1,111 @@ +package dist_util; +use strict; +use warnings; + +use File::Copy qw(copy); +use File::Find (); +use File::Spec (); +use File::Temp (); +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 Exporter; *import = \&Exporter::import; +our @EXPORT = qw(make_dist make_dist_dir cap_system tar writefile); + +sub writefile { + my ($file, $content) = @_; + my $fh; + if ($file =~ /\.gz$/) { + require IO::Compress::Gzip; + $fh = IO::Compress::Gzip->new($file); + } + else { + $fh = IO::File->new($file, '>:raw'); + } + $fh->print($content); + $fh->close; + undef $fh; + 1; +} + +sub cap_system { + my (@cmd) = @_; + my $failed; + open my $stdin, '<', File::Spec->devnull; + my $pid = open3 $stdin, my $stdout, undef, @cmd; + my $out = do { local $/; <$stdout> }; + close $stdout; + waitpid $pid, 0; + my $status = $?; + die "failed running [@cmd] (status $status):\n$out\n" + if $status; + return $out; +} + +sub make_dist_dir { + my $dist_dir = shift || File::Temp::tempdir('local-lib-dist-XXXXX', TMPDIR => 1); + copy 'Makefile.PL', "$dist_dir/Makefile.PL"; + { open my $fh, '>', "$dist_dir/META.yml"; } + File::Find::find({ no_chdir => 1, wanted => sub { + my $dest = "$dist_dir/$_"; + if (-d) { + mkdir $dest; + } + else { + copy $_, $dest; + } + }}, 'inc', 'lib'); + return $dist_dir; +} + +sub make_dist { + my $dist = shift; + my $distvname = basename($dist); + $distvname =~ s/\..*//; + $dist = File::Spec->rel2abs($dist); + my $dist_dir = make_dist_dir(); + my $cwd = cwd; + chdir $dist_dir; + cap_system $^X, 'Makefile.PL'; + cap_system $Config{make}, 'manifest'; + cap_system $Config{make}, 'distdir', "DISTVNAME=$distvname"; + tar($distvname, $dist); + chdir $cwd; + rmtree $dist_dir; + return $dist; +} + +sub tar { + require Archive::Tar; + my $dir = shift; + my $basename = basename($dir); + my $parent = dirname($dir); + my $tar = shift || do { + local $^W; + (File::Temp::tempdir( + "$basename-XXXXX", + SUFFIX => '.tar.gz', + TMPDIR => 1, + OPEN => 0, + ))[1]; + }; + my $cwd = cwd; + chdir $parent; + my @files; + File::Find::find({no_chdir => 1, wanted => sub { + push @files, $_; + }}, $basename); + Archive::Tar->create_archive( + $tar, + Archive::Tar::COMPRESS_GZIP(), + @files, + ); + chdir $cwd; + return $tar; +} + +1;