[PATCH] Updating Module::Build to 0.33_02
authorDavid Golden <dagolden@cpan.org>
Tue, 16 Jun 2009 12:35:47 +0000 (07:35 -0500)
committerSteve Peters <steve@fisharerojo.org>
Tue, 16 Jun 2009 12:35:47 +0000 (07:35 -0500)
36 files changed:
MANIFEST
Porting/Maintainers.pl
lib/Module/Build.pm
lib/Module/Build/API.pod
lib/Module/Build/Authoring.pod
lib/Module/Build/Base.pm
lib/Module/Build/Compat.pm
lib/Module/Build/Config.pm
lib/Module/Build/ConfigData.pm
lib/Module/Build/Cookbook.pm
lib/Module/Build/Dumper.pm
lib/Module/Build/ModuleInfo.pm
lib/Module/Build/Notes.pm
lib/Module/Build/PPMMaker.pm
lib/Module/Build/Platform/Amiga.pm
lib/Module/Build/Platform/Default.pm
lib/Module/Build/Platform/EBCDIC.pm
lib/Module/Build/Platform/MPEiX.pm
lib/Module/Build/Platform/MacOS.pm
lib/Module/Build/Platform/RiscOS.pm
lib/Module/Build/Platform/Unix.pm
lib/Module/Build/Platform/VMS.pm
lib/Module/Build/Platform/VOS.pm
lib/Module/Build/Platform/Windows.pm
lib/Module/Build/Platform/aix.pm
lib/Module/Build/Platform/cygwin.pm
lib/Module/Build/Platform/darwin.pm
lib/Module/Build/Platform/os2.pm
lib/Module/Build/PodParser.pm
lib/Module/Build/scripts/bundle.pl [deleted file]
lib/Module/Build/t/bundled/Tie/CPHash.pm
lib/Module/Build/t/compat.t
lib/Module/Build/t/ext.t
lib/Module/Build/t/extend.t
lib/Module/Build/t/metadata.t
lib/Module/Build/t/runthrough.t

index ead080d..beaf19f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2573,7 +2573,6 @@ lib/Module/Build/Platform/Windows.pm      Module::Build
 lib/Module/Build.pm            Module::Build
 lib/Module/Build/PodParser.pm  Module::Build
 lib/Module/Build/PPMMaker.pm   Module::Build
-lib/Module/Build/scripts/bundle.pl     Module::Build
 lib/Module/Build/scripts/config_data   Module::Build
 lib/Module/Build/t/add_property.t      Module::Build
 lib/Module/Build/t/basic.t     Module::Build
index 6e7562d..167c3ce 100644 (file)
@@ -1122,11 +1122,11 @@ package Maintainers;
     'Module::Build' =>
        {
        'MAINTAINER'    => 'kwilliams',
-       'DISTRIBUTION'  => 'EWILHELM/Module-Build-0.32.tar.gz',
+       'DISTRIBUTION'  => 'DAGOLDEN/Module-Build-0.33_02.tar.gz',
        'FILES'         => q[lib/Module/Build lib/Module/Build.pm],
-       'EXCLUDED'      => [ qw{ t/par.t t/signature.t }, ],
+       'EXCLUDED'      => [ qw{ t/par.t t/signature.t scripts/bundle.pl}, ],
        'CPAN'          => 1,
-       'UPSTREAM'      => undef,
+       'UPSTREAM'      => 'cpan',
        },
 
     'Module::CoreList' =>
index fe453b5..ae9639a 100644 (file)
@@ -15,7 +15,7 @@ use Module::Build::Base;
 
 use vars qw($VERSION @ISA);
 @ISA = qw(Module::Build::Base);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 
 # Okay, this is the brute-force method of finding out what kind of
@@ -312,10 +312,9 @@ module for source distribution through a medium like CPAN.  It will create a
 tarball of the files listed in F<MANIFEST> and compress the tarball using
 GZIP compression.
 
-By default, this action will use the external C<tar> and C<gzip>
-executables on Unix-like platforms, and the C<Archive::Tar> module
-elsewhere.  However, you can force it to use whatever executable you
-want by supplying an explicit C<tar> (and optional C<gzip>) parameter:
+By default, this action will use the C<Archive::Tar> module. However, you can
+force it to use binary "tar" and "gzip" executables by supplying an explicit 
+C<tar> (and optional C<gzip>) parameter:
 
   ./Build dist --tar C:\path\to\tar.exe --gzip C:\path\to\zip.exe
 
index 83e93f5..ab0691b 100644 (file)
@@ -182,6 +182,16 @@ installed.
 See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
 for the details of how requirements can be specified.
 
+=item create_license
+
+[version 0.31]
+
+This parameter tells Module::Build to automatically create a
+F<LICENSE> file at the top level of your distribution, containing the
+full text of the author's chosen license.  This requires
+C<Software::License> on the author's machine, and further requires
+that the C<license> parameter specifies a license that it knows about.
+
 =item create_makefile_pl
 
 [version 0.19]
