From 12ad1f859adc6409887cf19beebe3e8755861ab8 Mon Sep 17 00:00:00 2001 From: David Golden Date: Wed, 16 Feb 2011 09:48:51 -0500 Subject: Updated CPAN.pm to CPAN version 1.94_65 [DELTA] 2011-02-14 David Golden * release 1.94_65 * Adds support for META/MYMETA.json files if CPAN::Meta is installed * Adds HOMEDRIVE/HOMEPATH or USERPROFILE as home directory options on Windows * fixes a minor test bug related to Makefile timeskews * fixes a minor test bug related to Makefile timeskews * various documentation typo fixes --- cpan/CPAN/Changes | 16 +++++ cpan/CPAN/lib/CPAN.pm | 54 ++++++++++------- cpan/CPAN/lib/CPAN/Distribution.pm | 117 +++++++++++++++++++++++++++++-------- cpan/CPAN/lib/CPAN/FirstTime.pm | 10 ++-- cpan/CPAN/lib/CPAN/HandleConfig.pm | 13 ++++- 5 files changed, 158 insertions(+), 52 deletions(-) (limited to 'cpan') diff --git a/cpan/CPAN/Changes b/cpan/CPAN/Changes index c51f1c8721..1b6751932b 100644 --- a/cpan/CPAN/Changes +++ b/cpan/CPAN/Changes @@ -1,3 +1,19 @@ +2011-02-14 David Golden + + * release 1.94_65 + + * Adds support for META/MYMETA.json files if CPAN::Meta is + installed + + * Adds HOMEDRIVE/HOMEPATH or USERPROFILE as home directory + options on Windows + + * fixes a minor test bug related to Makefile timeskews + + * fixes a minor test bug related to Makefile timeskews + + * various documentation typo fixes + 2011-01-20 David Golden * release 1.94_64 diff --git a/cpan/CPAN/lib/CPAN.pm b/cpan/CPAN/lib/CPAN.pm index 7809af31bb..f4b7e298b5 100644 --- a/cpan/CPAN/lib/CPAN.pm +++ b/cpan/CPAN/lib/CPAN.pm @@ -2,7 +2,7 @@ # vim: ts=4 sts=4 sw=4: use strict; package CPAN; -$CPAN::VERSION = '1.94_64'; +$CPAN::VERSION = '1.94_65'; $CPAN::VERSION =~ s/_//; # we need to run chdir all over and we would get at wrong libraries @@ -547,7 +547,7 @@ sub _yaml_loadfile { return +[] unless -s $local_file; my $yaml_module = _yaml_module; if ($CPAN::META->has_inst($yaml_module)) { - # temporarly enable yaml code deserialisation + # temporarily enable yaml code deserialisation no strict 'refs'; # 5.6.2 could not do the local() with the reference # so we do it manually instead @@ -1007,6 +1007,17 @@ sub has_usable { # # these subroutines die if they believe the installed version is unusable; # + 'CPAN::Meta' => [ + sub { + require CPAN::Meta; + unless (CPAN::Version->vge(CPAN::Meta->VERSION, 2.110350)) { + for ("Will not use CPAN::Meta, need version 2.110350\n") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, + ], LWP => [ # we frequently had "Can't locate object # method "new" via package "LWP::UserAgent" at @@ -1173,7 +1184,7 @@ sub has_inst { CPAN: Module::Signature security checks disabled because Module::Signature not installed. Please consider installing the Module::Signature module. You may also need to be able to connect over the Internet to the public - keyservers like pool.sks-keyservers.net or pgp.mit.edu. + key servers like pool.sks-keyservers.net or pgp.mit.edu. }); $CPAN::Frontend->mysleep(2); @@ -1725,7 +1736,7 @@ B: See also L recompile() is a special command that takes no argument and runs the make/test/install cycle with brute force over all installed -dynamically loadable extensions (aka XS modules) with 'force' in +dynamically loadable extensions (a.k.a. XS modules) with 'force' in effect. The primary purpose of this command is to finish a network installation. Imagine you have a common source tree for two different architectures. You decide to do a completely independent fresh @@ -1971,7 +1982,8 @@ currently defined: dontload_list arrayref: modules in the list will not be loaded by the CPAN::has_inst() routine ftp path to external prg - ftp_passive if set, the envariable FTP_PASSIVE is set for downloads + ftp_passive if set, the environment variable FTP_PASSIVE is set + for downloads ftp_proxy proxy host for ftp requests ftpstats_period max number of days to keep download statistics ftpstats_size max number of items to keep in the download statistics @@ -2460,7 +2472,7 @@ parameter is C<0> or C<1> is determined by reading the patch beforehand. The path to each patch is either an absolute path on the local filesystem or relative to a patch directory specified in the C configuration variable or in the format of a canonical -distroname. For examples please consult the distroprefs/ directory in +distro name. For examples please consult the distroprefs/ directory in the CPAN.pm distribution (these examples are not installed by default). @@ -2734,7 +2746,7 @@ Like CPAN::Bundle::inst_file, but returns the $VERSION =item CPAN::Bundle::uptodate() -Returns 1 if the bundle itself and all its members are uptodate. +Returns 1 if the bundle itself and all its members are up-to-date. =item CPAN::Bundle::install() @@ -2832,7 +2844,7 @@ Note that install() gives no meaningful return value. See uptodate(). =item CPAN::Distribution::install_tested() -Install all distributions that have tested sucessfully but +Install all distributions that have tested successfully but not yet installed. See also C. =item CPAN::Distribution::isa_perl() @@ -2868,7 +2880,7 @@ in C<< $CPAN::Config->{pager} >>. Returns the hash reference from the first matching YAML file that the user has deposited in the C directory. The first succeeding match wins. The files in the C are processed -alphabetically, and the canonical distroname (e.g. +alphabetically, and the canonical distro name (e.g. AUTHOR/Foo-Bar-3.14.tar.gz) is matched against the regular expressions stored in the $root->{match}{distribution} attribute value. Additionally all module names contained in a distribution are matched @@ -2913,7 +2925,7 @@ runs C there. =item CPAN::Distribution::uptodate() Returns 1 if all the modules contained in the distribution are -uptodate. Relies on containsmods. +up-to-date. Relies on containsmods. =item CPAN::Index::force_reload() @@ -2936,7 +2948,7 @@ internal and thus subject to change without notice. Returns a one-line description of the module in four columns: The first column contains the word C, the second column consists of one character: an equals sign if this module is already installed -and uptodate, a less-than sign if this module is installed but can be +and up-to-date, a less-than sign if this module is installed but can be upgraded, and a space if the module is not installed. The third column is the name of the module and the fourth column gives maintainer or distribution information. @@ -2998,7 +3010,7 @@ Where the 'DSLIP' characters have the following meanings: d - Developer u - Usenet newsgroup comp.lang.perl.modules n - None known, try comp.lang.perl.modules - a - abandoned; volunteers welcome to take over maintainance + a - abandoned; volunteers welcome to take over maintenance L - Language Used: p - Perl-only, no compiler needed, should be platform independent @@ -3022,9 +3034,9 @@ Where the 'DSLIP' characters have the following meanings: b - BSD: The BSD License a - Artistic license alone 2 - Artistic license 2.0 or later - o - open source: appoved by www.opensource.org + o - open source: approved by www.opensource.org d - allows distribution without restrictions - r - restricted distribtion + r - restricted distribution n - no license at all =item CPAN::Module::force($method,@args) @@ -3143,7 +3155,7 @@ In this pod section each line obeys the format Module_Name [Version_String] [- optional text] The only required part is the first field, the name of a module -(e.g. Foo::Bar, ie. I the name of the distribution file). The rest +(e.g. Foo::Bar, i.e. I the name of the distribution file). The rest of the line is optional. The comment part is delimited by a dash just as in the man page header. @@ -3161,7 +3173,7 @@ modules in a snapshot bundle file. =head1 PREREQUISITES The CPAN program is trying to depend on as little as possible so the -user can use it in hostile enviroment. It works better the more goodies +user can use it in hostile environment. It works better the more goodies the environment provides. For example if you try in the CPAN shell install Bundle::CPAN @@ -3321,7 +3333,7 @@ requires that you have at least one of Crypt::OpenPGP module or the command-line F tool installed. You will also need to be able to connect over the Internet to the public -keyservers, like pgp.mit.edu, and their port 11731 (the HKP protocol). +key servers, like pgp.mit.edu, and their port 11731 (the HKP protocol). The configuration parameter check_sigs is there to turn signature checking on or off. @@ -3379,7 +3391,7 @@ prerequisites as early as possible. On the other hand, it's annoying that so many distributions need some interactive configuring. So what you can try to accomplish in your private bundle file is to have the packages that need to be configured early in the file and the gentle -ones later, so you can go out for cofeee after a few minutes and leave CPAN.pm +ones later, so you can go out for coffee after a few minutes and leave CPAN.pm to churn away untended. =head1 WORKING WITH CPAN.pm BEHIND FIREWALLS @@ -3598,7 +3610,7 @@ would be cpan> o conf term_is_latin 1 -If other charset support is needed, please file a bugreport against +If other charset support is needed, please file a bug report against CPAN.pm at rt.cpan.org and describe your needs. Maybe we can extend the support or maybe UTF-8 terminals become widely available. @@ -3665,9 +3677,9 @@ lowest 'ping' round-trip times. From the shell, use the command 'o conf init urllist' and allow CPAN to automatically select mirrors for you. Beyond that help, the urllist config parameter is yours. You can add and remove -sites at will. You should find out which sites have the best uptodateness, +sites at will. You should find out which sites have the best up-to-dateness, bandwidth, reliability, etc. and are topologically close to you. Some people -prefer fast downloads, others uptodateness, others reliability. You decide +prefer fast downloads, others up-to-dateness, others reliability. You decide which to try in which order. Henk P. Penning maintains a site that collects data about CPAN sites: diff --git a/cpan/CPAN/lib/CPAN/Distribution.pm b/cpan/CPAN/lib/CPAN/Distribution.pm index e031b692c2..2c4c933637 100644 --- a/cpan/CPAN/lib/CPAN/Distribution.pm +++ b/cpan/CPAN/lib/CPAN/Distribution.pm @@ -1,3 +1,5 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- +# vim: ts=4 sts=4 sw=4: package CPAN::Distribution; use strict; use Cwd qw(chdir); @@ -6,7 +8,7 @@ use CPAN::InfoObj; use File::Path (); @CPAN::Distribution::ISA = qw(CPAN::InfoObj); use vars qw($VERSION); -$VERSION = "1.9600"; +$VERSION = "1.9601"; # Accessors sub cpan_comment { @@ -580,6 +582,34 @@ EOF return($packagedir,$local_file); } +#-> sub CPAN::Distribution::pick_meta_file ; +sub pick_meta_file { + my($self, $yaml) = @_; + + my $build_dir; + unless ($build_dir = $self->{build_dir}) { + # maybe permission on build_dir was missing + $CPAN::Frontend->mywarn("Warning: cannot determine META.yml without a build_dir.\n"); + return; + } + + my $has_cm = $CPAN::META->has_usable("CPAN::Meta"); + my $has_pcm = $CPAN::META->has_usable("Parse::CPAN::Meta"); + + my @choices; + push @choices, 'MYMETA.json' if $has_cm; + push @choices, 'MYMETA.yml' if $has_cm || $has_pcm; + push @choices, 'META.json' if $has_cm; + push @choices, 'META.yml' if $has_cm || $has_pcm; + + for my $file ( @choices ) { + my $path = File::Spec->catdir( $build_dir, $file ); + return $path if -f $path + } + + return; +} + #-> sub CPAN::Distribution::parse_meta_yml ; sub parse_meta_yml { my($self, $yaml) = @_; @@ -2545,13 +2575,9 @@ sub unsat_prereq { my $prefs_depends = $self->prefs->{depends}||{}; my $feature_depends = $self->_feature_depends(); if ($slot eq "configure_requires_later") { - my $meta_yml = $self->parse_meta_yml(); - if (defined $meta_yml && (! ref $meta_yml || ref $meta_yml ne "HASH")) { - $CPAN::Frontend->mywarn("The content of META.yml is defined but not a HASH reference. Cannot use it.\n"); - $meta_yml = +{}; - } + my $meta_configure_requires = $self->configure_requires(); %merged = ( - %{$meta_yml->{configure_requires}||{}}, + %{$meta_configure_requires||{}}, %{$prefs_depends->{configure_requires}||{}}, %{$feature_depends->{configure_requires}||{}}, ); @@ -2816,27 +2842,42 @@ sub _fulfills_all_version_rqs { return $ret; } +#-> sub CPAN::Distribution::read_meta +# read any sort of meta files, return CPAN::Meta object if no errors and +# dynamic_config = 0 +sub read_meta { + my($self) = @_; + my $meta_file = $self->pick_meta_file + or return; + + return unless $CPAN::META->has_usable("CPAN::Meta"); + my $meta = eval { CPAN::Meta->load_file($meta_file)} + or return; + + # Very old EU::MM could have wrong META + if ($meta_file eq 'META.yml' + && $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/ + ) { + my $eummv = do { local $^W = 0; $1+0; }; + return if $eummv < 6.2501; + } + + # META/MYMETA is only authoritative if dynamic_config is false + return if $meta->dynamic_config; + + return $meta; +} + #-> sub CPAN::Distribution::read_yaml ; +# XXX This should be DEPRECATED -- dagolden, 2011-02-05 sub read_yaml { my($self) = @_; - my $build_dir; - unless ($build_dir = $self->{build_dir}) { - # maybe permission on build_dir was missing - $CPAN::Frontend->mywarn("Warning: cannot determine META.yml without a build_dir.\n"); - return; - } - # if MYMETA.yml exists, that takes precedence over META.yml - my $meta = File::Spec->catfile($build_dir,"META.yml"); - my $mymeta = File::Spec->catfile($build_dir,"MYMETA.yml"); - my $meta_file = -f $mymeta ? $mymeta : $meta; + my $meta_file = $self->pick_meta_file; $self->debug("meta_file[$meta_file]") if $CPAN::DEBUG; - return unless -f $meta_file; + return unless $meta_file; my $yaml; eval { $yaml = $self->parse_meta_yml($meta_file) }; if ($@ or ! $yaml) { - $CPAN::Frontend->mywarnonce("Could not read ". - "'$meta_file'. Falling back to other ". - "methods to determine prerequisites\n"); return undef; # if we die, then we cannot read YAML's own META.yml } # not "authoritative" @@ -2848,7 +2889,7 @@ sub read_yaml { if $CPAN::DEBUG; $self->debug($yaml) if $CPAN::DEBUG && $yaml; # MYMETA.yml is static and authoritative by definition - if ( $meta_file eq $mymeta ) { + if ( $meta_file =~ /MYMETA\.yml/ ) { return $yaml; } # META.yml is authoritative only if dynamic_config is defined and false @@ -2859,6 +2900,21 @@ sub read_yaml { return undef; } +#-> sub CPAN::Distribution::configure_requires ; +sub configure_requires { + my($self) = @_; + return unless my $meta_file = $self->pick_meta_file; + if (my $meta_obj = $self->read_meta) { + my $prereqs = $meta_obj->effective_prereqs; + my $cr = $prereqs->requirements_for(qw/configure requires/); + return $cr ? $cr->as_string_hash : undef; + } + else { + my $yaml = eval { $self->parse_meta_yml($meta_file) }; + return $yaml->{configure_requires}; + } +} + #-> sub CPAN::Distribution::prereq_pm ; sub prereq_pm { my($self) = @_; @@ -2873,7 +2929,17 @@ sub prereq_pm { $self->{modulebuild}||"", ) if $CPAN::DEBUG; my($req,$breq); - if (my $yaml = $self->read_yaml) { # often dynamic_config prevents a result here + if (my $meta_obj = $self->read_meta) { + my $prereqs = $meta_obj->effective_prereqs; + my $requires = $prereqs->requirements_for(qw/runtime requires/); + my $build_requires = $prereqs->requirements_for(qw/build requires/); + my $test_requires = $prereqs->requirements_for(qw/test requires/); + # XXX we don't yet distinguish build vs test, so merge them for now + $build_requires->add_requirements($test_requires); + $req = $requires->as_string_hash; + $breq = $build_requires->as_string_hash; + } + elsif (my $yaml = $self->read_yaml) { # often dynamic_config prevents a result here $req = $yaml->{requires} || {}; $breq = $yaml->{build_requires} || {}; undef $req unless ref $req eq "HASH" && %$req; @@ -2910,6 +2976,11 @@ sub prereq_pm { $req = $areq if $do_replace; } } + else { + $CPAN::Frontend->mywarnonce("Could not read metadata file. Falling back to other ". + "methods to determine prerequisites\n"); + } + unless ($req || $breq) { my $build_dir; unless ( $build_dir = $self->{build_dir} ) { diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm index bc1ccc1b46..667bdca2f9 100644 --- a/cpan/CPAN/lib/CPAN/FirstTime.pm +++ b/cpan/CPAN/lib/CPAN/FirstTime.pm @@ -10,7 +10,7 @@ use File::Path (); use File::Spec (); use CPAN::Mirrors (); use vars qw($VERSION $auto_config); -$VERSION = "5.5302"; +$VERSION = "5.5303"; =head1 NAME @@ -64,7 +64,7 @@ directory between sessions. Since 1.88_58 CPAN.pm has a YAML-based mechanism that makes it possible to share the contents of the build_dir/ directory between different sessions with the same version of perl. People who prefer to test things several days before -installing will like this feature because it safes a lot of time. +installing will like this feature because it saves a lot of time. If you say yes to the following question, CPAN will try to store enough information about the build process so that it can pick up in @@ -201,7 +201,7 @@ Preferred method for determining the current working directory? =item halt_on_failure -Normaly, CPAN.pm continues processing the full list of targets and +Normally, CPAN.pm continues processing the full list of targets and dependencies, even if one of them fails. However, you can specify that CPAN should halt after the first failure. @@ -389,7 +389,7 @@ default options for CPAN.pm and the environment can be overridden and dialog sequences can be stored that can later be executed by an Expect.pm object. The CPAN.pm distribution comes with some prefab YAML files that cover sample distributions that can be used as blueprints -to store one own prefs. Please check out the distroprefs/ directory of +to store your own prefs. Please check out the distroprefs/ directory of the CPAN.pm distribution to get a quick start into the prefs system. Directory where to store default options/environment/dialogs for @@ -472,7 +472,7 @@ Tar command verbosity level (none or v or vv)? =item term_is_latin -The next option deals with the charset (aka character set) your +The next option deals with the charset (a.k.a. character set) your terminal supports. In general, CPAN is English speaking territory, so the charset does not matter much but some CPAN have names that are outside the ASCII range. If your terminal supports UTF-8, you should diff --git a/cpan/CPAN/lib/CPAN/HandleConfig.pm b/cpan/CPAN/lib/CPAN/HandleConfig.pm index 5007934a57..58ccbe50e5 100644 --- a/cpan/CPAN/lib/CPAN/HandleConfig.pm +++ b/cpan/CPAN/lib/CPAN/HandleConfig.pm @@ -2,10 +2,11 @@ package CPAN::HandleConfig; use strict; use vars qw(%can %keys $loading $VERSION); use File::Path (); +use File::Spec (); use File::Basename (); use Carp (); -$VERSION = "5.5002"; # see also CPAN::Config::VERSION at end of file +$VERSION = "5.5003"; # see also CPAN::Config::VERSION at end of file %can = ( commit => "Commit changes to disk", @@ -518,9 +519,15 @@ sub cpan_home_dir_candidates { } push @dirs, File::HomeDir->my_home; } - push @dirs, $ENV{HOME}; + # Windows might not have HOME, so check it first + push @dirs, $ENV{HOME} if $ENV{HOME}; + # Windows might have these instead + push( @dirs, File::Spec->catpath($ENV{HOMEDRIVE}, $ENV{HOMEPATH}, '') ) + if $ENV{HOMEDRIVE} && $ENV{HOMEPATH}; + push @dirs, $ENV{USERPROFILE} if $ENV{USERPROFILE}; + $CPAN::Config->{load_module_verbosity} = $old_v; - @dirs = map { "$_/.cpan" } @dirs; + @dirs = map { "$_/.cpan" } grep { defined } @dirs; return wantarray ? @dirs : $dirs[0]; } -- cgit v1.2.1