From: apeiron Date: Wed, 26 Aug 2009 02:26:50 +0000 (+0000) Subject: roll-up of changes for 1.004005 and 1.004006 because I forgot to commit X-Git-Tag: 1.006009~65 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b9c94c15ba77150eb2a84b5d89cdd508d9ac508e;p=p5sagit%2Flocal-lib.git roll-up of changes for 1.004005 and 1.004006 because I forgot to commit 1.004005 because I suck git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@7392 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes index 7708d96..7735455 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,17 @@ Revision history for local::lib +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. + +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. + 1.004004 2009-08-05 - Add dependency on Extutils::Install 1.43 and install in --bootstrap diff --git a/Makefile.PL b/Makefile.PL index 504cc49..ad1ad46 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,7 +2,7 @@ use strict; use warnings; use File::Spec; use Cwd; -use vars qw($bootstrapping $bootstrapping_args); +use vars qw($bootstrapping $bootstrapping_args $no_manpages); use Config; my $cwd; @@ -27,6 +27,10 @@ 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 : (); @@ -91,6 +95,23 @@ DEATH 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', + 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;], + ); + } chdir($cwd); } diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 7ceb993..889f28b 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -11,24 +11,22 @@ use File::Path (); use Carp (); use Config; -our $VERSION = '1.004004'; # 1.4.4 +our $VERSION = '1.004006'; # 1.4.6 +my @KNOWN_FLAGS = (qw/--self-contained/); sub import { my ($class, @args) = @_; + @args <= 1 + @KNOWN_FLAGS or die <<'DEATH'; +Please see `perldoc local::lib` for directions on using this module. +DEATH # Remember what PERL5LIB was when we started my $perl5lib = $ENV{PERL5LIB}; - # The path is required, but last in the list, so we pop, not shift here. - my $path = pop @args; - $path = $class->resolve_path($path); - $class->setup_local_lib_for($path); - - # Handle the '--self-contained' option - my $flag = shift @args; - no warnings 'uninitialized'; # the flag is optional - # make sure fancy dashes cause an error - if ($flag =~ /−/) { + my %arg_store; + for my $arg (@args) { + # check for lethal dash first to stop processing before causing problems + if ($arg =~ /−/) { 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 @@ -37,14 +35,28 @@ 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 + } + elsif(grep { $arg eq $_ } @KNOWN_FLAGS) { + (my $flag = $arg) =~ s/--//; + $arg_store{$flag} = 1; + } + elsif($arg =~ /^--/) { + die "Unknown import argument: $arg"; + } + else { + # assume that what's left is a path + $arg_store{path} = $arg; + } } - if ($flag eq '--self-contained') { - # The only directories that remain are those that we just defined and those where core modules are stored. - # We put PERL5LIB first, so it'll be favored over privlibexp and archlibexp + + if($arg_store{'self-contained'}) { + # The only directories that remain are those that we just defined and those + # where core modules are stored. We put PERL5LIB first, so it'll be favored + # over privlibexp and archlibexp my %seen; @INC = grep { ! $seen{$_}++ } ( - $class->install_base_perl_path($path), - $class->install_base_arch_path($path), + $class->install_base_perl_path($arg_store{path}), + $class->install_base_arch_path($arg_store{path}), split( $Config{path_sep}, $perl5lib ), $Config::Config{privlibexp}, $Config::Config{archlibexp} @@ -54,9 +66,9 @@ DEATH # @INC from growing with each invocation $ENV{PERL5LIB} = join( $Config{path_sep}, @INC ); } - elsif (defined $flag) { - die "unrecognized import argument: $flag"; - } + + $arg_store{path} = $class->resolve_path($arg_store{path}); + $class->setup_local_lib_for($arg_store{path}); for (@INC) { # Untaint @INC next if ref; # Skip entry if it is an ARRAY, CODE, blessed, etc. @@ -416,6 +428,12 @@ You can also pass --bootstrap=~/foo to get a different location - $ echo 'eval $(perl -I$HOME/foo/lib/perl5 -Mlocal::lib=$HOME/foo)' >>~/.bashrc +If you're on a slower machine, or are operating under draconian disk space +limitations, you can disable the automatic generation of manpages from POD when +installing modules by using the C<--no-manpages> argument when bootstrapping: + + $ perl Makefile.PL --bootstrap --no-manpages + If you want to install multiple Perl module environments, say for application evelopment, install local::lib globally and then: @@ -702,6 +720,9 @@ documentation additions, contributed by Christopher Nehren . '--self-contained' feature contributed by Mark Stosberg . +Ability to pass '--self-contained' without a directory inspired by frew on +irc.perl.org/#catalyst. + Doc patches for a custom local::lib directory contributed by Torsten Raudssus .