index 871effd..a0a7dc3 100644 (file)
@@ -159,7 +159,8 @@ or C<CPANPLUS> will be expected to pick C<configure_requires> out of the
 F<META.yml> file and install these items before running the
 C<Build.PL>.
 
-*TODO* auto-add M::B?  In what circumstances?
+If no configure_requires is specified, the current version of Module::Build
+is automatically added to configure_requires.
 
 =item build_requires
 
index 703218b..2f6282e 100644 (file)
@@ -4,7 +4,7 @@ package Module::Build::Base;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 BEGIN { require 5.00503 }
 
@@ -129,6 +129,7 @@ sub _construct {
                                   %input,
                                  },
                    phash => {},
+                    stash => {}, # temporary caching, not stored in _build
                   }, $package;
 
   $self->_set_defaults;
@@ -1039,7 +1040,7 @@ sub dist_version {
     my $version_from = File::Spec->catfile( split( qr{/}, $dist_version_from ) );
     my $pm_info = Module::Build::ModuleInfo->new_from_file( $version_from )
       or die "Can't find file $version_from to determine version";
-    $p->{dist_version} = $pm_info->version();
+    $p->{dist_version} = $self->normalize_version( $pm_info->version() );
   }
 
   die ("Can't determine distribution version, must supply either 'dist_version',\n".
@@ -3424,7 +3425,7 @@ sub file_qr {
 
 sub dist_dir {
   my ($self) = @_;
-  return "$self->{properties}{dist_name}-$self->{properties}{dist_version}";
+  return join "-", $self->dist_name, $self->dist_version;
 }
 
 sub ppm_name {
@@ -3566,34 +3567,71 @@ sub do_create_metafile {
     push @INC, File::Spec->catdir($self->blib, 'lib');
   }
 
-  $self->write_metafile;
+  if ( $self->write_metafile( $self->metafile, $self->generate_metadata ) ) {
+    $self->{wrote_metadata} = 1;
+    $self->_add_to_manifest('MANIFEST', $metafile);
+  }
+
+  return 1;
 }
 
-sub write_metafile {
+sub generate_metadata {
   my $self = shift;
-  my $metafile = $self->metafile;
+  my $node = {};
 
   if ($self->_mb_feature('YAML_support')) {
     require YAML;
     require YAML::Node;
-
     # We use YAML::Node to get the order nice in the YAML file.
-    $self->prepare_metadata( my $node = YAML::Node->new({}) );
-    
+    $self->prepare_metadata( $node = YAML::Node->new({}) );
+  } else {
+    require Module::Build::YAML;
+    my @order_keys;
+    $self->prepare_metadata($node, \@order_keys);
+    $node->{_order} = \@order_keys;
+  }
+  return $node;
+}
+
+sub write_metafile {
+  my $self = shift;
+  my ($metafile, $node) = @_;
+
+  if ($self->_mb_feature('YAML_support')) {
+    # XXX this is probably redundant, but stick with it
+    require YAML;
+    require YAML::Node;
+    delete $node->{_order}; # XXX also probably redundant, but for safety
     # YAML API changed after version 0.30
     my $yaml_sub = $YAML::VERSION le '0.30' ? \&YAML::StoreFile : \&YAML::DumpFile;
-    $self->{wrote_metadata} = $yaml_sub->($metafile, $node );
-
+    $yaml_sub->( $metafile, $node );
   } else {
+    # XXX probably redundant
     require Module::Build::YAML;
-    my (%node, @order_keys);
-    $self->prepare_metadata(\%node, \@order_keys);
-    $node{_order} = \@order_keys;
-    &Module::Build::YAML::DumpFile($metafile, \%node);
-    $self->{wrote_metadata} = 1;
+    &Module::Build::YAML::DumpFile($metafile, $node);
   }
+  return 1;
+}
 
-  $self->_add_to_manifest('MANIFEST', $metafile);
+sub normalize_version {
+  my ($self, $version) = @_;
+  if ( $version =~ /[=<>!,]/ ) { # logic, not just version
+    # take as is without modification
+  }
+  elsif ( ref $version eq 'version' || 
+          ref $version eq 'Module::Build::Version' ) { # version objects
+    my $string = $version->stringify;
+    # normalize leading-v: "v1.2" -> "v1.2.0"
+    $version = substr($string,0,1) eq 'v' ? $version->normal : $string;
+  }
+  elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots
+    # normalize string tuples without "v": "1.2.3" -> "v1.2.3"
+    $version = "v$version";
+  }
+  else {
+    # leave alone
+  }
+  return $version;
 }
 
 sub prepare_metadata {
@@ -3613,38 +3651,57 @@ sub prepare_metadata {
     die "ERROR: Missing required field '$_' for META.yml\n"
       unless defined($node->{$name}) && length($node->{$name});
   }
-  $node->{version} = '' . $node->{version}; # Stringify version objects
+  $node->{version} = $self->normalize_version($node->{version}); 
 
   if (defined( my $l = $self->license )) {
     die "Unknown license string '$l'"
-      unless exists $self->valid_licenses->{ $self->license };
+      unless exists $self->valid_licenses->{ $l };
 
-    if (my $key = $self->valid_licenses->{ $self->license }) {
+    if (my $key = $self->valid_licenses->{ $l }) {
       my $class = "Software::License::$key";
       if (eval "use $class; 1") {
         # S::L requires a 'holder' key
         $node->{resources}{license} = $class->new({holder=>"nobody"})->url;
-      } else {
-        $node->{resources}{license} = $self->_license_url($key);
+      }
+      else {
+        $node->{resources}{license} = $self->_license_url($l);
       }
     }
+    # XXX we are silently omitting the url for any unknown license
   }
 
   if (exists $p->{configure_requires}) {
     foreach my $spec (keys %{$p->{configure_requires}}) {
       warn ("Warning: $spec is listed in 'configure_requires', but ".
-           "it is not found in any of the other prereq fields.\n")
-       unless grep exists $p->{$_}{$spec}, 
-              grep !/conflicts$/, @{$self->prereq_action_types};
+            "it is not found in any of the other prereq fields.\n")
+        unless grep exists $p->{$_}{$spec}, 
+              grep !/conflicts$/, @{$self->prereq_action_types};
+    }
+  }
+
+  # copy prereq data structures so we can modify them before writing to META
+  my %prereq_types;
+  for my $type ( 'configure_requires', @{$self->prereq_action_types} ) {
+    if (exists $p->{$type}) {  
+      for my $mod ( keys %{ $p->{$type} } ) {
+        $prereq_types{$type}{$mod} = 
+          $self->normalize_version($p->{$type}{$mod});
+      }
     }
   }
 
-  foreach ( 'configure_requires', @{$self->prereq_action_types} ) {
-    if (exists $p->{$_} and keys %{ $p->{$_} }) {
-      $add_node->($_, $p->{$_});
+  # add current Module::Build to configure_requires if there 
+  # isn't a configure_requires already specified
+  if ( ! $prereq_types{'configure_requires'} ) {
+    for my $t ('configure_requires', 'build_requires') {
+      $prereq_types{$t}{'Module::Build'} = $VERSION;
     }
   }
 
+  for my $t ( keys %prereq_types ) {
+      $add_node->($t, $prereq_types{$t});
+  }
+
   if (exists $p->{dynamic_config}) {
     $add_node->('dynamic_config', $p->{dynamic_config});
   }
@@ -3663,8 +3720,8 @@ sub prepare_metadata {
   $add_node->('generated_by', "Module::Build version $Module::Build::VERSION");
 
   $add_node->('meta-spec', 
-             {version => '1.2',
-              url     => 'http://module-build.sourceforge.net/META-spec-v1.2.html',
+             {version => '1.4',
+              url     => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
              });
 
   while (my($k, $v) = each %{$self->meta_add}) {
@@ -3801,9 +3858,10 @@ sub find_dist_packages {
     }
   }
 
-  # Stringify versions.  Can't use exists() here because of bug in YAML::Node.
+  # Normalize versions.  Can't use exists() here because of bug in YAML::Node.
+  # XXX "bug in YAML::Node" comment seems irrelvant -- dagolden, 2009-05-18
   for (grep defined $_->{version}, values %prime) {
-    $_->{version} = '' . $_->{version};
+    $_->{version} = $self->normalize_version( $_->{version} );
   }
 
   return \%prime;
@@ -4144,13 +4202,13 @@ sub cbuilder {
   # Returns a CBuilder object
 
   my $self = shift;
-  my $p = $self->{properties};
-  return $p->{_cbuilder} if $p->{_cbuilder};
+  my $s = $self->{stash};
+  return $s->{_cbuilder} if $s->{_cbuilder};
   die "Module::Build is not configured with C_support"
          unless $self->_mb_feature('C_support');
 
   require ExtUtils::CBuilder;
-  return $p->{_cbuilder} = ExtUtils::CBuilder->new(
+  return $s->{_cbuilder} = ExtUtils::CBuilder->new(
     config => $self->config,
     ($self->quiet ? (quiet => 1 ) : ()),
   );
index 7025f1c..b3ace5c 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Compat;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
 
 use File::Spec;
 use IO::File;
@@ -143,7 +143,9 @@ EOF
     eval "use Module::Build::Compat 0.02; 1" or die $@;
     %s
     Module::Build::Compat->run_build_pl(args => \@ARGV);
-    exit(0) unless(-e 'Build'); # cpantesters convention
+    my $build_script = 'Build';  
+    $build_script .= '.com' if $^O eq 'VMS';
+    exit(0) unless(-e $build_script); # cpantesters convention
     require %s;
     Module::Build::Compat->write_makefile(build_class => '%s');
 EOF
@@ -176,7 +178,7 @@ EOF
     
     $MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if $build->script_files;
     
-    $MM_Args{PL_FILES} = $build->PL_files if $build->PL_files;
+    $MM_Args{PL_FILES} = $build->PL_files || {};
     
     local $Data::Dumper::Terse = 1;
     my $args = Data::Dumper::Dumper(\%MM_Args);
@@ -288,13 +290,17 @@ all : force_do_it
 realclean : force_do_it
        $perl $Build realclean
        $unlink
+distclean : force_do_it
+       $perl $Build distclean
+       $unlink
+
 
 force_do_it :
        @ $noop
 EOF
 
   foreach my $action ($class->known_actions) {
-    next if $action =~ /^(all|realclean|force_do_it)$/;  # Don't double-define
+    next if $action =~ /^(all|distclean|realclean|force_do_it)$/;  # Don't double-define
     $maketext .= <<"EOF";
 $action : force_do_it
        $perl $Build $action
@@ -501,11 +507,7 @@ ever have to install Module::Build if they use the Makefile.PL, but
 they won't get to take advantage of Module::Build's extra features
 either.
 
-If you go this route, make sure you explicitly set C<PL_FILES> in the
-call to C<WriteMakefile()> (probably to an empty hash reference), or
-else MakeMaker will mistakenly run the Build.PL and you'll get an
-error message about "Too early to run Build script" or something.  For
-good measure, of course, test both the F<Makefile.PL> and the
+For good measure, of course, test both the F<Makefile.PL> and the
 F<Build.PL> before shipping.
 
 =item 3.
index 194b050..bf543eb 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Config;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Config;
 
index 7bc3998..3f539af 100644 (file)
@@ -22,6 +22,9 @@ sub config_names  { keys %$config }
 sub write {
   my $me = __FILE__;
   require IO::File;
+
+  # Can't use Module::Build::Dumper here because M::B is only a
+  # build-time prereq of this module
   require Data::Dumper;
 
   my $mode_orig = (stat $me)[2] & 07777;
@@ -33,9 +36,11 @@ sub write {
   }
   die "Couldn't find __DATA__ token in $me" if eof($fh);
 
-  local $Data::Dumper::Terse = 1;
   seek($fh, tell($fh), 0);
-  $fh->print( Data::Dumper::Dumper([$config, $features, $auto_features]) );
+  my $data = [$config, $features, $auto_features];
+  $fh->print( 'do{ my '
+             . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
+             . '$x; }' );
   truncate($fh, tell($fh));
   $fh->close;
 
@@ -159,36 +164,37 @@ authorship claim or copyright claim to the contents of C<Module::Build::ConfigDa
 
 __DATA__
 
-[
-          {},
-          {},
-          {
-            'YAML_support' => {
-                                'requires' => {
-                                                'YAML' => ' >= 0.35, != 0.49_01 '
-                                              },
-                                'description' => 'Use YAML.pm to write META.yml files'
-                              },
-            'manpage_support' => {
-                                   'requires' => {
-                                                   'Pod::Man' => 0
-                                                 },
-                                   'description' => 'Create Unix man pages'
-                                 },
-            'C_support' => {
+do{ my $x = [
+       {},
+       {},
+       {
+         'YAML_support' => {
                              'requires' => {
-                                             'ExtUtils::CBuilder' => '0.15'
+                                             'YAML' => ' >= 0.35, != 0.49_01 '
                                            },
-                             'recommends' => {
-                                               'ExtUtils::ParseXS' => '1.02'
-                                             },
-                             'description' => 'Compile/link C & XS code'
+                             'description' => 'Use YAML.pm to write META.yml files'
                            },
-            'HTML_support' => {
+         'manpage_support' => {
                                 'requires' => {
-                                                'Pod::Html' => 0
+                                                'Pod::Man' => 0
                                               },
-                                'description' => 'Create HTML documentation'
-                              }
-          }
-        ]
+                                'description' => 'Create Unix man pages'
+                              },
+         'C_support' => {
+                          'requires' => {
+                                          'ExtUtils::CBuilder' => '0.15'
+                                        },
+                          'recommends' => {
+                                            'ExtUtils::ParseXS' => '1.02'
+                                          },
+                          'description' => 'Compile/link C & XS code'
+                        },
+         'HTML_support' => {
+                             'requires' => {
+                                             'Pod::Html' => 0
+                                           },
+                             'description' => 'Create HTML documentation'
+                           }
+       }
+     ];
+$x; }
\ No newline at end of file
index e0c85df..9a76ba0 100644 (file)
@@ -1,14 +1,13 @@
 package Module::Build::Cookbook;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 
 
 =head1 NAME
 
 Module::Build::Cookbook - Examples of Module::Build Usage
 
-
 =head1 DESCRIPTION
 
 C<Module::Build> isn't conceptually very complicated, but examples are
index f3751bf..3765c84 100644 (file)
@@ -1,7 +1,7 @@
 package Module::Build::Dumper;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 
 # This is just a split-out of a wrapper function to do Data::Dumper
 # stuff "the right way".  See:
index d9821fe..eb1d9bf 100644 (file)
@@ -8,7 +8,7 @@ package Module::Build::ModuleInfo;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 
 use File::Spec;
index fca40b7..3a83b01 100644 (file)
@@ -4,7 +4,7 @@ package Module::Build::Notes;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Data::Dumper;
 use IO::File;
index 4136086..11909ce 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::PPMMaker;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 
 # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
@@ -130,8 +130,10 @@ sub _varchname {  # Copied from PPM.pm
   my ($self, $config) = @_;
   my $varchname = $config->{archname};
   # Append "-5.8" to architecture name for Perl 5.8 and later
-  if (defined($^V) && ord(substr($^V,1)) >= 8) {
-    $varchname .= sprintf("-%d.%d", ord($^V), ord(substr($^V,1)));
+  if ($] >= 5.008) {
+      my $vstring = sprintf "%vd", $^V;
+      $vstring =~ s/\.\d+$//;
+      $varchname .= "-$vstring";
   }
   return $varchname;
 }
index 4f5eb14..ee5c4f9 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Amiga;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index c3f6a50..98128e2 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Default;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index 26c3ee5..9d8a88a 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::EBCDIC;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index f599020..e4d531c 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::MPEiX;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index f7e22a3..f3b5dcf 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::MacOS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 use vars qw(@ISA);
index 1f732f5..458c02d 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::RiscOS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index 498e248..e6177c8 100644 (file)
@@ -2,20 +2,13 @@ package Module::Build::Platform::Unix;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
 use vars qw(@ISA);
 @ISA = qw(Module::Build::Base);
 
-sub make_tarball {
-  my $self = shift;
-  $self->{args}{tar}  ||= ['tar'];
-  $self->{args}{gzip} ||= ['gzip'];
-  $self->SUPER::make_tarball(@_);
-}
-
 sub is_executable {
   # We consider the owner bit to be authoritative on a file, because
   # -x will always return true if the user is root and *any*
index 69912c8..8175f6c 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::VMS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
@@ -229,8 +229,9 @@ sub _infer_xs_spec {
 
 =item rscan_dir
 
-Inherit the standard version but remove dots at end of name.  This may not be 
-necessary if File::Find has been fixed or DECC$FILENAME_UNIX_REPORT is in effect.
+Inherit the standard version but remove dots at end of name.
+If the extended character set is in effect, do not remove dots from filenames
+with Unix path delimiters.
 
 =cut
 
@@ -239,7 +240,11 @@ sub rscan_dir {
 
   my $result = $self->SUPER::rscan_dir( $dir, $pattern );
 
-  for my $file (@$result) { $file =~ s/\.$//; }
+  for my $file (@$result) {
+      if (!_efs() && ($file =~ m#/#)) {
+          $file =~ s/\.$//;
+      }
+  }
   return $result;
 }
 
@@ -254,7 +259,7 @@ sub dist_dir {
   my $self = shift;
 
   my $dist_dir = $self->SUPER::dist_dir;
-  $dist_dir =~ s/\./_/g;
+  $dist_dir =~ s/\./_/g unless _efs();
   return $dist_dir;
 }
 
@@ -322,6 +327,11 @@ sub _detildefy {
         # break up the paths for the merge
         my $home = VMS::Filespec::unixify($ENV{HOME});
 
+        # In the default VMS mode, the trailing slash is present.
+        # In Unix report mode it is not.  The parsing logic assumes that
+        # it is present.
+        $home .= '/' unless $home =~ m#/$#;
+
         # Trivial case of just ~ by it self
         if ($spec eq '') {
             $home =~ s#/$##;
@@ -361,9 +371,8 @@ sub _detildefy {
         # Now put the two cases back together
         $arg = File::Spec::Unix->catpath($hvol, $newdirs, $file);
 
-    } else {
-        return $arg;
     }
+    return $arg;
 
 }
 
@@ -376,7 +385,9 @@ lossy.
 
 =cut
 
-sub find_perl_interpreter { return $^X; }
+sub find_perl_interpreter {
+    return VMS::Filespec::vmsify($^X);
+}
 
 =item localize_file_path
 
@@ -386,8 +397,9 @@ Convert the file path to the local syntax
 
 sub localize_file_path {
   my ($self, $path) = @_;
+  $path = VMS::Filespec::vmsify($path);
   $path =~ s/\.\z//;
-  return VMS::Filespec::vmsify($path);
+  return $path;
 }
 
 =item localize_dir_path
@@ -415,6 +427,43 @@ sub ACTION_clean {
   }
 }
 
+
+# Need to look up the feature settings.  The preferred way is to use the
+# VMS::Feature module, but that may not be available to dual life modules.
+
+my $use_feature;
+BEGIN {
+    if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
+        $use_feature = 1;
+    }
+}
+
+# Need to look up the UNIX report mode.  This may become a dynamic mode
+# in the future.
+sub _unix_rpt {
+    my $unix_rpt;
+    if ($use_feature) {
+        $unix_rpt = VMS::Feature::current("filename_unix_report");
+    } else {
+        my $env_unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+        $unix_rpt = $env_unix_rpt =~ /^[ET1]/i; 
+    }
+    return $unix_rpt;
+}
+
+# Need to look up the EFS character set mode.  This may become a dynamic
+# mode in the future.
+sub _efs {
+    my $efs;
+    if ($use_feature) {
+        $efs = VMS::Feature::current("efs_charset");
+    } else {
+        my $env_efs = $ENV{'DECC$EFS_CHARSET'} || '';
+        $efs = $env_efs =~ /^[ET1]/i; 
+    }
+    return $efs;
+}
+
 =back
 
 =head1 AUTHOR
index ca77134..ca7270f 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::VOS;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
index c8b412c..72f0444 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::Windows;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 
 use Config;
index c8c5b49..e2f3eb6 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::aix;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index 62c6573..d9bc6e1 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::cygwin;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index aa87fb6..173d2b5 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::darwin;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index ba124dd..3e22aff 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::Platform::os2;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
index 0012aab..142ddfe 100644 (file)
@@ -2,7 +2,7 @@ package Module::Build::PodParser;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
 $VERSION = eval $VERSION;
 use vars qw(@ISA);
 
diff --git a/lib/Module/Build/scripts/bundle.pl b/lib/Module/Build/scripts/bundle.pl
deleted file mode 100755 (executable)
index 78de143..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/perl
-
-# this is just a first crack and it uses File::Fu because I'm lazy.
-
-=head1 using
-
-This installs from a fresh Module::Build to your inc/inc_Module-Build
-directory.  Use it from within your dist:
-
-  perl /path/to/Module-Build/scripts/bundle.pl
-
-You still need to manually add the following to your Build.PL
-
-  use lib 'inc';
-  use latest 'Module::Build';
-
-You also need to regen your manifest.
-
-  perl Build.PL
-  ./Build distmeta; >MANIFEST; ./Build manifest; svn diff MANIFEST
-
-=cut
-
-use warnings;
-use strict;
-
-use File::Fu;
-use File::Copy ();
-
-my $inc_dir = shift(@ARGV);
-$inc_dir = File::Fu->dir($inc_dir || 'inc/inc_Module-Build');
-$inc_dir->create unless($inc_dir->e);
-$inc_dir = $inc_dir->absolutely;
-
-
-my $mb_dir = File::Fu->program_dir->dirname;
-
-$mb_dir->chdir_for(sub {
-  my $temp = File::Fu->temp_dir('mb_bundle');
-  local @INC = @INC;
-  unshift(@INC, 'lib', 'inc');
-  require Module::Build;
-  my $builder = Module::Build->new_from_context;
-  $builder->dispatch(install =>
-    install_base => $temp,
-    install_path => {lib => $inc_dir},
-  );
-});
-
-my $latest = $mb_dir/'inc'+'latest.pm';
-File::Copy::copy($latest, 'inc');
-
-# vim:ts=2:sw=2:et:sta
index 8bf69bb..36aea85 100644 (file)
@@ -5,7 +5,7 @@ package Tie::CPHash;
 #
 # Author: Christopher J. Madsen <cjm@pobox.com>
 # Created: 08 Nov 1997
-# $Revision: 5841 $  $Date: 2006-03-21 05:27:29 -0800 (Tue, 21 Mar 2006) $
+# $Revision: 5841 $  $Date: 2006-03-21 08:27:29 -0500 (Tue, 21 Mar 2006) $
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the same terms as Perl itself.
index cb219aa..a5d880c 100644 (file)
@@ -135,8 +135,7 @@ ok $mb, "Module::Build->new_from_context";
     $foo_builder = Foo::Builder->new_from_context;
   });
   foreach my $style ('passthrough', 'small') {
-    Module::Build::Compat->create_makefile_pl($style, $foo_builder);
-    ok -e 'Makefile.PL', "$style Makefile.PL created";
+    create_makefile_pl($style, $foo_builder);
     
     # Should fail with "can't find Foo/Builder.pm"
     my $result;
@@ -153,8 +152,7 @@ ok $mb, "Module::Build->new_from_context";
     $bar_builder = Module::Build->subclass( class => 'Bar::Builder' )->new_from_context;
   });
   foreach my $style ('passthrough', 'small') {
-    Module::Build::Compat->create_makefile_pl($style, $bar_builder);
-    ok -e 'Makefile.PL', "$style Makefile.PL created via subclass";
+    create_makefile_pl($style, $bar_builder);
     my $result;
     stdout_of( sub {
       $result = $mb->run_perl_script('Makefile.PL');
@@ -165,7 +163,7 @@ ok $mb, "Module::Build->new_from_context";
 
 {
   # Make sure various Makefile.PL arguments are supported
-  Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+  create_makefile_pl('passthrough', $mb);
 
   my $libdir = File::Spec->catdir( $tmp, 'libdir' );
   my $result;
@@ -255,7 +253,7 @@ ok $mb, "Module::Build->new_from_context";
   # C<glob> on MSWin32 uses $ENV{HOME} if defined to do tilde-expansion
   local $ENV{HOME} = 'C:/' if $^O =~ /MSWin/ && !exists( $ENV{HOME} );
 
-  Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+  create_makefile_pl('passthrough', $mb);
 
   stdout_of( sub {
     $mb->run_perl_script('Makefile.PL', [], ['INSTALL_BASE=~/foo']);
@@ -290,8 +288,8 @@ sub test_makefile_types {
     ok $mb, "Module::Build->new_from_context";
 
     # Create and test Makefile.PL
-    Module::Build::Compat->create_makefile_pl($type, $mb);
-    ok -e 'Makefile.PL', "$type Makefile.PL created";
+    create_makefile_pl($type, $mb);
+
     test_makefile_pl_requires_perl( $opts{requires}{perl} );
     test_makefile_creation($mb);
     test_makefile_prereq_pm( $opts{requires} );
@@ -321,8 +319,11 @@ sub test_makefile_types {
     ok $success, "make realclean ran without error";
 
     # Try again with some Makefile.PL arguments
-    test_makefile_creation($mb, [], 'INSTALLDIRS=vendor', 1);
+    test_makefile_creation($mb, [], 'INSTALLDIRS=vendor', 'realclean');
     
+    # Try again using distclean
+    test_makefile_creation($mb, [], '', 'distclean');
+
     1 while unlink 'Makefile.PL';
     ok ! -e 'Makefile.PL', "cleaned up Makefile";
   }
@@ -344,10 +345,12 @@ sub test_makefile_creation {
   ok -e $makefile, "$makefile exists";
   
   if ($cleanup) {
-    $output = stdout_of( sub {
-      $build->do_system(@make, 'realclean');
+    # default to 'realclean' unless we recognize the clean method
+    $cleanup = 'realclean' unless $cleanup =~ /^(dist|real)clean$/;
+    my ($stdout, $stderr ) = stdout_stderr_of (sub {
+      $build->do_system(@make, $cleanup);
     });
-    ok ! -e '$makefile', "$makefile cleaned up";
+    ok ! -e $makefile, "$makefile cleaned up with $cleanup";
   }
   else {
     pass '(skipping cleanup)'; # keep test count constant
@@ -369,17 +372,17 @@ sub test_makefile_pl_files {
   my $expected = shift;
 
   SKIP: {
-    skip "$makefile not found", 1 unless -e $makefile;
-    my $pl_files = find_params_in_makefile()->{PL_FILES} || {};
-    is_deeply $pl_files, $expected,
-      "$makefile has correct PL_FILES line";
+    skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+    my $args = extract_writemakefile_args() || {};
+    is_deeply $args->{PL_FILES}, $expected,
+      "Makefile.PL has correct PL_FILES line";
   }
 }
 
 sub test_makefile_pl_requires_perl {
   my $perl_version = shift || q{};
   SKIP: {
-    skip 'Makefile.PL not found', 1 unless -e 'Makefile.PL';
+    skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
     my $file_contents = slurp 'Makefile.PL';
     my $found_requires = $file_contents =~ m{^require $perl_version;}ms;
     if (length $perl_version) {
@@ -417,3 +420,29 @@ sub find_params_in_makefile {
 
   return \%params;
 }
+
+sub extract_writemakefile_args {
+  SKIP: {
+    skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+    my $file_contents = slurp 'Makefile.PL';
+    my ($args) = $file_contents =~ m{^WriteMakefile\n\((.*)\).*;}ms;
+    ok $args, "Found WriteMakefile arguments"
+        or diag "Makefile.PL:\n$file_contents";
+    my %args = eval $args or diag $args; ## no critic
+    return \%args;
+  }
+}
+
+sub create_makefile_pl {
+    Module::Build::Compat->create_makefile_pl(@_);
+    my $ok = ok -e 'Makefile.PL', "$_[0] Makefile.PL created";
+
+    # Some really conservative make's, like HP/UX, assume files with the same
+    # timestamp are out of date.  Send the Makefile.PL one second into the past
+    # so its older than the Makefile it will generate.
+    # See [rt.cpan.org 45700]
+    my $mtime = (stat("Makefile.PL"))[9];
+    utime $mtime, $mtime - 1, "Makefile.PL";
+
+    return $ok;
+}
index 3b01a79..30c648b 100644 (file)
@@ -129,7 +129,7 @@ foreach my $test (@win_splits) {
 
   my @data = map values(%$_), @unix_splits, @win_splits;
   for my $d (@data) {
-    chomp(my $out = Module::Build->_backticks('perl', '-le', 'print join " ", map "{$_}", @ARGV', @$d));
+    chomp(my $out = Module::Build->_backticks($^X, '-le', 'print join " ", map "{$_}", @ARGV', @$d));
     is($out, join(' ', map "{$_}", @$d), "backticks round trip for ".join('',map "{$_}", @$d));
   }
 }
@@ -137,6 +137,12 @@ foreach my $test (@win_splits) {
 {
   # Make sure run_perl_script() propagates @INC
   my $dir = MBTest->tmpdir;
+  if ($^O eq 'VMS') {
+      # VMS can store INC paths in Unix format with out the trailing
+      # directory delimiter.
+      $dir = VMS::Filespec::unixify($dir);
+      $dir =~ s#/$##;
+  }
   local @INC = ($dir, @INC);
   my $output = stdout_of( sub { Module::Build->run_perl_script('-le', [], ['print for @INC']) } );
   like $output, qr{^\Q$dir\E}m;
index 4c96421..f939def 100644 (file)
@@ -50,7 +50,9 @@ print "Hello, World!\n";
   $mb->test_files('*t*');
   my $files = $mb->test_files;
   ok  grep {$_ eq 'script'}    @$files;
-  ok  grep {$_ eq File::Spec->catfile('t', 'basic.t')} @$files;
+  my $t_basic_t = File::Spec->catfile('t', 'basic.t');
+  $t_basic_t = VMS::Filespec::vmsify($t_basic_t) if $^O eq 'VMS';
+  ok  grep {$_ eq $t_basic_t} @$files;
   ok !grep {$_ eq 'Build.PL' } @$files;
 
   # Make sure order is preserved
index caa7d47..1def8af 100644 (file)
@@ -33,14 +33,24 @@ $dist->regen;
 my $simple_file = 'lib/Simple.pm';
 my $simple2_file = 'lib/Simple2.pm';
 
-   #TODO:
    # Traditional VMS will return the file in in lower case, and is_deeply
    # does exact case comparisons.
-   # When ODS-5 support is active for preserved case file names, this will
-   # need to be changed.
+   # When ODS-5 support is active for preserved case file names we do not
+   # change the case.
    if ($^O eq 'VMS') {
-       $simple_file = lc($simple_file);
-       $simple2_file = lc($simple2_file);
+       my $lower_case_expect = 1;
+       my $vms_efs_case = 0;
+       if (eval 'require VMS::Feature') {
+           $vms_efs_case = VMS::Feature::current("efs_case_preserve");
+       } else {
+           my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
+           $vms_efs_case = $efs_case =~ /^[ET1]/i;
+       }
+       $lower_case_expect = 0 if $vms_efs_case;
+       if ($lower_case_expect) {
+           $simple_file = lc($simple_file);
+           $simple2_file = lc($simple2_file);
+       }
    }
 
 
index e095a60..9891328 100644 (file)
@@ -73,11 +73,22 @@ ok -e $mb->build_script;
 
 my $dist_dir = 'Simple-0.01';
 
-# VMS may or may not need to modify the name, vmsify will do this if
-# the name looks like a UNIX directory.
+# VMS in traditional mode needs the $dist_dir name to not have a '.' in it
+# as this is a directory delimiter.  In extended character set mode the dot
+# is permitted for Unix format file specifications.
 if ($^O eq 'VMS') {
-   my @dist_dirs = File::Spec->splitdir(VMS::Filespec::vmsify($dist_dir.'/'));
-   $dist_dir = $dist_dirs[0];
+    my $Is_VMS_noefs = 1;
+    my $vms_efs = 0;
+    if (eval 'require VMS::Feature') {
+        $vms_efs = VMS::Feature::current("efs_charset");
+    } else {
+        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+        $vms_efs = $efs_charset =~ /^[ET1]/i; 
+    }
+    $Is_VMS_noefs = 0 if $vms_efs;
+    if ($Is_VMS_noefs) {
+        $dist_dir = 'Simple-0_01';
+    }
 }
 
 is $mb->dist_dir, $dist_dir;