diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-07-07 11:04:30 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-07-07 12:29:48 +0100 |
commit | 4b5789fe5c4c75816682f2e7a76a6b20720758fc (patch) | |
tree | 68c34a2f2734fdd9b41ac1414b03a2a7051fd64c | |
parent | f229537a3ecd9db056c7d315dbbf103a048e10dc (diff) | |
download | perl-4b5789fe5c4c75816682f2e7a76a6b20720758fc.tar.gz |
Update ExtUtils-MakeMaker to CPAN version 6.58
[DELTA]
6.58 Wed Jul 6 14:17:06 PDT 2011
No changes since 6.57_11
6.57_11 Thu May 19 17:26:31 PDT 2011
Bug Fixes
* Changed CPAN::Meta to accept version objects. [github #16]
* Massage bad versions and warn the user about them. [github #15]
* Protect against CPAN::Meta dying during metafile validation
and generation.
VMS
* Fix prereq.t to work around "local %ENV = %ENV" bug
Win32
* Liblist::Kid can now recognize long compiler paths
(Christian Walde) [github #11]
6.57_10 Sun, 03 Apr 2011 19:36:38 +1000
Bug Fixes
* Relaxed strictures on prerequisite versions. Invalid versions now
issue a warning and are set to 0 rather than dying. [github #7]
* Upgraded CPAN::Meta to 2.110930 which fixes a glitch in writing
MYMETA.yml if your module's version number was 1.4. [github #9]
* Convert LICENSE entries which are unknown to CPAN::Meta to
"unknown" rather than dying. [github #10]
6.57_09 Mon, 28 Mar 2011 11:13:39 +1100
Misc
* Make CPAN ignore bundled modules
* Accidentally rolled Version::Requirements into the version bundle
* Deleted now unused ExtUtils::MakeMaker::YAML
6.57_08 Sun, 27 Mar 2011 21:52:47 +1100
VMS
* Removed dependency on cc_runtime.h for VMS as well.
Misc
* Changed how modules are bundled to avoid replacing XS version of
Scalar::Util with a pure Perl version [github #4]
6.57_07 Fri, 25 Mar 2011 14:31:31 +1100
Enhancements
* Generates META.json and MYMETA.json in addition to
META.yml and MYMETA.yml (David Golden)
* MYMETA has the runtime requirements made priority over META_*
keys to allow generation of a correct META.* into the dist while
still generating an accurate MYMETA.* locally (Matt S Trout)
* Distributions should not depend on cc_runtime.h from core as it is
only needed for B::CC
* Now uses CPAN::Meta to generate META files.
Bug Fixes
* MYMETA.yml generation from META.yml actually works (Matt S Trout)
* All required META fields are generated, even if they must be filled
with "unknown" in place of real data (David Golden)
Test Fixes
* miniperl.t is no longer run outside of the perl core. Its only relevant
to bleadperl and requires no backwards compatibility [rt.cpan.org 61868]
Cygwin
* Rebase behaviour was improved (Reini Urban)
* Build man pages (Reini Urban)
Win32
* Spot valid lib files on Win32 when .a and .lib are mixed.
(Christian Walde) [github #3]
* Extensive testing of ExtUtils::Liblist::Kid for Win32
(Christian Walde)
* Implemented proper emulation of DOS escaping rules in ExtUtils::MM_Win32
(Christian Walde)
6.57_06 Wed Oct 06 13:49:00 EEST 2010
Win32
* Work around dmake's limitations on how long a "line" can be.
[rt.cpan.org 61286]
* ActivePerl 1007 can now see gcc. [rt.cpan.org 55752] (Christian Walde)
Bug Fixes
* Fix for AUTHOR and undocumented usage of MM->new() (Alexandr Ciornii)
53 files changed, 2087 insertions, 1690 deletions
@@ -965,7 +965,6 @@ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm MakeMaker wrapper for C cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod MakeMaker FAQ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm Write Makefiles for extensions cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod Writing a module with MakeMaker -cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm clone of YAML::Tiny cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm Writes a bootstrap file (see MakeMaker) cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm Writes a linker options file for extensions cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm MakeMaker methods for AIX @@ -1023,8 +1022,12 @@ cpan/ExtUtils-MakeMaker/t/lib/TieOut.pm Testing library to capture prints cpan/ExtUtils-MakeMaker/t/MakeMaker_Parameters.t test "MakeMaker Parameters" section cpan/ExtUtils-MakeMaker/t/make.t See if make detection works cpan/ExtUtils-MakeMaker/t/maketext_filter.t See if maketext_filter works +cpan/ExtUtils-MakeMaker/t/meta_convert.t See if MakeMaker works cpan/ExtUtils-MakeMaker/t/metafile_data.t See if META.yml handling works cpan/ExtUtils-MakeMaker/t/metafile_file.t See if META.yml handling works +cpan/ExtUtils-MakeMaker/t/META_for_testing.json test data for MakeMaker +cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml test data for MakeMaker +cpan/ExtUtils-MakeMaker/t/META_for_testing.yml test data for MakeMaker cpan/ExtUtils-MakeMaker/t/miniperl.t Test MakeMaker with miniperl cpan/ExtUtils-MakeMaker/t/min_perl_version.t Test the MIN_PERL_VERSION argument to WriteMakefile. cpan/ExtUtils-MakeMaker/t/Mkbootstrap.t See if ExtUtils::Mkbootstrap works diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index cd3557d11d..30a8e77c2f 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -730,10 +730,12 @@ use File::Glob qw(:case); 'ExtUtils::MakeMaker' => { 'MAINTAINER' => 'mschwern', - 'DISTRIBUTION' => 'CHORNY/ExtUtils-MakeMaker-6.57_05.tar.gz', + 'DISTRIBUTION' => 'MSCHWERN/ExtUtils-MakeMaker-6.58.tar.gz', 'FILES' => q[cpan/ExtUtils-MakeMaker], 'EXCLUDED' => [ qr{^t/lib/Test/}, - qr{^inc/ExtUtils/}, + qr{^(bundled|my)/}, + qr{^t/Liblist_Kid.t}, + qr{^t/liblist/}, ], 'UPSTREAM' => 'first-come', }, diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm index 138aee3e03..5d53514992 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta; BEGIN { - $CPAN::Meta::VERSION = '2.110930'; + $CPAN::Meta::VERSION = eval '2.110930_001'; } # ABSTRACT: the distribution metadata for a CPAN dist @@ -16,11 +16,7 @@ use CPAN::Meta::Validator; use Parse::CPAN::Meta 1.4400 (); sub _dclone { - my $ref = shift; - my $backend = Parse::CPAN::Meta->json_backend(); - return $backend->new->decode( - $backend->new->convert_blessed->encode($ref) - ); + CPAN::Meta::Converter::_dclone(@_); } diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm index 311a93dfff..2ea3456426 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm @@ -3,7 +3,7 @@ use strict; use warnings; package CPAN::Meta::Converter; BEGIN { - $CPAN::Meta::Converter::VERSION = '2.110930'; + $CPAN::Meta::Converter::VERSION = eval '2.110930_001'; } # ABSTRACT: Convert CPAN distribution metadata structures @@ -11,15 +11,30 @@ BEGIN { use CPAN::Meta::Validator; use version 0.82 (); use Parse::CPAN::Meta 1.4400 (); +use Carp qw(croak); sub _dclone { my $ref = shift; + + # Work around JSON::PP's lack of a convert_blessed_universally + local *UNIVERSAL::TO_JSON = sub { + my $obj = shift; + + # Special case: stringify version objects + # Everything else: serialize + return $obj->isa("version") ? "$obj" : + $obj->isa("HASH") ? { %$obj } : + $obj->isa("ARRAY") ? { @$obj } : + croak "Don't know how to serialize $obj"; + }; + my $backend = Parse::CPAN::Meta->json_backend(); return $backend->new->decode( - $backend->new->convert_blessed->encode($ref) + $backend->new->convert_blessed->allow_blessed->encode($ref) ); } + my %known_specs = ( '2' => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec', '1.4' => 'http://module-build.sourceforge.net/META-spec-v1.4.html', diff --git a/cpan/ExtUtils-MakeMaker/Changes b/cpan/ExtUtils-MakeMaker/Changes index 8ac998f58c..e549e9c8f0 100644 --- a/cpan/ExtUtils-MakeMaker/Changes +++ b/cpan/ExtUtils-MakeMaker/Changes @@ -1,3 +1,90 @@ +6.58 Wed Jul 6 14:17:06 PDT 2011 + No changes since 6.57_11 + + +6.57_11 Thu May 19 17:26:31 PDT 2011 + Bug Fixes + * Changed CPAN::Meta to accept version objects. [github #16] + * Massage bad versions and warn the user about them. [github #15] + * Protect against CPAN::Meta dying during metafile validation + and generation. + + VMS + * Fix prereq.t to work around "local %ENV = %ENV" bug + + Win32 + * Liblist::Kid can now recognize long compiler paths + (Christian Walde) [github #11] + + +6.57_10 Sun, 03 Apr 2011 19:36:38 +1000 + Bug Fixes + * Relaxed strictures on prerequisite versions. Invalid versions now + issue a warning and are set to 0 rather than dying. [github #7] + * Upgraded CPAN::Meta to 2.110930 which fixes a glitch in writing + MYMETA.yml if your module's version number was 1.4. [github #9] + * Convert LICENSE entries which are unknown to CPAN::Meta to + "unknown" rather than dying. [github #10] + + +6.57_09 Mon, 28 Mar 2011 11:13:39 +1100 + Misc + * Make CPAN ignore bundled modules + * Accidentally rolled Version::Requirements into the version bundle + * Deleted now unused ExtUtils::MakeMaker::YAML + + +6.57_08 Sun, 27 Mar 2011 21:52:47 +1100 + VMS + * Removed dependency on cc_runtime.h for VMS as well. + + Misc + * Changed how modules are bundled to avoid replacing XS version of + Scalar::Util with a pure Perl version [github #4] + + +6.57_07 Fri, 25 Mar 2011 14:31:31 +1100 + Enhancements + * Generates META.json and MYMETA.json in addition to + META.yml and MYMETA.yml (David Golden) + * MYMETA has the runtime requirements made priority over META_* + keys to allow generation of a correct META.* into the dist while + still generating an accurate MYMETA.* locally (Matt S Trout) + * Distributions should not depend on cc_runtime.h from core as it is + only needed for B::CC + * Now uses CPAN::Meta to generate META files. + + Bug Fixes + * MYMETA.yml generation from META.yml actually works (Matt S Trout) + * All required META fields are generated, even if they must be filled + with "unknown" in place of real data (David Golden) + + Test Fixes + * miniperl.t is no longer run outside of the perl core. Its only relevant + to bleadperl and requires no backwards compatibility [rt.cpan.org 61868] + + Cygwin + * Rebase behaviour was improved (Reini Urban) + * Build man pages (Reini Urban) + + Win32 + * Spot valid lib files on Win32 when .a and .lib are mixed. + (Christian Walde) [github #3] + * Extensive testing of ExtUtils::Liblist::Kid for Win32 + (Christian Walde) + * Implemented proper emulation of DOS escaping rules in ExtUtils::MM_Win32 + (Christian Walde) + + +6.57_06 Wed Oct 06 13:49:00 EEST 2010 + Win32 + * Work around dmake's limitations on how long a "line" can be. + [rt.cpan.org 61286] + * ActivePerl 1007 can now see gcc. [rt.cpan.org 55752] (Christian Walde) + + Bug Fixes + * Fix for AUTHOR and undocumented usage of MM->new() (Alexandr Ciornii) + 6.57_05 Sat Sep 11 23:24:00 EEST 2010 Bug Fixes * AUTHOR compatibility code should also be called after CONFIGURE callback @@ -14,7 +101,7 @@ 6.57_02 Wed Sep 08 02:40:00 EEST 2010 Bug Fixes * Don't do MANIFEST checks in PERL_CORE (Robin Barker) - + New Features * Accept several values (arrayref) in AUTHOR (Alexandr Ciornii) * Add MYMETA.yml support (Adam Kennedy, Alexandr Ciornii) diff --git a/cpan/ExtUtils-MakeMaker/MANIFEST b/cpan/ExtUtils-MakeMaker/MANIFEST index 929765ee20..0f31fec0eb 100644 --- a/cpan/ExtUtils-MakeMaker/MANIFEST +++ b/cpan/ExtUtils-MakeMaker/MANIFEST @@ -1,12 +1,34 @@ -.gitignore bin/instmodsh +bundled/CPAN-Meta-YAML/CPAN/Meta/YAML.pm +bundled/CPAN-Meta/CPAN/Meta.pm +bundled/CPAN-Meta/CPAN/Meta/Converter.pm +bundled/CPAN-Meta/CPAN/Meta/Feature.pm +bundled/CPAN-Meta/CPAN/Meta/History.pm +bundled/CPAN-Meta/CPAN/Meta/Prereqs.pm +bundled/CPAN-Meta/CPAN/Meta/Spec.pm +bundled/CPAN-Meta/CPAN/Meta/Validator.pm +bundled/ExtUtils-Command/ExtUtils/Command.pm +bundled/ExtUtils-Install/ExtUtils/Install.pm +bundled/ExtUtils-Install/ExtUtils/Installed.pm +bundled/ExtUtils-Install/ExtUtils/Packlist.pm +bundled/ExtUtils-Manifest/ExtUtils/Manifest.pm +bundled/ExtUtils-Manifest/ExtUtils/MANIFEST.SKIP +bundled/File-Copy-Recursive/File/Copy/Recursive.pm +bundled/File-Temp/File/Temp.pm +bundled/JSON-PP-Compat5006/JSON/PP/Compat5006.pm +bundled/JSON-PP/JSON/PP.pm +bundled/JSON-PP/JSON/PP/Boolean.pm +bundled/Parse-CPAN-Meta/Parse/CPAN/Meta.pm +bundled/Scalar-List-Utils/List/Util.pm +bundled/Scalar-List-Utils/List/Util/PP.pm +bundled/Scalar-List-Utils/Scalar/Util.pm +bundled/Scalar-List-Utils/Scalar/Util/PP.pm +bundled/Version-Requirements/Version/Requirements.pm +bundled/version/version.pm +bundled/version/version.pod +bundled/version/version/Internals.pod +bundled/version/version/vpp.pm Changes -inc/ExtUtils/Command.pm -inc/ExtUtils/Install.pm -inc/ExtUtils/Installed.pm -inc/ExtUtils/Manifest.pm -inc/ExtUtils/MANIFEST.SKIP -inc/ExtUtils/Packlist.pm INSTALL lib/ExtUtils/Command/MM.pm lib/ExtUtils/Liblist.pm @@ -15,7 +37,6 @@ lib/ExtUtils/MakeMaker.pm lib/ExtUtils/MakeMaker/Config.pm lib/ExtUtils/MakeMaker/FAQ.pod lib/ExtUtils/MakeMaker/Tutorial.pod -lib/ExtUtils/MakeMaker/YAML.pm lib/ExtUtils/Mkbootstrap.pm lib/ExtUtils/Mksymlists.pm lib/ExtUtils/MM.pm @@ -40,6 +61,7 @@ lib/ExtUtils/testlib.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP +my/bundles.pm NOTES PATCHING README @@ -77,9 +99,30 @@ t/lib/Test/Simple.pm t/lib/TieIn.pm t/lib/TieOut.pm t/Liblist.t +t/liblist/win32/__test.lib +'t/liblist/win32/di r/dir_test.lib' +t/liblist/win32/dir/dir_test.lib +t/liblist/win32/double.lib +t/liblist/win32/lib/CORE/c_test.lib +t/liblist/win32/lib/CORE/double.lib +t/liblist/win32/lib__test.lib +t/liblist/win32/lib_test.lib +t/liblist/win32/libpath/lp_test.lib +t/liblist/win32/pl.lib +'t/liblist/win32/space lib.lib' +t/liblist/win32/test.a.lib +t/liblist/win32/test.lib +t/liblist/win32/test.meep +t/liblist/win32/test2.lib +t/liblist/win32/vc/vctest.lib +t/Liblist_Kid.t t/make.t t/MakeMaker_Parameters.t t/maketext_filter.t +t/meta_convert.t +t/META_for_testing.json +t/META_for_testing.yml +t/META_for_testing_tricky_version.yml t/metafile_data.t t/metafile_file.t t/min_perl_version.t @@ -119,4 +162,6 @@ t/WriteEmptyMakefile.t t/writemakefile_args.t t/xs.t TODO -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) +SIGNATURE Public-key signature (added by MakeMaker) diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm index 40bf780dea..5a33bff6a3 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm @@ -8,9 +8,9 @@ use warnings; require Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(test_harness pod2man perllocal_install uninstall +our @EXPORT = qw(test_harness pod2man perllocal_install uninstall warn_if_old_packlist); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; my $Is_VMS = $^O eq 'VMS'; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm index 2184c4a6d7..a4e26666e4 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm @@ -2,7 +2,7 @@ package ExtUtils::Liblist; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use File::Spec; require ExtUtils::Liblist::Kid; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm index cf4826fe36..a0e2f24302 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm @@ -6,214 +6,241 @@ package ExtUtils::Liblist::Kid; # $self is not a Makemaker. use 5.006; + # Broken out of MakeMaker from version 4.11 use strict; -our $VERSION = 6.57_05; +use warnings; +our $VERSION = '6.58'; -use Config; +use ExtUtils::MakeMaker::Config; use Cwd 'cwd'; use File::Basename; use File::Spec; sub ext { - if ($^O eq 'VMS') { return &_vms_ext; } - elsif($^O eq 'MSWin32') { return &_win32_ext; } - else { return &_unix_os2_ext; } + if ( $^O eq 'VMS' ) { return &_vms_ext; } + elsif ( $^O eq 'MSWin32' ) { return &_win32_ext; } + else { return &_unix_os2_ext; } } sub _unix_os2_ext { - my($self,$potential_libs, $verbose, $give_libs) = @_; + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; $verbose ||= 0; - if ($^O =~ 'os2' and $Config{perllibs}) { - # Dynamic libraries are not transitive, so we may need including - # the libraries linked against perl.dll again. + if ( $^O =~ 'os2' and $Config{perllibs} ) { + + # Dynamic libraries are not transitive, so we may need including + # the libraries linked against perl.dll again. - $potential_libs .= " " if $potential_libs; - $potential_libs .= $Config{perllibs}; + $potential_libs .= " " if $potential_libs; + $potential_libs .= $Config{perllibs}; } - return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; + return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs; warn "Potential libraries are '$potential_libs':\n" if $verbose; - my($so) = $Config{so}; - my($libs) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs}; + my ( $so ) = $Config{so}; + my ( $libs ) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs}; my $Config_libext = $Config{lib_ext} || ".a"; my $Config_dlext = $Config{dlext}; - # compute $extralibs, $bsloadlibs and $ldloadlibs from # $potential_libs # this is a rewrite of Andy Dougherty's extliblist in perl - my(@searchpath); # from "-L/path" entries in $potential_libs - my(@libpath) = split " ", $Config{'libpth'}; - my(@ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen); - my(@libs, %libs_seen); - my($fullname, @fullname); - my($pwd) = cwd(); # from Cwd.pm - my($found) = 0; - - foreach my $thislib (split ' ', $potential_libs) { - - # Handle possible linker path arguments. - if ($thislib =~ s/^(-[LR]|-Wl,-R)//){ # save path flag type - my($ptype) = $1; - unless (-d $thislib){ - warn "$ptype$thislib ignored, directory does not exist\n" - if $verbose; - next; - } - my($rtype) = $ptype; - if (($ptype eq '-R') or ($ptype eq '-Wl,-R')) { - if ($Config{'lddlflags'} =~ /-Wl,-R/) { - $rtype = '-Wl,-R'; - } elsif ($Config{'lddlflags'} =~ /-R/) { - $rtype = '-R'; - } - } - unless (File::Spec->file_name_is_absolute($thislib)) { - warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; - $thislib = $self->catdir($pwd,$thislib); - } - push(@searchpath, $thislib); - push(@extralibs, "$ptype$thislib"); - push(@ldloadlibs, "$rtype$thislib"); - next; - } - - # Handle possible library arguments. - unless ($thislib =~ s/^-l//){ - warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; - next; - } - - my($found_lib)=0; - foreach my $thispth (@searchpath, @libpath) { - - # Try to find the full name of the library. We need this to - # determine whether it's a dynamically-loadable library or not. - # This tends to be subject to various os-specific quirks. - # For gcc-2.6.2 on linux (March 1995), DLD can not load - # .sa libraries, with the exception of libm.sa, so we - # deliberately skip them. - if (@fullname = - $self->lsdir($thispth,"^\Qlib$thislib.$so.\E[0-9]+")){ - # Take care that libfoo.so.10 wins against libfoo.so.9. - # Compare two libraries to find the most recent version - # number. E.g. if you have libfoo.so.9.0.7 and - # libfoo.so.10.1, first convert all digits into two - # decimal places. Then we'll add ".00" to the shorter - # strings so that we're comparing strings of equal length - # Thus we'll compare libfoo.so.09.07.00 with - # libfoo.so.10.01.00. Some libraries might have letters - # in the version. We don't know what they mean, but will - # try to skip them gracefully -- we'll set any letter to - # '0'. Finally, sort in reverse so we can take the - # first element. - - #TODO: iterate through the directory instead of sorting - - $fullname = "$thispth/" . - (sort { my($ma) = $a; - my($mb) = $b; - $ma =~ tr/A-Za-z/0/s; - $ma =~ s/\b(\d)\b/0$1/g; - $mb =~ tr/A-Za-z/0/s; - $mb =~ s/\b(\d)\b/0$1/g; - while (length($ma) < length($mb)) { $ma .= ".00"; } - while (length($mb) < length($ma)) { $mb .= ".00"; } - # Comparison deliberately backwards - $mb cmp $ma;} @fullname)[0]; - } elsif (-f ($fullname="$thispth/lib$thislib.$so") - && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){ - } elsif (-f ($fullname="$thispth/lib${thislib}_s$Config_libext") - && ($Config{'archname'} !~ /RM\d\d\d-svr4/) - && ($thislib .= "_s") ){ # we must explicitly use _s version - } elsif (-f ($fullname="$thispth/lib$thislib$Config_libext")){ - } elsif (defined($Config_dlext) - && -f ($fullname="$thispth/lib$thislib.$Config_dlext")){ - } elsif (-f ($fullname="$thispth/$thislib$Config_libext")){ - } elsif (-f ($fullname="$thispth/lib$thislib.dll$Config_libext")){ - } elsif (-f ($fullname="$thispth/Slib$thislib$Config_libext")){ - } elsif ($^O eq 'dgux' - && -l ($fullname="$thispth/lib$thislib$Config_libext") - && readlink($fullname) =~ /^elink:/s) { - # Some of DG's libraries look like misconnected symbolic - # links, but development tools can follow them. (They - # look like this: - # - # libm.a -> elink:${SDE_PATH:-/usr}/sde/\ - # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a - # - # , the compilation tools expand the environment variables.) - } else { - warn "$thislib not found in $thispth\n" if $verbose; - next; - } - warn "'-l$thislib' found at $fullname\n" if $verbose; - push @libs, $fullname unless $libs_seen{$fullname}++; - $found++; - $found_lib++; - - # Now update library lists - - # what do we know about this library... - my $is_dyna = ($fullname !~ /\Q$Config_libext\E\z/); - my $in_perl = ($libs =~ /\B-l\Q${thislib}\E\b/s); + my ( @searchpath ); # from "-L/path" entries in $potential_libs + my ( @libpath ) = split " ", $Config{'libpth'}; + my ( @ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen ); + my ( @libs, %libs_seen ); + my ( $fullname, @fullname ); + my ( $pwd ) = cwd(); # from Cwd.pm + my ( $found ) = 0; + + foreach my $thislib ( split ' ', $potential_libs ) { + + # Handle possible linker path arguments. + if ( $thislib =~ s/^(-[LR]|-Wl,-R)// ) { # save path flag type + my ( $ptype ) = $1; + unless ( -d $thislib ) { + warn "$ptype$thislib ignored, directory does not exist\n" + if $verbose; + next; + } + my ( $rtype ) = $ptype; + if ( ( $ptype eq '-R' ) or ( $ptype eq '-Wl,-R' ) ) { + if ( $Config{'lddlflags'} =~ /-Wl,-R/ ) { + $rtype = '-Wl,-R'; + } + elsif ( $Config{'lddlflags'} =~ /-R/ ) { + $rtype = '-R'; + } + } + unless ( File::Spec->file_name_is_absolute( $thislib ) ) { + warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; + $thislib = $self->catdir( $pwd, $thislib ); + } + push( @searchpath, $thislib ); + push( @extralibs, "$ptype$thislib" ); + push( @ldloadlibs, "$rtype$thislib" ); + next; + } + + # Handle possible library arguments. + unless ( $thislib =~ s/^-l// ) { + warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; + next; + } + + my ( $found_lib ) = 0; + foreach my $thispth ( @searchpath, @libpath ) { + + # Try to find the full name of the library. We need this to + # determine whether it's a dynamically-loadable library or not. + # This tends to be subject to various os-specific quirks. + # For gcc-2.6.2 on linux (March 1995), DLD can not load + # .sa libraries, with the exception of libm.sa, so we + # deliberately skip them. + if ( @fullname = $self->lsdir( $thispth, "^\Qlib$thislib.$so.\E[0-9]+" ) ) { + + # Take care that libfoo.so.10 wins against libfoo.so.9. + # Compare two libraries to find the most recent version + # number. E.g. if you have libfoo.so.9.0.7 and + # libfoo.so.10.1, first convert all digits into two + # decimal places. Then we'll add ".00" to the shorter + # strings so that we're comparing strings of equal length + # Thus we'll compare libfoo.so.09.07.00 with + # libfoo.so.10.01.00. Some libraries might have letters + # in the version. We don't know what they mean, but will + # try to skip them gracefully -- we'll set any letter to + # '0'. Finally, sort in reverse so we can take the + # first element. + + #TODO: iterate through the directory instead of sorting + + $fullname = "$thispth/" . ( + sort { + my ( $ma ) = $a; + my ( $mb ) = $b; + $ma =~ tr/A-Za-z/0/s; + $ma =~ s/\b(\d)\b/0$1/g; + $mb =~ tr/A-Za-z/0/s; + $mb =~ s/\b(\d)\b/0$1/g; + while ( length( $ma ) < length( $mb ) ) { $ma .= ".00"; } + while ( length( $mb ) < length( $ma ) ) { $mb .= ".00"; } + + # Comparison deliberately backwards + $mb cmp $ma; + } @fullname + )[0]; + } + elsif ( -f ( $fullname = "$thispth/lib$thislib.$so" ) + && ( ( $Config{'dlsrc'} ne "dl_dld.xs" ) || ( $thislib eq "m" ) ) ) + { + } + elsif (-f ( $fullname = "$thispth/lib${thislib}_s$Config_libext" ) + && ( $Config{'archname'} !~ /RM\d\d\d-svr4/ ) + && ( $thislib .= "_s" ) ) + { # we must explicitly use _s version + } + elsif ( -f ( $fullname = "$thispth/lib$thislib$Config_libext" ) ) { + } + elsif ( defined( $Config_dlext ) + && -f ( $fullname = "$thispth/lib$thislib.$Config_dlext" ) ) + { + } + elsif ( -f ( $fullname = "$thispth/$thislib$Config_libext" ) ) { + } + elsif ( -f ( $fullname = "$thispth/lib$thislib.dll$Config_libext" ) ) { + } + elsif ( -f ( $fullname = "$thispth/Slib$thislib$Config_libext" ) ) { + } + elsif ($^O eq 'dgux' + && -l ( $fullname = "$thispth/lib$thislib$Config_libext" ) + && readlink( $fullname ) =~ /^elink:/s ) + { + + # Some of DG's libraries look like misconnected symbolic + # links, but development tools can follow them. (They + # look like this: + # + # libm.a -> elink:${SDE_PATH:-/usr}/sde/\ + # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a + # + # , the compilation tools expand the environment variables.) + } + else { + warn "$thislib not found in $thispth\n" if $verbose; + next; + } + warn "'-l$thislib' found at $fullname\n" if $verbose; + push @libs, $fullname unless $libs_seen{$fullname}++; + $found++; + $found_lib++; + + # Now update library lists + + # what do we know about this library... + my $is_dyna = ( $fullname !~ /\Q$Config_libext\E\z/ ); + my $in_perl = ( $libs =~ /\B-l\Q${thislib}\E\b/s ); # include the path to the lib once in the dynamic linker path # but only if it is a dynamic lib and not in Perl itself - my($fullnamedir) = dirname($fullname); + my ( $fullnamedir ) = dirname( $fullname ); push @ld_run_path, $fullnamedir - if $is_dyna && !$in_perl && - !$ld_run_path_seen{$fullnamedir}++; - - # Do not add it into the list if it is already linked in - # with the main perl executable. - # We have to special-case the NeXT, because math and ndbm - # are both in libsys_s - unless ($in_perl || - ($Config{'osname'} eq 'next' && - ($thislib eq 'm' || $thislib eq 'ndbm')) ){ - push(@extralibs, "-l$thislib"); - } - - # We might be able to load this archive file dynamically - if ( ($Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0') - || ($Config{'dlsrc'} =~ /dl_dld/) ) - { - # We push -l$thislib instead of $fullname because - # it avoids hardwiring a fixed path into the .bs file. - # Mkbootstrap will automatically add dl_findfile() to - # the .bs file if it sees a name in the -l format. - # USE THIS, when dl_findfile() is fixed: - # push(@bsloadlibs, "-l$thislib"); - # OLD USE WAS while checking results against old_extliblist - push(@bsloadlibs, "$fullname"); - } else { - if ($is_dyna){ + if $is_dyna + && !$in_perl + && !$ld_run_path_seen{$fullnamedir}++; + + # Do not add it into the list if it is already linked in + # with the main perl executable. + # We have to special-case the NeXT, because math and ndbm + # are both in libsys_s + unless ( + $in_perl + || ( $Config{'osname'} eq 'next' + && ( $thislib eq 'm' || $thislib eq 'ndbm' ) ) + ) + { + push( @extralibs, "-l$thislib" ); + } + + # We might be able to load this archive file dynamically + if ( ( $Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0' ) + || ( $Config{'dlsrc'} =~ /dl_dld/ ) ) + { + + # We push -l$thislib instead of $fullname because + # it avoids hardwiring a fixed path into the .bs file. + # Mkbootstrap will automatically add dl_findfile() to + # the .bs file if it sees a name in the -l format. + # USE THIS, when dl_findfile() is fixed: + # push(@bsloadlibs, "-l$thislib"); + # OLD USE WAS while checking results against old_extliblist + push( @bsloadlibs, "$fullname" ); + } + else { + if ( $is_dyna ) { + # For SunOS4, do not add in this shared library if # it is already linked in the main perl executable - push(@ldloadlibs, "-l$thislib") - unless ($in_perl and $^O eq 'sunos'); - } else { - push(@ldloadlibs, "-l$thislib"); - } - } - last; # found one here so don't bother looking further - } - warn "Note (probably harmless): " - ."No library found for -l$thislib\n" - unless $found_lib>0; + push( @ldloadlibs, "-l$thislib" ) + unless ( $in_perl and $^O eq 'sunos' ); + } + else { + push( @ldloadlibs, "-l$thislib" ); + } + } + last; # found one here so don't bother looking further + } + warn "Note (probably harmless): " . "No library found for -l$thislib\n" + unless $found_lib > 0; } - unless( $found ) { - return ('','','','', ($give_libs ? \@libs : ())); + unless ( $found ) { + return ( '', '', '', '', ( $give_libs ? \@libs : () ) ); } else { - return ("@extralibs", "@bsloadlibs", "@ldloadlibs", - join(":",@ld_run_path), ($give_libs ? \@libs : ())); + return ( "@extralibs", "@bsloadlibs", "@ldloadlibs", join( ":", @ld_run_path ), ( $give_libs ? \@libs : () ) ); } } @@ -221,329 +248,378 @@ sub _win32_ext { require Text::ParseWords; - my($self, $potential_libs, $verbose, $give_libs) = @_; + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; $verbose ||= 0; # If user did not supply a list, we punt. # (caller should probably use the list in $Config{libs}) - return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; - - my $cc = $Config{cc}; - my $VC = $cc =~ /^cl/i; - my $BC = $cc =~ /^bcc/i; - my $GC = $cc =~ /^gcc/i; - my $so = $Config{'so'}; - my $libs = $Config{'perllibs'}; - my $libpth = $Config{'libpth'}; - my $libext = $Config{'lib_ext'} || ".lib"; - my(@libs, %libs_seen); - - if ($libs and $potential_libs !~ /:nodefault/i) { - # If Config.pm defines a set of default libs, we always - # tack them on to the user-supplied list, unless the user - # specified :nodefault - - $potential_libs .= " " if $potential_libs; - $potential_libs .= $libs; - } - warn "Potential libraries are '$potential_libs':\n" if $verbose; + return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs; - # normalize to forward slashes - $libpth =~ s,\\,/,g; - $potential_libs =~ s,\\,/,g; + # TODO: make this use MM_Win32.pm's compiler detection + my %libs_seen; + my @extralibs; + my $cc = $Config{cc} || ''; + my $VC = $cc =~ /\bcl\b/i; + my $GC = $cc =~ /\bgcc\b/i; + my $libext = _win32_lib_extensions(); + my @searchpath = ( '' ); # from "-L/path" entries in $potential_libs + my @libpath = _win32_default_search_paths( $VC ); + my $pwd = cwd(); # from Cwd.pm + my $search = 1; - # compute $extralibs from $potential_libs + # compute @extralibs from $potential_libs + my @lib_search_list = _win32_make_lib_search_list( $potential_libs, $verbose ); + for ( @lib_search_list ) { - my @searchpath; # from "-L/path" in $potential_libs - my @libpath = Text::ParseWords::quotewords('\s+', 0, $libpth); - my @extralibs; - my $pwd = cwd(); # from Cwd.pm - my $lib = ''; - my $found = 0; - my $search = 1; - my($fullname); + my $thislib = $_; - # add "$Config{installarchlib}/CORE" to default search path - push @libpath, "$Config{installarchlib}/CORE"; + # see if entry is a flag + if ( /^:\w+$/ ) { + $search = 0 if lc eq ':nosearch'; + $search = 1 if lc eq ':search'; + _debug( "Ignoring unknown flag '$thislib'\n", $verbose ) if !/^:(no)?(search|default)$/i; + next; + } - if ($VC and exists $ENV{LIB} and $ENV{LIB}) { - push @libpath, split /;/, $ENV{LIB}; - } + # if searching is disabled, do compiler-specific translations + unless ( $search ) { + s/^-l(.+)$/$1.lib/ unless $GC; + s/^-L/-libpath:/ if $VC; + push( @extralibs, $_ ); + next; + } - foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){ + # handle possible linker path arguments + if ( s/^-L// and not -d ) { + _debug( "$thislib ignored, directory does not exist\n", $verbose ); + next; + } + elsif ( -d ) { + unless ( File::Spec->file_name_is_absolute( $_ ) ) { + warn "Warning: '$thislib' changed to '-L$pwd/$_'\n"; + $_ = $self->catdir( $pwd, $_ ); + } + push( @searchpath, $_ ); + next; + } - my $thislib = $_; + my @paths = ( @searchpath, @libpath ); + my ( $fullname, $path ) = _win32_search_file( $thislib, $libext, \@paths, $verbose, $GC ); - # see if entry is a flag - if (/^:\w+$/) { - $search = 0 if lc eq ':nosearch'; - $search = 1 if lc eq ':search'; - warn "Ignoring unknown flag '$thislib'\n" - if $verbose and !/^:(no)?(search|default)$/i; - next; - } - - # if searching is disabled, do compiler-specific translations - unless ($search) { - s/^-l(.+)$/$1.lib/ unless $GC; - s/^-L/-libpath:/ if $VC; - push(@extralibs, $_); - $found++; - next; - } - - # handle possible linker path arguments - if (s/^-L// and not -d) { - warn "$thislib ignored, directory does not exist\n" - if $verbose; - next; - } - elsif (-d) { - unless (File::Spec->file_name_is_absolute($_)) { - warn "Warning: '$thislib' changed to '-L$pwd/$_'\n"; - $_ = $self->catdir($pwd,$_); - } - push(@searchpath, $_); - next; - } - - # handle possible library arguments - if (s/^-l// and $GC and !/^lib/i) { - $_ = "lib$_"; - } - $_ .= $libext if !/\Q$libext\E$/i; - - my $secondpass = 0; - LOOKAGAIN: - - # look for the file itself - if (-f) { - warn "'$thislib' found as '$_'\n" if $verbose; - $found++; - push(@extralibs, $_); - next; - } - - my $found_lib = 0; - foreach my $thispth (@searchpath, @libpath){ - unless (-f ($fullname="$thispth\\$_")) { - warn "'$thislib' not found as '$fullname'\n" if $verbose; - next; - } - warn "'$thislib' found as '$fullname'\n" if $verbose; - $found++; - $found_lib++; - push(@extralibs, $fullname); - push @libs, $fullname unless $libs_seen{$fullname}++; - last; - } - - # do another pass with (or without) leading 'lib' if they used -l - if (!$found_lib and $thislib =~ /^-l/ and !$secondpass++) { - if ($GC) { - goto LOOKAGAIN if s/^lib//i; - } - elsif (!/^lib/i) { - $_ = "lib$_"; - goto LOOKAGAIN; - } - } - - # give up - warn "Note (probably harmless): " - ."No library found for $thislib\n" - unless $found_lib>0; + if ( !$fullname ) { + warn "Note (probably harmless): No library found for $thislib\n"; + next; + } + _debug( "'$thislib' found as '$fullname'\n", $verbose ); + push( @extralibs, $fullname ); + $libs_seen{$fullname} = 1 if $path; # why is this a special case? } - return ('','','','', ($give_libs ? \@libs : ())) unless $found; + my @libs = keys %libs_seen; + + return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless @extralibs; # make sure paths with spaces are properly quoted - @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs; - @libs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @libs; - $lib = join(' ',@extralibs); + @extralibs = map { /\s/ ? qq["$_"] : $_ } @extralibs; + @libs = map { /\s/ ? qq["$_"] : $_ } @libs; + + my $lib = join( ' ', @extralibs ); # normalize back to backward slashes (to help braindead tools) # XXX this may break equally braindead GNU tools that don't understand # backslashes, either. Seems like one can't win here. Cursed be CP/M. $lib =~ s,/,\\,g; - warn "Result: $lib\n" if $verbose; - wantarray ? ($lib, '', $lib, '', ($give_libs ? \@libs : ())) : $lib; + _debug( "Result: $lib\n", $verbose ); + wantarray ? ( $lib, '', $lib, '', ( $give_libs ? \@libs : () ) ) : $lib; } +sub _win32_make_lib_search_list { + my ( $potential_libs, $verbose ) = @_; -sub _vms_ext { - my($self, $potential_libs, $verbose, $give_libs) = @_; - $verbose ||= 0; - - my(@crtls,$crtlstr); - @crtls = ( ($Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '') - . 'PerlShr/Share' ); - push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'}); - push(@crtls, grep { not /\(/ } split /\s+/, $Config{'libc'}); - # In general, we pass through the basic libraries from %Config unchanged. - # The one exception is that if we're building in the Perl source tree, and - # a library spec could be resolved via a logical name, we go to some trouble - # to insure that the copy in the local tree is used, rather than one to - # which a system-wide logical may point. - if ($self->{PERL_SRC}) { - my($locspec,$type); - foreach my $lib (@crtls) { - if (($locspec,$type) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i) { - if (lc $type eq '/share') { $locspec .= $Config{'exe_ext'}; } - elsif (lc $type eq '/library') { $locspec .= $Config{'lib_ext'}; } - else { $locspec .= $Config{'obj_ext'}; } - $locspec = $self->catfile($self->{PERL_SRC},$locspec); - $lib = "$locspec$type" if -e $locspec; - } - } - } - $crtlstr = @crtls ? join(' ',@crtls) : ''; - - unless ($potential_libs) { - warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose; - return ('', '', $crtlstr, '', ($give_libs ? [] : ())); - } - - my(%found,@fndlibs,$ldlib); - my $cwd = cwd(); - my($so,$lib_ext,$obj_ext) = @Config{'so','lib_ext','obj_ext'}; - # List of common Unix library names and their VMS equivalents - # (VMS equivalent of '' indicates that the library is automatically - # searched by the linker, and should be skipped here.) - my(@flibs, %libs_seen); - my %libmap = ( 'm' => '', 'f77' => '', 'F77' => '', 'V77' => '', 'c' => '', - 'malloc' => '', 'crypt' => '', 'resolv' => '', 'c_s' => '', - 'socket' => '', 'X11' => 'DECW$XLIBSHR', - 'Xt' => 'DECW$XTSHR', 'Xm' => 'DECW$XMLIBSHR', - 'Xmu' => 'DECW$XMULIBSHR'); - if ($Config{'vms_cc_type'} ne 'decc') { $libmap{'curses'} = 'VAXCCURSE'; } - - warn "Potential libraries are '$potential_libs'\n" if $verbose; - - # First, sort out directories and library names in the input - my(@dirs, @libs); - foreach my $lib (split ' ',$potential_libs) { - push(@dirs,$1), next if $lib =~ /^-L(.*)/; - push(@dirs,$lib), next if $lib =~ /[:>\]]$/; - push(@dirs,$lib), next if -d $lib; - push(@libs,$1), next if $lib =~ /^-l(.*)/; - push(@libs,$lib); - } - push(@dirs,split(' ',$Config{'libpth'})); - - # Now make sure we've got VMS-syntax absolute directory specs - # (We don't, however, check whether someone's hidden a relative - # path in a logical name.) - foreach my $dir (@dirs) { - unless (-d $dir) { - warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; - $dir = ''; - next; - } - warn "Resolving directory $dir\n" if $verbose; - if (File::Spec->file_name_is_absolute($dir)) { - $dir = $self->fixpath($dir,1); + # If Config.pm defines a set of default libs, we always + # tack them on to the user-supplied list, unless the user + # specified :nodefault + my $libs = $Config{'perllibs'}; + $potential_libs = join( ' ', $potential_libs, $libs ) if $libs and $potential_libs !~ /:nodefault/i; + _debug( "Potential libraries are '$potential_libs':\n", $verbose ); + + $potential_libs =~ s,\\,/,g; # normalize to forward slashes + + my @list = Text::ParseWords::quotewords( '\s+', 0, $potential_libs ); + + return @list; +} + +sub _win32_default_search_paths { + my ( $VC ) = @_; + + my $libpth = $Config{'libpth'} || ''; + $libpth =~ s,\\,/,g; # normalize to forward slashes + + my @libpath = Text::ParseWords::quotewords( '\s+', 0, $libpth ); + push @libpath, "$Config{installarchlib}/CORE"; # add "$Config{installarchlib}/CORE" to default search path + + if ( $VC and exists $ENV{LIB} and $ENV{LIB} ) { + push @libpath, split /;/, $ENV{LIB}; } - else { - $dir = $self->catdir($cwd,$dir); + + return @libpath; +} + +sub _win32_search_file { + my ( $thislib, $libext, $paths, $verbose, $GC ) = @_; + + my @file_list = _win32_build_file_list( $thislib, $GC, $libext ); + + for my $lib_file ( @file_list ) { + for my $path ( @{$paths} ) { + my $fullname = $lib_file; + $fullname = "$path\\$fullname" if $path; + + return ( $fullname, $path ) if -f $fullname; + + _debug( "'$thislib' not found as '$fullname'\n", $verbose ); + } } - } - @dirs = grep { length($_) } @dirs; - unshift(@dirs,''); # Check each $lib without additions first - - LIB: foreach my $lib (@libs) { - if (exists $libmap{$lib}) { - next unless length $libmap{$lib}; - $lib = $libmap{$lib}; + + return; +} + +sub _win32_build_file_list { + my ( $lib, $GC, $extensions ) = @_; + + my @pre_fixed = _win32_build_prefixed_list( $lib, $GC ); + return map _win32_attach_extensions( $_, $extensions ), @pre_fixed; +} + +sub _win32_build_prefixed_list { + my ( $lib, $GC ) = @_; + + return $lib if $lib !~ s/^-l//; + return $lib if $lib =~ /^lib/ and !$GC; + + ( my $no_prefix = $lib ) =~ s/^lib//i; + $lib = "lib$lib" if $no_prefix eq $lib; + + return ( $lib, $no_prefix ) if $GC; + return ( $no_prefix, $lib ); +} + +sub _win32_attach_extensions { + my ( $lib, $extensions ) = @_; + return map _win32_try_attach_extension( $lib, $_ ), @{$extensions}; +} + +sub _win32_try_attach_extension { + my ( $lib, $extension ) = @_; + + return $lib if $lib =~ /\Q$extension\E$/i; + return "$lib$extension"; +} + +sub _win32_lib_extensions { + my %extensions; + $extensions{ $Config{'lib_ext'} } = 1 if $Config{'lib_ext'}; + $extensions{".lib"} = 1; + return [ keys %extensions ]; +} + +sub _debug { + my ( $message, $verbose ) = @_; + return if !$verbose; + warn $message; + return; +} + +sub _vms_ext { + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; + $verbose ||= 0; + + my ( @crtls, $crtlstr ); + @crtls = ( ( $Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '' ) . 'PerlShr/Share' ); + push( @crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'} ); + push( @crtls, grep { not /\(/ } split /\s+/, $Config{'libc'} ); + + # In general, we pass through the basic libraries from %Config unchanged. + # The one exception is that if we're building in the Perl source tree, and + # a library spec could be resolved via a logical name, we go to some trouble + # to insure that the copy in the local tree is used, rather than one to + # which a system-wide logical may point. + if ( $self->{PERL_SRC} ) { + my ( $locspec, $type ); + foreach my $lib ( @crtls ) { + if ( ( $locspec, $type ) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i ) { + if ( lc $type eq '/share' ) { $locspec .= $Config{'exe_ext'}; } + elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; } + else { $locspec .= $Config{'obj_ext'}; } + $locspec = $self->catfile( $self->{PERL_SRC}, $locspec ); + $lib = "$locspec$type" if -e $locspec; + } + } } + $crtlstr = @crtls ? join( ' ', @crtls ) : ''; - my(@variants,$cand); - my($ctype) = ''; + unless ( $potential_libs ) { + warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose; + return ( '', '', $crtlstr, '', ( $give_libs ? [] : () ) ); + } - # If we don't have a file type, consider it a possibly abbreviated name and - # check for common variants. We try these first to grab libraries before - # a like-named executable image (e.g. -lperl resolves to perlshr.exe - # before perl.exe). - if ($lib !~ /\.[^:>\]]*$/) { - push(@variants,"${lib}shr","${lib}rtl","${lib}lib"); - push(@variants,"lib$lib") if $lib !~ /[:>\]]/; + my ( %found, @fndlibs, $ldlib ); + my $cwd = cwd(); + my ( $so, $lib_ext, $obj_ext ) = @Config{ 'so', 'lib_ext', 'obj_ext' }; + + # List of common Unix library names and their VMS equivalents + # (VMS equivalent of '' indicates that the library is automatically + # searched by the linker, and should be skipped here.) + my ( @flibs, %libs_seen ); + my %libmap = ( + 'm' => '', + 'f77' => '', + 'F77' => '', + 'V77' => '', + 'c' => '', + 'malloc' => '', + 'crypt' => '', + 'resolv' => '', + 'c_s' => '', + 'socket' => '', + 'X11' => 'DECW$XLIBSHR', + 'Xt' => 'DECW$XTSHR', + 'Xm' => 'DECW$XMLIBSHR', + 'Xmu' => 'DECW$XMULIBSHR' + ); + if ( $Config{'vms_cc_type'} ne 'decc' ) { $libmap{'curses'} = 'VAXCCURSE'; } + + warn "Potential libraries are '$potential_libs'\n" if $verbose; + + # First, sort out directories and library names in the input + my ( @dirs, @libs ); + foreach my $lib ( split ' ', $potential_libs ) { + push( @dirs, $1 ), next if $lib =~ /^-L(.*)/; + push( @dirs, $lib ), next if $lib =~ /[:>\]]$/; + push( @dirs, $lib ), next if -d $lib; + push( @libs, $1 ), next if $lib =~ /^-l(.*)/; + push( @libs, $lib ); } - push(@variants,$lib); - warn "Looking for $lib\n" if $verbose; - foreach my $variant (@variants) { - my($fullname, $name); - - foreach my $dir (@dirs) { - my($type); - - $name = "$dir$variant"; - warn "\tChecking $name\n" if $verbose > 2; - $fullname = VMS::Filespec::rmsexpand($name); - if (defined $fullname and -f $fullname) { - # It's got its own suffix, so we'll have to figure out the type - if ($fullname =~ /(?:$so|exe)$/i) { $type = 'SHR'; } - elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } - elsif ($fullname =~ /(?:$obj_ext|obj)$/i) { - warn "Note (probably harmless): " - ."Plain object file $fullname found in library list\n"; - $type = 'OBJ'; - } - else { - warn "Note (probably harmless): " - ."Unknown library type for $fullname; assuming shared\n"; - $type = 'SHR'; - } + push( @dirs, split( ' ', $Config{'libpth'} ) ); + + # Now make sure we've got VMS-syntax absolute directory specs + # (We don't, however, check whether someone's hidden a relative + # path in a logical name.) + foreach my $dir ( @dirs ) { + unless ( -d $dir ) { + warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; + $dir = ''; + next; } - elsif (-f ($fullname = VMS::Filespec::rmsexpand($name,$so)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.exe'))) { - $type = 'SHR'; - $name = $fullname unless $fullname =~ /exe;?\d*$/i; + warn "Resolving directory $dir\n" if $verbose; + if ( File::Spec->file_name_is_absolute( $dir ) ) { + $dir = $self->fixpath( $dir, 1 ); } - elsif (not length($ctype) and # If we've got a lib already, - # don't bother - ( -f ($fullname = VMS::Filespec::rmsexpand($name,$lib_ext)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.olb')))) { - $type = 'OLB'; - $name = $fullname unless $fullname =~ /olb;?\d*$/i; + else { + $dir = $self->catdir( $cwd, $dir ); } - elsif (not length($ctype) and # If we've got a lib already, - # don't bother - ( -f ($fullname = VMS::Filespec::rmsexpand($name,$obj_ext)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.obj')))) { - warn "Note (probably harmless): " - ."Plain object file $fullname found in library list\n"; - $type = 'OBJ'; - $name = $fullname unless $fullname =~ /obj;?\d*$/i; + } + @dirs = grep { length( $_ ) } @dirs; + unshift( @dirs, '' ); # Check each $lib without additions first + + LIB: foreach my $lib ( @libs ) { + if ( exists $libmap{$lib} ) { + next unless length $libmap{$lib}; + $lib = $libmap{$lib}; } - if (defined $type) { - $ctype = $type; $cand = $name; - last if $ctype eq 'SHR'; + + my ( @variants, $cand ); + my ( $ctype ) = ''; + + # If we don't have a file type, consider it a possibly abbreviated name and + # check for common variants. We try these first to grab libraries before + # a like-named executable image (e.g. -lperl resolves to perlshr.exe + # before perl.exe). + if ( $lib !~ /\.[^:>\]]*$/ ) { + push( @variants, "${lib}shr", "${lib}rtl", "${lib}lib" ); + push( @variants, "lib$lib" ) if $lib !~ /[:>\]]/; + } + push( @variants, $lib ); + warn "Looking for $lib\n" if $verbose; + foreach my $variant ( @variants ) { + my ( $fullname, $name ); + + foreach my $dir ( @dirs ) { + my ( $type ); + + $name = "$dir$variant"; + warn "\tChecking $name\n" if $verbose > 2; + $fullname = VMS::Filespec::rmsexpand( $name ); + if ( defined $fullname and -f $fullname ) { + + # It's got its own suffix, so we'll have to figure out the type + if ( $fullname =~ /(?:$so|exe)$/i ) { $type = 'SHR'; } + elsif ( $fullname =~ /(?:$lib_ext|olb)$/i ) { $type = 'OLB'; } + elsif ( $fullname =~ /(?:$obj_ext|obj)$/i ) { + warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n"; + $type = 'OBJ'; + } + else { + warn "Note (probably harmless): " . "Unknown library type for $fullname; assuming shared\n"; + $type = 'SHR'; + } + } + elsif (-f ( $fullname = VMS::Filespec::rmsexpand( $name, $so ) ) + or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.exe' ) ) ) + { + $type = 'SHR'; + $name = $fullname unless $fullname =~ /exe;?\d*$/i; + } + elsif ( + not length( $ctype ) and # If we've got a lib already, + # don't bother + ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $lib_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.olb' ) ) ) + ) + { + $type = 'OLB'; + $name = $fullname unless $fullname =~ /olb;?\d*$/i; + } + elsif ( + not length( $ctype ) and # If we've got a lib already, + # don't bother + ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $obj_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.obj' ) ) ) + ) + { + warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n"; + $type = 'OBJ'; + $name = $fullname unless $fullname =~ /obj;?\d*$/i; + } + if ( defined $type ) { + $ctype = $type; + $cand = $name; + last if $ctype eq 'SHR'; + } + } + if ( $ctype ) { + + # This has to precede any other CRTLs, so just make it first + if ( $cand eq 'VAXCCURSE' ) { unshift @{ $found{$ctype} }, $cand; } + else { push @{ $found{$ctype} }, $cand; } + warn "\tFound as $cand (really $fullname), type $ctype\n" + if $verbose > 1; + push @flibs, $name unless $libs_seen{$fullname}++; + next LIB; + } } - } - if ($ctype) { - # This has to precede any other CRTLs, so just make it first - if ($cand eq 'VAXCCURSE') { unshift @{$found{$ctype}}, $cand; } - else { push @{$found{$ctype}}, $cand; } - warn "\tFound as $cand (really $fullname), type $ctype\n" - if $verbose > 1; - push @flibs, $name unless $libs_seen{$fullname}++; - next LIB; - } + warn "Note (probably harmless): " . "No library found for $lib\n"; } - warn "Note (probably harmless): " - ."No library found for $lib\n"; - } - - push @fndlibs, @{$found{OBJ}} if exists $found{OBJ}; - push @fndlibs, map { "$_/Library" } @{$found{OLB}} if exists $found{OLB}; - push @fndlibs, map { "$_/Share" } @{$found{SHR}} if exists $found{SHR}; - my $lib = join(' ',@fndlibs); - - $ldlib = $crtlstr ? "$lib $crtlstr" : $lib; - warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose; - wantarray ? ($lib, '', $ldlib, '', ($give_libs ? \@flibs : ())) : $lib; + + push @fndlibs, @{ $found{OBJ} } if exists $found{OBJ}; + push @fndlibs, map { "$_/Library" } @{ $found{OLB} } if exists $found{OLB}; + push @fndlibs, map { "$_/Share" } @{ $found{SHR} } if exists $found{SHR}; + my $lib = join( ' ', @fndlibs ); + + $ldlib = $crtlstr ? "$lib $crtlstr" : $lib; + warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose; + wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib; } 1; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm index 945f24513b..ce3e0738ad 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm @@ -3,7 +3,7 @@ package ExtUtils::MM; use strict; use ExtUtils::MakeMaker::Config; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::Liblist; require ExtUtils::MakeMaker; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm index 021238523e..3d33e7fdad 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_AIX; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm index a38f2740f7..6a50c012df 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_Any; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use Carp; use File::Spec; @@ -486,8 +486,8 @@ clean :: clean_subdirs split /\s+/, $attribs{FILES} ; } - push(@files, qw[$(MAKE_APERL_FILE) - MYMETA.yml perlmain.c tmon.out mon.out so_locations + push(@files, qw[$(MAKE_APERL_FILE) + MYMETA.json MYMETA.yml perlmain.c tmon.out mon.out so_locations blibdirs.ts pm_to_blib pm_to_blib.ts *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso @@ -728,6 +728,13 @@ CMD return $manify; } +sub _has_cpan_meta { + return eval { + $INC{'CPAN/Meta.pm'} or require CPAN::Meta; + CPAN::Meta->VERSION(2.110350); + 1; + }; +} =head3 metafile_target @@ -743,28 +750,106 @@ possible. sub metafile_target { my $self = shift; - - return <<'MAKE_FRAG' if $self->{NO_META}; + return <<'MAKE_FRAG' if $self->{NO_META} or ! _has_cpan_meta(); metafile : $(NOECHO) $(NOOP) MAKE_FRAG - my @metadata = $self->metafile_data( + my %metadata = $self->metafile_data( $self->{META_ADD} || {}, $self->{META_MERGE} || {}, ); - my $meta = $self->metafile_file(@metadata); - my @write_meta = $self->echo($meta, 'META_new.yml'); + + _fix_metadata_before_conversion( \%metadata ); + + # paper over validation issues, but still complain, necessary because + # there's no guarantee that the above will fix ALL errors + my $meta = eval { CPAN::Meta->create( \%metadata, { lazy_validation => 1 } ) }; + warn $@ if $@ and + $@ !~ /encountered CODE.*, but JSON can only represent references to arrays or hashes/; + + # use the original metadata straight if the conversion failed + # or if it can't be stringified. + if( !$meta || + !eval { $meta->as_string( { version => "1.4" } ) } || + !eval { $meta->as_string } + ) + { + $meta = bless \%metadata, 'CPAN::Meta'; + } - return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta); + my @write_metayml = $self->echo( + $meta->as_string({version => "1.4"}), 'META_new.yml' + ); + my @write_metajson = $self->echo( + $meta->as_string(), 'META_new.json' + ); + + my $metayml = join("\n\t", @write_metayml); + my $metajson = join("\n\t", @write_metajson); + return sprintf <<'MAKE_FRAG', $metayml, $metajson; metafile : create_distdir $(NOECHO) $(ECHO) Generating META.yml %s -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml + $(NOECHO) $(ECHO) Generating META.json + %s + -$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json MAKE_FRAG } +=begin private + +=head3 _fix_metadata_before_conversion + + _fix_metadata_before_conversion( \%metadata ); + +Fixes errors in the metadata before it's handed off to CPAN::Meta for +conversion. This hopefully results in something that can be used further +on, no guarantee is made though. + +=end private + +=cut + +sub _fix_metadata_before_conversion { + my ( $metadata ) = @_; + + my $bad_version = $metadata->{version} && + !CPAN::Meta::Validator->new->version( 'version', $metadata->{version} ); + + # just delete all invalid versions + if( $bad_version ) { + warn "Can't parse version '$metadata->{version}'\n"; + $metadata->{version} = ''; + } + + my $validator = CPAN::Meta::Validator->new( $metadata ); + return if $validator->is_valid; + + # fix non-camelcase custom resource keys (only other trick we know) + for my $error ( $validator->errors ) { + my ( $key ) = ( $error =~ /Custom resource '(.*)' must be in CamelCase./ ); + next if !$key; + + # first try to remove all non-alphabetic chars + ( my $new_key = $key ) =~ s/[^_a-zA-Z]//g; + + # if that doesn't work, uppercase first one + $new_key = ucfirst $new_key if !$validator->custom_1( $new_key ); + + # copy to new key if that worked + $metadata->{resources}{$new_key} = $metadata->{resources}{$key} + if $validator->custom_1( $new_key ); + + # and delete old one in any case + delete $metadata->{resources}{$key}; + } + + return; +} + =begin private @@ -816,57 +901,16 @@ sub metafile_data { my $self = shift; my($meta_add, $meta_merge) = @_; - # The order in which standard meta keys should be written. - my @meta_order = qw( - name - version - abstract - author - license - distribution_type - - configure_requires - build_requires - requires - - resources - - provides - no_index - - generated_by - meta-spec - ); - - # Check the original args so we can tell between the user setting it - # to an empty hash and it just being initialized. - my $configure_requires; - if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { - $configure_requires = $self->{CONFIGURE_REQUIRES}; - } else { - $configure_requires = { - 'ExtUtils::MakeMaker' => 0, - }; - } - my $build_requires; - if( $self->{ARGS}{BUILD_REQUIRES} ) { - $build_requires = $self->{BUILD_REQUIRES}; - } else { - $build_requires = { - 'ExtUtils::MakeMaker' => 0, - }; - } - my %meta = ( + # required name => $self->{DISTNAME}, - version => $self->{VERSION}, - abstract => $self->{ABSTRACT}, + version => _normalize_version($self->{VERSION}), + abstract => $self->{ABSTRACT} || 'unknown', license => $self->{LICENSE} || 'unknown', - distribution_type => $self->{PM} ? 'module' : 'script', + dynamic_config => 1, - configure_requires => $configure_requires, - - build_requires => $build_requires, + # optional + distribution_type => $self->{PM} ? 'module' : 'script', no_index => { directory => [qw(t inc)] @@ -882,8 +926,18 @@ sub metafile_data { # The author key is required and it takes a list. $meta{author} = defined $self->{AUTHOR} ? $self->{AUTHOR} : []; - $meta{requires} = $self->{PREREQ_PM} if defined $self->{PREREQ_PM}; - $meta{requires}{perl} = $self->{MIN_PERL_VERSION} if $self->{MIN_PERL_VERSION}; + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { + $meta{configure_requires} + = _normalize_prereqs($self->{CONFIGURE_REQUIRES}); + } else { + $meta{configure_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; + } + + %meta = $self->_add_requirements_to_meta( %meta ); while( my($key, $val) = each %$meta_add ) { $meta{$key} = $val; @@ -893,24 +947,62 @@ sub metafile_data { $self->_hash_merge(\%meta, $key, $val); } - my @meta_pairs; + return %meta; +} + - # Put the standard keys first in the proper order. - for my $key (@meta_order) { - next unless exists $meta{$key}; +=begin private - push @meta_pairs, $key, delete $meta{$key}; - } +=cut - # Then tack everything else onto the end, alpha sorted. - for my $key (sort {lc $a cmp lc $b} keys %meta) { - push @meta_pairs, $key, $meta{$key}; +sub _add_requirements_to_meta { + my ( $self, %meta ) = @_; + + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + + if( $self->{ARGS}{BUILD_REQUIRES} ) { + $meta{build_requires} = _normalize_prereqs($self->{BUILD_REQUIRES}); + } else { + $meta{build_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; } - return @meta_pairs + $meta{requires} = _normalize_prereqs($self->{PREREQ_PM}) + if defined $self->{PREREQ_PM}; + $meta{requires}{perl} = _normalize_version($self->{MIN_PERL_VERSION}) + if $self->{MIN_PERL_VERSION}; + + return %meta; } -=begin private +sub _normalize_prereqs { + my ($hash) = @_; + my %prereqs; + while ( my ($k,$v) = each %$hash ) { + $prereqs{$k} = _normalize_version($v); + } + return \%prereqs; +} + +# Adapted from Module::Build::Base +sub _normalize_version { + my ($version) = @_; + $version = 0 unless defined $version; + + if ( ref $version eq 'version' ) { # version objects + $version = $version->is_qv ? $version->normal : $version->stringify; + } + 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; +} =head3 _dump_hash @@ -1069,16 +1161,25 @@ distdir. sub distmeta_target { my $self = shift; - my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']); -eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } + my @add_meta = ( + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']), +exit unless -e q{META.yml}; +eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) } or print "Could not add META.yml to MANIFEST: $${'@'}\n" CODE + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']) +exit unless -f q{META.json}; +eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) } + or print "Could not add META.json to MANIFEST: $${'@'}\n" +CODE + ); - my $add_meta_to_distdir = $self->cd('$(DISTVNAME)', $add_meta); + my @add_meta_to_distdir = map { $self->cd('$(DISTVNAME)', $_) } @add_meta; - return sprintf <<'MAKE', $add_meta_to_distdir; + return sprintf <<'MAKE', @add_meta_to_distdir; distmeta : create_distdir metafile $(NOECHO) %s + $(NOECHO) %s MAKE @@ -1096,12 +1197,9 @@ or from internal data. sub mymeta { my $self = shift; + my $file = shift || ''; # for testing - my $mymeta; - - if ( -e 'META.yml' ) { - $mymeta = $self->_mymeta_from_meta(); - } + my $mymeta = $self->_mymeta_from_meta($file); unless ( $mymeta ) { my @metadata = $self->metafile_data( @@ -1111,6 +1209,10 @@ sub mymeta { $mymeta = {@metadata}; } + # Overwrite the non-configure dependency hashes + + $mymeta = { $self->_add_requirements_to_meta( %$mymeta ) }; + $mymeta->{dynamic_config} = 0; return $mymeta; @@ -1119,14 +1221,20 @@ sub mymeta { sub _mymeta_from_meta { my $self = shift; + my $metafile = shift || ''; # for testing + + return unless _has_cpan_meta(); my $meta; - eval { - my @yaml = ExtUtils::MakeMaker::YAML::LoadFile('META.yml'); - $meta = $yaml[0]; - }; + for my $file ( $metafile, "META.json", "META.yml" ) { + next unless -e $file; + eval { + $meta = CPAN::Meta->load_file($file)->as_struct( {version => "1.4"} ); + }; + last if $meta; + } return undef unless $meta; - + # META.yml before 6.25_01 cannot be trusted. META.yml lived in the source directory. # There was a good chance the author accidentally uploaded a stale META.yml if they # rolled their own tarball rather than using "make dist". @@ -1138,20 +1246,9 @@ sub _mymeta_from_meta { } } - # Overwrite the non-configure dependency hashs - delete $meta->{requires}; - delete $meta->{build_requires}; - delete $meta->{recommends}; - if ( exists $self->{PREREQ_PM} ) { - $meta->{requires} = $self->{PREREQ_PM} || {}; - } - if ( exists $self->{BUILD_REQUIRES} ) { - $meta->{build_requires} = $self->{BUILD_REQUIRES} || {}; - } return $meta; } - =head3 write_mymeta $self->write_mymeta( $mymeta ); @@ -1166,18 +1263,19 @@ sub write_mymeta { my $self = shift; my $mymeta = shift; - require ExtUtils::MakeMaker::YAML; - my $mymeta_content = ExtUtils::MakeMaker::YAML::Dump($mymeta); + return unless _has_cpan_meta(); - open(my $myfh, ">", "MYMETA.yml") - or die "Unable to open MYMETA.yml: $!"; - print $myfh $mymeta_content; - close $myfh; - - return; + _fix_metadata_before_conversion( $mymeta ); + + # this can still blow up + # not sure if i should just eval this and skip file creation if it + # blows up + my $meta_obj = CPAN::Meta->new( $mymeta, { lazy_validation => 1 } ); + $meta_obj->save( 'MYMETA.json' ); + $meta_obj->save( 'MYMETA.yml', { version => "1.4" } ); + return 1; } - =head3 realclean (o) Defines the realclean target. @@ -1398,7 +1496,7 @@ sub init_INST { # perl has been built and installed. Setting INST_LIB allows # you to build directly into, say $Config{privlibexp}. unless ($self->{INST_LIB}){ - if ($self->{PERL_CORE}) { + if ($self->{PERL_CORE}) { if (defined $Cross::platform) { $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->catdir($self->{PERL_LIB},"..","xlib", @@ -1407,9 +1505,9 @@ sub init_INST { else { $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; } - } else { - $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); - } + } else { + $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); + } } my @parentdir = split(/::/, $self->{PARENT_NAME}); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm index 0eeb795e48..15918c9e0a 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm @@ -26,7 +26,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =item os_flavor diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm index d6ce3a7d68..7417b436e9 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm @@ -9,7 +9,7 @@ require ExtUtils::MM_Unix; require ExtUtils::MM_Win32; our @ISA = qw( ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm index 68612a80ac..915fc33cf4 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_DOS; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm index 20aeb79164..ca120a346c 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm @@ -7,7 +7,7 @@ BEGIN { our @ISA = qw( ExtUtils::MM_Unix ); } -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm index 4dcb6e55ec..33e5036e28 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_MacOS; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; sub new { die <<'UNSUPPORTED'; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm index 2089e8f88c..3e4ca58e52 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm @@ -22,7 +22,7 @@ use strict; use ExtUtils::MakeMaker::Config; use File::Basename; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm index 46d57be293..4d10020408 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm @@ -5,7 +5,7 @@ use strict; use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm index 5efd3771f3..f81c1c30b7 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_QNX; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm index 032bf35b84..6b9b6a6b02 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_UWIN; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm index 6964eea088..b8548876c2 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm @@ -15,7 +15,8 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue); # If we make $VERSION an our variable parse_version() breaks use vars qw($VERSION); -$VERSION = '6.57_05'; +$VERSION = '6.58'; +$VERSION = eval $VERSION; require ExtUtils::MM_Any; our @ISA = qw(ExtUtils::MM_Any); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm index d6b63eba63..3d52b87e23 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm @@ -15,7 +15,7 @@ BEGIN { use File::Basename; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm index e5b60d78e3..9a427c6c31 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_VOS; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm index faaf219ecb..5a1fd32234 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm @@ -27,13 +27,21 @@ use ExtUtils::MakeMaker qw( neatvalue ); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; $ENV{EMXSHELL} = 'sh'; # to run `commands` -my $BORLAND = $Config{'cc'} =~ /^bcc/i ? 1 : 0; -my $GCC = $Config{'cc'} =~ /\bgcc$/i ? 1 : 0; -my $DLLTOOL = $Config{'dlltool'} || 'dlltool'; +my ( $BORLAND, $GCC, $DLLTOOL ) = _identify_compiler_environment( \%Config ); + +sub _identify_compiler_environment { + my ( $config ) = @_; + + my $BORLAND = $config->{cc} =~ /^bcc/i ? 1 : 0; + my $GCC = $config->{cc} =~ /\bgcc\b/i ? 1 : 0; + my $DLLTOOL = $config->{dlltool} || 'dlltool'; + + return ( $BORLAND, $GCC, $DLLTOOL ); +} =head2 Overridden methods @@ -195,6 +203,8 @@ sub init_platform { my($self) = shift; $self->{MM_Win32_VERSION} = $VERSION; + + return; } sub platform_constants { @@ -211,6 +221,36 @@ sub platform_constants { } +=item constants + +Add MAXLINELENGTH for dmake before all the constants are output. + +=cut + +sub constants { + my $self = shift; + + my $make_text = $self->SUPER::constants; + return $make_text unless $self->is_make_type('dmake'); + + # dmake won't read any single "line" (even those with escaped newlines) + # larger than a certain size which can be as small as 8k. PM_TO_BLIB + # on large modules like DateTime::TimeZone can create lines over 32k. + # So we'll crank it up to a <ironic>WHOPPING</ironic> 64k. + # + # This has to come here before all the constants and not in + # platform_constants which is after constants. + my $size = $self->{MAXLINELENGTH} || 64 * 1024; + my $prefix = qq{ +# Get dmake to read long commands like PM_TO_BLIB +MAXLINELENGTH = $size + +}; + + return $prefix . $make_text; +} + + =item special_targets Add .USESHELL target for dmake. @@ -447,9 +487,31 @@ sub oneliner { sub quote_literal { my($self, $text) = @_; - # I don't know if this is correct, but it seems to work on - # Win98's command.com - $text =~ s{"}{\\"}g; + # DOS batch processing is hilarious: + # Quotes need to be converted into triple quotes. + # Certain special characters need to be escaped with a caret if an odd + # number of quotes came before them. + my @text = split '', $text; + my $quote_count = 0; + my %caret_chars = map { $_ => 1 } qw( < > | ); + for my $char ( @text ) { + if ( $char eq '"' ) { + $quote_count++; + $char = '"""'; + } + elsif ( $caret_chars{$char} and $quote_count % 2 ) { + $char = "^$char"; + } + elsif ( $char eq "\\" ) { + $char = "\\\\"; + } + } + $text = join '', @text; + + # There is a terribly confusing edge case here, where this will do entirely the wrong thing: + # perl -e "use Data::Dumper; @ARGV = '%PATH%'; print Dumper( \@ARGV );print qq{@ARGV};" -- + # I have no idea how to fix this manually, much less programmatically. + # However as it is such a rare edge case i'll just leave this documentation here and hope it never happens. # dmake eats '{' inside double quotes and leaves alone { outside double # quotes; however it transforms {{ into { either inside and outside double diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm index 19f5c7d61e..71115a86e5 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_Win95; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm index 464f814f0f..5591d4741d 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm @@ -3,7 +3,7 @@ package ExtUtils::MY; use strict; require ExtUtils::MM; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; our @ISA = qw(ExtUtils::MM); { diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm index be9624e389..6173b6be09 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm @@ -7,7 +7,7 @@ BEGIN {require 5.006;} require Exporter; use ExtUtils::MakeMaker::Config; -use Carp (); +use Carp; use File::Path; our $Verbose = 0; # exported @@ -18,7 +18,8 @@ our @Overridable; my @Prepend_parent; my %Recognized_Att_Keys; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; +$VERSION = eval $VERSION; # Emulate something resembling CVS $Revision$ (our $Revision = $VERSION) =~ s{_}{}; @@ -47,13 +48,13 @@ require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect sub WriteMakefile { - Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; + croak "WriteMakefile: Need even number of args" if @_ % 2; require ExtUtils::MY; my %att = @_; _convert_compat_attrs(\%att); - + _verify_att(\%att); my $mm = MM->new(\%att); @@ -114,7 +115,7 @@ my %Special_Sigs = ( @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys; @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs; -sub _convert_compat_attrs { +sub _convert_compat_attrs { #result of running several times should be same my($att) = @_; if (exists $att->{AUTHOR}) { if ($att->{AUTHOR}) { @@ -176,7 +177,7 @@ sub _format_att { sub prompt ($;$) { ## no critic my($mess, $def) = @_; - Carp::confess("prompt function called without an argument") + confess("prompt function called without an argument") unless defined $mess; my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; @@ -224,7 +225,7 @@ sub eval_in_subdirs { sub eval_in_x { my($self,$dir) = @_; - chdir $dir or Carp::carp("Couldn't change to directory $dir: $!"); + chdir $dir or carp("Couldn't change to directory $dir: $!"); { package main; @@ -401,6 +402,8 @@ sub new { my($class,$self) = @_; my($key); + _convert_compat_attrs($self) if defined $self && $self; + # Store the original args passed to WriteMakefile() foreach my $k (keys %$self) { $self->{ARGS}{$k} = $self->{$k}; @@ -408,13 +411,17 @@ sub new { $self = {} unless defined $self; - $self->{PREREQ_PM} ||= {}; - $self->{BUILD_REQUIRES} ||= {}; - # Temporarily bless it into MM so it can be used as an # object. It will be blessed into a temp package later. bless $self, "MM"; + # Cleanup all the module requirement bits + for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES)) { + $self->{$key} ||= {}; + $self->clean_versions( $key ); + } + + if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { $self->_PREREQ_PRINT; } @@ -446,7 +453,7 @@ sub new { }; if (!$perl_version_ok) { if (!defined $perl_version_ok) { - warn <<'END'; + die <<'END'; Warning: MIN_PERL_VERSION is not in a recognized format. Recommended is a quoted numerical value like '5.005' or '5.008001'. END @@ -515,13 +522,13 @@ END _convert_compat_attrs(\%configure_att); $self = { %$self, %configure_att }; } else { - Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; + croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; } } # This is for old Makefiles written pre 5.00, will go away if ( Carp::longmess("") =~ /runsubdirpl/s ){ - Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); + carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); } my $newclass = ++$PACKNAME; @@ -692,11 +699,11 @@ END } sub WriteEmptyMakefile { - Carp::croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; + croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; my %att = @_; my $self = MM->new(\%att); - + my $new = $self->{MAKEFILE}; my $old = $self->{MAKEFILE_OLD}; if (-f $old) { @@ -1029,9 +1036,10 @@ sub flush { unless ($self->{NO_MYMETA}) { # Write MYMETA.yml to communicate metadata up to the CPAN clients - print STDOUT "Writing MYMETA.yml\n"; + if ( $self->write_mymeta( $self->mymeta ) ) {; + print STDOUT "Writing MYMETA.yml and MYMETA.json\n"; + } - $self->write_mymeta( $self->mymeta ); } my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE); if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) { @@ -1103,6 +1111,22 @@ sub neatvalue { return "{ ".join(', ',@m)." }"; } +# Look for weird version numbers, warn about them and set them to 0 +# before CPAN::Meta chokes. +sub clean_versions { + my($self, $key) = @_; + + my $reqs = $self->{$key}; + for my $module (keys %$reqs) { + my $version = $reqs->{$module}; + + if( !defined $version or $version !~ /^[\d_\.]+$/ ) { + carp "Unparsable version '$version' for prerequisite $module"; + $reqs->{$module} = 0; + } + } +} + sub selfdocument { my($self) = @_; my(@m); @@ -1491,8 +1515,8 @@ the first line in the "=head1 NAME" section. $2 becomes the abstract. =item AUTHOR Array of strings containing name (and email address) of package author(s). -Is used in META.yml and PPD (Perl Package Description) files for PPM (Perl -Package Manager). +Is used in CPAN Meta files (META.yml or META.json) and PPD +(Perl Package Description) files for PPM (Perl Package Manager). =item BINARY_LOCATION @@ -1509,7 +1533,8 @@ located in the C<x86> directory relative to the PPD itself. A hash of modules that are needed to build your module but not run it. -This will go into the C<build_requires> field of your F<META.yml>. +This will go into the C<build_requires> field of your CPAN Meta file. +(F<META.yml> or F<META.json>). The format is the same as PREREQ_PM. @@ -1556,7 +1581,8 @@ be determined by some evaluation method. A hash of modules that are required to run Makefile.PL itself, but not to run your distribution. -This will go into the C<configure_requires> field of your F<META.yml>. +This will go into the C<configure_requires> field of your CPAN Meta file +(F<META.yml> or F<META.json>) Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> @@ -1963,7 +1989,8 @@ may hold a name for that binary. Defaults to perl =item META_MERGE -A hashrefs of items to add to the F<META.yml>. +A hashrefs of items to add to the CPAN Meta file (F<META.yml> or +F<META.json>). They differ in how they behave if they have the same key as the default metadata. META_ADD will override the default value with its @@ -2012,14 +2039,14 @@ Boolean. Attribute to inhibit descending into subdirectories. =item NO_META When true, suppresses the generation and addition to the MANIFEST of -the META.yml module meta-data file during 'make distdir'. +the META.yml and META.json module meta-data files during 'make distdir'. Defaults to false. =item NO_MYMETA -When true, suppresses the generation of MYMETA.yml module meta-data file -during 'perl Makefile.PL'. +When true, suppresses the generation of MYMETA.yml and MYMETA.json module +meta-data files during 'perl Makefile.PL'. Defaults to false. @@ -2276,7 +2303,8 @@ A hash of modules that are needed to run your module. The keys are the module names ie. Test::More, and the minimum version is the value. If the required version number is 0 any version will do. -This will go into the C<requires> field of your F<META.yml>. +This will go into the C<requires> field of your CPAN Meta file +(F<META.yml> or F<META.json>). PREREQ_PM => { # Require Test::More at least 0.47 @@ -2641,8 +2669,8 @@ Copies all the files that are in the MANIFEST file to a newly created directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory exists, it will be removed first. -Additionally, it will create a META.yml module meta-data file in the -distdir and add this to the distdir's MANIFEST. You can shut this +Additionally, it will create META.yml and META.json module meta-data file +in the distdir and add this to the distdir's MANIFEST. You can shut this behavior off with the NO_META flag. =item make disttest @@ -2716,26 +2744,37 @@ An example: ); -=head2 Module Meta-Data +=head2 Module Meta-Data (META and MYMETA) Long plaguing users of MakeMaker based modules has been the problem of getting basic information about the module out of the sources I<without> running the F<Makefile.PL> and doing a bunch of messy -heuristics on the resulting F<Makefile>. To this end a simple module -meta-data file has been introduced, F<META.yml>. - -F<META.yml> is a YAML document (see http://www.yaml.org) containing -basic information about the module (name, version, prerequisites...) -in an easy to read format. The format is developed and defined by the -Module::Build developers (see -http://module-build.sourceforge.net/META-spec.html) - -MakeMaker will automatically generate a F<META.yml> file for you and -add it to your F<MANIFEST> as part of the 'distdir' target (and thus -the 'dist' target). This is intended to seamlessly and rapidly -populate CPAN with module meta-data. If you wish to shut this feature -off, set the C<NO_META> C<WriteMakefile()> flag to true. - +heuristics on the resulting F<Makefile>. Over the years, it has become +standard to keep this information in one or more CPAN Meta files +distributed with each distribution. + +The original format of CPAN Meta files was L<YAML> and the corresponding +file was called F<META.yml>. In 2010, version 2 of the L<CPAN::Meta::Spec> +was released, which mandates JSON format for the metadata in order to +overcome certain compatibility issues between YAML serializers and to +avoid breaking older clients unable to handle a new version of the spec. +The L<CPAN::Meta> library is now standard for accessing old and new-style +Meta files. + +If L<CPAN::Meta> is installed, MakeMaker will automatically generate +F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as +part of the 'distdir' target (and thus the 'dist' target). This is intended to +seamlessly and rapidly populate CPAN with module meta-data. If you wish to +shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true. + +At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agrees +to use the CPAN Meta format to communicate post-configuration requirements +between toolchain components. These files, F<MYMETA.json> and F<MYMETA.yml>, +are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta> +is installed). Clients like L<CPAN> or L<CPANPLUS> will read this +files to see what prerequisites must be fulfilled before building or testing +the distribution. If you with to shut this feature off, set the C<NO_MYMETA> +C<WriteMakeFile()> flag to true. =head2 Disabling an extension @@ -2812,6 +2851,8 @@ not normally available. L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to help you setup your distribution. +L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail. + =head1 AUTHORS Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm index a7ac47d94a..70ee092c78 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::Config; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use Config (); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod index f3354231d1..ae9cf1ac58 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker::FAQ; -our $VERSION = '6.57_01'; +our $VERSION = '6.58'; 1; __END__ diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod index d5ff9086c3..dee1b10dbc 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker::Tutorial; -our $VERSION = 6.57_01; +our $VERSION = 6.58; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm deleted file mode 100644 index 55ff6fdf43..0000000000 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm +++ /dev/null @@ -1,658 +0,0 @@ -package ExtUtils::MakeMaker::YAML;
-
-use strict;
-
-# UTF Support?
-sub HAVE_UTF8 () { $] >= 5.007003 }
-BEGIN {
- if ( HAVE_UTF8 ) {
- # The string eval helps hide this from Test::MinimumVersion
- eval "require utf8;";
- die "Failed to load UTF-8 support" if $@;
- }
-
- # Class structure
- require 5.004;
- require Exporter;
- require Carp;
- $ExtUtils::MakeMaker::YAML::VERSION = '1.44';
- @ExtUtils::MakeMaker::YAML::ISA = qw{ Exporter };
- @ExtUtils::MakeMaker::YAML::EXPORT = qw{ Load Dump };
- @ExtUtils::MakeMaker::YAML::EXPORT_OK = qw{ LoadFile DumpFile freeze thaw };
-
- # Error storage
- $ExtUtils::MakeMaker::YAML::errstr = '';
-}
-
-# The character class of all characters we need to escape
-# NOTE: Inlined, since it's only used once
-# my $RE_ESCAPE = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]';
-
-# Printed form of the unprintable characters in the lowest range
-# of ASCII characters, listed by ASCII ordinal position.
-my @UNPRINTABLE = qw(
- z x01 x02 x03 x04 x05 x06 a
- x08 t n v f r x0e x0f
- x10 x11 x12 x13 x14 x15 x16 x17
- x18 x19 x1a e x1c x1d x1e x1f
-);
-
-# Printable characters for escapes
-my %UNESCAPES = (
- z => "\x00", a => "\x07", t => "\x09",
- n => "\x0a", v => "\x0b", f => "\x0c",
- r => "\x0d", e => "\x1b", '\\' => '\\',
-);
-
-# Special magic boolean words
-my %QUOTE = map { $_ => 1 } qw{
- null Null NULL
- y Y yes Yes YES n N no No NO
- true True TRUE false False FALSE
- on On ON off Off OFF
-};
-
-
-
-
-
-#####################################################################
-# Implementation
-
-# Create an empty ExtUtils::MakeMaker::YAML object
-sub new {
- my $class = shift;
- bless [ @_ ], $class;
-}
-
-# Create an object from a file
-sub read {
- my $class = ref $_[0] ? ref shift : shift;
-
- # Check the file
- my $file = shift or return $class->_error( 'You did not specify a file name' );
- return $class->_error( "File '$file' does not exist" ) unless -e $file;
- return $class->_error( "'$file' is a directory, not a file" ) unless -f _;
- return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;
-
- # Slurp in the file
- local $/ = undef;
- local *CFG;
- unless ( open(CFG, $file) ) {
- return $class->_error("Failed to open file '$file': $!");
- }
- my $contents = <CFG>;
- unless ( close(CFG) ) {
- return $class->_error("Failed to close file '$file': $!");
- }
-
- $class->read_string( $contents );
-}
-
-# Create an object from a string
-sub read_string {
- my $class = ref $_[0] ? ref shift : shift;
- my $self = bless [], $class;
- my $string = $_[0];
- unless ( defined $string ) {
- return $self->_error("Did not provide a string to load");
- }
-
- # Byte order marks
- # NOTE: Keeping this here to educate maintainers
- # my %BOM = (
- # "\357\273\277" => 'UTF-8',
- # "\376\377" => 'UTF-16BE',
- # "\377\376" => 'UTF-16LE',
- # "\377\376\0\0" => 'UTF-32LE'
- # "\0\0\376\377" => 'UTF-32BE',
- # );
- if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) {
- return $self->_error("Stream has a non UTF-8 BOM");
- } else {
- # Strip UTF-8 bom if found, we'll just ignore it
- $string =~ s/^\357\273\277//;
- }
-
- # Try to decode as utf8
- utf8::decode($string) if HAVE_UTF8;
-
- # Check for some special cases
- return $self unless length $string;
- unless ( $string =~ /[\012\015]+\z/ ) {
- return $self->_error("Stream does not end with newline character");
- }
-
- # Split the file into lines
- my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
- split /(?:\015{1,2}\012|\015|\012)/, $string;
-
- # Strip the initial YAML header
- @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;
-
- # A nibbling parser
- while ( @lines ) {
- # Do we have a document header?
- if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {
- # Handle scalar documents
- shift @lines;
- if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {
- push @$self, $self->_read_scalar( "$1", [ undef ], \@lines );
- next;
- }
- }
-
- if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {
- # A naked document
- push @$self, undef;
- while ( @lines and $lines[0] !~ /^---/ ) {
- shift @lines;
- }
-
- } elsif ( $lines[0] =~ /^\s*\-/ ) {
- # An array at the root
- my $document = [ ];
- push @$self, $document;
- $self->_read_array( $document, [ 0 ], \@lines );
-
- } elsif ( $lines[0] =~ /^(\s*)\S/ ) {
- # A hash at the root
- my $document = { };
- push @$self, $document;
- $self->_read_hash( $document, [ length($1) ], \@lines );
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify the line '$lines[0]'");
- }
- }
-
- $self;
-}
-
-# Deparse a scalar string to the actual scalar
-sub _read_scalar {
- my ($self, $string, $indent, $lines) = @_;
-
- # Trim trailing whitespace
- $string =~ s/\s*\z//;
-
- # Explitic null/undef
- return undef if $string eq '~';
-
- # Single quote
- if ( $string =~ /^\'(.*?)\'\z/ ) {
- return '' unless defined $1;
- $string = $1;
- $string =~ s/\'\'/\'/g;
- return $string;
- }
-
- # Double quote.
- # The commented out form is simpler, but overloaded the Perl regex
- # engine due to recursion and backtracking problems on strings
- # larger than 32,000ish characters. Keep it for reference purposes.
- # if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) {
- if ( $string =~ /^\"([^\\"]*(?:\\.[^\\"]*)*)\"\z/ ) {
- # Reusing the variable is a little ugly,
- # but avoids a new variable and a string copy.
- $string = $1;
- $string =~ s/\\"/"/g;
- $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex;
- return $string;
- }
-
- # Special cases
- if ( $string =~ /^[\'\"!&]/ ) {
- Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");
- }
- return {} if $string eq '{}';
- return [] if $string eq '[]';
-
- # Regular unquoted string
- return $string unless $string =~ /^[>|]/;
-
- # Error
- Carp::croak("ExtUtils::MakeMaker::YAML failed to find multi-line scalar content") unless @$lines;
-
- # Check the indent depth
- $lines->[0] =~ /^(\s*)/;
- $indent->[-1] = length("$1");
- if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- # Pull the lines
- my @multiline = ();
- while ( @$lines ) {
- $lines->[0] =~ /^(\s*)/;
- last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
- }
-
- my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
- my $t = (substr($string, 1, 1) eq '-') ? '' : "\n";
- return join( $j, @multiline ) . $t;
-}
-
-# Parse an array
-sub _read_array {
- my ($self, $array, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {
- # Inline nested hash
- my $indent2 = length("$1");
- $lines->[0] =~ s/-/ /;
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {
- # Array entry with a value
- shift @$lines;
- push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {
- shift @$lines;
- unless ( @$lines ) {
- push @$array, undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)\-/ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] == $indent2 ) {
- # Null array entry
- push @$array, undef;
- } else {
- # Naked indenter
- push @$array, [ ];
- $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines );
- }
-
- } elsif ( $lines->[0] =~ /^(\s*)\S/ ) {
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines );
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
-
- } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {
- # This is probably a structure like the following...
- # ---
- # foo:
- # - list
- # bar: value
- #
- # ... so lets return and let the hash parser handle it
- return 1;
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
- }
-
- return 1;
-}
-
-# Parse an array
-sub _read_hash {
- my ($self, $hash, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- # Get the key
- unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) {
- if ( $lines->[0] =~ /^\s*[?\'\"]/ ) {
- Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");
- }
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
- my $key = $1;
-
- # Do we have a value?
- if ( length $lines->[0] ) {
- # Yes
- $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines );
- } else {
- # An indent
- shift @$lines;
- unless ( @$lines ) {
- $hash->{$key} = undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)-/ ) {
- $hash->{$key} = [];
- $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines );
- } elsif ( $lines->[0] =~ /^(\s*)./ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] >= $indent2 ) {
- # Null hash entry
- $hash->{$key} = undef;
- } else {
- $hash->{$key} = {};
- $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines );
- }
- }
- }
- }
-
- return 1;
-}
-
-# Save an object to a file
-sub write {
- my $self = shift;
- my $file = shift or return $self->_error('No file name provided');
-
- # Write it to the file
- open( CFG, '>' . $file ) or return $self->_error(
- "Failed to open file '$file' for writing: $!"
- );
- print CFG $self->write_string;
- close CFG;
-
- return 1;
-}
-
-# Save an object to a string
-sub write_string {
- my $self = shift;
- return '' unless @$self;
-
- # Iterate over the documents
- my $indent = 0;
- my @lines = ();
- foreach my $cursor ( @$self ) {
- push @lines, '---';
-
- # An empty document
- if ( ! defined $cursor ) {
- # Do nothing
-
- # A scalar document
- } elsif ( ! ref $cursor ) {
- $lines[-1] .= ' ' . $self->_write_scalar( $cursor, $indent );
-
- # version object
- } elsif ( ref $cursor eq 'version' ) {
- $lines[-1] .= ' ' . $self->_write_scalar( $cursor->stringify, $indent );
-
- # A list at the root
- } elsif ( ref $cursor eq 'ARRAY' ) {
- unless ( @$cursor ) {
- $lines[-1] .= ' []';
- next;
- }
- push @lines, $self->_write_array( $cursor, $indent, {} );
-
- # A hash at the root
- } elsif ( ref $cursor eq 'HASH' ) {
- unless ( %$cursor ) {
- $lines[-1] .= ' {}';
- next;
- }
- push @lines, $self->_write_hash( $cursor, $indent, {} );
-
- } else {
- Carp::croak("Cannot serialize " . ref($cursor));
- }
- }
-
- join '', map { "$_\n" } @lines;
-}
-
-sub _write_scalar {
- my $string = $_[1];
- return '~' unless defined $string;
- return "''" unless length $string;
- if ( $string =~ /[\x00-\x08\x0b-\x0d\x0e-\x1f\"\'\n]/ ) {
- $string =~ s/\\/\\\\/g;
- $string =~ s/"/\\"/g;
- $string =~ s/\n/\\n/g;
- $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g;
- return qq|"$string"|;
- }
- if ( $string =~ /(?:^\W|\s)/ or $QUOTE{$string} ) {
- return "'$string'";
- }
- return $string;
-}
-
-sub _write_array {
- my ($self, $array, $indent, $seen) = @_;
- if ( $seen->{refaddr($array)}++ ) {
- die "ExtUtils::MakeMaker::YAML does not support circular references";
- }
- my @lines = ();
- foreach my $el ( @$array ) {
- my $line = (' ' x $indent) . '-';
- my $type = ref $el;
- if ( ! $type ) {
- $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );
- push @lines, $line;
-
- # version object
- } elsif ( $type eq 'version' ) {
- $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );
- push @lines, $line;
-
- } elsif ( $type eq 'ARRAY' ) {
- if ( @$el ) {
- push @lines, $line;
- push @lines, $self->_write_array( $el, $indent + 1, $seen );
- } else {
- $line .= ' []';
- push @lines, $line;
- }
-
- } elsif ( $type eq 'HASH' ) {
- if ( keys %$el ) {
- push @lines, $line;
- push @lines, $self->_write_hash( $el, $indent + 1, $seen );
- } else {
- $line .= ' {}';
- push @lines, $line;
- }
-
- } else {
- die "ExtUtils::MakeMaker::YAML does not support $type references";
- }
- }
-
- @lines;
-}
-
-sub _write_hash {
- my ($self, $hash, $indent, $seen) = @_;
- if ( $seen->{refaddr($hash)}++ ) {
- die "ExtUtils::MakeMaker::YAML does not support circular references";
- }
- my @lines = ();
- foreach my $name ( sort keys %$hash ) {
- my $el = $hash->{$name};
- my $line = (' ' x $indent) . "$name:";
- my $type = ref $el;
- if ( ! $type ) {
- $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );
- push @lines, $line;
-
- # version object
- } elsif ( $type eq 'version' ) {
- $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );
- push @lines, $line;
-
- } elsif ( $type eq 'ARRAY' ) {
- if ( @$el ) {
- push @lines, $line;
- push @lines, $self->_write_array( $el, $indent + 1, $seen );
- } else {
- $line .= ' []';
- push @lines, $line;
- }
-
- } elsif ( $type eq 'HASH' ) {
- if ( keys %$el ) {
- push @lines, $line;
- push @lines, $self->_write_hash( $el, $indent + 1, $seen );
- } else {
- $line .= ' {}';
- push @lines, $line;
- }
-
- } else {
- die "ExtUtils::MakeMaker::YAML does not support $type references";
- }
- }
-
- @lines;
-}
-
-# Set error
-sub _error {
- $ExtUtils::MakeMaker::YAML::errstr = $_[1];
- undef;
-}
-
-# Retrieve error
-sub errstr {
- $ExtUtils::MakeMaker::YAML::errstr;
-}
-
-
-
-
-
-#####################################################################
-# YAML Compatibility
-
-sub Dump {
- ExtUtils::MakeMaker::YAML->new(@_)->write_string;
-}
-
-sub Load {
- my $self = ExtUtils::MakeMaker::YAML->read_string(@_);
- unless ( $self ) {
- Carp::croak("Failed to load YAML document from string");
- }
- if ( wantarray ) {
- return @$self;
- } else {
- # To match YAML.pm, return the last document
- return $self->[-1];
- }
-}
-
-BEGIN {
- *freeze = *Dump;
- *thaw = *Load;
-}
-
-sub DumpFile {
- my $file = shift;
- ExtUtils::MakeMaker::YAML->new(@_)->write($file);
-}
-
-sub LoadFile {
- my $self = ExtUtils::MakeMaker::YAML->read($_[0]);
- unless ( $self ) {
- Carp::croak("Failed to load YAML document from '" . ($_[0] || '') . "'");
- }
- if ( wantarray ) {
- return @$self;
- } else {
- # Return only the last document to match YAML.pm,
- return $self->[-1];
- }
-}
-
-
-
-
-
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-BEGIN {
- eval {
- require Scalar::Util;
- *refaddr = *Scalar::Util::refaddr;
- };
- eval <<'END_PERL' if $@;
-# Failed to load Scalar::Util
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if (!!UNIVERSAL::can($_[0], 'can')) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { local $^W; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
-
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-ExtUtils::MakeMaker::YAML - clone of YAML::Tiny
-
-=head1 SYNOPSIS
-
-See L<YAML::Tiny>
-
-=head1 AUTHOR
-
-Adam Kennedy E<lt>adamk@cpan.orgE<gt>
-
-=head1 SEE ALSO
-
-L<YAML>, L<YAML::Syck>
-
-=head1 COPYRIGHT
-
-Copyright 2006 - 2010 Adam Kennedy.
-
-This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
-
-=cut
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm index fbf24156c6..bc3bd34f92 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm @@ -3,7 +3,7 @@ package ExtUtils::Mkbootstrap; # There's just too much Dynaloader incest here to turn on strict vars. use strict 'refs'; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require Exporter; our @ISA = ('Exporter'); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm index 9aac3fd74a..e7ff00ceb6 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm @@ -10,7 +10,7 @@ use Config; our @ISA = qw(Exporter); our @EXPORT = qw(&Mksymlists); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; sub Mksymlists { my(%spec) = @_; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm index 7314410926..623e01090c 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm @@ -3,7 +3,7 @@ package ExtUtils::testlib; use strict; use warnings; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; use Cwd; use File::Spec; diff --git a/cpan/ExtUtils-MakeMaker/t/00compile.t b/cpan/ExtUtils-MakeMaker/t/00compile.t index d627fb1c61..cdec1b977c 100644 --- a/cpan/ExtUtils-MakeMaker/t/00compile.t +++ b/cpan/ExtUtils-MakeMaker/t/00compile.t @@ -12,7 +12,11 @@ BEGIN { $Has_Test_Pod = eval 'use Test::Pod 0.95; 1'; } +plan skip_all => 'No MANIFEST' + unless -e "../MANIFEST"; + chdir ".."; + my $manifest = "MANIFEST"; open(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!"; my @modules = map { m{^lib/(\S+)}; $1 } diff --git a/cpan/ExtUtils-MakeMaker/t/INST.t b/cpan/ExtUtils-MakeMaker/t/INST.t index 6aac294fbf..b5ece3e157 100644 --- a/cpan/ExtUtils-MakeMaker/t/INST.t +++ b/cpan/ExtUtils-MakeMaker/t/INST.t @@ -46,12 +46,12 @@ my $mm = WriteMakefile( ); like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Liar\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? Big::Liar's\ vars\n INST_LIB\ =\ \S+\n INST_ARCHLIB\ =\ \S+\n Writing\ $Makefile\ for\ Big::Dummy\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? }x ); undef $stdout; untie *STDOUT; @@ -128,12 +128,12 @@ $mm = WriteMakefile( ); like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Liar\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? Big::Liar's\ vars\n INST_LIB\ =\ \S+\n INST_ARCHLIB\ =\ \S+\n Writing\ $Makefile\ for\ Big::Dummy\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? }x ); undef $stdout; untie *STDOUT; diff --git a/cpan/ExtUtils-MakeMaker/t/INST_PREFIX.t b/cpan/ExtUtils-MakeMaker/t/INST_PREFIX.t index fbb18a375a..5bd0a5dd80 100644 --- a/cpan/ExtUtils-MakeMaker/t/INST_PREFIX.t +++ b/cpan/ExtUtils-MakeMaker/t/INST_PREFIX.t @@ -50,12 +50,12 @@ my $mm = WriteMakefile( like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Liar\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? Big::Liar's\ vars\n INST_LIB\ =\ \S+\n INST_ARCHLIB\ =\ \S+\n Writing\ $Makefile\ for\ Big::Dummy\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? }x ); is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' ); @@ -80,12 +80,12 @@ $mm = WriteMakefile( ); like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Liar\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? Big::Liar's\ vars\n INST_LIB\ =\ \S+\n INST_ARCHLIB\ =\ \S+\n Writing\ $Makefile\ for\ Big::Dummy\n - Writing\ MYMETA.yml\n + (?:Writing\ MYMETA.yml\ and\ MYMETA.json\n)? }x ); undef $stdout; untie *STDOUT; diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing.json b/cpan/ExtUtils-MakeMaker/t/META_for_testing.json new file mode 100644 index 0000000000..c0ba55b9a0 --- /dev/null +++ b/cpan/ExtUtils-MakeMaker/t/META_for_testing.json @@ -0,0 +1,60 @@ +{ + "abstract" : "Create a module Makefile", + "author" : [ + "Michael G Schwern <schwern@pobox.com>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "ExtUtils-MakeMaker", + "no_index" : { + "directory" : [ + "t", + "inc" + ], + "package" : [ + "DynaLoader", + "in" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "Data::Dumper" : 0 + } + }, + "configure" : { + "requires" : {} + }, + "runtime" : { + "requires" : { + "DirHandle" : 0, + "File::Basename" : 0, + "File::Spec" : "0.8", + "Pod::Man" : 0, + "perl" : "5.006" + } + } + }, + "release_status" : "testing", + "resources" : { + "bugtracker" : { + "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker" + }, + "homepage" : "http://makemaker.org", + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker" + }, + "x_MailingList" : "makemaker@perl.org" + }, + "version" : "6.57_07" +} diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing.yml b/cpan/ExtUtils-MakeMaker/t/META_for_testing.yml new file mode 100644 index 0000000000..bda66a12eb --- /dev/null +++ b/cpan/ExtUtils-MakeMaker/t/META_for_testing.yml @@ -0,0 +1,34 @@ +--- +abstract: 'Create a module Makefile' +author: + - 'Michael G Schwern <schwern@pobox.com>' +build_requires: + Data::Dumper: 0 +configure_requires: {} +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: ExtUtils-MakeMaker +no_index: + directory: + - t + - inc + package: + - DynaLoader + - in +requires: + DirHandle: 0 + File::Basename: 0 + File::Spec: 0.8 + Pod::Man: 0 + perl: 5.006 +resources: + bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker + homepage: http://makemaker.org + license: http://dev.perl.org/licenses/ + repository: http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker + x_MailingList: makemaker@perl.org +version: 6.57_07 diff --git a/cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml b/cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml new file mode 100644 index 0000000000..04d809a89b --- /dev/null +++ b/cpan/ExtUtils-MakeMaker/t/META_for_testing_tricky_version.yml @@ -0,0 +1,23 @@ +--- #YAML:1.0 +name: GD-Barcode-Code93 +version: 1.4 +abstract: Code 93 implementation of GD::Barcode family +author: + - Chris DiMartino +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 +requires: + GD: 0 + GD::Barcode: 0 +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.55_02 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/cpan/ExtUtils-MakeMaker/t/MM_Win32.t b/cpan/ExtUtils-MakeMaker/t/MM_Win32.t index 39475ae3b4..98601d6aff 100644 --- a/cpan/ExtUtils-MakeMaker/t/MM_Win32.t +++ b/cpan/ExtUtils-MakeMaker/t/MM_Win32.t @@ -10,7 +10,7 @@ use Test::More; BEGIN { if ($^O =~ /MSWin32/i) { - plan tests => 49; + plan tests => 61; } else { plan skip_all => 'This is not Win32'; } @@ -272,6 +272,100 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; is( $MM->pasthru(), $pastru, 'pasthru()' ); } +# _identify_compiler_environment() +{ + sub _run_cc_id { + my ( $config ) = @_; + + $config->{cc} ||= ''; + + my @cc_env = ExtUtils::MM_Win32::_identify_compiler_environment( $config ); + + my %cc_env = ( BORLAND => $cc_env[0], GCC => $cc_env[1], DLLTOOL => $cc_env[2] ); + + return \%cc_env; + } + + sub _check_cc_id_value { + my ( $test ) = @_; + + my $res = _run_cc_id( $test->{config} ); + + fail( "unknown key '$test->{key}'" ) if !exists $res->{$test->{key}}; + my $val = $res->{$test->{key}}; + + is( $val, $test->{expect}, $test->{desc} ); + + return; + } + + my @tests = ( + { + config => {}, + key => 'DLLTOOL', expect => 'dlltool', + desc => 'empty dlltool defaults to "dlltool"', + }, + { + config => { dlltool => 'test' }, + key => 'DLLTOOL', expect => 'test', + desc => 'dlltool value is taken over verbatim from %Config, if set', + }, + { + config => {}, + key => 'GCC', expect => 0, + desc => 'empty cc is not recognized as gcc', + }, + { + config => { cc => 'gcc' }, + key => 'GCC', expect => 1, + desc => 'plain "gcc" is recognized', + }, + { + config => { cc => 'C:/MinGW/bin/gcc.exe' }, + key => 'GCC', expect => 1, + desc => 'fully qualified "gcc" is recognized', + }, + { + config => { cc => 'C:/MinGW/bin/gcc-1.exe' }, + key => 'GCC', expect => 1, + desc => 'dash-extended gcc is recognized', + }, + { + config => { cc => 'C:/MinGW/bin/gcc_1.exe' }, + key => 'GCC', expect => 0, + desc => 'underscore-extended gcc is not recognized', + }, + { + config => {}, + key => 'BORLAND', expect => 0, + desc => 'empty cc is not recognized as borland', + }, + { + config => { cc => 'bcc' }, + key => 'BORLAND', expect => 1, + desc => 'plain "bcc" is recognized', + }, + { + config => { cc => 'C:/Borland/bin/bcc.exe' }, + key => 'BORLAND', expect => 0, + desc => 'fully qualified borland cc is not recognized', + }, + { + config => { cc => 'bcc-1.exe' }, + key => 'BORLAND', expect => 1, + desc => 'dash-extended borland cc is recognized', + }, + { + config => { cc => 'bcc_1.exe' }, + key => 'BORLAND', expect => 1, + desc => 'underscore-extended borland cc is recognized', + }, + ); + + _check_cc_id_value($_) for @tests; + +} + package FakeOut; sub TIEHANDLE { diff --git a/cpan/ExtUtils-MakeMaker/t/basic.t b/cpan/ExtUtils-MakeMaker/t/basic.t index 9cd1d931c3..64b3017745 100644 --- a/cpan/ExtUtils-MakeMaker/t/basic.t +++ b/cpan/ExtUtils-MakeMaker/t/basic.t @@ -11,7 +11,7 @@ use strict; use Config; use ExtUtils::MakeMaker; -use Test::More tests => 98; +use Test::More tests => 171; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; use File::Find; @@ -31,8 +31,8 @@ $| = 1; ok( setup_recurs(), 'setup' ); END { - ok( chdir File::Spec->updir ); - ok( teardown_recurs(), 'teardown' ); + ok chdir File::Spec->updir or die; + ok teardown_recurs, "teardown"; } ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) || @@ -230,123 +230,162 @@ my $distdir = 'Big-Dummy-0.01'; $distdir =~ s/\./_/g if $Is_VMS; my $meta_yml = "$distdir/META.yml"; my $mymeta_yml = "$distdir/MYMETA.yml"; - -ok( !-f 'META.yml', 'META.yml not written to source dir' ); -ok( -f $meta_yml, 'META.yml written to dist dir' ); -ok( !-e "META_new.yml", 'temp META.yml file not left around' ); - -ok( -f 'MYMETA.yml', 'MYMETA.yml is written to source dir' ); -ok( -f $mymeta_yml, 'MYMETA.yml is written to dist dir on disttest' ); +my $meta_json = "$distdir/META.json"; +my $mymeta_json = "$distdir/MYMETA.json"; SKIP: { - # META.yml spec 1.4 was added in 0.11 - skip "Test::YAML::Meta >= 0.11 required", 4 - unless eval { require Test::YAML::Meta } and - Test::YAML::Meta->VERSION >= 0.11; - - Test::YAML::Meta::meta_spec_ok($meta_yml); - Test::YAML::Meta::meta_spec_ok($mymeta_yml); -} - -ok open META, $meta_yml or diag $!; -my $meta = join '', <META>; -ok close META; - -is $meta, <<"END"; ---- #YAML:1.0 -name: Big-Dummy -version: 0.01 -abstract: Try "our" hot dog's -author: - - Michael G Schwern <schwern\@pobox.com> -license: unknown -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 -build_requires: - warnings: 0 -requires: - strict: 0 -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -END - -my $mymeta_expected_content=<<"END"; ---- -abstract: "Try \\"our\\" hot dog's" -author: - - 'Michael G Schwern <schwern\@pobox.com>' -build_requires: - warnings: 0 -configure_requires: - ExtUtils::MakeMaker: 0 -distribution_type: module -dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION' -license: unknown -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -name: Big-Dummy -no_index: - directory: - - t - - inc -requires: - strict: 0 -version: 0.01 -END - -{ -ok open META, $mymeta_yml or diag $!; -my $mymeta_content = join '', <META>; -ok close META; - -is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (using Parse::CPAN::Meta) content is correct"); -} - -{ -ok open META, 'MYMETA.yml' or diag $!; -my $mymeta_content = join '', <META>; -ok close META; + skip "CPAN::Meta required", 104 unless eval { require CPAN::Meta }; + + ok( !-f 'META.yml', 'META.yml not written to source dir' ); + ok( -f $meta_yml, 'META.yml written to dist dir' ); + ok( !-e "META_new.yml", 'temp META.yml file not left around' ); + + ok( -f 'MYMETA.yml', 'MYMETA.yml is written to source dir' ); + ok( -f $mymeta_yml, 'MYMETA.yml is written to dist dir on disttest' ); + + ok( !-f 'META.json', 'META.json not written to source dir' ); + ok( -f $meta_json, 'META.json written to dist dir' ); + ok( !-e "META_new.json", 'temp META.json file not left around' ); + + ok( -f 'MYMETA.json', 'MYMETA.json is written to source dir' ); + ok( -f $mymeta_json, 'MYMETA.json is written to dist dir on disttest' ); + + for my $case ( + ['META.yml', $meta_yml], + ['MYMETA.yml', $mymeta_yml], + ['META.json', $meta_json], + ['MYMETA.json', $mymeta_json], + ['MYMETA.yml', 'MYMETA.yml'], + ['MYMETA.json', 'MYMETA.json'], + ) { + my ($label, $meta_name) = @$case; + ok( + my $obj = eval { + CPAN::Meta->load_file($meta_name, {lazy_validation => 0}) + }, + "$label validates" + ); + my $is = sub { + my ($m,$e) = @_; + is($obj->$m, $e, "$label -> $m") + }; + my $is_list = sub { + my ($m,$e) = @_; + is_deeply([$obj->$m], $e, "$label -> $m") + }; + my $is_map = sub { + my ($m,$e) = @_; + is_deeply($obj->$m, $e, "$label -> $m") + }; + $is->( name => "Big-Dummy" ); + $is->( version => "0.01" ); + $is->( abstract => q{Try "our" hot dog's} ); + $is_list->( licenses => [q{unknown}] ); + $is_list->( authors => [ q{Michael G Schwern <schwern@pobox.com>} ] ); + $is_map->( prereqs => { + configure => { + requires => { + 'ExtUtils::MakeMaker' => 0 + }, + }, + build => { + requires => { + 'warnings' => 0 + } + }, + runtime => { + requires => { + 'strict' => 0 + } + }, + } + ); + $is_map->( + no_index => { + directory => [qw/t inc/], + } + ); + $is->( dynamic_config => ($label =~ /MYMETA/) ? 0 : 1 ); + } -is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (generated from scratch)content is correct"); + my $manifest = maniread("$distdir/MANIFEST"); + # VMS is non-case preserving, so we can't know what the MANIFEST will + # look like. :( + _normalize($manifest); + is( $manifest->{'meta.yml'}, 'Module YAML meta-data (added by MakeMaker)', + "MANIFEST has META.yml" + ); + is( $manifest->{'meta.json'}, 'Module JSON meta-data (added by MakeMaker)', + "MANFIEST has META.json" + ); + + # Test NO_META META.yml suppression + for my $f ( $meta_yml, $meta_json, 'MYMETA.yml', 'MYMETA.json' ) { + 1 while unlink $f; + } + ok( !-f $meta_yml, 'META.yml deleted' ); + ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); + ok( !-f $meta_json, 'META.json deleted' ); + ok( !-f 'MYMETA.json','MYMETA.json deleted' ); + + @mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); + ok( -f 'MYMETA.yml', 'MYMETA.yml generation not suppressed by NO_META' ); + ok( -f 'MYMETA.json', 'MYMETA.json generation not suppressed by NO_META' ); + cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); + ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); + ok( !-f $meta_json, 'META.json generation suppressed by NO_META' ); + my $distdir_out = run("$make distdir"); + is( $?, 0, 'distdir' ) || diag($distdir_out); + ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); + ok( !-f $meta_json, 'META.json generation suppressed by NO_META' ); + + for my $f ( 'MYMETA.yml', 'MYMETA.json' ) { + 1 while unlink $f; + } + ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); + ok( !-f 'MYMETA.json','MYMETA.json deleted' ); + + @mpl_out = run(qq{$perl Makefile.PL "NO_MYMETA=1"}); + cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); + $distdir_out = run("$make distdir"); + is( $?, 0, 'distdir' ) || diag($distdir_out); + ok( !-f 'MYMETA.yml','MYMETA.yml generation suppressed by NO_MYMETA' ); + ok( !-f 'MYMETA.json','MYMETA.json generation suppressed by NO_MYMETA' ); + ok( -f $meta_yml, 'META.yml generation not suppressed by NO_MYMETA' ); + ok( -f $meta_json, 'META.json generation not suppressed by NO_MYMETA' ); + + # Test MYMETA really comes from META except for prereqs + for my $f ( $meta_yml, $meta_json, 'MYMETA.yml', 'MYMETA.json' ) { + 1 while unlink $f; + } + @mpl_out = run(qq{$perl Makefile.PL}); + cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); + $distdir_out = run("$make distdir"); + is( $?, 0, 'distdir' ) || diag($distdir_out); + ok( -f $meta_yml, 'META.yml generated in distdir' ); + ok( -f $meta_json, 'META.json generated in distdir' ); + ok( ! -f $mymeta_yml, 'MYMETA.yml not yet generated in distdir' ); + ok( ! -f $mymeta_json, 'MYMETA.json generated in distdir' ); + my $edit_meta = CPAN::Meta->load_file($meta_json)->as_struct; + $edit_meta->{abstract} = "New abstract"; + my $meta_obj = CPAN::Meta->new($edit_meta); + is( $meta_obj->abstract, "New abstract", "MYMETA abstract from META, not Makefile.PL"); + ok( $meta_obj->save($meta_json), "Saved edited META.json in distdir" ); + ok( $meta_obj->save($meta_yml, {version => 1.4}), "Saved edited META.yml in distdir"); + ok( chdir $distdir ); + ok( -f 'META.yml', 'META.yml confirmed in distdir' ); + ok( -f 'META.json', 'META.json confirmed in distdir' ); + @mpl_out = run(qq{$perl Makefile.PL}); + cmp_ok( $?, '==', 0, 'Makefile.PL in distdir exited with zero' ) || diag(@mpl_out); + ok( chdir File::Spec->updir ); + ok( -f $mymeta_yml, 'MYMETA.yml generated in distdir' ); + ok( -f $mymeta_json, 'MYMETA.json generated in distdir' ); + $meta_obj = CPAN::Meta->load_file($meta_json); + is( $meta_obj->abstract, "New abstract", "META abstract is same as was saved"); + $meta_obj = CPAN::Meta->load_file($mymeta_json); + is( $meta_obj->abstract, "New abstract", "MYMETA abstract from META, not Makefile.PL"); } -my $manifest = maniread("$distdir/MANIFEST"); -# VMS is non-case preserving, so we can't know what the MANIFEST will -# look like. :( -_normalize($manifest); -is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' ); - - -# Test NO_META META.yml suppression -unlink $meta_yml; -unlink 'MYMETA.yml'; -ok( !-f $meta_yml, 'META.yml deleted' ); -ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); -@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); -ok( -f 'MYMETA.yml', 'MYMETA.yml generation not suppressed by NO_META' ); -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); -ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); -my $distdir_out = run("$make distdir"); -is( $?, 0, 'distdir' ) || diag($distdir_out); -ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); -unlink 'MYMETA.yml'; - -ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); -@mpl_out = run(qq{$perl Makefile.PL "NO_MYMETA=1"}); -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); -$distdir_out = run("$make distdir"); -is( $?, 0, 'distdir' ) || diag($distdir_out); -ok( !-f 'MYMETA.yml','MYMETA.yml generation suppressed by NO_MYMETA' ); -ok( -f $meta_yml, 'META.yml generation not suppressed by NO_MYMETA' ); # Make sure init_dirscan doesn't go into the distdir diff --git a/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/SAS.pm b/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/SAS.pm index a8d31e1d60..04d9bd3259 100644 --- a/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/SAS.pm +++ b/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/SAS.pm @@ -1,67 +1,67 @@ -package MakeMaker::Test::Setup::SAS;
-
-@ISA = qw(Exporter);
-require Exporter;
-@EXPORT = qw(setup_recurs teardown_recurs);
-
-use strict;
-use File::Path;
-use File::Basename;
-
-our $dirname='Multiple-Authors';
-my %Files = (
- $dirname.'/Makefile.PL' => <<'END',
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
- NAME => 'Multiple::Authors',
- AUTHOR => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],
- VERSION_FROM => 'lib/Multiple/Authors.pm',
- PREREQ_PM => { strict => 0 },
-);
-END
-
- $dirname.'/lib/Multiple/Authors.pm' => <<'END',
-package Multiple::Authors;
-
-$VERSION = 0.05;
-
-=head1 NAME
-
-Multiple::Authors - several authors
-
-=cut
-
-1;
-END
-
-);
-
-
-sub setup_recurs {
- while(my($file, $text) = each %Files) {
- # Convert to a relative, native file path.
- $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
-
- my $dir = dirname($file);
- mkpath $dir;
- open(FILE, ">$file") || die "Can't create $file: $!";
- print FILE $text;
- close FILE;
- }
-
- return 1;
-}
-
-sub teardown_recurs {
- foreach my $file (keys %Files) {
- my $dir = dirname($file);
- if( -e $dir ) {
- rmtree($dir) || return;
- }
- }
- return 1;
-}
-
-
-1;
+package MakeMaker::Test::Setup::SAS; + +@ISA = qw(Exporter); +require Exporter; +@EXPORT = qw(setup_recurs teardown_recurs); + +use strict; +use File::Path; +use File::Basename; + +our $dirname='Multiple-Authors'; +my %Files = ( + $dirname.'/Makefile.PL' => <<'END', +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'Multiple::Authors', + AUTHOR => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'], + VERSION_FROM => 'lib/Multiple/Authors.pm', + PREREQ_PM => { strict => 0 }, +); +END + + $dirname.'/lib/Multiple/Authors.pm' => <<'END', +package Multiple::Authors; + +$VERSION = 0.05; + +=head1 NAME + +Multiple::Authors - several authors + +=cut + +1; +END + +); + + +sub setup_recurs { + while(my($file, $text) = each %Files) { + # Convert to a relative, native file path. + $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file); + + my $dir = dirname($file); + mkpath $dir; + open(FILE, ">$file") || die "Can't create $file: $!"; + print FILE $text; + close FILE; + } + + return 1; +} + +sub teardown_recurs { + foreach my $file (keys %Files) { + my $dir = dirname($file); + if( -e $dir ) { + rmtree($dir) || return; + } + } + return 1; +} + + +1; diff --git a/cpan/ExtUtils-MakeMaker/t/meta_convert.t b/cpan/ExtUtils-MakeMaker/t/meta_convert.t new file mode 100644 index 0000000000..84875bab1b --- /dev/null +++ b/cpan/ExtUtils-MakeMaker/t/meta_convert.t @@ -0,0 +1,127 @@ +BEGIN { + chdir '..' if -d '../t'; + unshift @INC, 't/lib'; + use lib 'lib'; +} + +use strict; +use warnings; +use Test::More 'no_plan'; + +require ExtUtils::MM_Any; + +sub ExtUtils::MM_Any::quote_literal { $_[1] } + +my $new_mm = sub { + return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any'; +}; + +my $warn_ok = sub { + my($code, $want, $name) = @_; + + my @have; + my $ret; + { + local $SIG{__WARN__} = sub { push @have, @_ }; + $ret = $code->(); + } + + like join("", @have), $want, $name; + return $ret; +}; + +my $version_regex = qr/version: ''/; +my $version_action = "they're converted to empty string"; + + +note "Filename as version"; { + my $mm = $new_mm->( + DISTNAME => 'Net::FTP::Recursive', + VERSION => 'Recursive.pm', + ); + + my $res = $warn_ok->( + sub { eval { $mm->metafile_target } }, + qr{Can't parse version 'Recursive.pm'} + ); + ok $res, 'we know how to deal with bogus versions defined in Makefile.PL'; + like $res, $version_regex, $version_action; +} + + +note "'undef' version from parse_version"; { + my $mm = $new_mm->( + DISTNAME => 'Image::Imgur', + VERSION => 'undef', + ); + my $res = $warn_ok->( + sub { eval { $mm->metafile_target } }, + qr{Can't parse version 'undef'} + ); + ok $res, q|when there's no $VERSION in Module.pm, $self->{VERSION} = 'undef'; via MM_Unix::parse_version and we know how to deal with that|; + like $res, $version_regex, $version_action; +} + + +note "x.y.z version"; { + my $mm = $new_mm->( + DISTNAME => 'SQL::Library', + VERSION => 0.0.3, + ); + + # It would be more useful if the warning got translated to visible characters + my $res = $warn_ok->( + sub { eval { $mm->metafile_target } }, + qr{Can't parse version '\x00\x00\x03'} + ); + ok $res, q|we know how to deal with our $VERSION = 0.0.3; style versions defined in the module|; + like $res, $version_regex, $version_action; +} + + +note ".5 version"; { + my $mm = $new_mm->( + DISTNAME => 'Array::Suffix', + VERSION => '.5', + ); + my $res = $warn_ok->( + sub { eval { $mm->metafile_target } }, + qr{Can't parse version '.5'} + ); + ok $res, q|we know how to deal with our $VERSION = '.5'; style versions defined in the module|; + like $res, $version_regex, $version_action; +} + + +note "Non-camel case metadata"; { + my $mm = $new_mm->( + DISTNAME => 'Attribute::Signature', + META_MERGE => { + resources => { + repository => 'http://github.com/chorny/Attribute-Signature', + 'Repository-clone' => 'git://github.com/chorny/Attribute-Signature.git', + }, + }, + ); + my $res = eval { $mm->metafile_target }; + ok $res, q|we know how to deal with non-camel-cased custom meta resource keys defined in Makefile.PL|; + like $res, qr/x_Repositoryclone:/, "they're camel-cased"; +} + + +note "version object in provides"; { + my $mm = $new_mm->( + DISTNAME => 'CPAN::Testers::ParseReport', + VERSION => '2.34', + META_ADD => { + provides => { + "CPAN::Testers::ParseReport" => { + version => version->declare("v1.2.3"), + file => "lib/CPAN/Testers/ParseReport.pm" + } + } + }, + ); + my $res = eval { $mm->metafile_target }; + like $res, qr{version: \s* v1.2.3}x; +} diff --git a/cpan/ExtUtils-MakeMaker/t/metafile_data.t b/cpan/ExtUtils-MakeMaker/t/metafile_data.t index 9e57cae79c..4c8fa76231 100644 --- a/cpan/ExtUtils-MakeMaker/t/metafile_data.t +++ b/cpan/ExtUtils-MakeMaker/t/metafile_data.t @@ -3,12 +3,51 @@ BEGIN { } use strict; -use Test::More tests => 7; +use Test::More tests => 19; use Data::Dumper; +use File::Temp; +use Cwd; +use Parse::CPAN::Meta; require ExtUtils::MM_Any; +sub in_dir(&;$) { + my $code = shift; + my $dir = shift || File::Temp->newdir; + + # chdir to the new directory + my $orig_dir = cwd(); + chdir $dir or die "Can't chdir to $dir: $!"; + + # Run the code, but trap the error so we can chdir back + my $return; + my $ok = eval { $return = $code->(); 1; }; + my $err = $@; + + # chdir back + chdir $orig_dir or die "Can't chdir to $orig_dir: $!"; + + # rethrow if necessary + die $err unless $ok; + + return $return; +} + +sub mymeta_ok { + my($have, $want, $name) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my $have_gen = delete $have->{generated_by}; + my $want_gen = delete $want->{generated_by}; + + is_deeply $have, $want, $name; + like $have_gen, qr{CPAN::Meta}, "CPAN::Meta mentioned in the generated_by"; + + return; +} + my $new_mm = sub { return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any'; }; @@ -22,12 +61,13 @@ my $new_mm = sub { }, ); - is_deeply [$mm->metafile_data], [ + is_deeply {$mm->metafile_data}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -46,15 +86,16 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ]; + }; - is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [ + is_deeply {$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -73,7 +114,7 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ], 'rt.cpan.org 39348'; + }, 'rt.cpan.org 39348'; } @@ -88,7 +129,7 @@ my $new_mm = sub { }, ); - is_deeply [$mm->metafile_data( + is_deeply {$mm->metafile_data( { configure_requires => { Stuff => 2.34 @@ -101,13 +142,14 @@ my $new_mm = sub { }, wibble => 23 }, - )], - [ + )}, + { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => ['Some Guy'], license => 'unknown', + dynamic_config => 1, distribution_type => 'script', configure_requires => { @@ -135,7 +177,7 @@ my $new_mm = sub { wibble => 23, wobble => 42, - ]; + }; } @@ -150,12 +192,13 @@ my $new_mm = sub { MIN_PERL_VERSION => 5.006, ); - is_deeply [$mm->metafile_data], [ + is_deeply {$mm->metafile_data}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -178,7 +221,7 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ]; + }; } @@ -196,12 +239,13 @@ my $new_mm = sub { }, ); - is_deeply [$mm->metafile_data], [ + is_deeply {$mm->metafile_data}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -225,7 +269,7 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ]; + }; } # Test CONFIGURE_REQUIRES @@ -241,12 +285,13 @@ my $new_mm = sub { }, ); - is_deeply [$mm->metafile_data], [ + is_deeply {$mm->metafile_data}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -265,7 +310,7 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ],'CONFIGURE_REQUIRES'; + },'CONFIGURE_REQUIRES'; } # Test BUILD_REQUIRES @@ -281,12 +326,13 @@ my $new_mm = sub { }, ); - is_deeply [$mm->metafile_data], [ + is_deeply {$mm->metafile_data}, { name => 'Foo-Bar', version => 1.23, - abstract => undef, + abstract => 'unknown', author => [], license => 'unknown', + dynamic_config => 1, distribution_type => 'module', configure_requires => { @@ -305,5 +351,149 @@ my $new_mm = sub { url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', version => 1.4 }, - ],'CONFIGURE_REQUIRES'; + },'CONFIGURE_REQUIRES'; +} + +# Test _REQUIRES key priority over META_ADD + +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + BUILD_REQUIRES => { + "Fake::Module1" => 1.01, + }, + META_ADD => (my $meta_add = { build_requires => {} }), + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + ); + + is_deeply {$mm->metafile_data($meta_add)}, { + name => 'Foo-Bar', + version => 1.23, + abstract => 'unknown', + author => [], + license => 'unknown', + dynamic_config => 1, + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { }, + + no_index => { + directory => [qw(t inc)], + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + },'META.yml data (META_ADD wins)'; + + + # Yes, this is all hard coded. + require CPAN::Meta; + my $want_mymeta = { + name => 'ExtUtils-MakeMaker', + version => '6.57_07', + abstract => 'Create a module Makefile', + author => ['Michael G Schwern <schwern@pobox.com>'], + license => 'perl', + dynamic_config => 0, + + requires => { + "DirHandle" => 0, + "File::Basename" => 0, + "File::Spec" => "0.8", + "Pod::Man" => 0, + "perl" => "5.006" + }, + + configure_requires => { + }, + build_requires => { + 'Fake::Module1' => 1.01, + }, + + resources => { + license => 'http://dev.perl.org/licenses/', + homepage => 'http://makemaker.org', + bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=ExtUtils-MakeMaker', + repository => 'http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker', + x_MailingList => 'makemaker@perl.org', + }, + + no_index => { + directory => [qw(t inc)], + package => ["DynaLoader", "in"], + }, + + generated_by => "ExtUtils::MakeMaker version 6.5707, CPAN::Meta::Converter version 2.110580", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + }; + + mymeta_ok $mm->mymeta("t/META_for_testing.json"), + $want_mymeta, + 'MYMETA JSON data (BUILD_REQUIRES wins)'; + + mymeta_ok $mm->mymeta("t/META_for_testing.yml"), + $want_mymeta, + 'MYMETA YAML data (BUILD_REQUIRES wins)'; +} + + +note "CPAN::Meta bug using the module version instead of the meta spec version"; { + my $mm = $new_mm->( + NAME => 'GD::Barcode::Code93', + AUTHOR => 'Chris DiMartino', + ABSTRACT => 'Code 93 implementation of GD::Barcode family', + PREREQ_PM => { + 'GD::Barcode' => 0, + 'GD' => 0 + }, + VERSION => '1.4', + ); + + my $meta = $mm->mymeta("t/META_for_testing_tricky_version.yml"); + is $meta->{'meta-spec'}{version}, 1.4; + + in_dir { + $mm->write_mymeta($meta); + ok -e "MYMETA.yml"; + ok -e "MYMETA.json"; + + my $meta_yml = Parse::CPAN::Meta->load_file("MYMETA.yml"); + is $meta_yml->{'meta-spec'}{version}, 1.4, "MYMETA.yml correctly downgraded to 1.4"; + + my $meta_json = Parse::CPAN::Meta->load_file("MYMETA.json"); + cmp_ok $meta_json->{'meta-spec'}{version}, ">=", 2, "MYMETA.json at 2 or better"; + }; + +} + + +note "A bad license string"; { + my $mm = $new_mm->( + DISTNAME => 'Foo::Bar', + VERSION => '1.4', + LICENSE => 'death and retribution', + ); + + in_dir { + my $meta = $mm->mymeta; + $mm->write_mymeta($meta); + + my $meta_yml = Parse::CPAN::Meta->load_file("MYMETA.yml"); + is $meta_yml->{license}, "unknown", "in yaml"; + + my $meta_json = Parse::CPAN::Meta->load_file("MYMETA.json"); + is_deeply $meta_json->{license}, ["unknown"], "in json"; + }; } diff --git a/cpan/ExtUtils-MakeMaker/t/min_perl_version.t b/cpan/ExtUtils-MakeMaker/t/min_perl_version.t index 6d892b95ba..fb19ae1bc0 100644 --- a/cpan/ExtUtils-MakeMaker/t/min_perl_version.t +++ b/cpan/ExtUtils-MakeMaker/t/min_perl_version.t @@ -8,7 +8,7 @@ BEGIN { } use strict; -use Test::More tests => 35; +use Test::More tests => 32; use TieOut; use MakeMaker::Test::Utils; @@ -102,13 +102,11 @@ END MIN_PERL_VERSION => 'foobar', ); }; - ok( '' ne $warnings, 'MIN_PERL_VERSION=foobar triggers a warning' ); - is( $warnings, <<'END', ' with expected message text' ); + is( $@, <<'END', 'Invalid MIN_PERL_VERSION is fatal' ); Warning: MIN_PERL_VERSION is not in a recognized format. Recommended is a quoted numerical value like '5.005' or '5.008001'. END - is( $@, '', ' and without a hard failure' ); } @@ -158,7 +156,6 @@ END ok( -e $makefile, 'Makefile present' ); } - # ----- ppd output ----- { my $ppd_file = 'Min-PerlVers.ppd'; @@ -180,24 +177,31 @@ END my $distdir = 'Min-PerlVers-0.05'; $distdir =~ s{\.}{_}g if $Is_VMS; - my $mymeta_yml = "MYMETA.yml"; - my $mymeta = slurp($mymeta_yml); - - ok( defined($mymeta), ' MYMETA.yml present' ); - - like( $mymeta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n}, - ' MYMETA.yml content good'); - my $meta_yml = "$distdir/META.yml"; + my $meta_json = "$distdir/META.json"; my @make_out = run(qq{$make metafile}); END { rmtree $distdir } - cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out); - my $meta = slurp($meta_yml); - ok( defined($meta), ' META.yml present' ); - - like( $meta, qr{\nrequires:[^\S\n]*\n\s+perl:\s+5\.005\n\s+strict:\s+0\n}, - ' META.yml content good'); + SKIP: { + skip "CPAN::Meta required", 4 + unless eval { require CPAN::Meta }; + + for my $case ( + ['META.yml', $meta_yml], + ['META.json', $meta_json], + ) { + my ($label, $meta_name) = @$case; + ok( + my $obj = eval { + CPAN::Meta->load_file($meta_name, {lazy_validation => 0}) + }, + "$label validates" + ); + is( $obj->prereqs->{runtime}{requires}{perl}, '5.005', + "$label has runtime/requires perl 5.005" + ); + } + } } __END__ diff --git a/cpan/ExtUtils-MakeMaker/t/miniperl.t b/cpan/ExtUtils-MakeMaker/t/miniperl.t index 2334eb05d8..9a4def2028 100644 --- a/cpan/ExtUtils-MakeMaker/t/miniperl.t +++ b/cpan/ExtUtils-MakeMaker/t/miniperl.t @@ -6,7 +6,15 @@ use strict; use lib 't/lib'; -use Test::More 'no_plan'; +use Test::More; + +# In a BEGIN block so the END tests aren't registered. +BEGIN { + plan skip_all => "miniperl test only necessary for the perl core" + if !$ENV{PERL_CORE}; + + plan "no_plan"; +} BEGIN { ok !$INC{"ExtUtils/MakeMaker.pm"}, "MakeMaker is not yet loaded"; diff --git a/cpan/ExtUtils-MakeMaker/t/oneliner.t b/cpan/ExtUtils-MakeMaker/t/oneliner.t index b040872011..4523441141 100644 --- a/cpan/ExtUtils-MakeMaker/t/oneliner.t +++ b/cpan/ExtUtils-MakeMaker/t/oneliner.t @@ -7,7 +7,7 @@ BEGIN { chdir 't'; use MakeMaker::Test::Utils; -use Test::More tests => 6; +use Test::More tests => 11; use File::Spec; my $TB = Test::More->builder; @@ -40,6 +40,13 @@ try_oneliner(q{$PATH = 'foo'; print $PATH},[], q{foo}, 'dollar signs' ); # switches? try_oneliner(q{print 'foo'}, ['-l'], "foo\n", 'switches' ); +# some DOS-specific things +try_oneliner(q{print " \" "}, [], q{ " }, 'single quote' ); +try_oneliner(q{print " < \" "}, [], q{ < " }, 'bracket, then quote' ); +try_oneliner(q{print " \" < "}, [], q{ " < }, 'quote, then bracket' ); +try_oneliner(q{print " < \"\" < \" < \" < "}, [], q{ < "" < " < " < }, 'quotes and brackets mixed' ); +try_oneliner(q{print " < \" | \" < | \" < \" < "}, [], q{ < " | " < | " < " < }, 'brackets, pipes and quotes' ); + # XXX gotta rethink the newline test. The Makefile does newline # escaping, then the shell. diff --git a/cpan/ExtUtils-MakeMaker/t/prereq.t b/cpan/ExtUtils-MakeMaker/t/prereq.t index 094fee75bf..07bbaf02d3 100644 --- a/cpan/ExtUtils-MakeMaker/t/prereq.t +++ b/cpan/ExtUtils-MakeMaker/t/prereq.t @@ -8,7 +8,7 @@ BEGIN { } use strict; -use Test::More tests => 13; +use Test::More tests => 16; use TieOut; use MakeMaker::Test::Utils; @@ -36,7 +36,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || $warnings .= join '', @_; }; # prerequisite warnings are disabled while building the perl core: - local $ENV{PERL_CORE} = undef; + local $ENV{PERL_CORE} = 0; WriteMakefile( NAME => 'Big::Dummy', @@ -67,6 +67,20 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || is $warnings, "Warning: prerequisite I::Do::Not::Exist 0 not found.\n"; + + $warnings = ''; + WriteMakefile( + NAME => 'Big::Dummy', + PREREQ_PM => { + "I::Do::Not::Exist" => "", + } + ); + my @warnings = split /\n/, $warnings; + is @warnings, 2; + like $warnings[0], qr{^Unparsable version '' for prerequisite I::Do::Not::Exist\b}; + is $warnings[1], "Warning: prerequisite I::Do::Not::Exist 0 not found."; + + $warnings = ''; WriteMakefile( NAME => 'Big::Dummy', diff --git a/cpan/ExtUtils-MakeMaker/t/several_authors.t b/cpan/ExtUtils-MakeMaker/t/several_authors.t index b11d05e82d..4fa0720949 100644 --- a/cpan/ExtUtils-MakeMaker/t/several_authors.t +++ b/cpan/ExtUtils-MakeMaker/t/several_authors.t @@ -1,130 +1,151 @@ -#!/usr/bin/perl -w
-
-# This is a test checking various aspects of the optional argument
-# MIN_PERL_VERSION to WriteMakefile.
-
-BEGIN {
- unshift @INC, 't/lib';
-}
-
-use strict;
-use Test::More tests => 18;
-
-use TieOut;
-use MakeMaker::Test::Utils;
-use MakeMaker::Test::Setup::SAS;
-use File::Path;
-
-use ExtUtils::MakeMaker;
-
-# avoid environment variables interfering with our make runs
-delete @ENV{qw(LIB MAKEFLAGS)};
-
-my $perl = which_perl();
-my $make = make_run();
-my $makefile = makefile_name();
-
-chdir 't';
-
-perl_lib();
-
-ok( setup_recurs(), 'setup' );
-END {
- ok( chdir(File::Spec->updir), 'leaving dir' );
- ok( teardown_recurs(), 'teardown' );
-}
-
-ok( chdir $MakeMaker::Test::Setup::SAS::dirname, "entering dir $MakeMaker::Test::Setup::SAS::dirname" ) ||
- diag("chdir failed: $!");
-
-{
- # ----- argument verification -----
-
- my $stdout = tie *STDOUT, 'TieOut';
- ok( $stdout, 'capturing stdout' );
- my $warnings = '';
- local $SIG{__WARN__} = sub {
- $warnings .= join '', @_;
- };
-
- eval {
- WriteMakefile(
- NAME => 'Multiple::Authors',
- AUTHOR => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'],
- );
- };
- is( $warnings, '', 'arrayref in AUTHOR does not trigger a warning' );
- is( $@, '', ' nor a hard failure' );
-
-}
-
-
-{
- # ----- argument verification -----
-
- my $stdout = tie *STDOUT, 'TieOut';
- ok( $stdout, 'capturing stdout' );
- my $warnings = '';
- local $SIG{__WARN__} = sub {
- $warnings .= join '', @_;
- };
-
- eval {
- WriteMakefile(
- NAME => 'Multiple::Authors',
- CONFIGURE => sub {
- return {AUTHOR => 'John Doe <jd@example.com>',};
- },
- );
- };
- is( $warnings, '', 'scalar in AUTHOR inside CONFIGURE does not trigger a warning' );
- is( $@, '', ' nor a hard failure' );
-
-}
-
-
-# ----- generated files verification -----
-{
- unlink $makefile;
- my @mpl_out = run(qq{$perl Makefile.PL});
- END { unlink $makefile, makefile_backup() }
-
- cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out);
- ok( -e $makefile, 'Makefile present' );
-}
-
-
-# ----- ppd output -----
-{
- my $ppd_file = 'Multiple-Authors.ppd';
- my @make_out = run(qq{$make ppd});
- END { unlink $ppd_file }
-
- cmp_ok( $?, '==', 0, 'Make ppd exiting normally' ) || diag(@make_out);
-
- my $ppd_html = slurp($ppd_file);
- ok( defined($ppd_html), ' .ppd file present' );
-
- like( $ppd_html, qr{John Doe <jd\@example.com>, Jane Doe <jd\@example.com>},
- ' .ppd file content good' );
-}
-
-
-# ----- META.yml output -----
-{
- my $distdir = 'Multiple-Authors-0.05';
- $distdir =~ s{\.}{_}g if $Is_VMS;
-
- my $meta_yml = "$distdir/META.yml";
- my @make_out = run(qq{$make metafile});
- END { rmtree $distdir }
-
- cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out);
- my $meta = slurp($meta_yml);
- ok( defined($meta), ' META.yml present' );
-
- like( $meta, qr{\nauthor:\n\s+- John Doe <jd\@example.com>\n\s+- Jane Doe <jd\@example.com>\n},
- ' META.yml content good');
-}
-
-__END__
+#!/usr/bin/perl -w + +# This is a test checking various aspects of the optional argument +# MIN_PERL_VERSION to WriteMakefile. + +BEGIN { + unshift @INC, 't/lib'; +} + +use strict; +use Test::More tests => 20; + +use TieOut; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::SAS; +use File::Path; + +use ExtUtils::MakeMaker; + +# avoid environment variables interfering with our make runs +delete @ENV{qw(LIB MAKEFLAGS)}; + +my $perl = which_perl(); +my $make = make_run(); +my $makefile = makefile_name(); + +chdir 't'; + +perl_lib(); + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir(File::Spec->updir), 'leaving dir' ); + ok( teardown_recurs(), 'teardown' ); +} + +ok( chdir $MakeMaker::Test::Setup::SAS::dirname, "entering dir $MakeMaker::Test::Setup::SAS::dirname" ) || + diag("chdir failed: $!"); + +{ + # ----- argument verification ----- + + my $stdout = tie *STDOUT, 'TieOut'; + ok( $stdout, 'capturing stdout' ); + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + eval { + WriteMakefile( + NAME => 'Multiple::Authors', + AUTHOR => ['John Doe <jd@example.com>', 'Jane Doe <jd@example.com>'], + ); + }; + is( $warnings, '', 'arrayref in AUTHOR does not trigger a warning' ); + is( $@, '', ' nor a hard failure' ); + +} + + +{ + # ----- argument verification ----- + + my $stdout = tie *STDOUT, 'TieOut'; + ok( $stdout, 'capturing stdout' ); + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + eval { + WriteMakefile( + NAME => 'Multiple::Authors', + CONFIGURE => sub { + return {AUTHOR => 'John Doe <jd@example.com>',}; + }, + ); + }; + is( $warnings, '', 'scalar in AUTHOR inside CONFIGURE does not trigger a warning' ); + is( $@, '', ' nor a hard failure' ); + +} + + +# ----- generated files verification ----- +{ + unlink $makefile; + my @mpl_out = run(qq{$perl Makefile.PL}); + END { unlink $makefile, makefile_backup() } + + cmp_ok( $?, '==', 0, 'Makefile.PL exiting normally' ) || diag(@mpl_out); + ok( -e $makefile, 'Makefile present' ); +} + + +# ----- ppd output ----- +{ + my $ppd_file = 'Multiple-Authors.ppd'; + my @make_out = run(qq{$make ppd}); + END { unlink $ppd_file } + + cmp_ok( $?, '==', 0, 'Make ppd exiting normally' ) || diag(@make_out); + + my $ppd_html = slurp($ppd_file); + ok( defined($ppd_html), ' .ppd file present' ); + + like( $ppd_html, qr{John Doe <jd\@example.com>, Jane Doe <jd\@example.com>}, + ' .ppd file content good' ); +} + + +# ----- META.yml output ----- +{ + my $distdir = 'Multiple-Authors-0.05'; + $distdir =~ s{\.}{_}g if $Is_VMS; + + my $meta_yml = "$distdir/META.yml"; + my $meta_json = "$distdir/META.json"; + my @make_out = run(qq{$make metafile}); + END { rmtree $distdir } + + cmp_ok( $?, '==', 0, 'Make metafile exiting normally' ) || diag(@make_out); + + SKIP: { + skip "CPAN::Meta required", 4 + unless eval { require CPAN::Meta }; + + for my $case ( + ['META.yml', $meta_yml], + ['META.json', $meta_json], + ) { + my ($label, $meta_name) = @$case; + ok( + my $obj = eval { + CPAN::Meta->load_file($meta_name, {lazy_validation => 0}) + }, + "$label validates" + ); + is_deeply( [ $obj->authors ], + [ + q{John Doe <jd@example.com>}, + q{Jane Doe <jd@example.com>}, + ], + "$label content good" + ); + } + } +} + +__END__ diff --git a/cpan/ExtUtils-MakeMaker/t/writemakefile_args.t b/cpan/ExtUtils-MakeMaker/t/writemakefile_args.t index 421a311c18..daa8255fbe 100644 --- a/cpan/ExtUtils-MakeMaker/t/writemakefile_args.t +++ b/cpan/ExtUtils-MakeMaker/t/writemakefile_args.t @@ -225,7 +225,7 @@ VERIFY }; is( $warnings, '' ); is_deeply( $mm->{AUTHOR}, ["test"] ); - + # AUTHOR / array $warnings = ''; @@ -238,5 +238,5 @@ VERIFY }; is( $warnings, '' ); is_deeply( $mm->{AUTHOR}, ["test1","test2"] ); - + } diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 8ed35bc6ea..6ee5362039 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -150,6 +150,10 @@ L<CPANPLUS> has been upgraded from version 0.9105 to version 0.9106 =item * +L<ExtUtils::MakeMaker> has been upgraded from version 6.57_05 to version 6.58 + +=item * + L<IPC::Cmd> has been upgraded from version 0.70 to version 0.72 Capturing of command output (both C<STDOUT> and C<STDERR>) is now supported |