From: Steffen Mueller Date: Thu, 4 Feb 2010 19:18:45 +0000 (+0100) Subject: Upgrade CPAN to 1.94_55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=23d72198749db53785b1c67cd1a37697afb95fc0;p=p5sagit%2Fp5-mst-13.2.git Upgrade CPAN to 1.94_55 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index b9bc394..cea79cf 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -379,7 +379,7 @@ use File::Glob qw(:case); 'CPAN' => { 'MAINTAINER' => 'andk', - 'DISTRIBUTION' => 'ANDK/CPAN-1.94_53.tar.gz', + 'DISTRIBUTION' => 'ANDK/CPAN-1.94_55.tar.gz', 'FILES' => q[cpan/CPAN], 'EXCLUDED' => [ qr{^distroprefs/}, qr{^inc/Test/}, diff --git a/cpan/CPAN/Changes b/cpan/CPAN/Changes index 8433c33..2fee983 100644 --- a/cpan/CPAN/Changes +++ b/cpan/CPAN/Changes @@ -1,3 +1,21 @@ +2010-02-03 Andreas J. Koenig + + * release 1.94_55 + + * Fixed rt.perl.org#72362 (CPAN ignoring configure_requires). + Also fixed (MY)META.yml processing to always prefer + Parse::CPAN::Meta, if available. Reported by Joshua B Jore + and patched by David Golden + + * Fixed rt.perl.org#72348 (missing CPAN::HandleConfig::output); + Reported by Joshua B Jore and patched by David Golden + + * Quieter user interface: made lots of '$module missing' type + warnings only warn once; eliminated 'no YAML' warnings for + distroprefs if there are no distroprefs. + + * now with 359 distroprefs files + 2010-01-14 Andreas J. Koenig * release 1.94_54 diff --git a/cpan/CPAN/lib/CPAN.pm b/cpan/CPAN/lib/CPAN.pm index cb0b890..245022d 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_54'; +$CPAN::VERSION = '1.94_55'; $CPAN::VERSION =~ s/_//; # we need to run chdir all over and we would get at wrong libraries @@ -1981,6 +1981,9 @@ currently defined: prerequisites_policy what to do if you are missing module prerequisites ('follow' automatically, 'ask' me, or 'ignore') + For 'follow', also sets PERL_AUTOINSTALL and + PERL_EXTUTILS_AUTOINSTALL for "--defaultdeps" if + not already set prefs_dir local directory to store per-distro build options proxy_user username for accessing an authenticating proxy proxy_pass password for accessing an authenticating proxy diff --git a/cpan/CPAN/lib/CPAN/Debug.pm b/cpan/CPAN/lib/CPAN/Debug.pm index 926b0d7..dc44a1e 100644 --- a/cpan/CPAN/lib/CPAN/Debug.pm +++ b/cpan/CPAN/lib/CPAN/Debug.pm @@ -52,9 +52,9 @@ sub debug { if ($arg and ref $arg) { eval { require Data::Dumper }; if ($@) { - $CPAN::Frontend->myprint($arg->as_string); + $CPAN::Frontend->myprint("Debug(\n" . $arg->as_string . ")\n"); } else { - $CPAN::Frontend->myprint(Data::Dumper::Dumper($arg)); + $CPAN::Frontend->myprint("Debug(\n" . Data::Dumper::Dumper($arg) . ")\n"); } } else { my $outer = ""; diff --git a/cpan/CPAN/lib/CPAN/Distribution.pm b/cpan/CPAN/lib/CPAN/Distribution.pm index 22d3f06..82dde03 100644 --- a/cpan/CPAN/lib/CPAN/Distribution.pm +++ b/cpan/CPAN/lib/CPAN/Distribution.pm @@ -171,6 +171,7 @@ sub color_cmd_tmps { my($color) = shift || 0; my($ancestors) = shift || []; # a distribution needs to recurse into its prereq_pms + $self->debug("color_cmd_tmps[$depth,$color,@$ancestors]") if $CPAN::DEBUG; return if exists $self->{incommandcolor} && $color==1 @@ -576,29 +577,33 @@ EOF #-> sub CPAN::Distribution::parse_meta_yml ; sub parse_meta_yml { - my($self) = @_; + my($self, $yaml) = @_; + $self->debug(sprintf("parse_meta_yml[%s]",$yaml||'undef')) if $CPAN::DEBUG; my $build_dir = $self->{build_dir} or die "PANIC: cannot parse yaml without a build_dir"; - my $yaml = File::Spec->catfile($build_dir,"META.yml"); - $self->debug("yaml[$yaml]") if $CPAN::DEBUG; + $yaml ||= File::Spec->catfile($build_dir,"META.yml"); + $self->debug("meta[$yaml]") if $CPAN::DEBUG; return unless -f $yaml; my $early_yaml; eval { - require Parse::CPAN::Meta; - $early_yaml = Parse::CPAN::Meta::LoadFile($yaml)->[0]; + $CPAN::META->has_inst("Parse::CPAN::Meta") or die; + # P::C::M returns last document in scalar context + $early_yaml = Parse::CPAN::Meta::LoadFile($yaml); }; unless ($early_yaml) { eval { $early_yaml = CPAN->_yaml_loadfile($yaml)->[0]; }; } - unless ($early_yaml) { - return; - } - return $early_yaml; + $self->debug(sprintf("yaml[%s]", $early_yaml || 'UNDEF')) if $CPAN::DEBUG; + $self->debug($early_yaml) if $CPAN::DEBUG && $early_yaml; + return $early_yaml || undef; } #-> sub CPAN::Distribution::satisfy_requires ; sub satisfy_requires { my ($self) = @_; + $self->debug("Entering satisfy_requires") if $CPAN::DEBUG; if (my @prereq = $self->unsat_prereq("later")) { + $self->debug("unsatisfied[@prereq]") if $CPAN::DEBUG; + $self->debug(@prereq) if $CPAN::DEBUG && @prereq; if ($prereq[0][0] eq "perl") { my $need = "requires perl '$prereq[0][1]'"; my $id = $self->pretty_id; @@ -618,11 +623,13 @@ sub satisfy_requires { } } } + return; } #-> sub CPAN::Distribution::satisfy_configure_requires ; sub satisfy_configure_requires { my($self) = @_; + $self->debug("Entering satisfy_configure_requires") if $CPAN::DEBUG; my $enable_configure_requires = 1; if (!$enable_configure_requires) { return 1; @@ -630,7 +637,10 @@ sub satisfy_configure_requires { # configure_requires that means, things with # configure_requires simply fail, all others succeed } - my @prereq = $self->unsat_prereq("configure_requires_later") or return 1; + my @prereq = $self->unsat_prereq("configure_requires_later"); + $self->debug("configure_requires[@prereq]") if $CPAN::DEBUG; + return 1 unless @prereq; + $self->debug(\@prereq) if $CPAN::DEBUG; if ($self->{configure_requires_later}) { for my $k (keys %{$self->{configure_requires_later_for}||{}}) { if ($self->{configure_requires_later_for}{$k}>1) { @@ -731,8 +741,8 @@ sub store_persistent_state { my $dir = $self->{build_dir}; unless (File::Spec->canonpath(File::Basename::dirname($dir)) eq File::Spec->canonpath($CPAN::Config->{build_dir})) { - $CPAN::Frontend->mywarn("Directory '$dir' not below $CPAN::Config->{build_dir}, ". - "will not store persistent state\n"); + $CPAN::Frontend->mywarnonce("Directory '$dir' not below $CPAN::Config->{build_dir}, ". + "will not store persistent state\n"); return; } my $file = sprintf "%s.yml", $dir; @@ -747,8 +757,8 @@ sub store_persistent_state { } ); } else { - $CPAN::Frontend->myprint("Warning (usually harmless): '$yaml_module' not installed, ". - "will not store persistent state\n"); + $CPAN::Frontend->myprintonce("'$yaml_module' not installed, ". + "will not store persistent state\n"); } } @@ -1538,7 +1548,6 @@ sub force { "make", "modulebuild", "prereq_pm", - "prereq_pm_detected", ], test => [ "badtestcnt", @@ -1798,6 +1807,10 @@ is part of the perl-%s distribution. To install that, you need to run $env{$k} = $v; } local %ENV = %env; + if ($CPAN::Config->{prerequisites_policy} eq "follow") { + $ENV{PERL_AUTOINSTALL} ||= "--defaultdeps"; + $ENV{PERL_EXTUTILS_AUTOINSTALL} ||= "--defaultdeps"; + } my $system; my $pl_commandline; if ($self->prefs->{pl}) { @@ -2179,6 +2192,12 @@ sub _find_prefs { if ($@) { $CPAN::Frontend->mydie("Cannot create directory $prefs_dir"); } + # shortcut if there are no distroprefs files + { + my $dh = DirHandle->new($prefs_dir) or $CPAN::Frontend->mydie("Couldn't open '$prefs_dir': $!"); + my @files = map { /\.(yml|dd|st)\z/i } $dh->read; + return unless @files; + } my $yaml_module = CPAN::_yaml_module(); my $ext_map = {}; my @extensions; @@ -2195,13 +2214,13 @@ sub _find_prefs { if (@fallbacks) { local $" = " and "; unless ($self->{have_complained_about_missing_yaml}++) { - $CPAN::Frontend->mywarn("'$yaml_module' not installed, falling back ". - "to @fallbacks to read prefs '$prefs_dir'\n"); + $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, falling back ". + "to @fallbacks to read prefs '$prefs_dir'\n"); } } else { unless ($self->{have_complained_about_missing_yaml}++) { - $CPAN::Frontend->mywarn("'$yaml_module' not installed, cannot ". - "read prefs '$prefs_dir'\n"); + $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, cannot ". + "read prefs '$prefs_dir'\n"); } } } @@ -2504,6 +2523,19 @@ sub unsat_prereq { %{$prefs_depends->{configure_requires}||{}}, %{$feature_depends->{configure_requires}||{}}, ); + if (-f "Build.PL" + && ! -f "Makefile.PL" + && ! exists $merged{"Module::Build"} + && ! $CPAN::META->has_inst("Module::Build") + ) { + $CPAN::Frontend->mywarn( + " Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.\n". + " Adding it now as such.\n" + ); + $CPAN::Frontend->mysleep(5); + $merged{"Module::Build"} = 0; + delete $self->{writemakefile}; + } $prereq_pm = {}; # configure_requires defined as "b" } elsif ($slot eq "later") { my $prereq_pm_0 = $self->prereq_pm || {}; @@ -2726,7 +2758,6 @@ sub _fulfills_all_version_rqs { #-> sub CPAN::Distribution::read_yaml ; sub read_yaml { my($self) = @_; - return $self->{yaml_content} if exists $self->{yaml_content}; my $build_dir; unless ($build_dir = $self->{build_dir}) { # maybe permission on build_dir was missing @@ -2736,44 +2767,40 @@ sub read_yaml { # 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 $yaml = -f $mymeta ? $mymeta : $meta; - $self->debug("yaml[$yaml]") if $CPAN::DEBUG; - return unless -f $yaml; - eval { $self->{yaml_content} = CPAN->_yaml_loadfile($yaml)->[0]; }; - if ($@) { - $CPAN::Frontend->mywarn("Could not read ". - "'$yaml'. Falling back to other ". - "methods to determine prerequisites\n"); - return $self->{yaml_content} = undef; # if we die, then we - # cannot read YAML's own - # META.yml + my $meta_file = -f $mymeta ? $mymeta : $meta; + $self->debug("meta_file[$meta_file]") if $CPAN::DEBUG; + return unless -f $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" - for ($self->{yaml_content}) { - if (defined $_ && (! ref $_ || ref $_ ne "HASH")) { - $CPAN::Frontend->mywarn("META.yml does not seem to be conforming, cannot use it.\n"); - $self->{yaml_content} = +{}; - } - } - # MYMETA.yml is not dynamic by definition - if ( $yaml ne $mymeta && - ( not exists $self->{yaml_content}{dynamic_config} - or $self->{yaml_content}{dynamic_config} - ) - ) { - $self->{yaml_content} = undef; + if (defined $yaml && (! ref $yaml || ref $yaml ne "HASH")) { + $CPAN::Frontend->mywarn("META.yml does not seem to be conforming, cannot use it.\n"); + $yaml = undef; } - $self->debug(sprintf "yaml_content[%s]", $self->{yaml_content} || "UNDEF") + $self->debug(sprintf "yaml[%s]", $yaml || "UNDEF") if $CPAN::DEBUG; - return $self->{yaml_content}; + $self->debug($yaml) if $CPAN::DEBUG && $yaml; + # MYMETA.yml is static and authoritative by definition + if ( $meta_file eq $mymeta ) { + return $yaml; + } + # META.yml is authoritative only if dynamic_config is defined and false + if ( defined $yaml->{dynamic_config} && ! $yaml->{dynamic_config} ) { + return $yaml; + } + # otherwise, we can't use what we found + return undef; } #-> sub CPAN::Distribution::prereq_pm ; sub prereq_pm { my($self) = @_; - $self->{prereq_pm_detected} ||= 0; - CPAN->debug("ID[$self->{ID}]prereq_pm_detected[$self->{prereq_pm_detected}]") if $CPAN::DEBUG; - return $self->{prereq_pm} if $self->{prereq_pm_detected}; return unless $self->{writemakefile} # no need to have succeeded # but we must have run it || $self->{modulebuild}; @@ -2888,20 +2915,7 @@ sub prereq_pm { } } } - if (-f "Build.PL" - && ! -f "Makefile.PL" - && ! exists $req->{"Module::Build"} - && ! $CPAN::META->has_inst("Module::Build")) { - $CPAN::Frontend->mywarn(" Warning: CPAN.pm discovered Module::Build as ". - "undeclared prerequisite.\n". - " Adding it now as such.\n" - ); - $CPAN::Frontend->mysleep(5); - $req->{"Module::Build"} = 0; - delete $self->{writemakefile}; - } if ($req || $breq) { - $self->{prereq_pm_detected}++; return $self->{prereq_pm} = { requires => $req, build_requires => $breq }; } } @@ -3745,7 +3759,7 @@ sub _should_report { # available if ( ! $CPAN::META->has_inst("CPAN::Reporter")) { - $CPAN::Frontend->mywarn( + $CPAN::Frontend->mywarnonce( "CPAN::Reporter not installed. No reports will be sent.\n" ); return $self->{should_report} = 0; diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm index d1db0cd..fadcb8b 100644 --- a/cpan/CPAN/lib/CPAN/FirstTime.pm +++ b/cpan/CPAN/lib/CPAN/FirstTime.pm @@ -397,8 +397,11 @@ building modules that need some customization? The CPAN module can detect when a module which you are trying to build depends on prerequisites. If this happens, it can build the prerequisites for you automatically ('follow'), ask you for -confirmation ('ask'), or just ignore them ('ignore'). Please set your -policy to one of the three values. +confirmation ('ask'), or just ignore them ('ignore'). Choosing +'follow' also sets PERL_AUTOINSTALL and PERL_EXTUTILS_AUTOINSTALL for +"--defaultdeps" if not already set. + +Please set your policy to one of the three values. Policy on building prerequisites (follow, ask or ignore)? @@ -841,9 +844,9 @@ sub init { #= Do we follow PREREQ_PM? # - my_prompt_loop(prerequisites_policy => 'ask', $matcher, + my_prompt_loop(prerequisites_policy => 'follow', $matcher, 'follow|ask|ignore'); - my_prompt_loop(build_requires_install_policy => 'ask/yes', $matcher, + my_prompt_loop(build_requires_install_policy => 'yes', $matcher, 'yes|no|ask/yes|ask/no'); # @@ -881,7 +884,7 @@ sub init { my_dflt_prompt(yaml_module => "YAML", $matcher); my $old_v = $CPAN::Config->{load_module_verbosity}; $CPAN::Config->{load_module_verbosity} = q[none]; - unless ($CPAN::META->has_inst($CPAN::Config->{yaml_module})) { + if (!$silent && !$CPAN::META->has_inst($CPAN::Config->{yaml_module})) { $CPAN::Frontend->mywarn ("Warning (maybe harmless): '$CPAN::Config->{yaml_module}' not installed.\n"); $CPAN::Frontend->mysleep(3); @@ -929,11 +932,11 @@ sub init { # verbosity # - my_prompt_loop(tar_verbosity => 'v', $matcher, + my_prompt_loop(tar_verbosity => 'none', $matcher, 'none|v|vv'); my_prompt_loop(load_module_verbosity => 'none', $matcher, 'none|v'); - my_prompt_loop(perl5lib_verbosity => 'v', $matcher, + my_prompt_loop(perl5lib_verbosity => 'none', $matcher, 'none|v'); my_yn_prompt(inhibit_startup_message => 0, $matcher); diff --git a/cpan/CPAN/lib/CPAN/HandleConfig.pm b/cpan/CPAN/lib/CPAN/HandleConfig.pm index 6a134bd..e3d7164 100644 --- a/cpan/CPAN/lib/CPAN/HandleConfig.pm +++ b/cpan/CPAN/lib/CPAN/HandleConfig.pm @@ -523,7 +523,8 @@ sub load { my($self, %args) = @_; $CPAN::Be_Silent++ if $args{be_silent}; my $doit; - $doit = delete $args{doit}; + $doit = delete $args{doit} || 0; + $loading = 0 unless defined $loading; use Carp; require_myconfig_or_config; @@ -560,9 +561,14 @@ sub load { if ($configpm) { $INC{$inc_key} = $configpm; } else { - my $text = qq{WARNING: CPAN.pm is unable to } . - qq{create a configuration file.}; - output($text, 'confess'); + my $myconfigpm = File::Spec->catfile(home,".cpan","CPAN","MyConfig.pm"); + $CPAN::Frontend->mydie(<<"END"); +WARNING: CPAN.pm is unable to write a configuration file. You need write +access to your default perl library directories or you must be able to +create and write to '$myconfigpm'. + +Aborting configuration. +END } } @@ -634,7 +640,7 @@ Edit key values as in the following (the "o" is a literal letter o): o conf inhibit_startup_message 1 ]); - undef; #don't reprint CPAN::Config + 1; #don't reprint CPAN::Config } sub cpl { diff --git a/cpan/CPAN/lib/CPAN/Shell.pm b/cpan/CPAN/lib/CPAN/Shell.pm index 8fb5628..290c121 100644 --- a/cpan/CPAN/lib/CPAN/Shell.pm +++ b/cpan/CPAN/lib/CPAN/Shell.pm @@ -1504,6 +1504,13 @@ sub myprint { ); } +my %already_printed; +#-> sub CPAN::Shell::mywarnonce ; +sub myprintonce { + my($self,$what) = @_; + $self->myprint($what) unless $already_printed{$what}++; +} + sub optprint { my($self,$category,$what) = @_; my $vname = $category . "_verbosity"; @@ -1528,6 +1535,13 @@ sub mywarn { $self->print_ornamented($what, $CPAN::Config->{colorize_warn}||'bold red on_white'); } +my %already_warned; +#-> sub CPAN::Shell::mywarnonce ; +sub mywarnonce { + my($self,$what) = @_; + $self->mywarn($what) unless $already_warned{$what}++; +} + # only to be used for shell commands #-> sub CPAN::Shell::mydie ; sub mydie { diff --git a/cpan/CPAN/lib/CPAN/Tarzip.pm b/cpan/CPAN/lib/CPAN/Tarzip.pm index b97bd20..24a1adc 100644 --- a/cpan/CPAN/lib/CPAN/Tarzip.pm +++ b/cpan/CPAN/lib/CPAN/Tarzip.pm @@ -29,8 +29,8 @@ sub new { } else { $CPAN::Frontend->mydie(qq{ CPAN.pm needs the external program bzip2 in order to handle '$file'. -Please install it now and run 'o conf init' to register it as external -program. +Please install it now and run 'o conf init bzip2' from the +CPAN shell prompt to register it as external program. }); } } @@ -422,12 +422,21 @@ sub unzip { return if $CPAN::Signal; } return 1; - } else { - my $unzip = $CPAN::Config->{unzip} or - $CPAN::Frontend->mydie("Cannot unzip, no unzip program available"); + } elsif ( my $unzip = $CPAN::Config->{unzip} ) { my @system = ($unzip, $file); return system(@system) == 0; } + else { + $CPAN::Frontend->mydie(<<"END"); + +Can't unzip '$file': + +You have not configured an 'unzip' program and do not have Archive::Zip +installed. Please either install Archive::Zip or else configure 'unzip' +by running the command 'o conf init unzip' from the CPAN shell prompt. + +END + } } 1;