@@ -1,339 +1,341 @@
Revision history for local::lib
+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
+
+2.000007 - 2014-03-11
+ - even more relaxed shell output testing
+ - only test shells in /etc/shells
+ - fix Makefile.PL on solaris
+
+2.000006 - 2014-03-07
+ - fix bootstrapping not auto-configuring in some cases
+ - more relaxed shell output testing
+ - use normal arguments to be used on the command line in addition to import
+ arguments
+ - support fish shell
+ - stop trying to test csh/sh on Win32
+ - work around CPAN.pm issues with checking prerequisites
+
2.000004 - 2014-01-03
- - fix errors in PowerShell output when clearing nonexistant variables
- - fix shell test to avoid extremely long lines
- - fix shell test to avoid testing standard Win32 shells on Cygwin
- - improved diagnostics in shell test
+ - fix errors in PowerShell output when clearing nonexistant variables
+ - fix shell test to avoid extremely long lines
+ - fix shell test to avoid testing standard Win32 shells on Cygwin
+ - improved diagnostics in shell test
2.000003 - 2013-12-30
- - releasing 2.000_002 as stable
+ - releasing 2.000_002 as stable
2.000_002 - 2013-12-25
- - fix CPAN setup error check in Makefile.PL
- - fix install test warnings
- - fix shell test to skip cmd/powershell startup scripts
+ - fix CPAN setup error check in Makefile.PL
+ - fix install test warnings
+ - fix shell test to skip cmd/powershell startup scripts
2.000_001 - 2013-12-23
- - fix shell output for old bourne shells
- - fix various shell test issues
- - note issues/workarounds when combining with PREFIX/--prefix options
+ - fix shell output for old bourne shells
+ - fix various shell test issues
+ - note issues/workarounds when combining with PREFIX/--prefix options
2.000_000 - 2013-12-22
- - significant refactor of internals, adding an object oriented interface
- - add --no-create option to prevent directory creation on activation
- - add support for powershell output
- - add --shelltype option to specify shell instead of auto detecting
- - document recommended use of $SHLVL
- - document limitations regarding File::Spec
- - avoid including empty path segments in output
- - fix output for csh to allow direct use in eval
- - improve taint handling test
- - fix docs for build_environment_vars, install_base_bin_path
- - use Distar instead of Module::Install for packaging
+ - significant refactor of internals, adding an object oriented interface
+ - add --no-create option to prevent directory creation on activation
+ - add support for powershell output
+ - add --shelltype option to specify shell instead of auto detecting
+ - document recommended use of $SHLVL
+ - document limitations regarding File::Spec
+ - avoid including empty path segments in output
+ - fix output for csh to allow direct use in eval
+ - improve taint handling test
+ - fix docs for build_environment_vars, install_base_bin_path
+ - use Distar instead of Module::Install for packaging
1.008026 - 2013-11-05
- - drop perl prerequisite to 5.6, since everything works there.
+ - drop perl prerequisite to 5.6, since everything works there.
1.008025 - 2013-11-01 (development release, unindexed)
- - fix install test on cygwin
- - fix stackable test on win32 and when external local::lib is set
- - clarify errors in Makefile.PL about CPAN configuration
- - adjust csh output to allow use directly by eval
- - silence a possible warning in Makefile.PL
- - add additional docs about combining local::lib with lib::core::only
- - reverse order of PERL_LOCAL_LIB_ROOT. new local::libs are now added
- to the beginning instead of the end, to match the order of other
- similar environment variables.
+ - fix install test on cygwin
+ - fix stackable test on win32 and when external local::lib is set
+ - clarify errors in Makefile.PL about CPAN configuration
+ - adjust csh output to allow use directly by eval
+ - silence a possible warning in Makefile.PL
+ - add additional docs about combining local::lib with lib::core::only
+ - reverse order of PERL_LOCAL_LIB_ROOT. new local::libs are now added
+ to the beginning instead of the end, to match the order of other
+ similar environment variables.
1.008024 - 2013-10-28 (development release, unindexed)
- - fix installation into directories with spaces or backslashes, as
- well as Win32 test failures when Capture::Tiny is installed
- - fix test breaking in some cases when an external local::lib is set
- - fix test compatibility with old versions of Exporter
+ - fix installation into directories with spaces or backslashes, as
+ well as Win32 test failures when Capture::Tiny is installed
+ - fix test breaking in some cases when an external local::lib is set
+ - fix test compatibility with old versions of Exporter
1.008023 - 2013-10-19
- - stable release of 1.008022 (no code changes since 1.008012)
+ - stable release of 1.008022 (no code changes since 1.008012)
1.008022 - 2013-10-07 (development release, unindexed)
- - see 1.008019 through 1.008021
+ - see 1.008019 through 1.008021
1.008021 - 2013-10-04 (development release, unindexed)
- - yet another attempt to overcome win32 testing issues (paths with
- spaces, backslashes)
+ - yet another attempt to overcome win32 testing issues (paths with
+ spaces, backslashes)
1.008020 - 2013-10-03 (development release, unindexed)
- - yet another attempt to overcome win32 testing issues (paths with
- spaces, backslashes)
+ - yet another attempt to overcome win32 testing issues (paths with
+ spaces, backslashes)
1.008019 - 2013-09-29 (development release, unindexed)
- - another attempt to overcome win32 testing issues (paths with spaces,
- backslashes)
+ - another attempt to overcome win32 testing issues (paths with spaces,
+ backslashes)
1.008018 - 2013-09-15
- - print out actual paths in more test cases, for helping to diagnose
- mysterious failures
+ - print out actual paths in more test cases, for helping to diagnose
+ mysterious failures
1.008017 - 2013-09-14
- - avoid "Unrecognized escape \s passed through" errors on win32
- (again)
+ - avoid "Unrecognized escape \s passed through" errors on win32
+ (again)
1.008016 - 2013-09-13
- - avoid "Unrecognized escape \s passed through" errors on win32
+ - avoid "Unrecognized escape \s passed through" errors on win32
1.008015 - 2013-09-12
- - re-release 1.008014 to fix broken MANIFEST
+ - re-release 1.008014 to fix broken MANIFEST
1.008014 - 2013-09-12
- - fix new test to use alternate path representations on windows, to
- handle potential space issues (regression since 1.008012)
+ - fix new test to use alternate path representations on windows, to
+ handle potential space issues (regression since 1.008012)
1.008013 - 2013-09-11
- - fix undef value errors when not installing into a local::lib
+ - fix undef value errors when not installing into a local::lib
1.008012 - 2013-09-11
- - now handling using -Mlocal::lib in a taintperl environment, by
- ensuring that all libs in PERL_LOCAL_LIB_ROOT are properly added to
- @INC (RT#76661, Karen Etheridge)
+ - now handling using -Mlocal::lib in a taintperl environment, by
+ ensuring that all libs in PERL_LOCAL_LIB_ROOT are properly added to
+ @INC (RT#76661, Karen Etheridge)
1.008011 - 2013-07-26
- - skip CPAN workaround if running via cpanminus (miyagawa, RT#85731)
+ - skip CPAN workaround if running via cpanminus (miyagawa, RT#85731)
1.008010 - 2013-05-26
- - Fix a split on undefined value warning (David Golden -- see
- https://github.com/gugod/App-perlbrew/issues/305)
+ - Fix a split on undefined value warning (David Golden -- see
+ https://github.com/gugod/App-perlbrew/issues/305)
1.008009 - 2013-02-24
- - Remove Carp::Always dep
+ - Remove Carp::Always dep
1.008008 - 2013-02-24
- - Fix putting arch path in PERL5LIB
- - Refactor Win32 path handling out of ensure_dir_structure_for()
- - Fix active_paths when PERL_LOCAL_LIB_ROOT starts with :
- - Fix ~/perl5/bin missing in $PATH
- - The environment variables definition for the shell is now output in
- a way that allows to put the generated content directly in the
- .profile without requiring to launch perl
- (the only difference is how PERL_LOCAL_LIB_ROOT is generated)
- (Olivier Mengué).
+ - Fix putting arch path in PERL5LIB
+ - Refactor Win32 path handling out of ensure_dir_structure_for()
+ - Fix active_paths when PERL_LOCAL_LIB_ROOT starts with :
+ - Fix ~/perl5/bin missing in $PATH
+ - The environment variables definition for the shell is now output in
+ a way that allows to put the generated content directly in the
+ .profile without requiring to launch perl
+ (the only difference is how PERL_LOCAL_LIB_ROOT is generated)
+ (Olivier Mengué).
1.008007 - 2013-02-17
- - Back to 1.008004 with Carp fix since subsequent releases were botched
- - Avoid issue where PERL5LIB Carp is older than local::lib one
+ - Back to 1.008004 with Carp fix since subsequent releases were botched
+ - Avoid issue where PERL5LIB Carp is older than local::lib one
1.008004 - 2011-02-24
-
- - Fix stackable tests on win32 by canonicalizing the path ahead of time
+ - Fix stackable tests on win32 by canonicalizing the path ahead of time
1.008003 - 2011-02-23
-
- - Fix tests with stacking l::ls.
+ - Fix tests with stacking l::ls.
1.008002 - 2011-02-23
-
- - Add local::lib stacking support.
- - Add activation/deactivation support.
+ - Add local::lib stacking support.
+ - Add activation/deactivation support.
1.008001 - 2011-01-09
-
- - Bootstrap Module::Build just like ExtUtils::MakeMaker
+ - Bootstrap Module::Build just like ExtUtils::MakeMaker
1.008000 - 2011-01-05
-
- - Remove redundant prereqs now that Module::Build 0.36 is required
- - Makefile.PL avoids CPAN client configuration when not required
- - print_environment_vars_for() refactored with separate function
- environment_vars_string_for()
- - PERL_LOCAL_LIB_ROOT environment is added to disambiguate when
- PERL_MM_OPT, etc. was set by local::lib or other means
+ - Remove redundant prereqs now that Module::Build 0.36 is required
+ - Makefile.PL avoids CPAN client configuration when not required
+ - print_environment_vars_for() refactored with separate function
+ environment_vars_string_for()
+ - PERL_LOCAL_LIB_ROOT environment is added to disambiguate when
+ PERL_MM_OPT, etc. was set by local::lib or other means
1.007000 - 2010-12-09
- - Chase the Module::Build version which supports PERL_MB_OPT. Thanks to
- miyagawa for pointing this out.
+ - Chase the Module::Build version which supports PERL_MB_OPT. Thanks to
+ miyagawa for pointing this out.
1.006009 - 2010-12-09
-
- - Split up method guess_shelltype from parts of print_environment_vars_for
- - Updated documentation about change of use with .modulebuildrc
+ - Split up method guess_shelltype from parts of print_environment_vars_for
+ - Updated documentation about change of use with .modulebuildrc
1.006008 - 2010-11-17
-
- - Finally move to PERL_MB_OPT rather than using .modulebuildrc.
+ - Finally move to PERL_MB_OPT rather than using .modulebuildrc.
1.006007 - 2010-08-12
-
- - Fixing stuff so that search.cpan.org displays right
- - Documented one method in all languages
+ - Fixing stuff so that search.cpan.org displays right
+ - Documented one method in all languages
1.006006 - 2010-08-12
-
- - Added portuguese translation
- - Several minor fixes in the documentation
- - Changed methods look in documentation
+ - Added portuguese translation
+ - Several minor fixes in the documentation
+ - Changed methods look in documentation
1.006005 - 2010-07-13
-
- - Added support informations (also for german)
- - Fixed newline in german translation from DOS2UNIX
+ - Added support informations (also for german)
+ - Fixed newline in german translation from DOS2UNIX
1.006004 - 2010-06-10
-
- - I am stupid.
+ - I am stupid.
1.006003 - 2010-06-10
-
- - Added german translation right
+ - Added german translation right
1.006002 - 2010-06-10
-
- - Hotfix for a search.cpan.org "Bug"
+ - Hotfix for a search.cpan.org "Bug"
1.006001 - 2010-06-10
-
- - Added german translation
- - Enhanced some parts of english documentation
- - doc patch for win32 from run4flat
- - reverse the perl/arch paths in PERL5LIB
+ - Added german translation
+ - Enhanced some parts of english documentation
+ - doc patch for win32 from run4flat
+ - reverse the perl/arch paths in PERL5LIB
1.006000 - 2010-03-31
-
- - Create lib::core::only that provides the "set @INC to core dirs
- only" functionality that was the only part of --self-contained that
- ever worked usefully.
- - Delete broken --self-contained flag from core
+ - Create lib::core::only that provides the "set @INC to core dirs
+ only" functionality that was the only part of --self-contained that
+ ever worked usefully.
+ - Delete broken --self-contained flag from core
1.005001 - 2010-03-10
-
- - I am an idiot.
+ - I am an idiot.
1.005000 - 2010-03-10
-
- - More robust handling of running new toolchains on older perls. This
- should sort out issues users have with bootstrapping on e.g. Solaris
- and other traditional Unices. In addition, try to find a GNU tar
- capable of dealing with @LongLink so bootstrapping doesn't fail.
-
- - Warnings for missing PATH/PERL5LIB (as when not running interactively)
- silenced by a patch from Marco Emilio Poleggi.
-
- - Start of better docs for C<--self-contained> thanks to
- markstos@cpan.org.
+ - More robust handling of running new toolchains on older perls. This
+ should sort out issues users have with bootstrapping on e.g. Solaris
+ and other traditional Unices. In addition, try to find a GNU tar
+ capable of dealing with @LongLink so bootstrapping doesn't fail.
+ - Warnings for missing PATH/PERL5LIB (as when not running interactively)
+ silenced by a patch from Marco Emilio Poleggi.
+ - Start of better docs for C<--self-contained> thanks to
+ markstos@cpan.org.
1.004009 - 2009-11-07
-
- - Fix warning if your $ENV{PERL5LIB} is undef
-
- - Doc improvement from kgish/#perl-help@irc.perl.org
-
- - t0m and chrisa on #local-lib@irc.perl.org pointed out a PERL5LIB ordering issue
- with C<--self-contained>.
+ - Fix warning if your $ENV{PERL5LIB} is undef
+ - Doc improvement from kgish/#perl-help@irc.perl.org
+ - t0m and chrisa on #local-lib@irc.perl.org pointed out a PERL5LIB ordering issue
+ with C<--self-contained>.
1.004008 - 2009-10-13
-
- - Clarify re-reading the shell config file after writing to it.
-
- - Clarify copyright and licensing for packaging by vendors.
+ - Clarify re-reading the shell config file after writing to it.
+ - Clarify copyright and licensing for packaging by vendors.
1.004007 - 2009-09-02
-
- - Ensure that $ENV{PERL5LIB} and @INC are always de-duped, stopping
- them from growing if local::lib is invoked multiple times for the
- same path. (t0m)
-
- - Doc improvements by kurisuto@irc.perl.org/#catalyst.
-
- - Cleaned up indentation of code lines in the POD. Everything should be
- nice and flush, now.
+ - Ensure that $ENV{PERL5LIB} and @INC are always de-duped, stopping
+ them from growing if local::lib is invoked multiple times for the
+ same path. (t0m)
+ - Doc improvements by kurisuto@irc.perl.org/#catalyst.
+ - Cleaned up indentation of code lines in the POD. Everything should be
+ nice and flush, now.
1.004006 - 2009-08-25
- - Fix parsing of --self-contained and local lib directory. It's now
- possible to specify flags and the directory in any order. Also made
- adding future flags easier in the future. Thanks to
- frew@irc.perl.org/#catalyst for pointing out that --self-contained
- wouldn't work without a directory.
+ - Fix parsing of --self-contained and local lib directory. It's now
+ possible to specify flags and the directory in any order. Also made
+ adding future flags easier in the future. Thanks to
+ frew@irc.perl.org/#catalyst for pointing out that --self-contained
+ wouldn't work without a directory.
1.004005 - 2009-08-23
- - Add the --no-manpages option to bootstraping to tell EUMM / MB to not
- generate manpages from POD. Thanks to RKITOVER for providing the
- necessary values for CPAN.pm's configuration.
+ - Add the --no-manpages option to bootstraping to tell EUMM / MB to not
+ generate manpages from POD. Thanks to RKITOVER for providing the
+ necessary values for CPAN.pm's configuration.
1.004004 - 2009-08-05
-
- - Add dependency on Extutils::Install 1.43 and install in --bootstrap
- otherwise we fail to build with latest MakeMaker on OpenSolaris (t0m)
-
- - Fix Win32 / Cygwin detection (emazep).
+ - Add dependency on Extutils::Install 1.43 and install in --bootstrap
+ otherwise we fail to build with latest MakeMaker on OpenSolaris (t0m)
+ - Fix Win32 / Cygwin detection (emazep).
1.004003 - 2009-16-16
- - Stop Makefile.PL exploding if your CPAN is too old to have
- CPAN::HandleConfig. Needed when installing local::lib via CPAN
- using an old CPAN version (t0m)
- - Fix warning from Makefile.PL about ExtUtils::MakeMaker::prompt (t0m)
- - Set PERL5LIB back to calculated @INC with --self-contained, to stop
- invoking other perl scripts from losing the local::lib if they
- mangle @INC from $ENV{PERL5LIB}, and fix install of 'difficult'
- modules with such as Test::Deep (t0m)
+ - Stop Makefile.PL exploding if your CPAN is too old to have
+ CPAN::HandleConfig. Needed when installing local::lib via CPAN
+ using an old CPAN version (t0m)
+ - Fix warning from Makefile.PL about ExtUtils::MakeMaker::prompt (t0m)
+ - Set PERL5LIB back to calculated @INC with --self-contained, to stop
+ invoking other perl scripts from losing the local::lib if they
+ mangle @INC from $ENV{PERL5LIB}, and fix install of 'difficult'
+ modules with such as Test::Deep (t0m)
1.004002 - 2009-06-15
- - Fixed up INC untaint procedure to skip/ignore CODE, ARRAY,
- blessed entries. (grink)
- - Include test in xt/ for the above
-
- - Put PERL5LIB first, so it'll be favored over privlibexp and
- archlibexp when self contained.
- - Automatically untaint @INC (t0m)
- - Prevent @INC from growing when you have multiple scripts using
- --self-contained called from inside one another. (grink by way of t0m)
- - eg/scripted_install.pl now no longer requires TARGET, but still
- respects it. (confound)
+ - Fixed up INC untaint procedure to skip/ignore CODE, ARRAY,
+ blessed entries. (grink)
+ - Include test in xt/ for the above
+ - Put PERL5LIB first, so it'll be favored over privlibexp and
+ archlibexp when self contained.
+ - Automatically untaint @INC (t0m)
+ - Prevent @INC from growing when you have multiple scripts using
+ --self-contained called from inside one another. (grink by way of t0m)
+ - eg/scripted_install.pl now no longer requires TARGET, but still
+ respects it. (confound)
1.004001 - 2009-05-21
- - Clean up CPAN.pm's environment variable the same way we do for
- CPANPLUS. Add an example program showing local::lib employed
- programmatically (confound).
-
- - Add the beginnings of a troubleshooting section (pattern).
+ - Clean up CPAN.pm's environment variable the same way we do for
+ CPANPLUS. Add an example program showing local::lib employed
+ programmatically (confound).
+ - Add the beginnings of a troubleshooting section (pattern).
1.004000 - 2009-05-14
- - Don't allow dangerous settings for CPAN.pm that affect where CPAN
- installs stuff, as this conflicts with what we're trying to do.
-
- - Make sure that our Makefile is written to the correct directory when
- bootstrapping (confound).
+ - Don't allow dangerous settings for CPAN.pm that affect where CPAN
+ installs stuff, as this conflicts with what we're trying to do.
+ - Make sure that our Makefile is written to the correct directory when
+ bootstrapping (confound).
1.003004 - 2009-05-12
- - Additional documentation and examples concerning having multiple
- local::lib enviornments (amiri)
-
- - Some install tests courtesy of Hans Dieter Pearcey <hdp@cpan.org>.
- Thanks!
+ - Additional documentation and examples concerning having multiple
+ local::lib enviornments (amiri)
+ - Some install tests courtesy of Hans Dieter Pearcey <hdp@cpan.org>.
+ Thanks!
1.003003 - 2009-04-09
- - Expose the internals per RT #36846.
- - Fix the MANIFEST up a bit.
+ - Expose the internals per RT #36846.
+ - Fix the MANIFEST up a bit.
1.003002 - 2009-02-25
- - Add a doc patch from Torsten Raudssus <torsten@raudssus.de> that
- clarifies how to specify a directory other than ~/perl5.
+ - Add a doc patch from Torsten Raudssus <torsten@raudssus.de> that
+ clarifies how to specify a directory other than ~/perl5.
1.003001 - 2009-01-14
- - Properly bail if given fancy dashes obtained by copy-pasting from a
- UTF8-happy POD formatter. This will bail in both the Makefile.PL and
- in local::lib::import().
+ - Properly bail if given fancy dashes obtained by copy-pasting from a
+ UTF8-happy POD formatter. This will bail in both the Makefile.PL and
+ in local::lib::import().
1.003000 - 2009-01-13
- - Add the --self-contained flag from Mark Stosberg, which also contains
- a doc patch warning about the dangers of UNINST=1. Thanks, Mark!
+ - Add the --self-contained flag from Mark Stosberg, which also contains
+ a doc patch warning about the dangers of UNINST=1. Thanks, Mark!
1.002000 - 2008-08-06
- - make CPAN config reinit non-prompting but still robust
- - make bootstrap auto-init CPAN config and set USE_DEFAULT for deps
+ - make CPAN config reinit non-prompting but still robust
+ - make bootstrap auto-init CPAN config and set USE_DEFAULT for deps
1.001000 - 2007-09-19
- - refactored shell command generation
- - implemented C shell command generation based on this (checks $SHELL}
- - improved docs
- - modified Makefile.PL to install an up-to-date CPAN.pm if needed
+ - refactored shell command generation
+ - implemented C shell command generation based on this (checks $SHELL}
+ - improved docs
+ - modified Makefile.PL to install an up-to-date CPAN.pm if needed
1.000000 - 2007-09-13
- - initial release
+ - initial release
@@ -1,17 +1,21 @@
Changes
eg/scripted_install.pl
+inc/CheckVersion.pm
+inc/ConfigCPAN.pm
lib/lib/core/only.pm
lib/local/lib.pm
lib/POD2/DE/local/lib.pod
lib/POD2/PT_BR/local/lib.pod
+maint/bump-version
+maint/Makefile.include
maint/Makefile.PL.include
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
-t/install.t
t/lib-core-only.t
t/lib/ENVDumper.pm
t/lib/TempDir.pm
@@ -21,6 +25,7 @@ t/stackable.t
t/subroutine-in-inc.t
t/taint-mode.t
xt/bootstrap.t
+xt/install.t
xt/release/cpan-changes.t
xt/release/eol.t
xt/release/kwalitee.t
@@ -4,7 +4,7 @@
"mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830",
+ "generated_by" : "ExtUtils::MakeMaker version 6.96, CPAN::Meta::Converter version 2.140640",
"license" : [
"perl_5"
],
@@ -16,18 +16,40 @@
"no_index" : {
"directory" : [
"t",
- "inc",
- "xt"
+ "inc"
]
},
"prereqs" : {
+ "build" : {
+ "requires" : {}
+ },
+ "configure" : {
+ "requires" : {}
+ },
+ "develop" : {
+ "recommends" : {
+ "Test::CPAN::Changes" : "0"
+ },
+ "requires" : {
+ "Capture::Tiny" : "0",
+ "Test::EOL" : "0",
+ "Test::More" : "0.8101",
+ "Test::NoTabs" : "0",
+ "Test::Pod" : "0"
+ }
+ },
"runtime" : {
"requires" : {
"CPAN" : "1.82",
"ExtUtils::Install" : "1.43",
"ExtUtils::MakeMaker" : "6.74",
"Module::Build" : "0.36",
- "perl" : "v5.8.1"
+ "perl" : "5.006"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0"
}
}
},
@@ -42,10 +64,10 @@
],
"repository" : {
"type" : "git",
- "url" : "git://git.shadowcat.co.uk/p5sagit/local-lib.git",
- "web" : "http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/local-lib.git"
+ "url" : "git://github.com/Perl-Toolchain-Gang/local-lib",
+ "web" : "https://github.com/Perl-Toolchain-Gang/local-lib"
},
"x_IRC" : "irc://irc.perl.org/#local-lib"
},
- "version" : "2.000004"
+ "version" : "2.000012"
}
@@ -2,28 +2,29 @@
abstract: 'create and use a local lib/ for perl modules with PERL5LIB'
author:
- 'mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>'
-build_requires: {}
+build_requires:
+ Test::More: '0'
+configure_requires: {}
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830'
+generated_by: 'ExtUtils::MakeMaker version 6.96, CPAN::Meta::Converter version 2.140640'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: local-lib
no_index:
directory:
- t
- inc
- - xt
requires:
- CPAN: 1.82
- ExtUtils::Install: 1.43
- ExtUtils::MakeMaker: 6.74
- Module::Build: 0.36
- perl: v5.8.1
+ CPAN: '1.82'
+ ExtUtils::Install: '1.43'
+ ExtUtils::MakeMaker: '6.74'
+ Module::Build: '0.36'
+ perl: '5.006'
resources:
IRC: irc://irc.perl.org/#local-lib
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=local-lib
license: http://dev.perl.org/licenses/
- repository: git://git.shadowcat.co.uk/p5sagit/local-lib.git
-version: 2.000004
+ repository: git://github.com/Perl-Toolchain-Gang/local-lib
+version: '2.000012'
@@ -1,9 +1,55 @@
use strict;
-use warnings;
-use File::Spec;
-use Cwd;
-use vars qw($bootstrapping $bootstrapping_args $no_manpages);
-use Config;
+use warnings FATAL => 'all';
+
+my %META = (
+ name => 'local-lib',
+ license => 'perl_5',
+ prereqs => {
+ configure => { requires => {
+ } },
+ build => { requires => {
+ } },
+ test => { requires => {
+ 'Test::More' => 0,
+ } },
+ runtime => { requires => {
+ 'perl' => 5.006,
+ 'ExtUtils::MakeMaker' => '6.74', # version PERL_MM_OPT is shell parsed
+ 'ExtUtils::Install' => '1.43', # version INSTALL_BASE was added
+ 'Module::Build' => '0.36', # PERL_MB_OPT
+ 'CPAN' => '1.82', # sudo support + CPAN::HandleConfig
+ } },
+ develop => {
+ requires => {
+ 'Test::EOL' => 0,
+ 'Test::NoTabs' => 0,
+ 'Test::Pod' => 0,
+ 'Capture::Tiny' => 0,
+ 'Test::More' => 0.81_01,
+ },
+ recommends => {
+ 'Test::CPAN::Changes' => 0,
+ },
+ },
+ },
+ resources => {
+ repository => {
+ url => 'git://github.com/Perl-Toolchain-Gang/local-lib',
+ web => 'https://github.com/Perl-Toolchain-Gang/local-lib',
+ type => 'git',
+ },
+ x_IRC => 'irc://irc.perl.org/#local-lib',
+ bugtracker => {
+ web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=local-lib',
+ mailto => 'bug-local-lib@rt.cpan.org',
+ },
+ license => [ 'http://dev.perl.org/licenses/' ],
+ },
+);
+
+my %MM_ARGS = ();
+
+##############################################################################
# Solaris (and possibly other Unices) have a tar in /usr/bin that, among
# other things, does not understand @LongLink. This can cause
@@ -14,40 +60,32 @@ use Config;
# tar, but I digress), we'll look for GNU tar. If we don't find it, and the
# user hasn't pointed us to a suitable tar, we'll bomb and tell them what to
# do.
-
-my $have_gtar = 0;
-if($^O eq 'solaris') {
- $have_gtar = 0;
- for my $env_path (split /:/, $ENV{PATH}) {
- $have_gtar = 1 if -x File::Spec->catfile($env_path, 'gtar');
- }
-} else {
- $have_gtar = 1;
-}
-if(exists $ENV{PERL_LL_TAR}) {
- $have_gtar ||= -x $ENV{PERL_LL_TAR};
-}
-
-die <<'DEATH' unless $have_gtar;
+#
+require File::Spec;
+unless (exists $ENV{PERL_LL_TAR} ? -x $ENV{PERL_LL_TAR}
+ : $^O eq 'solaris'
+ ? (grep -x,
+ map File::Spec->catfile($_, 'gtar'),
+ File::Spec->path)
+ : 1) {
+ die <<'DEATH';
You are using Solaris (or another traditional Unix) that does not provide a sane
tar, capable of dealing with the output of GNU tar. Please either set the
PERL_LL_TAR environment variable to the location of a version of tar that
understands the @LongLink convention or put a binary named gtar somewhere on
your PATH.
DEATH
+}
-my $cwd;
-BEGIN {
- $cwd = Cwd::cwd();
- # watch out for fancy dashes. these can wind up in our @ARGV if the user is
- # copypasting the bootstrap command from the POD displayed e.g. by perldoc
- # on a Mac OS X terminal. since no software recognizes and handles these
- # dashes, it's better to die loudly telling the user exactly what happened
- # so they don't make the same mistake again rather than being the only
- # program in the universe that works with them.
- # the fancy dash is U+2212 or \xE2\x88\x92
- if(grep { /\xE2\x88\x92/ } @ARGV or grep { /−/ } @ARGV) {
- die <<'DEATH';
+# watch out for fancy dashes. these can wind up in our @ARGV if the user is
+# copypasting the bootstrap command from the POD displayed e.g. by perldoc
+# on a Mac OS X terminal. since no software recognizes and handles these
+# dashes, it's better to die loudly telling the user exactly what happened
+# so they don't make the same mistake again rather than being the only
+# program in the universe that works with them.
+# the fancy dash is U+2212 or \xE2\x88\x92
+if(grep { /\xE2\x88\x92/ || /\x{2212}/ } @ARGV) {
+ die <<'DEATH';
WHOA THERE! It looks like you've got some fancy dashes in your commandline!
These are *not* the traditional -- dashes that software recognizes. You
probably got these by copy-pasting from the perldoc for this module as
@@ -55,268 +93,118 @@ rendered by a UTF8-capable formatter. This most typically happens on an OS X
terminal, but can happen elsewhere too. Please try again after replacing the
dashes with normal minus signs.
DEATH
- }
- if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
- @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
- $bootstrapping = 1;
- if(my ($x) = grep { /^--no-manpages/ } @ARGV) {
- $no_manpages = 1;
- @ARGV = grep { !/^--no-manpages/ } @ARGV;
- }
- my ($path) = $x =~ /^--bootstrap(?:=(.*))?$/;
- my @args = $path ? $path : ();
-
- {
- local @INC = @INC;
- unshift(@INC, 'lib');
- require local::lib;
- }
-
- local::lib->import(@args);
-
- my @libs = map { "-I$_" } split $Config{path_sep}, $ENV{PERL5LIB};
- $bootstrapping_args = "@libs";
- push(@ARGV,$ENV{PERL_MM_OPT});
- push(@ARGV, @libs);
-
- # <mst> GODDAMN makepl_arg INSTALLDIRS=site
- # <mst> we must set PERL_AUTOINSTALL_PREFER_CPAN too
- $ENV{PERL_AUTOINSTALL_PREFER_CPAN} = 1;
-
- system($^X, '-MExtUtils::MakeMaker 6.74', '-e1');
- my $eumm = $? >> 8;
-
- system($^X, '-MExtUtils::Install 1.43', '-e1');
- my $eui = $? >> 8;
-
- system($^X, '-MModule::Build 0.36', '-e1');
- my $mb = $? >> 8;
-
- system($^X, '-MCPAN 1.82', '-e1');
- my $cpan = $? >> 8;
- my $cpan_command = '';
-
- my $did_cpan_config = 0;
- my $cpan_config_command =
- 'my $done; require ExtUtils::MakeMaker;
- my $orig = ExtUtils::MakeMaker->can("prompt");
- *ExtUtils::MakeMaker::prompt = sub ($;$) {
- if (!$done && $_[0] =~ /manual configuration/) {
- $done++;
- return "no";
- }
- return $orig->(@_);
- };
- # not yet -- apeiron, 2010-03-10
- #$CPAN::Config->{urllist} = ["http://cpan.shadowcatprojects.net"];
- # <mst> all bootstrapped fine on one DH account
- # <mst> on another, it tries to install man stuff into /usr/local
- # <mst> cannot for the life of me figure out why
- # <mst> (same fucking server as well)
- # <mst> GOT THE BASTARD
- # <mst> ExtUtils::ParseXS uses Module::Build
- # <mst> but Module::Build depends on it
- # <mst> so you need to set prefer_installer MM
- # <mst> so cpan uses EU::ParseXS Makefile.PL
- # <mst> since we already got EUMM, *that* works
- $CPAN::Config->{prefer_installer} = "EUMM";
- 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;
- }';
+}
- $ENV{PERL_MM_USE_DEFAULT} = 1;
+my $bootstrapping;
+my $disable_manpages;
+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;
+ }
- # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
+ {
+ local @INC = @INC;
+ unshift(@INC, 'lib');
+ require local::lib;
+ }
- if ($eumm) { # non-zero exit
- $cpan_command .= 'force("install","ExtUtils::MakeMaker"); ';
- }
- if ($eui) {
- $cpan_command .= 'install("ExtUtils::Install"); ';
- }
- if ($mb) {
- $cpan_command .= 'install("Module::Build"); ';
- }
- if ($cpan) {
- $cpan_command .= 'force("install","CPAN"); ';
- }
- if(length $cpan_command) {
- system($^X, '-MCPAN', '-e', $cpan_config_command);
- $did_cpan_config++;
- system($^X, '-MCPAN', '-e', $cpan_command);
- }
- if ($cpan) {
- system($^X, '-MCPAN', '-e', 'CPAN::Config->load; CPAN::Config->commit;');
- }
- if($no_manpages) {
- # if we call this code directly, the changes get written to
- # $BOOTSTRAP/lib/perl5/CPAN/Config.pm, not where the user expects them to
- # be in their ~/.cpan/CPAN/MyConfig.pm.
- system($^X, '-MCPAN', '-e', $cpan_config_command)
- unless $did_cpan_config;
- system($^X, '-MCPAN',
- '-e',
- q[CPAN::HandleConfig->load;],
- '-e',
- q[$CPAN::Config->{makepl_arg} = ] .
- q['INSTALLMAN1DIR=none INSTALLMAN3DIR=none';],
- '-e',
- q[$CPAN::Config->{buildpl_arg} = ] .
- q['--install_path libdoc="" --install_path bindoc=""';],
- '-e',
- q[CPAN::Config->commit;],
- );
- }
+ local::lib->import($path || ());
+ $bootstrapping = 1;
+}
- chdir($cwd);
+my $requires = $MM_ARGS{PREREQ_PM} = { %{$META{prereqs}{runtime}{requires}} };
+if ($ENV{PERL5_CPANM_IS_RUNNING}) {
+ $requires->{CPAN} = undef;
+}
+for my $module (grep { $_ ne 'perl' } keys %$requires) {
+ my $need_v = $requires->{$module} or next;
+ my $res = system($^X, '-Minc::CheckVersion', '-', $module, $need_v);
+ $res >>= 8;
+ if ($res == 0 || $res == 1) {
+ $requires->{$module} = undef;
}
}
-require ExtUtils::MakeMaker;
-ExtUtils::MakeMaker->import;
-(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
-
-my %CONFIGURE_DEPS = ();
-my %BUILD_DEPS = ();
-my %TEST_DEPS = (
- 'Test::More' => 0,
-);
-my %RUN_DEPS = (
- 'ExtUtils::MakeMaker' => '6.74', # version PERL_MM_OPT is shell parsed
- 'ExtUtils::Install' => '1.43', # version INSTALL_BASE was added
- 'Module::Build' => '0.36', # PERL_MB_OPT
- 'CPAN' => '1.82', # sudo support + CPAN::HandleConfig
-);
-
-my %extra_info = (
- 'meta-spec' => { version => 2 },
- resources => {
- repository => {
- # r/w: p5sagit@git.shadowcat.co.uk:local-lib.git
- url => 'git://git.shadowcat.co.uk/p5sagit/local-lib.git',
- web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/local-lib.git',
- type => 'git',
- },
- x_IRC => 'irc://irc.perl.org/#local-lib',
- bugtracker => {
- web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=local-lib',
- mailto => 'bug-local-lib@rt.cpan.org',
- },
- license => [ 'http://dev.perl.org/licenses/' ],
- },
- prereqs => {
- runtime => { requires => { perl => '5.8.1' } },
- },
-);
-
if ($bootstrapping) {
+ my @modules = grep $requires->{$_},
+ qw(ExtUtils::MakeMaker ExtUtils::Install Module::Build CPAN);
+
no warnings 'once';
-*MY::postamble = sub {
- <<"END";
-PERL += $bootstrapping_args
-FULLPERL += $bootstrapping_args
+ *MY::postamble = sub {
+ <<"END";
+PERL += -I\$(INSTALLPRIVLIB)
+FULLPERL += -I\$(INSTALLPRIVLIB)
END
+ };
+
+ local $ENV{PERL_AUTOINSTALL_PREFER_CPAN} = 1;
+ local $ENV{PERL_MM_USE_DEFAULT} = 1;
+
+ my @cpan_command = map qq{force(q[install],q[$_]);}, @modules;
+
+ if (@cpan_command || $disable_manpages) {
+ system($^X, '-Minc::ConfigCPAN', '-', 'configure');
+ }
+ if (@cpan_command) {
+ system($^X, '-MCPAN', '-e', $_)
+ for @cpan_command;
+ }
+ if (grep { $_ eq 'CPAN' } @modules ) {
+ system($^X, '-MCPAN', '-e', 'CPAN::Config->load;CPAN::Config->commit;');
+ }
+ if ($disable_manpages) {
+ system($^X, '-Minc::ConfigCPAN', '-', 'disable_manpages');
}
}
-# don't bother fixing CPAN.pm if bootstrapped from cpanminus
-if ($ENV{PERL5_CPANM_IS_RUNNING}) {
- delete $RUN_DEPS{CPAN};
+if (!$ENV{PERL5_CPANM_IS_RUNNING}) {
+ my $status = system $^X, '-Minc::ConfigCPAN', '-', 'check',
+ $META{prereqs}{runtime}{requires}{CPAN};
+ exit $status
+ if $status;
}
-else {
- # No, really. See
- # https://rt.cpan.org/Public/Bug/Display.html?id=23735
- # for why CPAN now sets the CPANPLUS env var.
- # trouble is this means we can't auto_install(_now) CPAN itself
- # without this beautiful hack
- my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
- my $no_cpan_env = !exists $ENV{PERL5_CPAN_IS_RUNNING};
- require CPAN;
- delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
- delete $ENV{PERL5_CPAN_IS_RUNNING} if $no_cpan_env;
+##############################################################################
+require ExtUtils::MakeMaker;
+(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
- # and make sure that the user doesn't have any existing CPAN config that'll
- # cause us problems for the next few steps.
- local $@;
- eval { require CPAN::HandleConfig; };
- # 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 (!$@ ) {
- 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 {
- my $error = $@;
- require CPAN;
- # Explode if it looks like requiring CPAN::HandleConfig should
- # have worked, but didn't.
- die($error) if $CPAN::VERSION >= $RUN_DEPS{CPAN};
- }
+# have to do this since old EUMM dev releases miss the eval $VERSION line
+my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
+my $mymeta = $eumm_version >= 6.57_02;
+my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
+
+($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;
+$MM_ARGS{NO_MYMETA} = 1
+ if $mymeta_broken;
+$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
+ unless -f 'META.yml';
+
+for (qw(configure build test runtime)) {
+ my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
+ my $r = $MM_ARGS{$key} = {
+ %{$META{prereqs}{$_}{requires}},
+ %{delete $MM_ARGS{$key} || {}},
+ };
+ defined $r->{$_} or delete $r->{$_} for keys %$r;
}
-chdir($cwd);
-
-@{$extra_info{prereqs}{runtime}{requires}}{keys %RUN_DEPS} = values %RUN_DEPS;
-# have to do this since old EUMM dev releases miss the eval $VERSION line
-my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
-my $mymeta_works = $eumm_version >= 6.57_07;
-my $mymeta = $eumm_version >= 6.57_02;
+$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
-my $has_test_requires = $eumm_version >= 6.63_03;
+delete $MM_ARGS{MIN_PERL_VERSION}
+ if $eumm_version < 6.47_01;
+$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
+ if $eumm_version < 6.63_03;
+$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
+ if $eumm_version < 6.55_01;
+delete $MM_ARGS{CONFIGURE_REQUIRES}
+ if $eumm_version < 6.51_03;
-my $has_meta_v2 = $eumm_version >= 6.57_10;
-if (! $has_meta_v2) {
- %extra_info = ();
-}
-if (not $has_test_requires) {
- %BUILD_DEPS = (%BUILD_DEPS, %TEST_DEPS);
- %TEST_DEPS = ();
-}
-if (not $mymeta_works) {
- %RUN_DEPS = (%RUN_DEPS, %BUILD_DEPS);
- %BUILD_DEPS = ();
-}
+$MM_ARGS{realclean}{FILES} = 'Distar/';
-WriteMakefile(
- NAME => 'local::lib',
- VERSION_FROM => 'lib/local/lib.pm',
- CONFIGURE_REQUIRES => \%CONFIGURE_DEPS,
- PREREQ_PM => {
- %RUN_DEPS,
- },
- keys %BUILD_DEPS ? ( BUILD_REQUIRES => \%BUILD_DEPS ) : (),
- keys %TEST_DEPS ? ( TEST_REQUIRES => \%TEST_DEPS ) : (),
- META_ADD => \%extra_info,
- META_MERGE => {
- no_index => {
- directory => [ 'xt' ]
- },
- },
- ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()),
- LICENSE => 'perl',
-);
+ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
@@ -19,10 +19,11 @@ SYNOPSIS
# Just print out useful shell commands
$ perl -Mlocal::lib
- export PERL_MB_OPT='--install_base /home/username/perl5'
- export PERL_MM_OPT='INSTALL_BASE=/home/username/perl5'
- export PERL5LIB="/home/username/perl5/lib/perl5"
- export PATH="/home/username/perl5/bin:$PATH"
+ PERL_MB_OPT='--install_base /home/username/perl5'; export PERL_MB_OPT;
+ PERL_MM_OPT='INSTALL_BASE=/home/username/perl5'; export PERL_MM_OPT;
+ PERL5LIB="/home/username/perl5/lib/perl5"; export PERL5LIB;
+ PATH="/home/username/perl5/bin:$PATH"; export PATH;
+ PERL_LOCAL_LIB_ROOT="/home/usename/perl5:$PERL_LOCAL_LIB_ROOT"; export PERL_LOCAL_LIB_ROOT;
From a .bashrc file -
@@ -475,11 +476,11 @@ LIMITATIONS
* 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
@@ -0,0 +1,27 @@
+package inc::CheckVersion;
+use strict;
+use warnings;
+
+sub import {
+ my $target = caller;
+ my $result = check_version(@ARGV);
+ exit $result;
+}
+
+sub check_version {
+ my ($module, $need_v) = @_;
+ require ExtUtils::MakeMaker;
+ (my $file = "$module.pm") =~ s{::}{/}g;
+ my ($pm) = grep { -e } map { "$_/$file" } @INC;
+ if (!$pm) {
+ return 1;
+ }
+ my $v = MM->parse_version($pm) || 0;
+ $v = eval $v;
+ if ($v >= $need_v) {
+ return 0;
+ }
+ return 2;
+}
+
+1;
@@ -0,0 +1,102 @@
+package inc::ConfigCPAN;
+use strict;
+use warnings;
+
+sub import {
+ my $op = shift @ARGV
+ or die "no operation specified!\n";
+ my $do = __PACKAGE__->can("cmd_$op")
+ or die "invalid operation $op\n";
+ $do->(@ARGV);
+ exit 0;
+}
+
+sub cmd_configure {
+ 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/"];
+
+ # <mst> all bootstrapped fine on one DH account
+ # <mst> on another, it tries to install man stuff into /usr/local
+ # <mst> cannot for the life of me figure out why
+ # <mst> (same fucking server as well)
+ # <mst> GOT THE BASTARD
+ # <mst> ExtUtils::ParseXS uses Module::Build
+ # <mst> but Module::Build depends on it
+ # <mst> so you need to set prefer_installer MM
+ # <mst> so cpan uses EU::ParseXS Makefile.PL
+ # <mst> since we already got EUMM, *that* works
+ $CPAN::Config->{prefer_installer} = "EUMM";
+ 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_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;
@@ -1,18 +1,94 @@
+package local::lib;
+use 5.006;
use strict;
use warnings;
+use Config;
-package local::lib;
+our $VERSION = '2.000012';
+$VERSION = eval $VERSION;
-use 5.006;
+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;
+}
-use File::Spec ();
-use Config;
+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;
+ }
+}
-our $VERSION = '2.000004'; # 2.0.4
-$VERSION = eval $VERSION;
+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
+ if $0 eq '-';
my @steps;
my %opts;
@@ -100,7 +176,6 @@ sub libs { $_[0]->{libs} ||= [ \'PERL5LIB' ] }
sub bins { $_[0]->{bins} ||= [ \'PATH' ] }
sub roots { $_[0]->{roots} ||= [ \'PERL_LOCAL_LIB_ROOT' ] }
sub extra { $_[0]->{extra} ||= {} }
-sub shelltype { $_[0]->{shelltype} ||= $_[0]->guess_shelltype }
sub no_create { $_[0]->{no_create} }
my $_archname = $Config{archname};
@@ -135,21 +210,21 @@ my @_lib_subdirs = (
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 {
@@ -282,6 +357,18 @@ sub build_environment_vars_for {
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;
(
@@ -299,6 +386,12 @@ sub setup_local_lib_for {
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};
}
@@ -335,11 +428,12 @@ sub environment_vars_string {
my $build_method = "build_${shelltype}_env_declaration";
+ my $extra = $self->extra;
my @envs = (
PATH => $self->bins,
PERL5LIB => $self->libs,
PERL_LOCAL_LIB_ROOT => $self->roots,
- %{$self->extra},
+ map { $_ => $extra->{$_} } sort keys %$extra,
);
my $out = '';
while (@envs) {
@@ -352,17 +446,9 @@ sub environment_vars_string {
&& ${$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_' . $self->shelltype . '_output';
+ my $wrap_method = "wrap_${shelltype}_output";
if ($self->can($wrap_method)) {
return $self->$wrap_method($out);
}
@@ -380,7 +466,7 @@ sub build_bourne_env_declaration {
$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";\nexport ${name};\n}
+ qq{${name}="$value"; export ${name};\n}
}
sub build_csh_env_declaration {
@@ -440,6 +526,16 @@ sub wrap_powershell_output {
return $out || " \n";
}
+sub build_fish_env_declaration {
+ my ($class, $name, $args) = @_;
+ my $value = $class->_interpolate($args, '$%s', qr/[" ]/, '\\%s');
+ if (!defined $value) {
+ return qq{set -e $name;\n};
+ }
+ $value =~ s/$_path_sep/ /g;
+ qq{set -x $name $value;\n};
+}
+
sub _interpolate {
my ($class, $args, $var_pat, $escape, $escape_pat) = @_;
return
@@ -498,11 +594,11 @@ sub resolve_empty_path {
sub resolve_home_path {
my ($class, $path) = @_;
- return $path unless ($path =~ /^~/);
- my ($user) = ($path =~ /^~([^\/]+)/); # can assume ^~ so undef for 'us'
+ $path =~ /^~([^\/]*)/ or return $path;
+ my $user = $1;
my $homedir = do {
- if (!defined $user && defined $ENV{HOME}) {
- $ENV{HOME}
+ if (! length($user) && defined $ENV{HOME}) {
+ $ENV{HOME};
}
else {
require File::Glob;
@@ -510,7 +606,7 @@ sub resolve_home_path {
}
};
unless (defined $homedir) {
- require Carp;
+ require Carp; require Carp::Heavy;
Carp::croak(
"Couldn't resolve homedir for "
.(defined $user ? $user : 'current user')
@@ -522,7 +618,7 @@ sub resolve_home_path {
sub resolve_relative_path {
my ($class, $path) = @_;
- $path = File::Spec->rel2abs($path);
+ _rel2abs($path);
}
sub ensure_dir_structure_for {
@@ -543,11 +639,11 @@ sub ensure_dir_structure_for {
sub guess_shelltype {
my $shellbin
= defined $ENV{SHELL}
- ? (File::Spec->splitpath($ENV{SHELL}))[-1]
+ ? ($ENV{SHELL} =~ /([\w.]+)$/)[-1]
: ( $^O eq 'MSWin32' && exists $ENV{'!EXITCODE'} )
? 'bash'
: ( $^O eq 'MSWin32' && $ENV{PROMPT} && $ENV{COMSPEC} )
- ? (File::Spec->splitpath($ENV{COMSPEC}))[-1]
+ ? ($ENV{COMSPEC} =~ /([\w.]+)$/)[-1]
: ( $^O eq 'MSWin32' && !$ENV{PROMPT} )
? 'powershell.exe'
: 'sh';
@@ -555,6 +651,7 @@ sub guess_shelltype {
for ($shellbin) {
return
/csh$/ ? 'csh'
+ : /fish/ ? 'fish'
: /command(?:\.com)?$/i ? 'cmd'
: /cmd(?:\.exe)?$/i ? 'cmd'
: /4nt(?:\.exe)?$/i ? 'cmd'
@@ -591,10 +688,11 @@ From the shell -
# Just print out useful shell commands
$ perl -Mlocal::lib
- export PERL_MB_OPT='--install_base /home/username/perl5'
- export PERL_MM_OPT='INSTALL_BASE=/home/username/perl5'
- export PERL5LIB="/home/username/perl5/lib/perl5"
- export PATH="/home/username/perl5/bin:$PATH"
+ PERL_MB_OPT='--install_base /home/username/perl5'; export PERL_MB_OPT;
+ PERL_MM_OPT='INSTALL_BASE=/home/username/perl5'; export PERL_MM_OPT;
+ PERL5LIB="/home/username/perl5/lib/perl5"; export PERL5LIB;
+ PATH="/home/username/perl5/bin:$PATH"; export PATH;
+ PERL_LOCAL_LIB_ROOT="/home/usename/perl5:$PERL_LOCAL_LIB_ROOT"; export PERL_LOCAL_LIB_ROOT;
From a .bashrc file -
@@ -1196,11 +1294,10 @@ not set, a Bourne-compatible shell is assumed.
=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
@@ -9,5 +9,8 @@ author 'mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>';
manifest_include eg => 'scripted_install.pl';
manifest_include lib => '.pod';
+manifest_include inc => '.pm';
+
+manifest_include '' => 'cpan-configure.pl';
1;
@@ -0,0 +1,11 @@
+bump:
+ maint/bump-version
+ rm Makefile
+bumpminor:
+ maint/bump-version minor
+ rm Makefile
+bumpmajor:
+ maint/bump-version major
+ rm Makefile
+upload: $(DISTVNAME).tar$(SUFFIX)
+ cpan-upload $<
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings FATAL => 'all';
+use autodie;
+
+chomp(my $LATEST = qx(grep '^[0-9]' Changes | head -1 | awk '{print \$1}'));
+
+my @parts = split /\./, $LATEST;
+if (@parts == 2) {
+ @parts[1,2] = $parts[1] =~ /(\d{1,3})(\d{1,3})/;
+}
+
+my $OLD_DECIMAL = sprintf('%i.%03i%03i', @parts);
+
+my %bump_part = (major => 0, minor => 1, bugfix => 2);
+
+my $bump_this = $bump_part{$ARGV[0]||'bugfix'};
+
+die "no idea which part to bump - $ARGV[0] means nothing to me"
+ unless defined($bump_this);
+
+my @new_parts = @parts;
+
+$new_parts[$bump_this]++;
+
+my $NEW_DECIMAL = sprintf('%i.%03i%03i', @new_parts);
+
+warn "Bumping $OLD_DECIMAL -> $NEW_DECIMAL\n";
+
+for my $PM_FILE (qw(
+ lib/local/lib.pm
+)) {
+ my $file = do { local (@ARGV, $/) = ($PM_FILE); <> };
+
+ $file =~ s/(?<=\$VERSION = ')${\quotemeta $OLD_DECIMAL}/${NEW_DECIMAL}/
+ or die "unable to bump version number in $PM_FILE";
+
+ open my $out, '>', $PM_FILE;
+
+ print $out $file;
+}
@@ -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;
+}
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 4;;
+use Test::More tests => 4;
use File::Temp;
use local::lib ();
@@ -13,13 +13,10 @@ my $c = 'local::lib';
}
{
- no warnings 'once';
- local *File::Spec::rel2abs = sub { shift; 'FOO'.shift; };
- is($c->resolve_relative_path('bar'),'FOObar');
-}
-
-{
+ my $warn = '';
+ local $SIG{__WARN__} = sub { $warn .= $_[0] };
my $dir = File::Temp::tempdir();
$c->ensure_dir_structure_for("$dir/splat");
ok(-d "$dir/splat");
+ like($warn, qr/^Attempting to create directory/);
}
@@ -1,92 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-BEGIN { plan skip_all => "Install Capture::Tiny to test installation"
- unless eval { require Capture::Tiny; 1 } }
-use Capture::Tiny qw(capture_merged);
-use File::Spec;
-use File::Path qw(mkpath);
-use Cwd;
-use Config;
-
-use lib 't/lib'; use TempDir;
-
-use local::lib ();
-
-delete @ENV{
- 'PERL_MM_OPT',
- 'PERL_MB_OPT',
- 'PERL_LOCAL_LIB_ROOT',
- grep /^MAKE/, keys %ENV
-};
-
-my @dirs = (
- 'plain',
- 'with space',
- 'with\backslash',
- 'with space\and-bs',
-);
-
-my %dist_types = (
- EUMM => sub {
- open my $fh, '>', 'Makefile.PL' or die "can't create Makefile.PL: $!";
- print $fh 'use ExtUtils::MakeMaker; WriteMakefile( NAME => "EUMM" );';
- close $fh;
- system($^X, '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: $!";
- print $fh <<END_BUILD;
-use Module::Build;
-Module::Build->new(
- module_name => "MB",
- dist_version => 1,
- license => "perl",
-)->create_build_script;
-END_BUILD
- close $fh;
- system($^X, 'Build.PL') && die "Build.PL failed";
- system($^X, 'Build', 'install') && die "Build install failed";
- },
-);
-
-plan tests => @dirs * keys(%dist_types) * 2;
-
-my $orig_dir = cwd;
-for my $dir_base (@dirs) {
- for my $dist_type (sort keys %dist_types) {
- chdir $orig_dir;
- my $temp = mk_temp_dir("install-$dist_type-XXXXX");
- my $ll_dir = "$dist_type-$dir_base";
- my $ll = "$temp/$ll_dir";
- mkpath(File::Spec->canonpath($ll));
-
- local::lib->import($ll);
-
- my $dist_dir = mk_temp_dir("source-$dist_type-XXXXX");
- chdir $dist_dir;
- mkdir 'lib';
- open my $fh, '>', "lib/$dist_type.pm";
- print $fh '1;';
- close $fh;
-
- my $output = capture_merged { eval {
- $dist_types{$dist_type}->();
- } };
- is $@, '', "installed $dist_type into '$ll_dir'"
- or diag $output;
-
- my $dest_dir = local::lib->install_base_perl_path($ll);
- my $file = File::Spec->catfile($dest_dir, "$dist_type.pm");
- (my $short_file = $file) =~ s/^\Q$ll/$ll_dir/;
- ok(
- -e $file,
- "$dist_type - $dir_base - $dist_type.pm installed as '$short_file'",
- ) or diag 'Files in ' . $dest_dir . ":\n", join("\n", do {
- my $dh;
- (opendir $dh, $dest_dir) ? readdir $dh : "doesn't exist";
- });
- }
-}
-chdir $orig_dir;
@@ -1,3 +1,9 @@
-package ENVDumper;
+package t::lib::ENVDumper;
use Data::Dumper;
-print Dumper(\%ENV);
+
+sub import {
+ local $Data::Dumper::Terse = 1;
+ print Dumper(\%ENV);
+}
+
+1;
@@ -7,19 +7,29 @@ use File::Temp ();
use Config;
use local::lib ();
-my @paths = File::Spec->path;
-my @ext = $^O eq 'MSWin32' ? (split /\Q$Config{path_sep}/, $ENV{PATHEXT}) : ('');
+my @ext = $^O eq 'MSWin32' ? (split /\Q$Config{path_sep}/, $ENV{PATHEXT}) : ();
sub which {
my $shell = shift;
- for my $dir (@paths) {
- my $file = File::Spec->catfile($dir||'.', $shell);
- for my $ext (@ext) {
- my $full = $file . $ext;
- return $full
- if -x $full;
- }
+ my ($full) =
+ grep { -x }
+ map { my $x = $_; $x, map { $x . $_ } @ext }
+ map { File::Spec->catfile( $_, $shell) }
+ File::Spec->path;
+ return $full;
+}
+
+my %shell_path;
+{
+ my @shell_paths;
+ if (open my $fh, '<', '/etc/shells') {
+ my @lines = <$fh>;
+ s/^\s+//, s/\s+$// for @lines;
+ @shell_paths = grep { length && !/^#/ } @lines;
}
- return;
+ %shell_path =
+ map { m{[\\/]([^\\/]+)$} ? ($1 => $_) : () }
+ grep { defined && -x }
+ ( '/bin/sh', '/bin/csh', $ENV{'ComSpec'}, @shell_paths );
}
my $extra_lib = '-I"' . dirname(dirname($INC{'local/lib.pm'})) . '"';
@@ -30,32 +40,53 @@ for my $shell (
name => 'sh',
},
{
+ name => 'dash',
+ },
+ {
+ name => 'bash',
+ },
+ {
+ name => 'zsh',
+ },
+ {
+ name => 'ksh',
+ },
+ {
name => 'csh',
opt => '-f',
},
{
- name => 'cmd',
+ name => 'tcsh',
+ opt => '-f',
+ },
+ {
+ name => 'fish',
+ },
+ {
+ name => 'cmd.exe',
opt => '/Q /D /C',
ext => 'bat',
perl => qq{@"$^X"},
- skip => $^O eq 'cygwin',
+ skip => $^O ne 'MSWin32',
},
{
- name => 'powershell',
+ name => 'powershell.exe',
+ shell => which('powershell.exe'),
opt => '-NoProfile -ExecutionPolicy Unrestricted -File',
ext => 'ps1',
perl => qq{& '$^X'},
- skip => $^O eq 'cygwin',
+ skip => $^O ne 'MSWin32',
},
) {
my $name = $shell->{name};
- $shell->{shell} = which($name);
+ $shell->{shell} ||= $shell_path{$name};
$shell->{ext} ||= $name;
$shell->{perl} ||= qq{"$^X"};
if (@ARGV) {
next
if !grep {$_ eq $name} @ARGV;
- if (!$shell->{shell}) {
+ my $exec = $shell->{shell} ||= which($name);
+ if (!$exec) {
warn "unable to find executable for $name";
next;
}
@@ -69,7 +100,9 @@ for my $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);
+
+plan tests => 2*@vars*@shells;
my $sep = $Config{path_sep};
@@ -77,28 +110,35 @@ 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};
+ local $ENV{$_}
+ for @vars;
+ delete $ENV{$_}
+ for @vars;
+ $ENV{PATH} = $root;
+ my $bin_path = local::lib->install_base_bin_path($ll_dir);
+ mkdir $bin_path;
my $env = call_ll($shell, "$ll");
is $env->{PERL_LOCAL_LIB_ROOT}, $ll_dir,
"$shell->{name}: activate root";
- is $env->{PATH}, local::lib->install_base_bin_path($ll_dir)."$sep$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),
"$shell->{name}: activate PERL5LIB";
+ my %install_opts = local::lib->installer_options_for($ll_dir);
+ 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";
- is $env->{PATH}, $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";
+ }
}
sub call_ll {
@@ -127,7 +167,6 @@ sub call_ll {
diag "running:\n$cmd";
die "failed with code: $?";
}
- my $VAR1;
- eval $out or die "bad output: $@";
- $VAR1;
+ my $env = eval $out or die "bad output: $@";
+ $env;
}
@@ -16,8 +16,6 @@ my $dir1 = mk_temp_dir('test_local_lib-XXXXX');
my $dir2 = mk_temp_dir('test_local_lib-XXXXX');
my ($dir1_arch, $dir2_arch) = map { File::Spec->catfile($_, qw'lib perl5', $Config{archname}) } $dir1, $dir2;
-note $dir1_arch;
-note $dir2_arch;
my $prev_active = () = local::lib->active_paths;
@@ -25,7 +23,6 @@ local::lib->import($dir1);
is +() = local::lib->active_paths, $prev_active + 1, 'one active path';
like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, 'added one dir in root';
like $ENV{PERL5LIB}, qr/\Q$dir1/, 'added one dir in lib';
-note $ENV{PERL5LIB};
unlike $ENV{PERL5LIB}, qr/\Q$dir1_arch/, 'no arch in PERL5LIB';
my $dir1_escape = local::lib::_mm_escape_path($dir1);
like $ENV{PERL_MM_OPT}, qr/\Q$dir1_escape/, 'first path is installation target';
@@ -6,11 +6,13 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 4;
use File::Temp 'tempfile';
+use File::Basename qw(basename dirname);
use Cwd;
use File::Spec;
use IPC::Open3;
+use Config;
use lib 't/lib'; use TempDir;
@@ -26,7 +28,12 @@ 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.
-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
@@ -47,9 +54,40 @@ 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: ", explain \@libs;
+ 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: ", explain \@libs;
+ 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});
+ }
+
+ 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 = Cwd::abs_path($cwd);
+ is $cwd, Cwd::cwd(), 'reimplemented cwd matches standard cwd';
+}
@@ -20,36 +20,46 @@ sub check_version {
length $version ? $version : undef;
}
-use Test::More;
+use Test::More 0.81_01;
use IPC::Open3;
use File::Temp;
use File::Spec;
+use Parse::CPAN::Meta;
use local::lib ();
my @perl;
+my $force;
while (@ARGV) {
my $arg = shift @ARGV;
if ($arg =~ /^--perl(?:=(.*))$/) {
push @perl, ($1 || shift @ARGV);
}
+ elsif ($arg eq '-f') {
+ $force = 1;
+ }
else {
warn "unrecognized option: $arg\n";
}
}
+
+plan skip_all => 'this test will overwrite Makefile. use -f to force.'
+ if -e 'Makefile' && !$force;
+
@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;
+ local $ENV{AUTOMATED_TESTING} = 1;
local $ENV{PERL5LIB};
local $ENV{PERL_LOCAL_LIB_ROOT};
local $ENV{PERL_MM_OPT};
@@ -58,16 +68,18 @@ for my $perl (@perl) {
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";
- 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}";
}
}
- $ENV{HOME} = my $home = File::Temp::tempdir( CLEANUP => 1 );
my $ll = File::Spec->catdir($home, 'local-lib');
open my $null_in, '<', File::Spec->devnull;
@@ -80,12 +92,24 @@ for my $perl (@perl) {
is $?, 0, 'Makefile.PL ran successfully'
or diag $out;
- local::lib->setup_env_hash_for($ll);
+ my $meta = Parse::CPAN::Meta->load_file('MYMETA.yml');
- for my $module (@modules) {
- my $version = check_version($perl, $module->[0]);
- cmp_ok $version, '>=', $module->[1], "bootstrap installed new enough $module->[0]"
- or diag "PERL5LIB: $ENV{PERL5LIB}";
+ local::lib->setup_env_hash_for($ll);
+ for my $module (sort keys %modules) {
+ SKIP: {
+ 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";
+ }
+ }
}
}
+
+unlink 'Makefile';
@@ -0,0 +1,90 @@
+use strict;
+use warnings;
+use Test::More;
+use Capture::Tiny qw(capture_merged);
+use File::Spec;
+use File::Path qw(mkpath);
+use Cwd;
+use Config;
+
+use lib 't/lib'; use TempDir;
+
+use local::lib ();
+
+delete @ENV{
+ 'PERL_MM_OPT',
+ 'PERL_MB_OPT',
+ 'PERL_LOCAL_LIB_ROOT',
+ grep /^MAKE/, keys %ENV
+};
+
+my @dirs = (
+ 'plain',
+ 'with space',
+ 'with\backslash',
+ 'with space\and-bs',
+);
+
+my %dist_types = (
+ EUMM => sub {
+ open my $fh, '>', 'Makefile.PL' or die "can't create Makefile.PL: $!";
+ print $fh 'use ExtUtils::MakeMaker; WriteMakefile( NAME => "EUMM" );';
+ close $fh;
+ system($^X, '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: $!";
+ print $fh <<END_BUILD;
+use Module::Build;
+Module::Build->new(
+ module_name => "MB",
+ dist_version => 1,
+ license => "perl",
+)->create_build_script;
+END_BUILD
+ close $fh;
+ system($^X, 'Build.PL') && die "Build.PL failed";
+ system($^X, 'Build', 'install') && die "Build install failed";
+ },
+);
+
+plan tests => @dirs * keys(%dist_types) * 2;
+
+my $orig_dir = cwd;
+for my $dir_base (@dirs) {
+ for my $dist_type (sort keys %dist_types) {
+ chdir $orig_dir;
+ my $temp = mk_temp_dir("install-$dist_type-XXXXX");
+ my $ll_dir = "$dist_type-$dir_base";
+ my $ll = "$temp/$ll_dir";
+ mkpath(File::Spec->canonpath($ll));
+
+ local::lib->import($ll);
+
+ my $dist_dir = mk_temp_dir("source-$dist_type-XXXXX");
+ chdir $dist_dir;
+ mkdir 'lib';
+ open my $fh, '>', "lib/$dist_type.pm";
+ print $fh '1;';
+ close $fh;
+
+ my $output = capture_merged { eval {
+ $dist_types{$dist_type}->();
+ } };
+ is $@, '', "installed $dist_type into '$ll_dir'"
+ or diag $output;
+
+ my $dest_dir = local::lib->install_base_perl_path($ll);
+ my $file = File::Spec->catfile($dest_dir, "$dist_type.pm");
+ (my $short_file = $file) =~ s/^\Q$ll/$ll_dir/;
+ ok(
+ -e $file,
+ "$dist_type - $dir_base - $dist_type.pm installed as '$short_file'",
+ ) or diag 'Files in ' . $dest_dir . ":\n", join("\n", do {
+ my $dh;
+ (opendir $dh, $dest_dir) ? readdir $dh : "doesn't exist";
+ });
+ }
+}
+chdir $orig_dir;
@@ -1,6 +1,11 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
+BEGIN {
+ plan skip_all => 'Test::CPAN::Changes not available'
+ if !eval { require Test::CPAN::Changes };
+}
+plan tests => 4;
use Test::CPAN::Changes;
changes_file_ok('Changes');