diff options
author | David Golden <dagolden@cpan.org> | 2009-12-17 16:08:09 -0500 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2009-12-17 17:15:32 -0500 |
commit | 53fc1c7e149a219087a8d9ad9879eb0a6ea109d9 (patch) | |
tree | 629fb33f877eac34870ed20173f3867d34448dce /cpan/Module-Build | |
parent | feb517daa146d8e378d6d18de1ce5d7dc752383d (diff) | |
download | perl-53fc1c7e149a219087a8d9ad9879eb0a6ea109d9.tar.gz |
Updated Module::Build to 0.35_14
0.35_14 - Thu Dec 17 16:02:14 EST 2009
Bug fixes:
- If not set, the 'module_name' is detected from 'dist_version_from'
or from 'dist_name'. The directory is no longer used. [David Golden]
- The 'share_dir' property no longer defaults to 'share' and must be
explicitly set instead; this fixes problems for CPAN distributions that
already have a 'share' directory for whatever reason [David Golden]
- Change t/00-compile.t test for more portability [David Golden]
- Skip ppm.t if Pod::Html is not available [David Goldenj]
- Changed guts of inc::latest to work properly on older versions of Perl
[David Golden]
- Ensure bundle_inc.t doesn't accidentally uninstall the installed M::B
during testing if the user had 'uninst=1' set during Build.PL
[David Golden]
0.35_13 - Sat Dec 5 11:26:36 EST 2009
Bug fixes:
- Protect against tempfile errors when checking ExtUtils::Installed
[David Golden]
0.35_12 - Fri Dec 4 23:06:49 EST 2009
Bug fixes:
- Protect inc/ bundling tests against broken ExtUtils::Installed
[David Golden]
0.35_11 - Thu Dec 3 11:07:44 EST 2009
*** API CHANGE ***
- The old API for prepare_metadata() has been restored to avoid breaking
distributions that were overriding it (e.g. BioPerl), but the method
has been marked deprecated and may be made private or may disappear in
some future version of Module::Build. [David Golden]
- A new get_metadata() method has been added as a simpler wrapper around
the old, kludgy prepare_metadata() API. [David Golden]
0.35_10 - Tue Nov 24 22:49:19 EST 2009
Bug fixes:
- bundle_inc.t is more careful about permissions and open filehandles
to avoid failures/skips on Win32 [David Golden]
- Fix compilation error in Module::Build::Platform::VMS (RT#51766)
[David Golden]
- Don't generate a MANIFEST.SKIP during distclean and add any generated
MANIFEST.SKIP to cleanup list [reported by Zefram, fixed by David Golden]
- Module::Build::ModuleInfo version parsing would fail if a module sets
its $VERSION from another module, but the other module is not installed.
We now try to detect such failures, prepend 'lib' to @INC and try again.
[David Golden]
- MYMETA.yml used to be generated from scratch, overriding any
customizations used to create META.yml. Now, if META.yml exists, that
will be used as the base for MYMETA and only prereq fields will be
updated (to reflect any dynamic configuration); also, 'dynamic_config'
will be set to false and 'generated_by' will be updated [David Golden]
0.35_09 - Thu Nov 19 01:30:42 EST 2009
Bug fixes:
- The DB package should not be included in 'provides' in META files
[David Golden]
- Fixed t/xs.t build failures in bleadperl for noexec temp directories
[Nicholas Clark]
- Adjusted order of @INC in resume() (fixes par.t, ppm.t, xs.t fails):
@INC = @new_additions_to_inc, @saved_additions_to_inc, @default_inc
[David Golden]
- Skip bundle_inc.t tests if bundled Module::Build for test can't be
tweaked (Works around test crashes on Win2) [David Golden]
Other:
- 'C_support' is no longer an optional feature. Modern ExtUtils::CBuilder
and ExtUtils::ParseXS added to the 'requires' list. This ensures that
upgrading Module::Build will upgrade this critical modules.
ExtUtils::CBuilder no longer requires a compiler, so it is "safe" to
require.
Diffstat (limited to 'cpan/Module-Build')
44 files changed, 613 insertions, 407 deletions
diff --git a/cpan/Module-Build/Changes b/cpan/Module-Build/Changes index bfc585f3cd..def6bc986a 100644 --- a/cpan/Module-Build/Changes +++ b/cpan/Module-Build/Changes @@ -1,5 +1,77 @@ Revision history for Perl extension Module::Build. +0.35_14 - Thu Dec 17 16:02:14 EST 2009 + + Bug fixes: + + - If not set, the 'module_name' is detected from 'dist_version_from' + or from 'dist_name'. The directory is no longer used. [David Golden] + + - The 'share_dir' property no longer defaults to 'share' and must be + explicitly set instead; this fixes problems for CPAN distributions that + already have a 'share' directory for whatever reason [David Golden] + + - Change t/00-compile.t test for more portability [David Golden] + + - Skip ppm.t if Pod::Html is not available [David Goldenj] + + - Changed guts of inc::latest to work properly on older versions of Perl + [David Golden] + + - Ensure bundle_inc.t doesn't accidentally uninstall the installed M::B + during testing if the user had 'uninst=1' set during Build.PL + [David Golden] + +0.35_13 - Sat Dec 5 11:26:36 EST 2009 + + Bug fixes: + + - Protect against tempfile errors when checking ExtUtils::Installed + [David Golden] + +0.35_12 - Fri Dec 4 23:06:49 EST 2009 + + Bug fixes: + + - Protect inc/ bundling tests against broken ExtUtils::Installed + [David Golden] + +0.35_11 - Thu Dec 3 11:07:44 EST 2009 + + *** API CHANGE *** + + - The old API for prepare_metadata() has been restored to avoid breaking + distributions that were overriding it (e.g. BioPerl), but the method + has been marked deprecated and may be made private or may disappear in + some future version of Module::Build. [David Golden] + + - A new get_metadata() method has been added as a simpler wrapper around + the old, kludgy prepare_metadata() API. [David Golden] + +0.35_10 - Tue Nov 24 22:49:19 EST 2009 + + Bug fixes: + + - bundle_inc.t is more careful about permissions and open filehandles + to avoid failures/skips on Win32 [David Golden] + + - Fix compilation error in Module::Build::Platform::VMS (RT#51766) + [David Golden] + + - Don't generate a MANIFEST.SKIP during distclean and add any generated + MANIFEST.SKIP to cleanup list [reported by Zefram, fixed by David Golden] + + - Module::Build::ModuleInfo version parsing would fail if a module sets + its $VERSION from another module, but the other module is not installed. + We now try to detect such failures, prepend 'lib' to @INC and try again. + [David Golden] + + - MYMETA.yml used to be generated from scratch, overriding any + customizations used to create META.yml. Now, if META.yml exists, that + will be used as the base for MYMETA and only prereq fields will be + updated (to reflect any dynamic configuration); also, 'dynamic_config' + will be set to false and 'generated_by' will be updated [David Golden] + 0.35_09 - Thu Nov 19 01:30:42 EST 2009 Bug fixes: diff --git a/cpan/Module-Build/lib/Module/Build.pm b/cpan/Module-Build/lib/Module/Build.pm index e8bd9b6306..cc5d0fbda7 100644 --- a/cpan/Module-Build/lib/Module/Build.pm +++ b/cpan/Module-Build/lib/Module/Build.pm @@ -15,7 +15,7 @@ use Module::Build::Base; use vars qw($VERSION @ISA); @ISA = qw(Module::Build::Base); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; # Okay, this is the brute-force method of finding out what kind of @@ -167,25 +167,7 @@ This illustrates initial configuration and the running of three 'actions'. In this case the actions run are 'build' (the default action), 'test', and 'install'. Other actions defined so far include: - build manifest - clean manpages - code pardist - config_data ppd - diff ppmdist - dist prereq_data - distcheck prereq_report - distclean pure_install - distdir realclean - distmeta retest - distsign skipcheck - disttest test - docs testall - fakeinstall testcover - help testdb - html testpod - install testpodcoverage - installdeps versioninstall - +<action_list> You can run the 'help' action for a complete list of actions. @@ -318,7 +300,7 @@ tarball of the files listed in F<MANIFEST> and compress the tarball using GZIP compression. 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 +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 @@ -559,7 +541,7 @@ for a bug report. [version 0.28] This action is identical to the C<install> action. In the future, -though, when C<install> starts writing to the file +though, when C<install> starts writing to the file F<$(INSTALLARCHLIB)/perllocal.pod>, C<pure_install> won't, and that will be the only difference between them. @@ -684,7 +666,7 @@ argument. [version 0.25] -This checks all the files described in the C<docs> action and +This checks all the files described in the C<docs> action and produces C<Test::Harness>-style output. If you are a module author, this is useful to run before creating a new release. @@ -692,7 +674,7 @@ this is useful to run before creating a new release. [version 0.28] -This checks the pod coverage of the distribution and +This checks the pod coverage of the distribution and produces C<Test::Harness>-style output. If you are a module author, this is useful to run before creating a new release. diff --git a/cpan/Module-Build/lib/Module/Build/API.pod b/cpan/Module-Build/lib/Module/Build/API.pod index 7d269f3cb0..146d28ec2b 100644 --- a/cpan/Module-Build/lib/Module/Build/API.pod +++ b/cpan/Module-Build/lib/Module/Build/API.pod @@ -763,14 +763,15 @@ be installed as read-only files for use with L<File::ShareDir>. The C<share_dir> property supports both distribution-level and module-level share files. -The default when C<share_dir> is not set is for any files in a F<share> -directory at the top level of the distribution to be installed in -distribution-level share directory. Alternatively, C<share_dir> can be set to -a directory name or an arrayref of directory names containing files to be -installed in the distribution-level share directory. +The simplest use of C<share_dir> is to set it to a directory name or an +arrayref of directory names containing files to be installed in the +distribution-level share directory. -If C<share_dir> is a hashref, it may have C<dist> or C<module> keys -providing full flexibility in defining share directories to install. + share_dir => 'share' + +Alternatively, if C<share_dir> is a hashref, it may have C<dist> or +C<module> keys providing full flexibility in defining how share +directories should be installed. share_dir => { dist => [ 'examples', 'more_examples' ], @@ -780,8 +781,8 @@ providing full flexibility in defining share directories to install. } } -If C<share_dir> is set (manually or automatically), then File::ShareDir -will automatically be added to the C<requires> hash. +If C<share_dir> is set, then File::ShareDir will automatically be added +to the C<requires> hash. =item sign @@ -1182,7 +1183,7 @@ See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">. Returns a hash reference indicating the C<conflicts> prerequisites that were passed to the C<new()> method. -=item contains_pod($file) +=item contains_pod($file) [deprecated] [version 0.20] @@ -1569,7 +1570,7 @@ localized path based on C<$value>. Assigning the value C<undef> to an element causes it to be removed. -=item prepare_metadata() +=item get_metadata() [version 0.36] @@ -1580,13 +1581,34 @@ of F<META.yml>. E.g. package My::Builder; use base 'Module::Build'; - sub prepare_metadata { - my $self = shift; - my $data = $self->SUPER::prepare_metadata(); + sub get_metadata { + my $self, @args = @_; + my $data = $self->SUPER::get_metadata(@args); $data->{custom_field} = 'foo'; return $data; } +The only valid argument is C<fatal>, which indicates whether missing required +metadata fields should be a fatal error or not. For META creation, it +generally should, but for MYMETA creation for end-users, it should not be +fatal. + +This method is a wrapper around the old prepare_metadata API now that we +no longer use YAML::Node to hold metadata. + +=item prepare_metadata() [deprecated] + +[version 0.36] + +[Deprecated] As of 0.36, authors should use C<get_metadata> instead. This +method is preserved for backwards compatibility only. + +It takes three positional arguments: a hashref (to which metadata will be +added), an optional arrayref (to which metadata keys will be added in order if +the arrayref exists), and a hashref of arguments (as provided to get_metadata). +The latter argument is new as of 0.36. Earlier versions are always fatal on +errors. + Prior to version 0.36, this method took a YAML::Node as an argument to hold assembled metadata. @@ -1805,129 +1827,7 @@ accessor methods for the following properties: =over 4 -=item PL_files() - -=item allow_mb_mismatch() - -=item auto_configure_requires() - -=item autosplit() - -=item base_dir() - -=item bindoc_dirs() - -=item blib() - -=item build_bat() - -=item build_class() - -=item build_elements() - -=item build_requires() - -=item build_script() - -=item bundle_inc() - -=item bundle_inc_preload() - -=item c_source() - -=item config_dir() - -=item configure_requires() - -=item conflicts() - -=item cpan_client() - -=item create_license() - -=item create_makefile_pl() - -=item create_packlist() - -=item create_readme() - -=item debug() - -=item debugger() - -=item destdir() - -=item get_options() - -=item html_css() - -=item include_dirs() - -=item install_base() - -=item installdirs() - -=item libdoc_dirs() - -=item license() - -=item magic_number() - -=item mb_version() - -=item meta_add() - -=item meta_merge() - -=item metafile() - -=item module_name() - -=item mymetafile() - -=item needs_compiler() - -=item orig_dir() - -=item perl() - -=item pm_files() - -=item pod_files() - -=item pollute() - -=item prefix() - -=item prereq_action_types() - -=item program_name() - -=item quiet() - -=item recommends() - -=item recurse_into() - -=item recursive_test_files() - -=item requires() - -=item scripts() - -=item sign() - -=item tap_harness_args() - -=item test_file_exts() - -=item use_rcfile() - -=item use_tap_harness() - -=item verbose() - -=item xs_files() +<autogenerated_accessors> =back diff --git a/cpan/Module-Build/lib/Module/Build/Base.pm b/cpan/Module-Build/lib/Module/Build/Base.pm index 5894ce51b3..c52ec72b49 100644 --- a/cpan/Module-Build/lib/Module/Build/Base.pm +++ b/cpan/Module-Build/lib/Module/Build/Base.pm @@ -4,7 +4,7 @@ package Module::Build::Base; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; BEGIN { require 5.00503 } @@ -1090,11 +1090,11 @@ sub _guess_module_name { $p->{module_name} = $mi->name; } else { - my $mod_path = my $mod_name = File::Basename::basename($self->base_dir); + my $mod_path = my $mod_name = $p->{dist_name}; $mod_name =~ s{-}{::}g; $mod_path =~ s{-}{/}g; $mod_path .= ".pm"; - if ( -e $mod_path || -e File::Spec->catfile('lib', $mod_path) ) { + if ( -e $mod_path || -e "lib/$mod_path" ) { $p->{module_name} = $mod_name; } else { @@ -1279,7 +1279,15 @@ sub write_config { return unless inc::latest->can('loaded_modules'); require ExtUtils::Installed; # ExtUtils::Installed is buggy about finding additions to default @INC - my $inst = ExtUtils::Installed->new(extra_libs => [@INC]); + my $inst = eval { ExtUtils::Installed->new(extra_libs => [@INC]) }; + if ($@) { + $self->log_warn( << "EUI_ERROR" ); +Bundling in inc/ is disabled because ExtUtils::Installed could not +create a list of your installed modules. Here is the error: +$@ +EUI_ERROR + return; + } my @bundle_list = map { [ $_, 0 ] } inc::latest->loaded_modules; # XXX TODO: Need to get ordering of prerequisites correct so they are @@ -1753,17 +1761,48 @@ my \$build = $build_package->resume ( EOF } -sub create_build_script { +sub create_mymeta { my ($self) = @_; - $self->write_config; - - # Create MYMETA.yml my $mymetafile = $self->mymetafile; + my $metafile = $self->metafile; + + # cleanup if ( $self->delete_filetree($mymetafile) ) { $self->log_verbose("Removed previous '$mymetafile'\n"); } $self->log_info("Creating new '$mymetafile' with configuration results\n"); - $self->write_metafile( $mymetafile, $self->prepare_metadata( fatal => 0 ) ); + + # use old meta and update prereqs, if possible + my $mymeta; + if ( -f $metafile ) { + $mymeta = eval { $self->read_metafile( $self->metafile ) }; + } + # if we read META OK, just update it + if ( defined $mymeta ) { + my $prereqs = $self->_normalize_prereqs; + for my $t ( keys %$prereqs ) { + $mymeta->{$t} = $prereqs->{$t}; + } + } + # but generate from scratch, ignoring errors if META doesn't exist + else { + $mymeta = $self->get_metadata( fatal => 0 ); + } + + # MYMETA is always static + $mymeta->{dynamic_config} = 0; + # Note which M::B created it + $mymeta->{generated_by} = "Module::Build version $Module::Build::VERSION"; + + $self->write_metafile( $mymetafile, $mymeta ); + return 1; +} + +sub create_build_script { + my ($self) = @_; + + $self->write_config; + $self->create_mymeta; # Create Build my ($build_script, $dist_name, $dist_version) @@ -2416,6 +2455,7 @@ sub _action_listing { while (my ($one, $two) = splice @actions, 0, 2) { $out .= sprintf(" %-12s %-12s\n", $one, $two||''); } + $out =~ s{\s*$}{}mg; # remove trailing spaces return $out; } @@ -2716,14 +2756,14 @@ sub _find_share_dir_files { my @file_map; if ( $share_dir->{dist} ) { - my $prefix = File::Spec->catdir( "dist", $self->dist_name ); + my $prefix = "dist/".$self->dist_name; push @file_map, $self->_share_dir_map( $prefix, $share_dir->{dist} ); } if ( $share_dir->{module} ) { for my $mod ( keys %{ $share_dir->{module} } ) { (my $altmod = $mod) =~ s{::}{-}g; - my $prefix = File::Spec->catdir("module", $altmod); + my $prefix = "module/$altmod"; push @file_map, $self->_share_dir_map($prefix, $share_dir->{module}{$mod}); } } @@ -2736,9 +2776,8 @@ sub _share_dir_map { my %files; for my $dir ( @$list ) { for my $f ( @{ $self->rscan_dir( $dir, sub {-f} )} ) { - $files{File::Spec->canonpath($f)} = File::Spec->catfile( - $prefix, File::Spec->abs2rel( $f, $dir ) - ); + $f =~ s{\A.*\Q$dir\E/}{}; + $files{"$dir/$f"} = "$prefix/$f"; } } return %files; @@ -3482,7 +3521,7 @@ sub ACTION_dist { sub ACTION_distcheck { my ($self) = @_; - $self->_check_manifest_skip; + $self->_check_manifest_skip unless $self->invoked_action eq 'distclean'; require ExtUtils::Manifest; local $^W; # ExtUtils::Manifest is not warnings clean. @@ -3861,7 +3900,7 @@ sub _write_default_maniskip { $content .= <<'EOF'; # Avoid configuration metadata file -^MYMETA\.$ +^MYMETA\. # Avoid Module::Build generated and utility files. \bBuild$ @@ -3870,6 +3909,7 @@ sub _write_default_maniskip { \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ +^MANIFEST\.SKIP # Avoid archives of this distribution EOF @@ -3888,8 +3928,9 @@ sub _check_manifest_skip { my $maniskip = 'MANIFEST.SKIP'; if ( ! -e $maniskip ) { - $self->log_warn("File '$maniskip' does not exist: Creating a default '$maniskip'\n"); + $self->log_warn("File '$maniskip' does not exist: Creating a temporary '$maniskip'\n"); $self->_write_default_maniskip($maniskip); + $self->add_to_cleanup($maniskip); } else { # MYMETA must not be added to MANIFEST, so always confirm the skip @@ -3948,8 +3989,7 @@ sub share_dir { # Always coerce to proper hash form if ( ! defined $p->{share_dir} ) { - # not set -- use default 'share' dir if exists - $p->{share_dir} = { dist => [ 'share' ] } if -d 'share'; + return; } elsif ( ! ref $p->{share_dir} ) { # scalar -- treat as a single 'dist' directory @@ -4127,7 +4167,7 @@ sub do_create_metafile { push @INC, File::Spec->catdir($self->blib, 'lib'); } - if ( $self->write_metafile( $self->metafile, $self->prepare_metadata( fatal => 1 ) ) ) { + if ($self->write_metafile($self->metafile,$self->get_metadata(fatal=>1))){ $self->{wrote_metadata} = 1; $self->_add_to_manifest('MANIFEST', $metafile); } @@ -4135,6 +4175,21 @@ sub do_create_metafile { return 1; } +sub read_metafile { + my $self = shift; + my ($metafile) = @_; + my $yaml; + + my $class = $self->_mb_feature('YAML_support') + ? 'YAML::Tiny' : 'Module::Build::YAML' ; + + eval "require $class; 1" or die $@; + my $meta = $class->read($metafile) + or $self->log_warn( "Error reading '$metafile': " . $class->errstr . "\n"); + + return $meta->[0] || {}; +} + sub write_metafile { my $self = shift; my ($metafile, $node) = @_; @@ -4172,16 +4227,51 @@ sub normalize_version { return $version; } -sub prepare_metadata { +sub _normalize_prereqs { + my ($self) = @_; + my $p = $self->{properties}; + + # 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}); + } + } + } + return \%prereq_types; +} + + +# wrapper around old prepare_metadata API; +sub get_metadata { my ($self, %args) = @_; - my $fatal = $args{fatal} || 0; + my $metadata = {}; + $self->prepare_metadata( $metadata, undef, \%args ); + return $metadata; +} + +# To preserve compatibility with old API, $node *must* be a hashref +# passed in to prepare_metadata. $keys is an arrayref holding a +# list of keys -- it's use is optional and generally no longer needed +# but kept for back compatibility. $args is an optional parameter to +# support the new 'fatal' toggle + +sub prepare_metadata { + my ($self, $node, $keys, $args) = @_; + unless ( ref $node eq 'HASH' ) { + croak "prepare_metadata() requires a hashref argument to hold output\n"; + } + my $fatal = $args->{fatal} || 0; my $p = $self->{properties}; - my $node = {}; # A little helper sub my $add_node = sub { my ($name, $val) = @_; $node->{$name} = $val; + push @$keys, $name if $keys; }; foreach (qw(dist_name dist_version dist_author dist_abstract license)) { @@ -4223,19 +4313,10 @@ sub prepare_metadata { # XXX we are silently omitting the url for any unknown license } - # 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}); - } - } - } - for my $t ( keys %prereq_types ) { - $add_node->($t, $prereq_types{$t}); + my $prereqs = $self->_normalize_prereqs; + for my $t ( keys %$prereqs ) { + $add_node->($t, $prereqs->{$t}); } if (exists $p->{dynamic_config}) { diff --git a/cpan/Module-Build/lib/Module/Build/Compat.pm b/cpan/Module-Build/lib/Module/Build/Compat.pm index c8a3670333..eeeb2bce08 100644 --- a/cpan/Module-Build/lib/Module/Build/Compat.pm +++ b/cpan/Module-Build/lib/Module/Build/Compat.pm @@ -2,7 +2,7 @@ package Module::Build::Compat; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; use File::Basename (); use File::Spec; @@ -18,7 +18,7 @@ my %convert_installdirs = ( VENDOR => 'vendor', ); -my %makefile_to_build = +my %makefile_to_build = ( TEST_VERBOSE => 'verbose', VERBINST => 'verbose', @@ -89,18 +89,18 @@ sub _merge_prereq { } return %$merge; } - - + + sub create_makefile_pl { my ($package, $type, $build, %args) = @_; - + die "Don't know how to build Makefile.PL of type '$type'" unless $type =~ /^(small|passthrough|traditional)$/; if ($type eq 'passthrough') { $build->log_warn(<<"HERE"); - -IMPORTANT NOTE: The '$type' style of Makefile.PL is deprecated and + +IMPORTANT NOTE: The '$type' style of Makefile.PL is deprecated and may be removed in a future version of Module::Build in favor of the 'configure_requires' property. See Module::Build::Compat documentation for details. @@ -120,7 +120,7 @@ HERE print {$fh} "# Note: this file was auto-generated by ", __PACKAGE__, " version $VERSION\n"; - # Minimum perl version should be specified as "require 5.XXXXXX" in + # Minimum perl version should be specified as "require 5.XXXXXX" in # Makefile.PL my $requires = $build->requires; if ( my $minimum_perl = $requires->{perl} ) { @@ -160,41 +160,41 @@ EOF } elsif ($type eq 'passthrough') { printf {$fh} <<'EOF', $subclass_load, ref($build), ref($build); - + unless (eval "use Module::Build::Compat 0.02; 1" ) { print "This module requires Module::Build to install itself.\n"; - + require ExtUtils::MakeMaker; my $yn = ExtUtils::MakeMaker::prompt (' Install Module::Build now from CPAN?', 'y'); - + unless ($yn =~ /^y/i) { die " *** Cannot install without Module::Build. Exiting ...\n"; } - + require Cwd; require File::Spec; require CPAN; - + # Save this 'cause CPAN will chdir all over the place. my $cwd = Cwd::cwd(); - + CPAN::Shell->install('Module::Build::Compat'); CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate or die "Couldn't install Module::Build, giving up.\n"; - + chdir $cwd or die "Cannot chdir() back to $cwd: $!"; } eval "use Module::Build::Compat 0.02; 1" or die $@; %s Module::Build::Compat->run_build_pl(args => \@ARGV); - my $build_script = 'Build'; + 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 - + } elsif ($type eq 'traditional') { my (%MM_Args, %prereq); @@ -202,27 +202,27 @@ EOF tie %MM_Args, 'Tie::IxHash'; # Don't care if it fails here tie %prereq, 'Tie::IxHash'; # Don't care if it fails here } - + my %name = ($build->module_name ? (NAME => $build->module_name) : (DISTNAME => $build->dist_name)); - + my %version = ($build->dist_version_from ? (VERSION_FROM => $build->dist_version_from) : (VERSION => $build->dist_version) ); %MM_Args = (%name, %version); - + %prereq = _merge_prereq( $build->requires, $build->build_requires ); %prereq = map {$_, $prereq{$_}} sort keys %prereq; - + delete $prereq{perl}; $MM_Args{PREREQ_PM} = \%prereq; - + $MM_Args{INSTALLDIRS} = $build->installdirs eq 'core' ? 'perl' : $build->installdirs; - + $MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if $build->script_files; - + $MM_Args{PL_FILES} = $build->PL_files || {}; if ($build->recursive_test_files) { @@ -232,7 +232,7 @@ EOF local $Data::Dumper::Terse = 1; my $args = Data::Dumper::Dumper(\%MM_Args); $args =~ s/\{(.*)\}/($1)/s; - + print $fh <<"EOF"; use ExtUtils::MakeMaker; WriteMakefile @@ -250,7 +250,7 @@ sub _test_globs { sub subclass_dir { my ($self, $build) = @_; - + return (Module::Build::ModuleInfo->find_module_dir_by_name(ref $build) || File::Spec->catdir($build->config_dir, 'lib')); } @@ -265,7 +265,7 @@ sub makefile_to_build_args { my @out; foreach my $arg (@_) { next if $arg eq ''; - + my ($key, $val) = ($arg =~ /^(\w+)=(.+)/ ? ($1, $2) : die "Malformed argument '$arg'"); @@ -320,7 +320,7 @@ sub makefile_to_build_macros { } } } - push @out, (config => \%config) if %config; + push @out, (config => \%config) if %config; return @out; } @@ -379,19 +379,19 @@ $action : force_do_it $perl $Build $action EOF } - + if ($self->_is_vms_mms) { # Roll our own .EXPORT as MMS/MMK don't honor that directive. - $maketext .= "\n.FIRST\n\t\@ $noop\n"; + $maketext .= "\n.FIRST\n\t\@ $noop\n"; for my $macro (keys %macro_to_build) { $maketext .= ".IFDEF $macro\n\tDEFINE $macro \"\$($macro)\"\n.ENDIF\n"; } - $maketext .= "\n"; + $maketext .= "\n"; } else { $maketext .= "\n.EXPORT : " . join(' ', keys %macro_to_build) . "\n\n"; } - + return $maketext; } diff --git a/cpan/Module-Build/lib/Module/Build/Config.pm b/cpan/Module-Build/lib/Module/Build/Config.pm index 49b5881dc1..0fba67adee 100644 --- a/cpan/Module-Build/lib/Module/Build/Config.pm +++ b/cpan/Module-Build/lib/Module/Build/Config.pm @@ -2,7 +2,7 @@ package Module::Build::Config; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Config; diff --git a/cpan/Module-Build/lib/Module/Build/ConfigData.pm b/cpan/Module-Build/lib/Module/Build/ConfigData.pm index 83c88922dc..15114ee072 100644 --- a/cpan/Module-Build/lib/Module/Build/ConfigData.pm +++ b/cpan/Module-Build/lib/Module/Build/ConfigData.pm @@ -217,4 +217,4 @@ do{ my $x = [ } } ]; -$x; } +$x; }
\ No newline at end of file diff --git a/cpan/Module-Build/lib/Module/Build/Cookbook.pm b/cpan/Module-Build/lib/Module/Build/Cookbook.pm index a5182aeaf5..e4df170ffa 100644 --- a/cpan/Module-Build/lib/Module/Build/Cookbook.pm +++ b/cpan/Module-Build/lib/Module/Build/Cookbook.pm @@ -1,7 +1,7 @@ package Module::Build::Cookbook; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; =head1 NAME @@ -487,7 +487,7 @@ Next, add this to the top of your F<Build.PL>. # Find out what version of Module::Build is installed or fail quietly. # This should be cross-platform. - my $Installed_MB = + my $Installed_MB = `$^X -e "eval q{require Module::Build; print Module::Build->VERSION} or exit 1"; # some operating systems put a newline at the end of every print. diff --git a/cpan/Module-Build/lib/Module/Build/Dumper.pm b/cpan/Module-Build/lib/Module/Build/Dumper.pm index 12d63d581a..f094172e97 100644 --- a/cpan/Module-Build/lib/Module/Build/Dumper.pm +++ b/cpan/Module-Build/lib/Module/Build/Dumper.pm @@ -1,7 +1,7 @@ package Module::Build::Dumper; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; # This is just a split-out of a wrapper function to do Data::Dumper # stuff "the right way". See: diff --git a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm index 90e4bb43c2..b82d1b62c9 100644 --- a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm +++ b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm @@ -8,7 +8,7 @@ package Module::Build::ModuleInfo; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use File::Spec; @@ -23,7 +23,7 @@ my $PKG_REGEXP = qr{ # match a package declaration \s+ # whitespace ([\w:]+) # a package name \s* # optional whitespace - ($V_NUM_REGEXP)? # optional version number + ($V_NUM_REGEXP)? # optional version number \s* # optional whitesapce ; # semicolon line terminator }x; @@ -235,7 +235,7 @@ sub _parse_fh { $need_vers = 0 if $vers_pkg eq $pkg; unless ( defined $vers{$vers_pkg} && length $vers{$vers_pkg} ) { - $vers{$vers_pkg} = + $vers{$vers_pkg} = $self->_evaluate_version_line( $vers_sig, $vers_fullname, $line ); } else { # Warn unless the user is using the "$VERSION = eval @@ -321,12 +321,18 @@ sub _evaluate_version_line { local $^W; # Try to get the $VERSION eval $eval; + # some modules say $VERSION = $Foo::Bar::VERSION, but Foo::Bar isn't + # installed, so we need to hunt in ./lib for it + if ( $@ =~ /Can't locate/ && -d 'lib' ) { + local @INC = ('lib',@INC); + eval $eval; + } warn "Error evaling version line '$eval' in $self->{filename}: $@\n" if $@; (ref($vsub) eq 'CODE') or die "failed to build version sub for $self->{filename}"; my $result = eval { $vsub->() }; - die "Could not get version from $self->{filename} by executing:\n$eval\n\nThe fatal error was: $@\n" + die "Could not get version from $self->{filename} by executing:\n$eval\n\nThe fatal error was: $@\n" if $@; # Activestate apparently creates custom versions like '1.23_45_01', which @@ -340,7 +346,7 @@ sub _evaluate_version_line { # Bless it into our own version class eval { $result = Module::Build::Version->new($result) }; - die "Version '$result' from $self->{filename} does not appear to be valid:\n$eval\n\nThe fatal error was: $@\n" + die "Version '$result' from $self->{filename} does not appear to be valid:\n$eval\n\nThe fatal error was: $@\n" if $@; return $result; diff --git a/cpan/Module-Build/lib/Module/Build/Notes.pm b/cpan/Module-Build/lib/Module/Build/Notes.pm index 9b48f4c077..f227568052 100644 --- a/cpan/Module-Build/lib/Module/Build/Notes.pm +++ b/cpan/Module-Build/lib/Module/Build/Notes.pm @@ -4,7 +4,7 @@ package Module::Build::Notes; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Data::Dumper; use IO::File; @@ -33,10 +33,10 @@ sub restore { sub access { my $self = shift; return $self->read() unless @_; - + my $key = shift; return $self->read($key) unless @_; - + my $value = shift; $self->write({ $key => $value }); return $self->read($key); @@ -61,7 +61,7 @@ sub read { return $self->{new}{$key} if exists $self->{new}{$key}; return $self->{disk}{$key}; } - + # Return all data my $out = (keys %{$self->{new}} ? {%{$self->{disk}}, %{$self->{new}}} @@ -79,7 +79,7 @@ sub _same { sub write { my ($self, $href) = @_; $href ||= {}; - + @{$self->{new}}{ keys %$href } = values %$href; # Merge # Do some optimization to avoid unnecessary writes @@ -88,17 +88,17 @@ sub write { next if ref $self->{disk}{$key} or !exists $self->{disk}{$key}; delete $self->{new}{$key} if $self->_same($self->{new}{$key}, $self->{disk}{$key}); } - + if (my $file = $self->{file}) { my ($vol, $dir, $base) = File::Spec->splitpath($file); $dir = File::Spec->catpath($vol, $dir, ''); return unless -e $dir && -d $dir; # The user needs to arrange for this return if -e $file and !keys %{ $self->{new} }; # Nothing to do - - @{$self->{disk}}{ keys %{$self->{new}} } = values %{$self->{new}}; # Merge + + @{$self->{disk}}{ keys %{$self->{new}} } = values %{$self->{new}}; # Merge $self->_dump($file, $self->{disk}); - + $self->{new} = {}; } return $self->read; @@ -106,7 +106,7 @@ sub write { sub _dump { my ($self, $file, $data) = @_; - + my $fh = IO::File->new("> $file") or die "Can't create '$file': $!"; print {$fh} Module::Build::Dumper->_data_dump($data); } @@ -126,7 +126,7 @@ sub write_config_data { # strip out private POD markers we use to keep pod from being # recognized for *this* source file $template =~ s{$_\n}{} for '=begin private', '=end private'; - + my $fh = IO::File->new("> $args{file}") or die "Can't create '$args{file}': $!"; print {$fh} $template; print {$fh} "\n__DATA__\n"; @@ -218,18 +218,18 @@ sub write { sub feature { my ($package, $key) = @_; return $features->{$key} if exists $features->{$key}; - + my $info = $auto_features->{$key} or return 0; - + # Under perl 5.005, each(%$foo) isn't working correctly when $foo # was reanimated with Data::Dumper and eval(). Not sure why, but # copying to a new hash seems to solve it. my %info = %$info; - + require Module::Build; # XXX should get rid of this while (my ($type, $prereqs) = each %info) { next if $type eq 'description' || $type eq 'recommends'; - + my %p = %$prereqs; # Ditto here. while (my ($modname, $spec) = each %p) { my $status = Module::Build->check_installed_status($modname, $spec); @@ -251,10 +251,10 @@ NOTES_NAME - Configuration for MODULE_NAME use NOTES_NAME; $value = NOTES_NAME->config('foo'); $value = NOTES_NAME->feature('bar'); - + @names = NOTES_NAME->config_names; @names = NOTES_NAME->feature_names; - + NOTES_NAME->set_config(foo => $new_value); NOTES_NAME->set_feature(bar => $new_value); NOTES_NAME->write; # Save changes diff --git a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm index 8567626cdd..89eb3d9ac7 100644 --- a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm +++ b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm @@ -3,7 +3,7 @@ package Module::Build::PPMMaker; use strict; use Config; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a @@ -137,7 +137,7 @@ sub _varchname { # Copied from PPM.pm '<' => '<', ); my $rx = join '|', keys %escapes; - + sub _simple_xml_escape { $_[1] =~ s/($rx)/$escapes{$1}/go; } diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm b/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm index 1b796d42c0..81cba49796 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Amiga; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm index 6c9391621d..8fc7f2dec0 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Default; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm b/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm index 25fb528d9d..d116684c91 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::EBCDIC; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm b/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm index 3d44c520d0..56e98bad4f 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::MPEiX; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm index 8a35afb658..479ffd27a1 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::MacOS; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; use vars qw(@ISA); @@ -15,17 +15,17 @@ sub have_forkpipe { 0 } sub new { my $class = shift; my $self = $class->SUPER::new(@_); - + # $Config{sitelib} and $Config{sitearch} are, unfortunately, missing. foreach ('sitelib', 'sitearch') { $self->config($_ => $self->config("install$_")) unless $self->config($_); } - + # For some reason $Config{startperl} is filled with a bunch of crap. (my $sp = $self->config('startperl')) =~ s/.*Exit \{Status\}\s//; $self->config(startperl => $sp); - + return $self; } @@ -42,7 +42,7 @@ sub dispatch { if( !@_ and !@ARGV ) { require MacPerl; - + # What comes first in the action list. my @action_list = qw(build test install); my %actions = map {+($_, 1)} $self->known_actions; @@ -53,17 +53,17 @@ sub dispatch { foreach (@action_list) { $_ .= ' *' if $toolserver{$_}; } - + my $cmd = MacPerl::Pick("What build command? ('*' requires ToolServer)", @action_list); return unless defined $cmd; $cmd =~ s/ \*$//; $ARGV[0] = ($cmd); - + my $args = MacPerl::Ask('Any extra arguments? (ie. verbose=1)', ''); return unless defined $args; push @ARGV, $self->split_like_shell($args); } - + $self->SUPER::dispatch(@_); } @@ -82,10 +82,10 @@ sub ACTION_realclean { sub ACTION_install { my $self = shift; - + return $self->SUPER::ACTION_install(@_) if eval {ExtUtils::Install->VERSION('1.30'); 1}; - + local $^W = 0; # Avoid a 'redefine' warning local *ExtUtils::Install::find = sub { my ($code, @dirs) = @_; @@ -94,7 +94,7 @@ sub ACTION_install { return File::Find::find($code, @dirs); }; - + return $self->SUPER::ACTION_install(@_); } diff --git a/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm index cad70baabf..39756ab640 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::RiscOS; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm index 3e7d79ab97..85500a3883 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Unix; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm index bdea755558..bad1aaf751 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::VMS; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; use Config; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm index 02b2dcc5c9..308260dce3 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::VOS; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm index d5602c5b20..60059559ff 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Windows; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Config; @@ -207,22 +207,22 @@ sub split_like_shell { # into words. The algorithm below was bashed out by Randy and Ken # (mostly Randy), and there are a lot of regression tests, so we # should feel free to adjust if desired. - + (my $self, local $_) = @_; - + return @$_ if defined() && UNIVERSAL::isa($_, 'ARRAY'); - + my @argv; return @argv unless defined() && length(); - + my $arg = ''; my( $i, $quote_mode ) = ( 0, 0 ); - + while ( $i < length() ) { - + my $ch = substr( $_, $i , 1 ); my $next_ch = substr( $_, $i+1, 1 ); - + if ( $ch eq '\\' && $next_ch eq '"' ) { $arg .= '"'; $i++; @@ -249,10 +249,10 @@ sub split_like_shell { } else { $arg .= $ch; } - + $i++; } - + push( @argv, $arg ) if defined( $arg ) && length( $arg ); return @argv; } diff --git a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm index a5db1c5711..ba0d3f28a8 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::aix; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm index c176c3954f..7e9cd64d90 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::cygwin; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm index d9a82788a4..9f89908336 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::darwin; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm index 194dd8523f..d37a97dc76 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::os2; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/PodParser.pm b/cpan/Module-Build/lib/Module/Build/PodParser.pm index bb34b2b0b3..aa8ae577fb 100644 --- a/cpan/Module-Build/lib/Module/Build/PodParser.pm +++ b/cpan/Module-Build/lib/Module/Build/PodParser.pm @@ -2,7 +2,7 @@ package Module::Build::PodParser; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use vars qw(@ISA); @@ -33,13 +33,13 @@ sub new { sub _myparse_from_filehandle { my ($self, $fh) = @_; - + local $_; while (<$fh>) { next unless /^=(?!cut)/ .. /^=cut/; # in POD last if ($self->{abstract}) = /^ (?: [a-z:]+ \s+ - \s+ ) (.*\S) /ix; } - + my @author; while (<$fh>) { next unless /^=head1\s+AUTHORS?/i ... /^=/; @@ -48,16 +48,16 @@ sub _myparse_from_filehandle { } return unless @author; s/^\s+|\s+$//g foreach @author; - + $self->{author} = \@author; - + return; } sub get_abstract { my $self = shift; return $self->{abstract} if defined $self->{abstract}; - + $self->parse_from_filehandle($self->{fh}); return $self->{abstract}; @@ -66,7 +66,7 @@ sub get_abstract { sub get_author { my $self = shift; return $self->{author} if defined $self->{author}; - + $self->parse_from_filehandle($self->{fh}); return $self->{author} || []; diff --git a/cpan/Module-Build/lib/Module/Build/Version.pm b/cpan/Module-Build/lib/Module/Build/Version.pm index 0664d432ab..21abe00cbe 100644 --- a/cpan/Module-Build/lib/Module/Build/Version.pm +++ b/cpan/Module-Build/lib/Module/Build/Version.pm @@ -81,7 +81,7 @@ sub import { map { $args{$_} = 1 } @_ } else { # no parameters at all on use line - %args = + %args = ( qv => 1, 'UNIVERSAL::VERSION' => 1, @@ -89,9 +89,9 @@ sub import { } my $callpkg = caller(); - + if (exists($args{declare})) { - *{$callpkg."::declare"} = + *{$callpkg."::declare"} = sub {return $class->declare(shift) } unless defined(&{$callpkg.'::declare'}); } @@ -155,7 +155,7 @@ sub new { my ($class, $value) = @_; my $self = bless ({}, ref ($class) || $class); - + if ( ref($value) && eval('$value->isa("version")') ) { # Can copy the elements directly $self->{version} = [ @{$value->{version} } ]; @@ -193,7 +193,7 @@ sub new $value = sprintf("%.9f",$value); $value =~ s/(0+)$//; # trim trailing zeros } - + # This is not very efficient, but it is morally equivalent # to the XS code (as that is the reference implementation). # See vutil/vutil.c for details @@ -215,7 +215,7 @@ sub new } $start = $last = $pos = $s; - + # pre-scan the input string to check for decimals/underbars while ( substr($value,$pos,1) =~ /[._\d,]/ ) { if ( substr($value,$pos,1) eq '.' ) { @@ -300,7 +300,7 @@ sub new $orev = $rev; $rev += substr($value,$s,1) * $mult; $mult /= 10; - if ( abs($orev) > abs($rev) + if ( abs($orev) > abs($rev) || abs($rev) > abs($VERSION_MAX) ) { if ( warnings::enabled("overflow") ) { require Carp; @@ -320,7 +320,7 @@ sub new $orev = $rev; $rev += substr($value,$end,1) * $mult; $mult *= 10; - if ( abs($orev) > abs($rev) + if ( abs($orev) > abs($rev) || abs($rev) > abs($VERSION_MAX) ) { if ( warnings::enabled("overflow") ) { require Carp; @@ -335,15 +335,15 @@ sub new # Append revision push @{$self->{version}}, $rev; - if ( substr($value,$pos,1) eq '.' + if ( substr($value,$pos,1) eq '.' && substr($value,$pos+1,1) =~ /\d/ ) { $s = ++$pos; } - elsif ( substr($value,$pos,1) eq '_' + elsif ( substr($value,$pos,1) eq '_' && substr($value,$pos+1,1) =~ /\d/ ) { $s = ++$pos; } - elsif ( substr($value,$pos,1) eq ',' + elsif ( substr($value,$pos,1) eq ',' && substr($value,$pos+1,1) =~ /\d/ ) { $s = ++$pos; } @@ -400,7 +400,7 @@ sub new *parse = \&new; -sub numify +sub numify { my ($self) = @_; unless (_verify($self)) { @@ -441,7 +441,7 @@ sub numify return $string; } -sub normal +sub normal { my ($self) = @_; unless (_verify($self)) { @@ -484,9 +484,9 @@ sub stringify require Carp; Carp::croak("Invalid version object"); } - return exists $self->{original} - ? $self->{original} - : exists $self->{qv} + return exists $self->{original} + ? $self->{original} + : exists $self->{qv} ? $self->normal : $self->numify; } @@ -524,8 +524,8 @@ sub vcmp } # tiebreaker for alpha with identical terms - if ( $retval == 0 - && $l == $r + if ( $retval == 0 + && $l == $r && $left->{version}[$m] == $right->{version}[$m] && ( $lalpha || $ralpha ) ) { @@ -557,7 +557,7 @@ sub vcmp } } - return $retval; + return $retval; } sub vbool { @@ -565,8 +565,8 @@ sub vbool { return vcmp($self,$self->new("0"),1); } -sub vnoop { - require Carp; +sub vnoop { + require Carp; Carp::croak("operation not supported with version object"); } @@ -644,7 +644,7 @@ sub _VERSION { if ( defined $req ) { unless ( defined $version ) { require Carp; - my $msg = $] < 5.006 + my $msg = $] < 5.006 ? "$class version $req required--this is only version " : "$class does not define \$$class\::VERSION" ."--version check failed"; @@ -662,14 +662,14 @@ sub _VERSION { if ( $req > $version ) { require Carp; if ( $req->is_qv ) { - Carp::croak( + Carp::croak( sprintf ("%s version %s required--". "this is only version %s", $class, $req->normal, $version->normal) ); } else { - Carp::croak( + Carp::croak( sprintf ("%s version %s required--". "this is only version %s", $class, $req->stringify, $version->stringify) diff --git a/cpan/Module-Build/lib/Module/Build/YAML.pm b/cpan/Module-Build/lib/Module/Build/YAML.pm index af06f35f80..2da91f2256 100644 --- a/cpan/Module-Build/lib/Module/Build/YAML.pm +++ b/cpan/Module-Build/lib/Module/Build/YAML.pm @@ -15,7 +15,7 @@ BEGIN { # Class structure require 5.004; - + $Module::Build::YAML::VERSION = '1.40'; # Error storage @@ -561,7 +561,7 @@ sub LoadFile { if ( wantarray ) { return @$self; } else { - # Return only the last document to match YAML.pm, + # Return only the last document to match YAML.pm, return $self->[-1]; } } diff --git a/cpan/Module-Build/lib/inc/latest.pm b/cpan/Module-Build/lib/inc/latest.pm index d63dff8fac..32466b1210 100644 --- a/cpan/Module-Build/lib/inc/latest.pm +++ b/cpan/Module-Build/lib/inc/latest.pm @@ -1,7 +1,7 @@ package inc::latest; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use Carp; @@ -21,19 +21,15 @@ sub import { my ($package, $mod, @args) = @_; return unless(defined $mod); - my $inc_path = './inc/latest.pm'; - my $private_path = './inc/latest/private.pm'; - if(-e $inc_path) { - # delete our methods - delete $inc::latest::{$_} for(keys %inc::latest::); - # load the bundled module - require $inc_path; + my $private_path = 'inc/latest/private.pm'; + if(-e $private_path) { + # user mode - delegate work to bundled private module require $private_path; - my $import = inc::latest->can('import'); - goto $import; + splice( @_, 0, 1, 'inc::latest::private'); + goto \&inc::latest::private::import; } - # author mode - just record and load the modules + # author mode - just record and load the modules push(@loaded_modules, $mod); require inc::latest::private; goto \&inc::latest::private::_load_module; @@ -77,7 +73,7 @@ HERE sub bundle_module { my ($package, $module, $where) = @_; - + # create inc/inc_$foo (my $dist = $module) =~ s{::}{-}g; my $inc_lib = File::Spec->catdir($where,"inc_$dist"); @@ -132,7 +128,7 @@ inc::latest - use modules bundled in inc/ if they are newer than installed ones The C<inc::latest> module helps bootstrap configure-time dependencies for CPAN distributions. These dependencies get bundled into the C<inc> directory within -a distribution and are used by Build.PL (or Makefile.PL). +a distribution and are used by Build.PL (or Makefile.PL). Arguments to C<inc::latest> are module names that are checked against both the current C<@INC> array and against specially-named directories in C<inc>. If diff --git a/cpan/Module-Build/lib/inc/latest/private.pm b/cpan/Module-Build/lib/inc/latest/private.pm index 58ad0bc9ee..5ebc187386 100644 --- a/cpan/Module-Build/lib/inc/latest/private.pm +++ b/cpan/Module-Build/lib/inc/latest/private.pm @@ -1,7 +1,7 @@ package inc::latest::private; use strict; use vars qw($VERSION); -$VERSION = '0.35_09'; +$VERSION = '0.35_14'; $VERSION = eval $VERSION; use File::Spec; @@ -21,7 +21,7 @@ sub import { # A bundled copy must be present my ($bundled, $bundled_dir) = $package->_search_bundled($file) or die "No bundled copy of $mod found"; - + my $from_inc = $package->_search_INC($file); unless ($from_inc) { # Only bundled is available @@ -66,7 +66,7 @@ sub _search_bundled { while (defined(my $e = readdir DH)) { next unless $e =~ /^inc_/; my $try = File::Spec->catfile($mypath, $e, $file); - + return($try, File::Spec->catdir($mypath, $e)) if -e $try; } return; diff --git a/cpan/Module-Build/scripts/config_data b/cpan/Module-Build/scripts/config_data index 374922f20c..489cb4519c 100644..100755 --- a/cpan/Module-Build/scripts/config_data +++ b/cpan/Module-Build/scripts/config_data @@ -1,4 +1,7 @@ -#!/usr/bin/perl +#!/opt/perl/5.10.1/bin/perl + +eval 'exec /opt/perl/5.10.1/bin/perl -S $0 ${1+"$@"}' + if 0; # not running under some shell use strict; use Module::Build 0.25; @@ -92,7 +95,7 @@ sub load_config { $mod =~ /^([\w:]+)$/ or die "Invalid module name '$mod'"; - + my $cf = $mod . "::ConfigData"; eval "require $cf"; die $@ if $@; @@ -104,10 +107,10 @@ sub usage { my %defs = @_; my $out = "\nUsage: $0 [options]\n\n Options include:\n"; - + foreach my $name (sort keys %defs) { $out .= " --$name"; - + for ($defs{$name}{type}) { /^=s$/ and $out .= " <string>"; /^=s%$/ and $out .= " <string>=<value>"; @@ -144,11 +147,11 @@ config_data - Query or change configuration of Perl modules # Get config/feature values config_data --module Foo::Bar --feature bazzable config_data --module Foo::Bar --config magic_number - + # Set config/feature values config_data --module Foo::Bar --set_feature bazzable=1 config_data --module Foo::Bar --set_config magic_number=42 - + # Print a usage message config_data --help diff --git a/cpan/Module-Build/t/00-compile.t b/cpan/Module-Build/t/00-compile.t new file mode 100644 index 0000000000..21bae84869 --- /dev/null +++ b/cpan/Module-Build/t/00-compile.t @@ -0,0 +1,17 @@ +use strict; +use warnings; +use lib 't/lib'; +use MBTest; +use File::Find qw/find/; + +my @files; +find( sub { -f && /\.pm$/ && push @files, $File::Find::name }, 'lib' ); + +plan tests => scalar @files; + +for my $f ( sort @files ) { + my $ec; + my $output = stdout_stderr_of( sub { $ec = system( $^X, '-c', $f ) } ); + ok( ! $ec, "compiling $f" ) or diag $output; +} + diff --git a/cpan/Module-Build/t/bundle_inc.t b/cpan/Module-Build/t/bundle_inc.t index bbc3b86aaa..b6b0a77ff5 100644 --- a/cpan/Module-Build/t/bundle_inc.t +++ b/cpan/Module-Build/t/bundle_inc.t @@ -8,6 +8,7 @@ use Config; use IO::File; use File::Spec; use ExtUtils::Packlist; +use ExtUtils::Installed; use File::Path; # Ensure any Module::Build modules are loaded from correct directory @@ -17,8 +18,11 @@ blib_load('Module::Build::ConfigData'); if ( $ENV{PERL_CORE} ) { plan skip_all => 'bundle_inc tests will never succeed in PERL_CORE'; } +elsif ( ! MBTest::check_EUI() ) { + plan skip_all => 'ExtUtils::Installed takes too long on your system'; +} elsif ( Module::Build::ConfigData->feature('inc_bundling_support') ) { - plan tests => 18; + plan tests => 19; } else { plan skip_all => 'inc_bundling_support feature is not enabled'; } @@ -36,10 +40,15 @@ ok( -d $arch_path, "created temporary M::B pseudo-install directory"); unshift @INC, $lib_path, $arch_path; local $ENV{PERL5LIB} = join( $Config{path_sep}, - $lib_path, $arch_path, ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : () ) + $lib_path, ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : () ) ); -stdout_of( sub { $current_mb->dispatch('install', install_base => $temp_install) } ); +# must uninst=0 so we don't try to remove an installed M::B! +stdout_of( sub { $current_mb->dispatch( + 'install', install_base => $temp_install, uninst => 0 + ) + } +); # create dist object in a temp directory # enter the directory and generate the skeleton files @@ -53,12 +62,12 @@ is_deeply( $mb->bundle_inc, [ 'Module::Build' ], "Module::Build is flagged for bundling" ); -# see what gets bundled +# bundle stuff into distdir stdout_stderr_of( sub { $mb->dispatch('distdir') } ); my $dist_inc = File::Spec->catdir($mb->dist_dir, 'inc'); ok( -e File::Spec->catfile( $dist_inc, 'latest.pm' ), - "./inc/latest.pm created" + "dist_dir/inc/latest.pm created" ); ok( -d File::Spec->catdir( $dist_inc, 'inc_Module-Build' ), @@ -82,6 +91,7 @@ ok( -e File::Spec->catfile( $dist_inc, qw/inc_Module-Build Module Build Base.pm/ eval { my $fh; + chmod 0666, $mb_file; $fh = IO::File->new($mb_file, "<") or die "Could not read $mb_file: $!"; my $mb_code = do { local $/; <$fh> }; $mb_code =~ s{\$VERSION\s+=\s+\S+}{\$VERSION = 9999;}; @@ -101,12 +111,14 @@ SKIP: { chdir $mb->dist_dir; stdout_of( sub { Module::Build->run_perl_script('Build.PL',[],[]) } ); + ok( -e 'MYMETA.yml', 'MYMETA was created' ); my $meta = IO::File->new('MYMETA.yml'); - ok( $meta, "found MYMETA.yml" ); + ok( $meta, "opened MYMETA.yml" ); ok( scalar( grep { /generated_by:.*9999/ } <$meta> ), "dist_dir Build.PL loaded bundled Module::Build" ); + close $meta; #--------------------------------------------------------------------------# # test identification of dependencies diff --git a/cpan/Module-Build/t/extend.t b/cpan/Module-Build/t/extend.t index 36ff4b6946..505a47360c 100644 --- a/cpan/Module-Build/t/extend.t +++ b/cpan/Module-Build/t/extend.t @@ -98,15 +98,15 @@ print "Hello, World!\n"; use vars qw($VERSION @ISA); @ISA = qw(Module::Build); $VERSION = 0.01; - + # Add a new property. ok(__PACKAGE__->add_property('foo')); # Add a new property with a default value. ok(__PACKAGE__->add_property('bar', 'hey')); # Add a hash property. ok(__PACKAGE__->add_property('hash', {})); - - + + # Catch an exception adding an existing property. eval { __PACKAGE__->add_property('module_name')}; like "$@", qr/already exists/; @@ -118,7 +118,7 @@ print "Hello, World!\n"; use vars qw($VERSION @ISA); @ISA = qw(Module::Build); $VERSION = 0.01; - + # Add a new property with a different default value than MBSub has. ok(__PACKAGE__->add_property('bar', 'yow')); } @@ -130,30 +130,30 @@ print "Hello, World!\n"; isa_ok $mb, 'MBSub'; ok $mb->valid_property('foo'); can_ok $mb, 'module_name'; - + # Check foo property. can_ok $mb, 'foo'; ok ! $mb->foo; ok $mb->foo(1); ok $mb->foo; - + # Check bar property. can_ok $mb, 'bar'; is $mb->bar, 'hey'; ok $mb->bar('you'); is $mb->bar, 'you'; - + # Check hash property. ok $mb = MBSub->new( module_name => $dist->name, hash => { foo => 'bar', bin => 'foo'} ); - + can_ok $mb, 'hash'; isa_ok $mb->hash, 'HASH'; is $mb->hash->{foo}, 'bar'; is $mb->hash->{bin}, 'foo'; - + # Check hash property passed via the command-line. { local @ARGV = ( @@ -167,7 +167,7 @@ print "Hello, World!\n"; isa_ok $mb->hash, 'HASH'; is $mb->hash->{foo}, 'bar'; is $mb->hash->{bin}, 'foo'; - + # Make sure that a different subclass with the same named property has a # different default. ok $mb = MBSub2->new( module_name => $dist->name ); @@ -186,19 +186,19 @@ print "Hello, World!\n"; meta_add => {foo => 'bar'}, conflicts => {'Foo::Barxx' => 0}, ); - my $data = $mb->prepare_metadata; + my $data = $mb->get_metadata; is $data->{foo}, 'bar'; $mb->meta_merge(foo => 'baz'); - $data = $mb->prepare_metadata; + $data = $mb->get_metadata; is $data->{foo}, 'baz'; $mb->meta_merge(conflicts => {'Foo::Fooxx' => 0}); - $data = $mb->prepare_metadata; + $data = $mb->get_metadata; is_deeply $data->{conflicts}, {'Foo::Barxx' => 0, 'Foo::Fooxx' => 0}; $mb->meta_add(conflicts => {'Foo::Bazxx' => 0}); - $data = $mb->prepare_metadata; + $data = $mb->get_metadata; is_deeply $data->{conflicts}, {'Foo::Bazxx' => 0, 'Foo::Fooxx' => 0}; } diff --git a/cpan/Module-Build/t/install_extra_target.t b/cpan/Module-Build/t/install_extra_target.t index 21d0c272ae..09d2cbe8eb 100644 --- a/cpan/Module-Build/t/install_extra_target.t +++ b/cpan/Module-Build/t/install_extra_target.t @@ -7,7 +7,7 @@ use MBTest tests => 6; blib_load('Module::Build'); -use File::Spec::Functions qw( catdir ); +use File::Spec::Functions qw( catdir catfile ); my $tmp = MBTest->tmpdir; my $output; @@ -83,7 +83,7 @@ $build->install_base_relpaths('etc' => "etc/$distdir"); $build->create_build_script(); ===EOF=== - + #Test Build.PL exists ok? $dist->add_file("etc/config", <<'===EOF==='); @@ -128,8 +128,8 @@ diag "OUTPUT:\n$output" if $error; $output = stdout_of sub { $dist->run_build('install') }; $error = 0; -$error++ unless ok(-e "$installdest/etc/simple/config", "installed etc/config"); -$error++ unless ok(-e "$installdest/shared/simple/data", "installed shared/data"); -$error++ unless ok(-e "$installdest/shared/simple/html/index.html", "installed shared/html"); +$error++ unless ok(-e catfile($installdest, qw/etc simple config/), "installed etc/config"); +$error++ unless ok(-e catfile($installdest, qw/shared simple data/), "installed shared/data"); +$error++ unless ok(-e catfile($installdest, qw/shared simple html index.html/), "installed shared/html"); diag "OUTPUT:\n$output" if $error; diff --git a/cpan/Module-Build/t/lib/DistGen.pm b/cpan/Module-Build/t/lib/DistGen.pm index d1fb260d60..9fbd6d0c8c 100644 --- a/cpan/Module-Build/t/lib/DistGen.pm +++ b/cpan/Module-Build/t/lib/DistGen.pm @@ -312,7 +312,7 @@ sub name { shift()->{name} } sub dirname { my $self = shift; - my $dist = join( '-', split( /::/, $self->{name} ) ); + my $dist = $self->{distdir} || join( '-', split( /::/, $self->{name} ) ); return File::Spec->catdir( $self->{dir}, $dist ); } @@ -645,14 +645,19 @@ dist name. =item dir The (parent) directory in which to create the distribution directory. The -distribution will be created under this according to the "dist" form of C<name> -(e.g. "Foo-Bar".) Defaults to a temporary directory. +distribution will be created under this according to C<distdir> parameter +below. Defaults to a temporary directory. $dist = DistGen->new( dir => '/tmp/MB-test' ); $dist->regen; # distribution files have been created in /tmp/MB-test/Simple +=item distdir + +The name of the distribution directory to create. Defaults to the dist form of +C<name>, e.g. 'Foo-Bar' if C<name> is 'Foo::Bar'. + =item xs If true, generates an XS based module. diff --git a/cpan/Module-Build/t/lib/MBTest.pm b/cpan/Module-Build/t/lib/MBTest.pm index 11d02dec14..6dc4c8627a 100644 --- a/cpan/Module-Build/t/lib/MBTest.pm +++ b/cpan/Module-Build/t/lib/MBTest.pm @@ -2,6 +2,7 @@ package MBTest; use strict; +use IO::File (); use File::Spec; use File::Temp (); use File::Path (); @@ -84,6 +85,7 @@ my @extra_exports = qw( check_compiler have_module blib_load + timed_out ); push @EXPORT, @extra_exports; __PACKAGE__->export(scalar caller, @extra_exports); @@ -107,7 +109,7 @@ __PACKAGE__->export(scalar caller, @extra_exports); { # backwards compatible temp filename recipe adapted from perlfaq my $tmp_count = 0; - my $tmp_base_name = sprintf("%d-%d", $$, time()); + my $tmp_base_name = sprintf("MB-%d-%d", $$, time()); sub temp_file_name { sprintf("%s-%04d", $tmp_base_name, ++$tmp_count) } @@ -123,7 +125,7 @@ sub tmpdir { sub save_handle { my ($handle, $subr) = @_; - my $outfile = temp_file_name(); + my $outfile = File::Spec->catfile(File::Spec->tmpdir, temp_file_name()); local *SAVEOUT; open SAVEOUT, ">&" . fileno($handle) @@ -238,5 +240,35 @@ sub blib_load { } } +sub timed_out { + my ($sub, $timeout) = @_; + return unless $sub; + $timeout ||= 60; + + my $saw_alarm = 0; + eval { + local $SIG{ALRM} = sub { $saw_alarm++; die "alarm\n"; }; # NB: \n required + alarm $timeout; + $sub->(); + alarm 0; + }; + if ($@) { + die unless $@ eq "alarm\n"; # propagate unexpected errors + } + return $saw_alarm; +} + +sub check_EUI { + my $timed_out; + stdout_stderr_of( sub { + $timed_out = timed_out( sub { + ExtUtils::Installed->new(extra_libs => [@INC]) + } + ); + } + ); + return ! $timed_out; +} + 1; # vim:ts=2:sw=2:et:sta diff --git a/cpan/Module-Build/t/metadata.t b/cpan/Module-Build/t/metadata.t index 2850bea24c..1ac35b28c4 100644 --- a/cpan/Module-Build/t/metadata.t +++ b/cpan/Module-Build/t/metadata.t @@ -9,7 +9,7 @@ blib_load('Module::Build::ConfigData'); my $tmp = MBTest->tmpdir; -my %metadata = +my %metadata = ( module_name => 'Simple', dist_version => '3.14159265', @@ -62,10 +62,10 @@ my $mb = Module::Build->new_from_context; { my $mb_prereq = { 'Module::Build' => $Module::Build::VERSION }; - my $mb_config_req = { - 'Module::Build' => int($Module::Build::VERSION * 100)/100 + my $mb_config_req = { + 'Module::Build' => int($Module::Build::VERSION * 100)/100 }; - my $node = $mb->prepare_metadata( ); + my $node = $mb->get_metadata( ); # exists() doesn't seem to work here is $node->{name}, $metadata{module_name}; @@ -86,7 +86,7 @@ my $mb = Module::Build->new_from_context; { my $mb_prereq = { 'Module::Build' => 0 }; $mb->configure_requires( $mb_prereq ); - my $node = $mb->prepare_metadata( ); + my $node = $mb->get_metadata( ); # exists() doesn't seem to work here @@ -176,11 +176,11 @@ package Simple::Simon; $VERSION = version->new('0.61.' . (qw$Revision: 129 $)[1]); --- $dist->regen; - my $provides = new_build()->prepare_metadata()->{provides}; + my $provides = new_build()->get_metadata()->{provides}; is $provides->{'Simple'}{version}, 'v0.60.128', "Check version"; is $provides->{'Simple::Simon'}{version}, 'v0.61.129', "Check version"; - is ref($provides->{'Simple'}{version}), '', "Versions from prepare_metadata() aren't refs"; - is ref($provides->{'Simple::Simon'}{version}), '', "Versions from prepare_metadata() aren't refs"; + is ref($provides->{'Simple'}{version}), '', "Versions from get_metadata() aren't refs"; + is ref($provides->{'Simple::Simon'}{version}), '', "Versions from get_metadata() aren't refs"; } diff --git a/cpan/Module-Build/t/mymeta.t b/cpan/Module-Build/t/mymeta.t index c60a5b2420..91a269027e 100644 --- a/cpan/Module-Build/t/mymeta.t +++ b/cpan/Module-Build/t/mymeta.t @@ -2,14 +2,30 @@ use strict; use lib 't/lib'; -use MBTest tests => 3; +use MBTest; +plan tests => 24; blib_load('Module::Build'); +blib_load('Module::Build::YAML'); my $tmp = MBTest->tmpdir; use DistGen; my $dist = DistGen->new( dir => $tmp ); +$dist->change_file('Build.PL', <<"---"); +use strict; +use Module::Build; + +my \$builder = Module::Build->new( + module_name => '$dist->{name}', + license => 'perl', + requires => { + 'File::Spec' => ( \$ENV{BUMP_PREREQ} ? 0.86 : 0 ), + }, +); + +\$builder->create_build_script(); +--- $dist->regen; $dist->chdir_in; @@ -17,14 +33,91 @@ $dist->chdir_in; # Test MYMETA generation { + ok( ! -e "META.yml", "META.yml doesn't exist before Build.PL runs" ); ok( ! -e "MYMETA.yml", "MYMETA.yml doesn't exist before Build.PL runs" ); my $output; $output = stdout_of sub { $dist->run_build_pl }; like($output, qr/Creating new 'MYMETA.yml' with configuration results/, - "Saw MYMETA.yml creation message" + "Ran Build.PL and saw MYMETA.yml creation message" + ); + ok( -e "MYMETA.yml", "MYMETA.yml exists" ); +} + +######################### + +# Test interactions between META/MYMETA +{ + my $output = stdout_of sub { $dist->run_build('distmeta') }; + like($output, qr/Creating META.yml/, + "Ran Build distmeta to create META.yml"); + my $meta = Module::Build::YAML->read('META.yml')->[0]; + my $mymeta = Module::Build::YAML->read('MYMETA.yml')->[0]; + is( delete $mymeta->{dynamic_config}, 0, + "MYMETA 'dynamic_config' is 0" + ); + is_deeply( $meta, $mymeta, "Other generated MYMETA matches generated META" ); + $output = stdout_stderr_of sub { $dist->run_build('realclean') }; + like( $output, qr/Cleaning up/, "Ran realclean"); + ok( ! -e 'Build', "Build file removed" ); + ok( ! -e 'MYMETA.yml', "MYMETA file removed" ); + + # test that dynamic prereq is picked up + local $ENV{BUMP_PREREQ} = 1; + $output = stdout_of sub { $dist->run_build_pl }; + like($output, qr/Creating new 'MYMETA.yml' with configuration results/, + "Ran Build.PL with dynamic config" ); ok( -e "MYMETA.yml", "MYMETA.yml exists" ); + $mymeta = Module::Build::YAML->read('MYMETA.yml')->[0]; + isnt( $meta->{requires}{'File::Spec'}, + $mymeta->{requires}{'File::Spec'}, + "MYMETA requires differs from META" + ); + $output = stdout_stderr_of sub { $dist->run_build('realclean') }; + like( $output, qr/Cleaning up/, "Ran realclean"); + ok( ! -e 'Build', "Build file removed" ); + ok( ! -e 'MYMETA.yml', "MYMETA file removed" ); + + # manually change META and check that changes are preserved + $meta->{author} = ['John Gault']; + ok( Module::Build::YAML->new($meta)->write('META.yml'), + "Wrote manually modified META.yml" ); + + $output = stdout_of sub { $dist->run_build_pl }; + like($output, qr/Creating new 'MYMETA.yml' with configuration results/, + "Ran Build.PL" + ); + my $mymeta2 = Module::Build::YAML->read('MYMETA.yml')->[0]; + is_deeply( $mymeta2->{author}, [ 'John Gault' ], + "MYMETA preserved META modifications" + ); + + + } ######################### +# Test cleanup +{ + my $output = stdout_stderr_of sub { $dist->run_build('distcheck') }; + like($output, qr/Creating a temporary 'MANIFEST.SKIP'/, + "MANIFEST.SKIP created for distcheck" + ); + unlike($output, qr/MYMETA/, + "MYMETA not flagged by distcheck" + ); +} + + +{ + my $output = stdout_of sub { $dist->run_build_pl }; + like($output, qr/Creating new 'MYMETA.yml' with configuration results/, + "Ran Build.PL and saw MYMETA.yml creation message" + ); + $output = stdout_stderr_of sub { $dist->run_build('distclean') }; + ok( ! -f 'MYMETA.yml', "No MYMETA.yml after distclean" ); + ok( ! -f 'MANIFEST.SKIP', "No MANIFEST.SKIP after distclean" ); +} + + diff --git a/cpan/Module-Build/t/ppm.t b/cpan/Module-Build/t/ppm.t index acbd56d1f5..5eb5f0288d 100644 --- a/cpan/Module-Build/t/ppm.t +++ b/cpan/Module-Build/t/ppm.t @@ -18,6 +18,8 @@ my $tmp; plan skip_all => 'No compiler found'; } elsif ( !$Config{usedl} ) { plan skip_all => 'Perl not compiled for dynamic loading' + } elsif ( ! $HTML_support ) { + plan skip_all => "HTML support not installed"; } elsif ( ! eval {require Archive::Tar} ) { plan skip_all => "Archive::Tar not installed to read archives."; } elsif ( ! eval {IO::Zlib->VERSION(1.01)} ) { diff --git a/cpan/Module-Build/t/properties/module_name.t b/cpan/Module-Build/t/properties/module_name.t index c266b41ba2..69aec8e21e 100644 --- a/cpan/Module-Build/t/properties/module_name.t +++ b/cpan/Module-Build/t/properties/module_name.t @@ -10,22 +10,26 @@ plan tests => 4; # Ensure any Module::Build modules are loaded from correct directory blib_load('Module::Build'); -# enter the directory and generate the skeleton files -my $dist = DistGen->new( name => "Not::So::Simple" )->chdir_in; +my $dist; #--------------------------------------------------------------------------# -# try getting module_name from dist directory name +# try getting module_name from dist_name #--------------------------------------------------------------------------# +$dist = DistGen->new( + name => "Not::So::Simple", + distdir => 'Random-Name', +)->chdir_in; + $dist->change_build_pl( - dist_name => 'Random-Name', + dist_name => 'Not-So-Simple', dist_version => 1, )->regen; my $mb = $dist->new_from_context(); isa_ok( $mb, "Module::Build" ); is( $mb->module_name, "Not::So::Simple", - "module_name guessed from directory name" + "module_name guessed from dist_name" ); #--------------------------------------------------------------------------# diff --git a/cpan/Module-Build/t/properties/share_dir.t b/cpan/Module-Build/t/properties/share_dir.t index f781a8a7ce..8cf961dbc8 100644 --- a/cpan/Module-Build/t/properties/share_dir.t +++ b/cpan/Module-Build/t/properties/share_dir.t @@ -33,7 +33,7 @@ my $mb = $dist->new_from_context; # Test without a 'share' dir ok( $mb, "Created Module::Build object" ); is( $mb->share_dir, undef, - "default share undef if no 'share' dir exists" + "default share_dir undef if no 'share' dir exists" ); ok( ! exists $mb->{properties}{requires}{'File::ShareDir'}, "File::ShareDir not added to 'requires'" @@ -52,13 +52,14 @@ ok( -e catfile(qw/other share bar.txt/), "Created 'other/share' directory" ); # Check default when share_dir is not given stdout_stderr_of( sub { $mb = $dist->new_from_context }); -is_deeply( $mb->share_dir, { dist => [ 'share' ] }, - "Default share_dir set as dist-type share" +is( $mb->share_dir, undef, + "Default share_dir is undef even if 'share' exists" ); -is( $mb->{properties}{requires}{'File::ShareDir'}, '1.00', - "File::ShareDir 1.00 added to 'requires'" +ok( ! exists $mb->{properties}{requires}{'File::ShareDir'}, + "File::ShareDir not added to 'requires'" ); + # share_dir set to scalar $dist->change_build_pl( { @@ -161,8 +162,8 @@ is_deeply( $mb->share_dir, is_deeply( $mb->_find_share_dir_files, { - catfile(qw/share foo.txt/) => catfile(qw/dist Simple-Share foo.txt/), - catfile(qw/other share bar.txt/) => catfile(qw/module Simple-Share bar.txt/), + "share/foo.txt" => "dist/Simple-Share/foo.txt", + "other/share/bar.txt" => "module/Simple-Share/bar.txt", }, "share_dir filemap for copying to lib complete" ); diff --git a/cpan/Module-Build/t/runthrough.t b/cpan/Module-Build/t/runthrough.t index 741755c12c..a220c8c3d7 100644 --- a/cpan/Module-Build/t/runthrough.t +++ b/cpan/Module-Build/t/runthrough.t @@ -13,7 +13,7 @@ my $have_yaml = Module::Build::ConfigData->feature('YAML_support'); my $tmp = MBTest->tmpdir; use DistGen; -my $dist = DistGen->new( dir => $tmp ); +my $dist = DistGen->new(); $dist->change_build_pl ({ module_name => 'Simple', @@ -67,7 +67,7 @@ if ($^O eq 'VMS') { $vms_efs = VMS::Feature::current("efs_charset"); } else { my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; - $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; } $Is_VMS_noefs = 0 if $vms_efs; if ($Is_VMS_noefs) { @@ -94,7 +94,7 @@ ok grep {$_ eq 'save_out' } $mb->cleanup; }; $all_ok &&= is($@, ''); $all_ok &&= like($output, qr/all tests successful/i); - + # This is the output of lib/Simple/Script.PL $all_ok &&= ok(-e $mb->localize_file_path('lib/Simple/Script')); @@ -113,16 +113,16 @@ SKIP: { stdout_of( sub { $mb->dispatch('disttest') } ) }; is $@, ''; - + # After a test, the distdir should contain a blib/ directory ok -e File::Spec->catdir('Simple-0.01', 'blib'); - + eval {$mb->dispatch('distdir')}; is $@, ''; - + # The 'distdir' should contain a lib/ directory ok -e File::Spec->catdir('Simple-0.01', 'lib'); - + # The freshly run 'distdir' should never contain a blib/ directory, or # else it could get into the tarball ok ! -e File::Spec->catdir('Simple-0.01', 'blib'); @@ -147,11 +147,11 @@ SKIP: { # Make sure the 'script' file was recognized as a script. my $scripts = $mb->script_files; ok $scripts->{script}; - + # Check that a shebang line is rewritten my $blib_script = File::Spec->catfile( qw( blib script script ) ); ok -e $blib_script; - + SKIP: { skip("We do not rewrite shebang on VMS", 1) if $^O eq 'VMS'; my $fh = IO::File->new($blib_script); @@ -197,7 +197,7 @@ SKIP: { echo Hello, World! --- - $dist = DistGen->new( dir => $tmp ); + $dist = DistGen->new(); $dist->change_build_pl({ module_name => 'Simple', scripts => [ 'bin/script.bat' ], |