[Bast-commits] r7392 - in local-lib/1.000/trunk: . lib/local

apeiron at dev.catalyst.perl.org apeiron at dev.catalyst.perl.org
Wed Aug 26 02:26:50 GMT 2009


Author: apeiron
Date: 2009-08-26 02:26:50 +0000 (Wed, 26 Aug 2009)
New Revision: 7392

Modified:
   local-lib/1.000/trunk/Changes
   local-lib/1.000/trunk/Makefile.PL
   local-lib/1.000/trunk/lib/local/lib.pm
Log:
roll-up of changes for 1.004005 and 1.004006 because I forgot to commit
1.004005 because I suck


Modified: local-lib/1.000/trunk/Changes
===================================================================
--- local-lib/1.000/trunk/Changes	2009-08-25 14:24:50 UTC (rev 7391)
+++ local-lib/1.000/trunk/Changes	2009-08-26 02:26:50 UTC (rev 7392)
@@ -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 at 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

Modified: local-lib/1.000/trunk/Makefile.PL
===================================================================
--- local-lib/1.000/trunk/Makefile.PL	2009-08-25 14:24:50 UTC (rev 7391)
+++ local-lib/1.000/trunk/Makefile.PL	2009-08-26 02:26:50 UTC (rev 7392)
@@ -2,7 +2,7 @@
 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 @@
   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 @@
     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);
   }

Modified: local-lib/1.000/trunk/lib/local/lib.pm
===================================================================
--- local-lib/1.000/trunk/lib/local/lib.pm	2009-08-25 14:24:50 UTC (rev 7391)
+++ local-lib/1.000/trunk/lib/local/lib.pm	2009-08-26 02:26:50 UTC (rev 7392)
@@ -11,24 +11,22 @@
 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 @@
 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,10 +66,10 @@
     # @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.
     m/(.*)/ and $_ = $1;
@@ -416,6 +428,12 @@
 
   $ 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 @@
 
 '--self-contained' feature contributed by Mark Stosberg <mark at summersault.com>.
 
+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
 <torsten at raudssus.de>.
 




More information about the Bast-commits mailing list