From: Steve Peters Date: Tue, 24 Oct 2006 15:44:22 +0000 (+0000) Subject: Upgrade to CPAN-1.88_57. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6658a91be12dc399e39e5db903527c1df5b2609f;p=p5sagit%2Fp5-mst-13.2.git Upgrade to CPAN-1.88_57. p4raw-id: //depot/perl@29100 --- diff --git a/lib/CPAN.pm b/lib/CPAN.pm index e4f1d62..25b6e73 100644 --- a/lib/CPAN.pm +++ b/lib/CPAN.pm @@ -1,7 +1,7 @@ # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- use strict; package CPAN; -$CPAN::VERSION = '1.88_55'; +$CPAN::VERSION = '1.88_57'; $CPAN::VERSION = eval $CPAN::VERSION; use CPAN::HandleConfig; @@ -58,13 +58,25 @@ $CPAN::Defaultdocs ||= "http://search.cpan.org/perldoc?"; $CPAN::Defaultrecent ||= "http://search.cpan.org/recent"; -use vars qw($VERSION @EXPORT $AUTOLOAD - $DEBUG $META $HAS_USABLE $term - $GOTOSHELL - $Signal $Suppress_readline $Frontend - @Defaultsites $Have_warned $Defaultdocs $Defaultrecent +use vars qw( + $AUTOLOAD $Be_Silent + $CONFIG_DIRTY + $DEBUG + $Defaultdocs + $Defaultrecent + $Frontend + $GOTOSHELL + $HAS_USABLE + $Have_warned + $META + $Signal + $Suppress_readline + $VERSION $autoload_recursion + $term + @Defaultsites + @EXPORT ); @CPAN::ISA = qw(CPAN::Debug Exporter); @@ -247,7 +259,10 @@ ReadLine support %s $CPAN::META->debug("line[".join("|",@line)."]") if $CPAN::DEBUG; my $command = shift @line; eval { CPAN::Shell->$command(@line) }; - warn $@ if $@; + if ($@){ + require Carp; + Carp::cluck($@); + } if ($command =~ /^(make|test|install|force|notest|clean|report|upgrade)$/) { CPAN::Shell->failed($CPAN::CurrentCommandId,1); } @@ -292,15 +307,12 @@ ReadLine support %s } } } - if ($CPAN::DEBUG && $CPAN::DEBUG & $CPAN::DEBUG{CPAN}) { - # debugging 'incommandcolor': should always be off at the end of a command - # (incommandcolor is used to detect recursive dependencies) - for my $class (qw(Module Distribution)) { - for my $dm (keys %{$CPAN::META->{readwrite}{"CPAN::$class"}}) { - next unless $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; - CPAN->debug("BUG: $class '$dm' was in command state, resetting"); - delete $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; - } + for my $class (qw(Module Distribution)) { + # again unsafe meta access? + for my $dm (keys %{$CPAN::META->{readwrite}{"CPAN::$class"}}) { + next unless $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; + CPAN->debug("BUG: $class '$dm' was in command state, resetting"); + delete $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor}; } } if ($GOTOSHELL) { @@ -344,8 +356,8 @@ sub _yaml_loadfile { my $yaml_module = $CPAN::Config->{yaml_module} || "YAML"; if ($CPAN::META->has_inst($yaml_module)) { my $code = UNIVERSAL::can($yaml_module, "LoadFile"); - my $yaml; - eval { $yaml = $code->($local_file); }; + my @yaml; + eval { @yaml = $code->($local_file); }; if ($@) { $CPAN::Frontend->mydie("Alert: While trying to parse YAML file\n". " $local_file\n". @@ -353,11 +365,11 @@ sub _yaml_loadfile { " $@\n" ); } - return $yaml; + return \@yaml; } else { $CPAN::Frontend->mywarn("'$yaml_module' not installed, cannot parse '$local_file'\n"); } - return +{}; + return +[]; } package CPAN::CacheMgr; @@ -861,7 +873,7 @@ sub has_usable { ], 'File::HomeDir' => [ sub {require File::HomeDir; - unless (File::HomeDir->VERSION >= 0.52){ + unless (File::HomeDir::->VERSION >= 0.52){ for ("Will not use File::HomeDir, need 0.52\n") { $CPAN::Frontend->mywarn($_); die $_; @@ -1006,6 +1018,9 @@ sub cleanup { unlink $META->{LOCK}; # require Carp; # Carp::cluck("DEBUGGING"); + if ( $CPAN::CONFIG_DIRTY ) { + $CPAN::Frontend->mywarn("Warning: Configuration not saved.\n"); + } $CPAN::Frontend->myprint("Lockfile removed.\n"); } @@ -1035,11 +1050,13 @@ sub savehist { close $fh; } +#-> sub CPAN::is_tested sub is_tested { my($self,$what) = @_; $self->{is_tested}{$what} = 1; } +#-> sub CPAN::is_installed # unsets the is_tested flag: as soon as the thing is installed, it is # not needed in set_perl5lib anymore sub is_installed { @@ -1047,16 +1064,34 @@ sub is_installed { delete $self->{is_tested}{$what}; } +#-> sub CPAN::set_perl5lib sub set_perl5lib { - my($self) = @_; + my($self,$for) = @_; + unless ($for) { + (undef,undef,undef,$for) = caller(1); + $for =~ s/.*://; + } $self->{is_tested} ||= {}; return unless %{$self->{is_tested}}; my $env = $ENV{PERL5LIB}; $env = $ENV{PERLLIB} unless defined $env; my @env; push @env, $env if defined $env and length $env; - my @dirs = map {("$_/blib/arch", "$_/blib/lib")} keys %{$self->{is_tested}}; - $CPAN::Frontend->myprint("Prepending @dirs to PERL5LIB.\n"); + #my @dirs = map {("$_/blib/arch", "$_/blib/lib")} keys %{$self->{is_tested}}; + #$CPAN::Frontend->myprint("Prepending @dirs to PERL5LIB.\n"); + my @dirs = map {("$_/blib/arch", "$_/blib/lib")} sort keys %{$self->{is_tested}}; + if (@dirs < 15) { + $CPAN::Frontend->myprint("Prepending @dirs to PERL5LIB for $for\n"); + } else { + my @d = map {s/^\Q$CPAN::Config->{'build_dir'}/%BUILDDIR%/; $_ } + sort keys %{$self->{is_tested}}; + $CPAN::Frontend->myprint("Prepending blib/arch and blib/lib subdirs of ". + "@d to PERL5LIB; ". + "%BUILDDIR%=$CPAN::Config->{'build_dir'} ". + "for $for\n" + ); + } + $ENV{PERL5LIB} = join $Config::Config{path_sep}, @dirs, @env; } @@ -1439,7 +1474,6 @@ sub i { # 'debug'; 'o conf ARGS' calls ->edit in CPAN/HandleConfig.pm sub o { my($self,$o_type,@o_what) = @_; - $DB::single = 1; $o_type ||= ""; CPAN->debug("o_type[$o_type] o_what[".join(" | ",@o_what)."]\n"); if ($o_type eq 'conf') { @@ -1617,7 +1651,12 @@ sub reload_this { unless ($file && -f $file) { # this thingie is not in the INC path, maybe CPAN/MyConfig.pm? $file = $INC{$f}; - @inc = substr($file,0,-length($f)); # bring in back to me! + unless (CPAN->has_inst("File::Basename")) { + @inc = File::Basename::dirname($file); + } else { + # do we ever need this? + @inc = substr($file,0,-length($f)-1); # bring in back to me! + } } CPAN->debug("file[$file]inc[@inc]") if $CPAN::DEBUG; unless (-f $file) { @@ -1783,7 +1822,8 @@ sub report { $CPAN::Frontend->mydie("CPAN::Reporter not installed; cannot continue"); } local $CPAN::Config->{test_report} = 1; - $self->force("test",@args); + $self->force("test",@args); # force is there so that the test be + # re-run (as documented) } #-> sub CPAN::Shell::upgrade ; @@ -1872,7 +1912,6 @@ sub _u_r_common { } my $color_on = ""; my $color_off = ""; - # $GLOBAL_AUTOLOAD_RECURSION = 12; if ( $COLOR_REGISTERED && @@ -1931,6 +1970,7 @@ sub failed { DIST: for my $d ($CPAN::META->all_objects("CPAN::Distribution")) { my $failed = ""; NAY: for my $nosayer ( + "unwrapped", "writemakefile", "signature_verify", "make", @@ -4115,10 +4155,17 @@ sub ro { exists $self->{RO} and return $self->{RO}; } +#-> sub CPAN::InfoObj::cpan_userid sub cpan_userid { my $self = shift; - my $ro = $self->ro or return "N/A"; # N/A for bundles found locally - return $ro->{CPAN_USERID} || "N/A"; + my $ro = $self->ro; + if ($ro) { + return $ro->{CPAN_USERID} || "N/A"; + } else { + $self->debug("ID[$self->{ID}]"); + # N/A for bundles found locally + return "N/A"; + } } sub id { shift->{ID}; } @@ -4528,7 +4575,7 @@ sub normalize { for ($CPAN::META->instance("CPAN::Distribution", $s)) { $_->{build_dir} = $s; $_->{archived} = "local_directory"; - $_->{unwrapped} = "local_directory"; + $_->{unwrapped} = CPAN::Distrostatus->new("YES -- local_directory"); } } } elsif ( @@ -4547,7 +4594,12 @@ sub normalize { #-> sub CPAN::Distribution::author ; sub author { my($self) = @_; - my($authorid) = $self->pretty_id =~ /^([\w\-]+)/; + my($authorid); + if (substr($self->id,-1,1) eq ".") { + $authorid = "LOCAL"; + } else { + ($authorid) = $self->pretty_id =~ /^([\w\-]+)/; + } CPAN::Shell->expand("Author",$authorid); } @@ -4574,7 +4626,16 @@ sub fast_yaml { $local_wanted)) { $CPAN::Frontend->mydie("Giving up on downloading yaml file '$local_wanted'\n"); } - my $yaml = CPAN->_yaml_loadfile($local_file); + my $yaml = CPAN->_yaml_loadfile($local_file)->[0]; +} + +#-> sub CPAN::Distribution::cpan_userid +sub cpan_userid { + my $self = shift; + if ($self->{ID} =~ m{[A-Z]/[A-Z\-]{2}/([A-Z\-]+)/}) { + return $1; + } + return $self->SUPER::cpan_userid; } #-> sub CPAN::Distribution::pretty_id @@ -4686,11 +4747,26 @@ sub called_for { #-> sub CPAN::Distribution::get ; sub get { my($self) = @_; + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + EXCUSE: { my @e; - exists $self->{'build_dir'} and push @e, - "Is already unwrapped into directory $self->{'build_dir'}"; - $CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e; + exists $self->{build_dir} and push @e, + "Is already unwrapped into directory $self->{build_dir}"; + + exists $self->{unwrapped} and ( + $self->{unwrapped}->can("failed") ? + $self->{unwrapped}->failed : + $self->{unwrapped} =~ /^NO/ + ) + and push @e, "Unwrapping had some problem, won't try again without force"; + + $CPAN::Frontend->mywarn(join "", map {" $_\n"} @e) and return if @e; } my $sub_wd = CPAN::anycwd(); # for cleaning up as good as possible @@ -4718,7 +4794,8 @@ sub get { } $CPAN::Frontend->mydie("Giving up on '$local_wanted'\n$note"); } - $self->debug("local_file[$local_file]") if $CPAN::DEBUG; + + $self->debug("local_wanted[$local_wanted]local_file[$local_file]") if $CPAN::DEBUG; $self->{localfile} = $local_file; return if $CPAN::Signal; @@ -4761,7 +4838,6 @@ EOF # # Unpack the goods # - $self->debug("local_file[$local_file]") if $CPAN::DEBUG; my $ct = CPAN::Tarzip->new($local_file); if ($local_file =~ /(\.tar\.(bz2|gz|Z)|\.tgz)(?!\n)\Z/i){ $self->{was_uncompressed}++ unless $ct->gtest(); @@ -4770,8 +4846,6 @@ EOF $self->unzip_me($ct); } else { $self->{was_uncompressed}++ unless $ct->gtest(); - $self->debug("calling pm2dir for local_file[$local_file]") - if $CPAN::DEBUG; $local_file = $self->handle_singlefile($local_file); # } else { # $self->{archived} = "NO"; @@ -4814,8 +4888,8 @@ EOF )) if $CPAN::DEBUG; } else { my $userid = $self->cpan_userid; - unless ($userid) { - CPAN->debug("no userid? self[$self]"); + CPAN->debug("userid[$userid]"); + if (!$userid or $userid eq "N/A") { $userid = "anon"; } my $pragmatic_dir = $userid . '000'; @@ -4840,50 +4914,7 @@ EOF File::Path::rmtree("tmp"); $self->safe_chdir($packagedir); - if ($CPAN::Config->{check_sigs}) { - if ($CPAN::META->has_inst("Module::Signature")) { - if (-f "SIGNATURE") { - $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG; - my $rv = Module::Signature::verify(); - if ($rv != Module::Signature::SIGNATURE_OK() and - $rv != Module::Signature::SIGNATURE_MISSING()) { - $CPAN::Frontend->myprint( - qq{\nSignature invalid for }. - qq{distribution file. }. - qq{Please investigate.\n\n}. - $self->as_string, - $CPAN::META->instance( - 'CPAN::Author', - $self->cpan_userid, - )->as_string - ); - - my $wrap = - sprintf(qq{I'd recommend removing %s. Its signature -is invalid. Maybe you have configured your 'urllist' with -a bad URL. Please check this array with 'o conf urllist', and -retry. For more information, try opening a subshell with - look %s -and there run - cpansign -v -}, - $self->{localfile}, - $self->pretty_id, - ); - $self->{signature_verify} = CPAN::Distrostatus->new("NO"); - $CPAN::Frontend->mywarn(Text::Wrap::wrap("","",$wrap)); - $CPAN::Frontend->mysleep(5) if $CPAN::Frontend->can("mysleep"); - } else { - $self->{signature_verify} = CPAN::Distrostatus->new("YES"); - $self->debug("Module::Signature has verified") if $CPAN::DEBUG; - } - } else { - $CPAN::Frontend->mywarn(qq{Package came without SIGNATURE\n\n}); - } - } else { - $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG; - } - } + $self->_signature_business(); $self->safe_chdir($builddir); return if $CPAN::Signal; @@ -4903,116 +4934,201 @@ and there run my $prefer_installer = "eumm"; # eumm|mb if (-f File::Spec->catfile($packagedir,"Build.PL")) { if ($mpl_exists) { # they *can* choose - if ($CPAN::META->has_inst("Module::Build")) { - $prefer_installer = $CPAN::Config->{prefer_installer}; - } + $prefer_installer = CPAN::HandleConfig->prefs_lookup($self, + q{prefer_installer}); } else { $prefer_installer = "mb"; } } + return unless $self->patch; if (lc($prefer_installer) eq "mb") { $self->{modulebuild} = 1; } elsif (! $mpl_exists) { - $self->debug(sprintf("makefilepl[%s]anycwd[%s]", - $mpl, - CPAN::anycwd(), - )) if $CPAN::DEBUG; - my($configure) = File::Spec->catfile($packagedir,"Configure"); - if (-f $configure) { - # do we have anything to do? - $self->{'configure'} = $configure; - } elsif (-f File::Spec->catfile($packagedir,"Makefile")) { - $CPAN::Frontend->mywarn(qq{ + $self->_edge_cases($mpl,$packagedir,$local_file); + } + + return $self; +} + +#-> CPAN::Distribution::patch +sub try_download { + my($self,$patch) = @_; + my $norm = $self->normalize($patch); + my($local_wanted) = + File::Spec->catfile( + $CPAN::Config->{keep_source_where}, + "authors", + "id", + split(/\//,$norm), + ); + $self->debug("Doing localize") if $CPAN::DEBUG; + return CPAN::FTP->localize("authors/id/$norm", + $local_wanted); +} + +#-> CPAN::Distribution::patch +sub patch { + my($self) = @_; + if (my $patches = $self->prefs->{patches}) { + return unless @$patches; + $self->safe_chdir($self->{build_dir}); + CPAN->debug("patches[$patches]"); + my $patchbin = $CPAN::Config->{patch}; + unless ($patchbin && length $patchbin) { + $CPAN::Frontend->mydie("No external patch command configured\n\n". + "Please run 'o conf init /patch/'\n\n"); + } + unless (MM->maybe_command($patchbin)) { + $CPAN::Frontend->mydie("No external patch command available\n\n". + "Please run 'o conf init /patch/'\n\n"); + } + $patchbin = CPAN::HandleConfig->safe_quote($patchbin); + my $args = "-b -g0 -p1 -N --fuzz=3"; + my $countedpatches = @$patches == 1 ? "1 patch" : (scalar @$patches . " patches"); + $CPAN::Frontend->myprint("Going to apply $countedpatches:\n"); + for my $patch (@$patches) { + unless (-f $patch) { + if (my $trydl = $self->try_download($patch)) { + $patch = $trydl; + } else { + my $fail = "Could not find patch '$patch'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + } + $CPAN::Frontend->myprint(" $patch\n"); + my $readfh = CPAN::Tarzip->TIEHANDLE($patch); + my $writefh = FileHandle->new; + unless (open $writefh, "|$patchbin $args") { + my $fail = "Could not fork '$patchbin $args'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + while (my $x = $readfh->READLINE) { + print $writefh $x; + } + unless (close $writefh) { + my $fail = "Could not apply patch '$patch'"; + $CPAN::Frontend->mywarn("$fail; cannot continue\n"); + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail"); + delete $self->{build_dir}; + return; + } + } + $self->{patched}++; + } + return 1; +} + +#-> sub CPAN::Distribution::_edge_cases +# with "configure" or "Makefile" or single file scripts +sub _edge_cases { + my($self,$mpl,$packagedir,$local_file) = @_; + $self->debug(sprintf("makefilepl[%s]anycwd[%s]", + $mpl, + CPAN::anycwd(), + )) if $CPAN::DEBUG; + my($configure) = File::Spec->catfile($packagedir,"Configure"); + if (-f $configure) { + # do we have anything to do? + $self->{configure} = $configure; + } elsif (-f File::Spec->catfile($packagedir,"Makefile")) { + $CPAN::Frontend->mywarn(qq{ Package comes with a Makefile and without a Makefile.PL. We\'ll try to build it with that Makefile then. }); - $self->{writemakefile} = CPAN::Distrostatus->new("YES"); - $CPAN::Frontend->mysleep(2); - } else { - my $cf = $self->called_for || "unknown"; - if ($cf =~ m|/|) { - $cf =~ s|.*/||; - $cf =~ s|\W.*||; - } - $cf =~ s|[/\\:]||g; # risk of filesystem damage - $cf = "unknown" unless length($cf); - $CPAN::Frontend->mywarn(qq{Package seems to come without Makefile.PL. + $self->{writemakefile} = CPAN::Distrostatus->new("YES"); + $CPAN::Frontend->mysleep(2); + } else { + my $cf = $self->called_for || "unknown"; + if ($cf =~ m|/|) { + $cf =~ s|.*/||; + $cf =~ s|\W.*||; + } + $cf =~ s|[/\\:]||g; # risk of filesystem damage + $cf = "unknown" unless length($cf); + $CPAN::Frontend->mywarn(qq{Package seems to come without Makefile.PL. (The test -f "$mpl" returned false.) Writing one on our own (setting NAME to $cf)\a\n}); - $self->{had_no_makefile_pl}++; - $CPAN::Frontend->mysleep(3); - - # Writing our own Makefile.PL - - my $script = ""; - if ($self->{archived} eq "maybe_pl"){ - my $fh = FileHandle->new; - my $script_file = File::Spec->catfile($packagedir,$local_file); - $fh->open($script_file) - or Carp::croak("Could not open $script_file: $!"); - local $/ = "\n"; - # name parsen und prereq - my($state) = "poddir"; - my($name, $prereq) = ("", ""); - while (<$fh>){ - if ($state eq "poddir" && /^=head\d\s+(\S+)/) { - if ($1 eq 'NAME') { - $state = "name"; - } elsif ($1 eq 'PREREQUISITES') { - $state = "prereq"; - } - } elsif ($state =~ m{^(name|prereq)$}) { - if (/^=/) { - $state = "poddir"; - } elsif (/^\s*$/) { - # nop - } elsif ($state eq "name") { - if ($name eq "") { - ($name) = /^(\S+)/; - $state = "poddir"; - } - } elsif ($state eq "prereq") { - $prereq .= $_; - } - } elsif (/^=cut\b/) { - last; - } - } - $fh->close; + $self->{had_no_makefile_pl}++; + $CPAN::Frontend->mysleep(3); - for ($name) { - s{.*<}{}; # strip X<...> - s{>.*}{}; - } - chomp $prereq; - $prereq = join " ", split /\s+/, $prereq; - my($PREREQ_PM) = join("\n", map { - s{.*<}{}; # strip X<...> - s{>.*}{}; - if (/[\s\'\"]/) { # prose? - } else { - s/[^\w:]$//; # period? - " "x28 . "'$_' => 0,"; + # Writing our own Makefile.PL + + my $script = ""; + if ($self->{archived} eq "maybe_pl") { + my $fh = FileHandle->new; + my $script_file = File::Spec->catfile($packagedir,$local_file); + $fh->open($script_file) + or Carp::croak("Could not open $script_file: $!"); + local $/ = "\n"; + # name parsen und prereq + my($state) = "poddir"; + my($name, $prereq) = ("", ""); + while (<$fh>) { + if ($state eq "poddir" && /^=head\d\s+(\S+)/) { + if ($1 eq 'NAME') { + $state = "name"; + } elsif ($1 eq 'PREREQUISITES') { + $state = "prereq"; + } + } elsif ($state =~ m{^(name|prereq)$}) { + if (/^=/) { + $state = "poddir"; + } elsif (/^\s*$/) { + # nop + } elsif ($state eq "name") { + if ($name eq "") { + ($name) = /^(\S+)/; + $state = "poddir"; + } + } elsif ($state eq "prereq") { + $prereq .= $_; } - } split /\s*,\s*/, $prereq); + } elsif (/^=cut\b/) { + last; + } + } + $fh->close; + + for ($name) { + s{.*<}{}; # strip X<...> + s{>.*}{}; + } + chomp $prereq; + $prereq = join " ", split /\s+/, $prereq; + my($PREREQ_PM) = join("\n", map { + s{.*<}{}; # strip X<...> + s{>.*}{}; + if (/[\s\'\"]/) { # prose? + } else { + s/[^\w:]$//; # period? + " "x28 . "'$_' => 0,"; + } + } split /\s*,\s*/, $prereq); - $script = " + $script = " EXE_FILES => ['$name'], PREREQ_PM => { $PREREQ_PM }, "; + if ($name) { + my $to_file = File::Spec->catfile($packagedir, $name); + rename $script_file, $to_file + or die "Can't rename $script_file to $to_file: $!"; + } + } - my $to_file = File::Spec->catfile($packagedir, $name); - rename $script_file, $to_file - or die "Can't rename $script_file to $to_file: $!"; - } - - my $fh = FileHandle->new; - $fh->open(">$mpl") - or Carp::croak("Could not open >$mpl: $!"); - $fh->print( -qq{# This Makefile.PL has been autogenerated by the module CPAN.pm + my $fh = FileHandle->new; + $fh->open(">$mpl") + or Carp::croak("Could not open >$mpl: $!"); + $fh->print( + qq{# This Makefile.PL has been autogenerated by the module CPAN.pm # because there was no Makefile.PL supplied. # Autogenerated on: }.scalar localtime().qq{ @@ -5021,21 +5137,67 @@ WriteMakefile( NAME => q[$cf],$script ); }); - $fh->close; - } + $fh->close; } +} - return $self; +#-> CPAN::Distribution::_signature_business +sub _signature_business { + my($self) = @_; + if ($CPAN::Config->{check_sigs}) { + if ($CPAN::META->has_inst("Module::Signature")) { + if (-f "SIGNATURE") { + $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG; + my $rv = Module::Signature::verify(); + if ($rv != Module::Signature::SIGNATURE_OK() and + $rv != Module::Signature::SIGNATURE_MISSING()) { + $CPAN::Frontend->myprint( + qq{\nSignature invalid for }. + qq{distribution file. }. + qq{Please investigate.\n\n}. + $self->as_string, + $CPAN::META->instance( + 'CPAN::Author', + $self->cpan_userid, + )->as_string + ); + + my $wrap = + sprintf(qq{I'd recommend removing %s. Its signature +is invalid. Maybe you have configured your 'urllist' with +a bad URL. Please check this array with 'o conf urllist', and +retry. For more information, try opening a subshell with + look %s +and there run + cpansign -v +}, + $self->{localfile}, + $self->pretty_id, + ); + $self->{signature_verify} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->mywarn(Text::Wrap::wrap("","",$wrap)); + $CPAN::Frontend->mysleep(5) if $CPAN::Frontend->can("mysleep"); + } else { + $self->{signature_verify} = CPAN::Distrostatus->new("YES"); + $self->debug("Module::Signature has verified") if $CPAN::DEBUG; + } + } else { + $CPAN::Frontend->mywarn(qq{Package came without SIGNATURE\n\n}); + } + } else { + $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG; + } + } } -# CPAN::Distribution::untar_me ; +#-> CPAN::Distribution::untar_me ; sub untar_me { my($self,$ct) = @_; $self->{archived} = "tar"; if ($ct->untar()) { - $self->{unwrapped} = "YES"; + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); } else { - $self->{unwrapped} = "NO"; + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- untar failed"); } } @@ -5044,9 +5206,9 @@ sub unzip_me { my($self,$ct) = @_; $self->{archived} = "zip"; if ($ct->unzip()) { - $self->{unwrapped} = "YES"; + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); } else { - $self->{unwrapped} = "NO"; + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- unzip failed"); } return; } @@ -5063,13 +5225,13 @@ sub handle_singlefile { my $to = File::Basename::basename($local_file); if ($to =~ s/\.(gz|Z)(?!\n)\Z//) { if (CPAN::Tarzip->new($local_file)->gunzip($to)) { - $self->{unwrapped} = "YES"; + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); } else { - $self->{unwrapped} = "NO"; + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed"); } } else { File::Copy::cp($local_file,"."); - $self->{unwrapped} = "YES"; + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed"); } return $to; } @@ -5291,7 +5453,7 @@ sub CHECKSUM_check_file { $sloppy ||= 0; $self->debug("chk_file[$chk_file]sloppy[$sloppy]") if $CPAN::DEBUG; if ($CPAN::Config->{check_sigs}) { - if ($CPAN::META->has_inst("Module::Signature") and Module::Signature->VERSION >= 0.26) { + if ($CPAN::META->has_inst("Module::Signature")) { $self->debug("Module::Signature is installed, verifying"); $self->SIG_check_file($chk_file); } else { @@ -5437,8 +5599,11 @@ sub force { make make_test modulebuild + prefs + prefs_file prereq_pm prereq_pm_detected + reqtype signature_verify unwrapped writemakefile @@ -5540,17 +5705,31 @@ is part of the perl-%s distribution. To install that, you need to run } $CPAN::Frontend->myprint(sprintf "Running %s for %s\n", $make, $self->id); $self->get; + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + if ($CPAN::Signal){ delete $self->{force_update}; return; } EXCUSE: { my @e; - !$self->{archived} || $self->{archived} eq "NO" and push @e, - "Is neither a tar nor a zip archive."; + if (!$self->{archived} || $self->{archived} eq "NO") { + push @e, "Is neither a tar nor a zip archive."; + } - !$self->{unwrapped} || $self->{unwrapped} eq "NO" and push @e, - "Had problems unarchiving. Please build manually"; + if (!$self->{unwrapped} + || ( + $self->{unwrapped}->can("failed") ? + $self->{unwrapped}->failed : + $self->{unwrapped} =~ /^NO/ + )) { + push @e, "Had problems unarchiving. Please build manually"; + } unless ($self->{force_update}) { exists $self->{signature_verify} and ( @@ -5631,7 +5810,12 @@ is part of the perl-%s distribution. To install that, you need to run $makepl_arg ? " $makepl_arg" : "", ); } - local %ENV = %ENV; + my %env; + while (my($k,$v) = each %ENV) { + next unless defined $v; + $env{$k} = $v; + } + local %ENV = %env; if (my $env = $self->prefs->{pl}{env}) { for my $e (keys %$env) { $ENV{$e} = $env->{$e}; @@ -5693,7 +5877,7 @@ is part of the perl-%s distribution. To install that, you need to run } } else { if (my $expect = $self->prefs->{pl}{expect}) { - $ret = $self->run_via_expect($system,$expect); + $ret = $self->_run_via_expect($system,$expect); } else { $ret = system($system); } @@ -5765,17 +5949,26 @@ is part of the perl-%s distribution. To install that, you need to run } } -# CPAN::Distribution::run_via_expect -sub run_via_expect { +# CPAN::Distribution::_run_via_expect +sub _run_via_expect { my($self,$system,$expect) = @_; CPAN->debug("system[$system]expect[$expect]") if $CPAN::DEBUG; if ($CPAN::META->has_inst("Expect")) { my $expo = Expect->new; $expo->spawn($system); EXPECT: for (my $i = 0; $i < $#$expect; $i+=2) { - my $regex = eval "qr{$expect->[$i]}"; + my $next = $expect->[$i]; + my($timeout,$re); + if (ref $next) { + $timeout = $next->{timeout}; + $re = $next->{expect}; + } else { + $timeout = 15; + $re = $next; + } + my $regex = eval "qr{$re}"; my $send = $expect->[$i+1]; - $expo->expect(10, + $expo->expect($timeout, [ eof => sub { my $but = $expo->clear_accum; $CPAN::Frontend->mywarn("EOF (maybe harmless) system[$system] @@ -5800,8 +5993,8 @@ expected[$regex]\nbut[$but]\n\n"); # CPAN::Distribution::_find_prefs sub _find_prefs { - my($self,$distro) = @_; - my $distroid = $distro->pretty_id; + my($self) = @_; + my $distroid = $self->pretty_id; CPAN->debug("distroid[$distroid]") if $CPAN::DEBUG; my $prefs_dir = $CPAN::Config->{prefs_dir}; eval { File::Path::mkpath($prefs_dir); }; @@ -5816,39 +6009,52 @@ sub _find_prefs { next if $_ eq "." || $_ eq ".."; next unless /\.yml$/; my $abs = File::Spec->catfile($prefs_dir, $_); - # CPAN->debug("abs[$abs]") if $CPAN::DEBUG; if (-f $abs) { - my $yaml = CPAN->_yaml_loadfile($abs); - my $ok = 1; - my $match = $yaml->{match} or - $CPAN::Frontend->mydie("Nonconforming YAML file '$abs': ". - "missing attribut 'match'. Please ". - "remove, cannot continue."); - for my $sub_attribute (keys %$match) { - my $qr = eval "qr{$yaml->{match}{$sub_attribute}}"; - if ($sub_attribute eq "module") { - my $okm = 0; - my @modules = $distro->containsmods; - for my $module (@modules) { - $okm ||= $module =~ /$qr/; - last if $okm; + CPAN->debug(sprintf "abs[%s]", $abs) if $CPAN::DEBUG; + my @yaml = @{CPAN->_yaml_loadfile($abs)}; + # $DB::single=1; + ELEMENT: for my $y (0..$#yaml) { + my $yaml = $yaml[$y]; + my $match = $yaml->{match}; + unless ($match) { + CPAN->debug("no 'match' in abs[$abs], skipping"); + next ELEMENT; + } + my $ok = 1; + for my $sub_attribute (keys %$match) { + my $qr = eval "qr{$yaml->{match}{$sub_attribute}}"; + if ($sub_attribute eq "module") { + my $okm = 0; + CPAN->debug(sprintf "abs[%s]yaml[%d]", $abs, scalar @yaml) if $CPAN::DEBUG; + my @modules = $self->containsmods; + CPAN->debug(sprintf "abs[%s]yaml[%d]modules[%s]", $abs, scalar @yaml, join(",",@modules)) if $CPAN::DEBUG; + MODULE: for my $module (@modules) { + $okm ||= $module =~ /$qr/; + last MODULE if $okm; + } + $ok &&= $okm; + } elsif ($sub_attribute eq "distribution") { + my $okd = $distroid =~ /$qr/; + $ok &&= $okd; + } elsif ($sub_attribute eq "perl") { + my $okp = $^X =~ /$qr/; + $ok &&= $okp; + } else { + $CPAN::Frontend->mydie("Nonconforming YAML file '$abs': ". + "unknown sub_attribut '$sub_attribute'. ". + "Please ". + "remove, cannot continue."); } - $ok &&= $okm; - } elsif ($sub_attribute eq "distribution") { - my $okd = $distroid =~ /$qr/; - $ok &&= $okd; - } else { - $CPAN::Frontend->mydie("Nonconforming YAML file '$abs': ". - "unknown sub_attribut '$sub_attribute'. ". - "Please ". - "remove, cannot continue."); } - } - if ($ok) { - return { - prefs => $yaml, - prefs_file => $abs, - }; + CPAN->debug(sprintf "abs[%s]yaml[%d]ok[%d]", $abs, scalar @yaml, $ok) if $CPAN::DEBUG; + if ($ok) { + return { + prefs => $yaml, + prefs_file => $abs, + prefs_file_section => $y, + }; + } + } } } @@ -5868,19 +6074,23 @@ sub prefs { } if ($CPAN::Config->{prefs_dir}) { CPAN->debug("prefs_dir[$CPAN::Config->{prefs_dir}]") if $CPAN::DEBUG; - my $prefs = $self->_find_prefs($self); + my $prefs = $self->_find_prefs(); if ($prefs) { - for my $x (qw(prefs prefs_file)) { + for my $x (qw(prefs prefs_file prefs_file_section)) { $self->{$x} = $prefs->{$x}; } - my $basename = File::Basename::basename($self->{prefs_file}); + my $bs = sprintf( + "%s[%s]", + File::Basename::basename($self->{prefs_file}), + $self->{prefs_file_section}, + ); my $filler1 = "_" x 22; - my $filler2 = int(66 - length($basename))/2; + my $filler2 = int(66 - length($bs))/2; $filler2 = 0 if $filler2 < 0; $filler2 = " " x $filler2; $CPAN::Frontend->myprint(" $filler1 D i s t r o P r e f s $filler1 -$filler2 $basename $filler2 +$filler2 $bs $filler2 "); $CPAN::Frontend->mysleep(1); return $self->{prefs}; @@ -5917,8 +6127,8 @@ sub _make_command { return CPAN::HandleConfig ->safe_quote( - $self->prefs->{cpanconfig}{make} - || $CPAN::Config->{make} + CPAN::HandleConfig->prefs_lookup($self, + q{make}) || $Config::Config{make} || 'make' ); @@ -5927,7 +6137,7 @@ sub _make_command { Carp::confess("CPAN::_make_command() used as function. Don't Do That."); return safe_quote(undef, - $self->prefs->{cpanconfig}{make} + CPAN::HandleConfig->prefs_lookup($self,q{make}) || $CPAN::Config->{make} || $Config::Config{make} || 'make'); @@ -5940,15 +6150,30 @@ sub follow_prereqs { my(@prereq_tuples) = grep {$_->[0] ne "perl"} @_; return unless @prereq_tuples; my @prereq = map { $_->[0] } @prereq_tuples; - my $id = $self->id; + my $pretty_id = $self->pretty_id; my %map = ( b => "build_requires", r => "requires", c => "commandline", ); + my($filler1,$filler2,$filler3,$filler4); + my $unsat = "Unsatisfied dependencies detected during"; + my $w = length($unsat) > length($pretty_id) ? length($unsat) : length($pretty_id); + { + my $r = int(($w - length($unsat))/2); + my $l = $w - length($unsat) - $r; + $filler1 = "-"x4 . " "x$l; + $filler2 = " "x$r . "-"x4 . "\n"; + } + { + my $r = int(($w - length($pretty_id))/2); + my $l = $w - length($pretty_id) - $r; + $filler3 = "-"x4 . " "x$l; + $filler4 = " "x$r . "-"x4 . "\n"; + } $CPAN::Frontend-> - myprint("---- Unsatisfied dependencies detected during\n". - "---- $id\n". + myprint("$filler1 $unsat $filler2". + "$filler3 $pretty_id $filler4". join("", map {" $_->[0] \[$map{$_->[1]}]\n"} @prereq_tuples), ); my $follow = 0; @@ -5965,6 +6190,7 @@ of modules we are processing right now?", "yes"); myprint(" Ignoring dependencies on modules @prereq\n"); } if ($follow) { + my $id = $self->id; # color them as dirty for my $p (@prereq) { # warn "calling color_cmd_tmps(0,1)"; @@ -6073,9 +6299,9 @@ sub read_yaml { my $yaml = File::Spec->catfile($build_dir,"META.yml"); $self->debug("yaml[$yaml]") if $CPAN::DEBUG; return unless -f $yaml; - eval { $self->{yaml_content} = CPAN->_yaml_loadfile($yaml); }; + eval { $self->{yaml_content} = CPAN->_yaml_loadfile($yaml)->[0]; }; if ($@) { - return; # if we die, then we cannot read our own META.yml + return; # if we die, then we cannot read YAML's own META.yml } if (not exists $self->{yaml_content}{dynamic_config} or $self->{yaml_content}{dynamic_config} @@ -6165,19 +6391,28 @@ sub prereq_pm { $req = Module::Build->current->requires(); $breq = Module::Build->current->build_requires(); }; + # this failed for example for HTML::Mason and for + # Error.pm because they are subclassing Module::Build + # in their Build.PL in such a way that Module::Build + # cannot read the _build directory. We DO need a dump + # command for that. if ($@) { - # HTML::Mason prompted for this with bleadperl@28900 or so $CPAN::Frontend ->mywarn( sprintf("Warning: while trying to determine ". "prerequisites for %s with the help of ". "Module::Build the following error ". - "occurred: '%s'\n\nCannot care for prerequisites\n", + "occurred: '%s'\n\nFalling back to META.yml ". + "for prerequisites\n", $self->id, $@ )); - $self->{prereq_pm_detected}++; - return $self->{prereq_pm} = {requires=>{},build_requires=>{}}; + my $build_dir = $self->{build_dir}; + my $yaml = File::Spec->catfile($build_dir,"META.yml"); + if ($yaml = CPAN->_yaml_loadfile($yaml)->[0]) { + $req = $yaml->{requires} || {}; + $breq = $yaml->{build_requires} || {}; + } } } } @@ -6213,6 +6448,14 @@ sub test { } my $make = $self->{modulebuild} ? "Build" : "make"; + + local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) + ? $ENV{PERL5LIB} + : ($ENV{PERLLIB} || ""); + + $CPAN::META->set_perl5lib; + local $ENV{MAKEFLAGS}; # protect us from outer make calls + $CPAN::Frontend->myprint("Running $make test\n"); if (my @prereq = $self->unsat_prereq){ unless ($prereq[0][0] eq "perl") { @@ -6293,18 +6536,64 @@ sub test { $system = join " ", $self->_make_command(), "test"; } my($tests_ok); - # XXX fix unini warnings - local %ENV = %ENV; + my %env; + while (my($k,$v) = each %ENV) { + next unless defined $v; + $env{$k} = $v; + } + local %ENV = %env; if (my $env = $self->prefs->{test}{env}) { for my $e (keys %$env) { $ENV{$e} = $env->{$e}; } } my $expect = $self->prefs->{test}{expect}; - if ($expect && @$expect) { - $tests_ok = $self->run_via_expect($system,$expect) == 0; - } elsif ( $CPAN::Config->{test_report} && - $CPAN::META->has_inst("CPAN::Reporter") ) { + my $can_expect = $CPAN::META->has_inst("Expect"); + my $want_expect = 0; + if ( $expect && @$expect ) { + if ($can_expect) { + $want_expect = 1; + } else { + $CPAN::Frontend->mywarn("Expect not installed, falling back to ". + "testing without\n"); + } + } + my $test_report = CPAN::HandleConfig->prefs_lookup($self, + q{test_report}); + my $can_report = $CPAN::META->has_inst("CPAN::Reporter"); + my $want_report = $test_report && $can_report; + my $ready_to_report = $want_report; + if ($ready_to_report + && ( + substr($self->id,-1,1) eq "." + || + $self->author->id eq "LOCAL" + ) + ) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ". + "for for local directories\n"); + $ready_to_report = 0; + } + if ($ready_to_report + && + $self->prefs->{patches} + && + @{$self->prefs->{patches}} + && + $self->{patched} + ) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ". + "when the source has been patched\n"); + $ready_to_report = 0; + } + if ($want_expect) { + if ($ready_to_report) { + $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is currently ". + "not supported when distroprefs specify ". + "an interactive test\n"); + } + $tests_ok = $self->_run_via_expect($system,$expect) == 0; + } elsif ( $ready_to_report ) { $tests_ok = CPAN::Reporter::test($self, $system); } else { $tests_ok = system($system) == 0; @@ -6330,7 +6619,7 @@ sub test { my $verb = $cnt == 1 ? "one dependency not OK ($which)" : "$cnt dependencies missing ($which)"; $CPAN::Frontend->mywarn("Tests succeeded but $verb\n"); - $self->{make_test} = CPAN::Distrostatus->new("NO -- $verb"); + $self->{make_test} = CPAN::Distrostatus->new("NO $verb"); return; } } @@ -6503,9 +6792,9 @@ sub install { ); } else { my($make_install_make_command) = - $self->prefs->{cpanconfig}{make_install_make_command} - || $CPAN::Config->{make_install_make_command} - || $self->_make_command(); + CPAN::HandleConfig->prefs_lookup($self, + q{make_install_make_command}) + || $self->_make_command(); $system = sprintf("%s install %s", $make_install_make_command, $CPAN::Config->{make_install_arg}, @@ -6513,8 +6802,8 @@ sub install { } my($stderr) = $^O eq "MSWin32" ? "" : " 2>&1 "; - my $brip = $self->prefs->{cpanconfig}{build_requires_install_policy}; - $brip ||= $CPAN::Config->{build_requires_install_policy}; + my $brip = CPAN::HandleConfig->prefs_lookup($self, + q{build_requires_install_policy}); $brip ||="ask/yes"; my $id = $self->id; my $reqtype = $self->{reqtype} ||= "c"; # in doubt it was a command @@ -6556,15 +6845,15 @@ sub install { $self->{install} = CPAN::Distrostatus->new("NO"); $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); my $mimc = - $self->prefs->{cpanconfig}{make_install_make_command} || - $CPAN::Config->{make_install_make_command}; + CPAN::HandleConfig->prefs_lookup($self, + q{make_install_make_command}); if ( $makeout =~ /permission/s && $> > 0 && ( ! $mimc - || $mimc eq ($self->prefs->{cpanconfig}{make} - || $CPAN::Config->{make}) + || $mimc eq (CPAN::HandleConfig->prefs_lookup($self, + q{make})) ) ) { $CPAN::Frontend->myprint( @@ -6994,9 +7283,10 @@ sub rematein { if ($type eq 'CPAN::Distribution') { $CPAN::Frontend->mywarn(qq{ The Bundle }.$self->id.qq{ contains -explicitly a file $s. +explicitly a file '$s'. +Going to $meth that. }); - $CPAN::Frontend->mysleep(3); + $CPAN::Frontend->mysleep(5); } # possibly noisy action: $self->debug("type[$type] s[$s]") if $CPAN::DEBUG; @@ -7397,7 +7687,7 @@ sub manpage_headline { # Note: also inherited by CPAN::Bundle sub cpan_file { my $self = shift; - CPAN->debug(sprintf "id[%s]", $self->id) if $CPAN::DEBUG; + # CPAN->debug(sprintf "id[%s]", $self->id) if $CPAN::DEBUG; unless ($self->ro) { CPAN::Index->reload; } @@ -7941,7 +8231,9 @@ commands), then you should try the CPAN::Nox module for recovery. =head2 report Bundle|Distribution|Module The C command temporarily turns on the C config -variable, then runs the C command with the given arguments. +variable, then runs the C command with the given +arguments. The C pragma is used to re-run the tests and repeat +every step that might have failed before. =head2 upgrade [Module|/Regex/]... @@ -7975,9 +8267,9 @@ Modules know their associated Distribution objects. They always refer to the most recent official release. Developers may mark their releases as unstable development versions (by inserting an underbar into the module version number which will also be reflected in the distribution -name when you run 'make dist'), so the really hottest and newest -distribution is not always the default. If a module Foo circulates -on CPAN in both version 1.23 and 1.23_90, CPAN.pm offers a convenient +name when you run 'make dist'), so the really hottest and newest +distribution is not always the default. If a module Foo circulates +on CPAN in both version 1.23 and 1.23_90, CPAN.pm offers a convenient way to install version 1.23 by saying install Foo @@ -7994,6 +8286,29 @@ so you would have to say The first example will be driven by an object of the class CPAN::Module, the second by an object of class CPAN::Distribution. +=head2 Integrating local directories + +Distribution objects are normally distributions from the CPAN, but +there is a slightly degenerate case for Distribution objects, too, +normally only needed by developers. If a distribution object ends with +a dot or is a dot by itself, then it represents a local directory and +all actions such as C, C, and C are applied +directly to that directory. This gives the command C an +interesting touch: while the normal mantra of installing a CPAN module +without CPAN.pm is one of + + perl Makefile.PL perl Build.PL + ( go and get prerequisites ) + make ./Build + make test ./Build test + make install ./Build install + +the command C does all of this at once. It figures out which +of the two mantras is appropriate, fetches and installs all +prerequisites, cares for them recursively and finally finishes the +installation of the module in the current directory, be it a CPAN +module or not. + =head1 PROGRAMMER'S INTERFACE If you do not enter the shell, the available shell commands are both @@ -8300,7 +8615,8 @@ through the pager specified in C<$CPAN::Config->{pager}>. Returns the content of the META.yml of this distro as a hashref. Note: works only after an attempt has been made to C the distribution. -Returns undef otherwise. +Returns undef otherwise. Also returns undef if the content of META.yml +is dynamic. =item CPAN::Distribution::test() @@ -8738,6 +9054,7 @@ defined: no_proxy don't proxy to these hosts/domains (comma separated list) pager location of external program more (or any pager) password your password if you CPAN server wants one + patch path to external prg prefer_installer legal values are MB and EUMM: if a module comes with both a Makefile.PL and a Build.PL, use the former (EUMM) or the latter (MB); if the module @@ -8870,17 +9187,18 @@ modules like Plagger. CPAN.pm can use YAML files to either pass additional arguments to one of the four commands, set environment variables or instantiate an -Expect object that reads from the console, waits for some regular -expression and enters some answer. Needless to say that for the latter -option Expect.pm needs to be installed. +Expect object that reads from the console and enters answers on your +behalf (latter option requires Expect.pm installed). A further option +is to apply patches from the local disk or from CPAN. CPAN.pm comes with a couple of such YAML files. The structure is -currently not documented. Please see the distroprefs directory of the -CPAN distribution for examples and follow the README in there. +currently not documented because in flux. Please see the distroprefs +directory of the CPAN distribution for examples and follow the README +in there. Please note that setting the environment variable PERL_MM_USE_DEFAULT to a true value can also get you a long way if you want to always pick -the default answers. But this only works if the author of apackage +the default answers. But this only works if the author of a package used the prompt function provided by ExtUtils::MakeMaker and if the defaults are OK for you. diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 02707be..256980a 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -17,9 +17,9 @@ use ExtUtils::MakeMaker (); use FileHandle (); use File::Basename (); use File::Path (); -use File::Spec; +use File::Spec (); use vars qw($VERSION $urllist); -$VERSION = sprintf "%.6f", substr(q$Rev: 1039 $,4)/1000000 + 5.4; +$VERSION = sprintf "%.6f", substr(q$Rev: 1086 $,4)/1000000 + 5.4; =head1 NAME @@ -296,7 +296,7 @@ Shall we use it as the general CPAN build and cache directory? my @external_progs = qw/bzip2 gzip tar unzip make curl lynx wget ncftpget ncftp ftp - gpg/; + gpg patch/; my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'}; if (!$matcher or "@external_progs" =~ /$matcher/) { $CPAN::Frontend->myprint($prompts{external_progs}); @@ -337,9 +337,12 @@ Shall we use it as the general CPAN build and cache directory? $progcall = $Config::Config{$progname} if $Config::Config{$progname}; } - $path ||= find_exe($progcall,[@path]); - $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH\n") unless - $path; # not -e $path, because find_exe already checked that + $path ||= find_exe($progcall,\@path); + { + local $"=";"; + $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@path]\n") unless + $path; # not -e $path, because find_exe already checked that + } $ans = prompt("Where is your $progname program?",$path) || $path; $CPAN::Config->{$progname} = $ans; } @@ -347,8 +350,8 @@ Shall we use it as the general CPAN build and cache directory? if (!$matcher or 'pager' =~ /$matcher/) { my $path = $CPAN::Config->{'pager'} || - $ENV{PAGER} || find_exe("less",[@path]) || - find_exe("more",[@path]) || ($^O eq 'MacOS' ? $ENV{EDITOR} : 0 ) + $ENV{PAGER} || find_exe("less",\@path) || + find_exe("more",\@path) || ($^O eq 'MacOS' ? $ENV{EDITOR} : 0 ) || "more"; $ans = prompt("What is your favorite pager program?",$path); $CPAN::Config->{'pager'} = $ans; diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm index b6af22b..a51f557 100644 --- a/lib/CPAN/HandleConfig.pm +++ b/lib/CPAN/HandleConfig.pm @@ -2,7 +2,7 @@ package CPAN::HandleConfig; use strict; use vars qw(%can %keys $VERSION); -$VERSION = sprintf "%.6f", substr(q$Rev: 987 $,4)/1000000 + 5.4; +$VERSION = sprintf "%.6f", substr(q$Rev: 1128 $,4)/1000000 + 5.4; %can = ( commit => "Commit changes to disk", @@ -14,70 +14,81 @@ $VERSION = sprintf "%.6f", substr(q$Rev: 987 $,4)/1000000 + 5.4; # Q: where is the "How do I add a new config option" HOWTO? # A1: svn diff -r 757:758 # where dagolden added test_report # A2: svn diff -r 985:986 # where andk added yaml_module -%keys = map { $_ => undef } ( - # allow_unauthenticated ?? some day... - "build_cache", - "build_dir", - "build_requires_install_policy", - "bzip2", - "cache_metadata", - "check_sigs", - "colorize_output", - "colorize_print", - "colorize_warn", - "commandnumber_in_prompt", - "commands_quote", - "cpan_home", - "curl", - "dontload_hash", # deprecated after 1.83_68 (rev. 581) - "dontload_list", - "ftp", - "ftp_passive", - "ftp_proxy", - "getcwd", - "gpg", - "gzip", - "histfile", - "histsize", - "http_proxy", - "inactivity_timeout", - "index_expire", - "inhibit_startup_message", - "keep_source_where", - "lynx", - "make", - "make_arg", - "make_install_arg", - "make_install_make_command", - "makepl_arg", - "mbuild_arg", - "mbuild_install_arg", - "mbuild_install_build_command", - "mbuildpl_arg", - "ncftp", - "ncftpget", - "no_proxy", - "pager", - "password", - "prefer_installer", - "prerequisites_policy", - "prefs_dir", - "proxy_pass", - "proxy_user", - "scan_cache", - "shell", - "show_upload_date", - "tar", - "term_is_latin", - "term_ornaments", - "test_report", - "unzip", - "urllist", - "username", - "wait_list", - "wget", - "yaml_module", - ); +%keys = map { $_ => undef } + ( + "build_cache", + "build_dir", + "build_requires_install_policy", + "bzip2", + "cache_metadata", + "check_sigs", + "colorize_output", + "colorize_print", + "colorize_warn", + "commandnumber_in_prompt", + "commands_quote", + "cpan_home", + "curl", + "dontload_hash", # deprecated after 1.83_68 (rev. 581) + "dontload_list", + "ftp", + "ftp_passive", + "ftp_proxy", + "getcwd", + "gpg", + "gzip", + "histfile", + "histsize", + "http_proxy", + "inactivity_timeout", + "index_expire", + "inhibit_startup_message", + "keep_source_where", + "lynx", + "make", + "make_arg", + "make_install_arg", + "make_install_make_command", + "makepl_arg", + "mbuild_arg", + "mbuild_install_arg", + "mbuild_install_build_command", + "mbuildpl_arg", + "ncftp", + "ncftpget", + "no_proxy", + "pager", + "password", + "patch", + "prefer_installer", + "prerequisites_policy", + "prefs_dir", + "proxy_pass", + "proxy_user", + "scan_cache", + "shell", + "show_upload_date", + "tar", + "term_is_latin", + "term_ornaments", + "test_report", + "unzip", + "urllist", + "username", + "wait_list", + "wget", + "yaml_module", + ); + +my %prefssupport = map { $_ => 1 } + ( + "build_requires_install_policy", + "make", + "make_install_make_command", + "prefer_installer", + "test_report", + ); + if ($^O eq "MSWin32") { for my $k (qw( mbuild_install_build_command @@ -137,6 +148,7 @@ sub edit { $self->prettyprint($o); } if ($changed) { + $CPAN::CONFIG_DIRTY = 1; if ($o eq "urllist") { # reset the cached values undef $CPAN::FTP::Thesite; @@ -148,11 +160,18 @@ sub edit { } return $changed; } elsif ($o =~ /_hash$/) { - @args = () if @args==1 && $args[0] eq ""; - push @args, "" if @args % 2; + if (@args==1 && $args[0] eq ""){ + @args = (); + } elsif (@args % 2) { + push @args, ""; + } $CPAN::Config->{$o} = { @args }; + $CPAN::CONFIG_DIRTY = 1; } else { - $CPAN::Config->{$o} = $args[0] if defined $args[0]; + if (defined $args[0]){ + $CPAN::CONFIG_DIRTY = 1; + $CPAN::Config->{$o} = $args[0]; + } $self->prettyprint($o) if exists $keys{$o} or defined $CPAN::Config->{$o}; return 1; @@ -192,6 +211,7 @@ sub prettyprint { sub commit { my($self,@args) = @_; + CPAN->debug("args[@args]") if $CPAN::DEBUG; my $configpm; if (@args) { if ($args[0] eq "args") { @@ -252,6 +272,7 @@ EOF #chmod $mode, $configpm; ###why was that so? $self->defaults; $CPAN::Frontend->myprint("commit: wrote '$configpm'\n"); + $CPAN::CONFIG_DIRTY = 0; 1; } @@ -262,7 +283,10 @@ sub neatvalue { my($self, $v) = @_; return "undef" unless defined $v; my($t) = ref $v; - return "q[$v]" unless $t; + unless ($t){ + $v =~ s/\\/\\\\/g; + return "q[$v]"; + } if ($t eq 'ARRAY') { my(@m, @neat); push @m, "["; @@ -287,11 +311,13 @@ sub defaults { my $done; for my $config (qw(CPAN/MyConfig.pm CPAN/Config.pm)) { if ($INC{$config}) { + CPAN->debug("INC{'$config'}[$INC{$config}]") if $CPAN::DEBUG; CPAN::Shell->reload_this($config,{force => 1}); $CPAN::Frontend->myprint("'$INC{$config}' reread\n"); last; } } + $CPAN::CONFIG_DIRTY = 0; 1; } @@ -340,6 +366,7 @@ else: quote it with the correct quote type for the box we're on my $quote = $CPAN::Config->{commands_quote} || $quotes; if ($quote ne ' ' + and defined($command ) and $command =~ /\s/ and $command !~ /[$quote]/) { return qq<$use_quote$command$use_quote> @@ -573,27 +600,39 @@ sub cpl { return grep /^\Q$word\E/, @o_conf; } +sub prefs_lookup { + my($self,$distro,$what) = @_; + if ($prefssupport{$what}) { + return $distro->prefs->{cpanconfig}{$what} || $CPAN::Config->{$what}; + } else { + warn "Warning: $what no yet officially supported for distroprefs, doing a normal lookup"; + return $CPAN::Config->{$what}; + } +} -package - CPAN::Config; ####::###### #hide from indexer -# note: J. Nick Koston wrote me that they are using -# CPAN::Config->commit although undocumented. I suggested -# CPAN::Shell->o("conf","commit") even when ugly it is at least -# documented - -# that's why I added the CPAN::Config class with autoload and -# deprecated warning -use strict; -use vars qw($AUTOLOAD $VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 987 $,4)/100; - -# formerly CPAN::HandleConfig was known as CPAN::Config -sub AUTOLOAD { - my($l) = $AUTOLOAD; - $CPAN::Frontend->mywarn("Dispatching deprecated method '$l' to CPAN::HandleConfig\n"); - $l =~ s/.*:://; - CPAN::HandleConfig->$l(@_); +{ + package + CPAN::Config; ####::###### #hide from indexer + # note: J. Nick Koston wrote me that they are using + # CPAN::Config->commit although undocumented. I suggested + # CPAN::Shell->o("conf","commit") even when ugly it is at least + # documented + + # that's why I added the CPAN::Config class with autoload and + # deprecated warning + + use strict; + use vars qw($AUTOLOAD $VERSION); + $VERSION = sprintf "%.2f", substr(q$Rev: 1128 $,4)/100; + + # formerly CPAN::HandleConfig was known as CPAN::Config + sub AUTOLOAD { + my($l) = $AUTOLOAD; + $CPAN::Frontend->mywarn("Dispatching deprecated method '$l' to CPAN::HandleConfig\n"); + $l =~ s/.*:://; + CPAN::HandleConfig->$l(@_); + } } 1; diff --git a/lib/CPAN/SIGNATURE b/lib/CPAN/SIGNATURE index 0611775..26dbe81 100644 --- a/lib/CPAN/SIGNATURE +++ b/lib/CPAN/SIGNATURE @@ -14,20 +14,20 @@ not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 6d72390291a03a21802b5e27ff1854a841d44e67 ChangeLog +SHA1 50c2f08483563a4ecf5ce52d4dc6e1170344649b ChangeLog SHA1 9b97524a7a91c815e46b19302a33829d3c26bbbf ChangeLog.old -SHA1 867e2682d752994348fc528a3888de92b08117c7 Changes +SHA1 bffe9c0880ee43829f4d9ccc89385e93b765046d Changes SHA1 a029ffa2f2252bb8914eb658666244710994d256 Changes.old -SHA1 728c5c4d79b5b51fb110b3b4e6929fbd2dc415bf MANIFEST -SHA1 a0fa2932338e260c4ce86743b0693e3e7b50e200 MANIFEST.SKIP -SHA1 fb1c5b9518642f7d85627b5a09e221a951dd3648 META.yml +SHA1 cbbb5e95810bbd22148c1de7960750d04818a49f MANIFEST +SHA1 b71a24cdb69d391a6fb1aae4c684b08387319dc4 MANIFEST.SKIP +SHA1 18e6488a210c111206817ef1c2da20f993536b18 META.yml SHA1 d96dd2c08f9f1eb9211a1f2e4dc77ab64e770e9c Makefile.PL SHA1 37e858c51409a297ef5d3fb35dc57cd3b57f9a4d PAUSE2003.pub SHA1 af016003ad503ed078c5f8254521d13a3e0c494f PAUSE2005.pub -SHA1 e89bb7bf2aa39f1bb8e6ea83893d9e1611222c15 README -SHA1 c91c21d12d4197f7704ef40f523d29bca031efe1 Todo -SHA1 f702be53267d199cb02cac18ba12a201afe27660 distroprefs/ABW.Template-Toolkit.01.yml -SHA1 cd3dfcad60c98d0dc692076552af64f2e06e339a distroprefs/AUDREYT.Module-Signature.01.yml +SHA1 cf9e7e46c1e5edde1b3918f41712d4bd7759ea97 README +SHA1 f14b1344edbb2a66d7d42f367e4318295d983894 Todo +SHA1 932277e2bfe93e15a50bb0beb84b1d38aff7c032 distroprefs/ABW.Template-Toolkit.01.yml +SHA1 43d244a0dce7dc14d41b9b97f156291e0250aac1 distroprefs/AUDREYT.Module-Signature.01.yml SHA1 b9213e79239022a0f55ddc43d36b299f5a0a2b26 distroprefs/BTROTT.Convert-PEM.01.yml SHA1 9ab8285183aa556cb89941708a20b4182644ff1f distroprefs/BTROTT.Crypt-DSA.01.yml SHA1 170d7a16d7cdac6524dc685fe2abcfacfa5ad1bd distroprefs/BTROTT.Feed-Find.01.yml @@ -35,38 +35,49 @@ SHA1 3ca4097da44acb77bd726249ddbfd0cdfbe8658e distroprefs/BTROTT.URI-Fetch-0.01. SHA1 42e46487c9bc79e5503060ec69996aaa963de81c distroprefs/BTROTT.XML-Feed.01.yml SHA1 c767fe6635991af2219f84121d7b18ad63311d64 distroprefs/BYRNE.SOAP-Lite.01.yml SHA1 a7913ce41d3101ef07210f78610ffc14c4533f19 distroprefs/CHAMAS.Crypt-SSLeay.01.yml -SHA1 7e51d67f6bd2664f95ae976dd1bf6dc3eb15564b distroprefs/DBROBINS.Net-SSH-Perl.01.yml +SHA1 3a4da73826cad9375547ba49283abda51b74a62f distroprefs/DBD-mysql.yml +SHA1 fce1b0543af844fde7d303cac4bd3ddf05caab20 distroprefs/DBROBINS.Net-SSH-Perl.01.yml SHA1 e14a98da8bee5f37c2692f8bf7b609844c466979 distroprefs/EESTABROO.IMAP-Admin.01.yml SHA1 1a696ce324ed86d2cc582cc296ffe3b941f57231 distroprefs/FDALY.Test-Deep.01.yml SHA1 56b5beca3c7eb33d7976a409daa44ec2106eee60 distroprefs/GAAS.libwww.01.yml SHA1 b182afae2709fbd424678f59046c7bc4a7e59623 distroprefs/GBARR.Authen-SASL.01.yml -SHA1 c90b986731504ec0161be4915f92e387e68bbaef distroprefs/GBARR.perl-ldap.01.yml +SHA1 29e0a5387bae0580c2bddbfe0623c19449a5ea1d distroprefs/GBARR.perl-ldap.01.yml SHA1 ab26131aac57b547c5fb83838f02df5a905797e4 distroprefs/GEOFF.Apache-Test.01.yml -SHA1 6cac360adb6bddd0453ee7a5c9a437395a1cb946 distroprefs/ILYAZ.Math-Pari.01.yml +SHA1 e911c1acfe28ae5e93d034e95da70756de28e9f0 distroprefs/ILYAZ.Math-Pari.01.yml SHA1 95d003e0db14776761c1c97935d22efc00d83b3e distroprefs/ILYAZ.Term-ReadLine-Perl.01.yml SHA1 437aa0353e49ee2af4f32f95ac18a7e0757851eb distroprefs/INGY.Inline.01.yml SHA1 212fecda3240d87886cc0d05a803a1b04dd82365 distroprefs/INGY.YAML.01.yml SHA1 a8c60f0f9c9f14af29a1e70e9046fce2040b9afb distroprefs/JJORE.Carp-Clan.01.yml +SHA1 4a2eb79f201a0e4ada6ff6dcabcf3f7c47b5d244 distroprefs/Jifty.yml SHA1 7a31b880a7dceabc3b1664a67900843970041b85 distroprefs/KWILLIAMS.AI-Categorizer.01.yml +SHA1 45ed7e3908cecea98939e6c3f30e72377bb1a035 distroprefs/LOCAL.trailing_dot_distros.yml SHA1 098c0b2c697f389f4debd65cb9e5676c94cbcc5c distroprefs/MIYAGAWA.Plagger.yml SHA1 8b24d26e239fc2dc5e8cd40158f72806b7b6b679 distroprefs/MIYAGAWA.XML-Atom.yml +SHA1 223423e181aad486357599da47ee7dde05cc7b12 distroprefs/MLEHMANN.Coro.yml +SHA1 dd1623cba2eaef34189f4b2893038ed78974b579 distroprefs/Module-Install.yml SHA1 6e678a41dd8e0f7b1801cea22a316d54e2f386d4 distroprefs/NIKIP.Authen-PAM.01.yml SHA1 1611017f8fb4e16aeefee6b54c65185bb5640844 distroprefs/OLAF.Net-DNS.01.yml SHA1 d20084e5fe455b21f3d2fa9fb961df990277ee19 distroprefs/PCIMPRICH.XML-SAX-ExpatXS.01.yml SHA1 f070d5f16e1fbac9af26ee20a0ffe1b7d1fec692 distroprefs/PDF-FromHTML.yml SHA1 90858ffc05805be1072966981a8fa313f3418edc distroprefs/PETDANCE.WWW-Mechanize.01.yml SHA1 82618c54cd5913d77898c0ef8d9e5be43f6942bc distroprefs/RCAPUTO.POE.01.yml -SHA1 f2e90571b0dac19743e230728de6fc6bf7bd4ffc distroprefs/README +SHA1 fda2bcfb03e39300260ca45d491ff3c786bba819 distroprefs/README +SHA1 4aec360d2b5ea2172b47892135327ade1565cb13 distroprefs/RGIERSIG.Expect.yml +SHA1 0219d681658dcab42a21c089658c74b7d5cb6e2b distroprefs/SCHWERN.Exporter-Lite.yml +SHA1 1355fbad3086a5f8d969c70754bc9e31e029a276 distroprefs/SCHWERN.UNIVERSAL-require.yml SHA1 611ccc9663349408320f477737070c4c7f504770 distroprefs/SREZIC.Tk-Autoscroll.01.yml +SHA1 f3f9f97e46f9581a534fde5cd1bbd8bab1ab0290 distroprefs/TIMB.DBI.yml +SHA1 5bb6703dbc7b00b39f999a2c0e2bb16a331febdb distroprefs/Test-CTDPBF.yml +SHA1 87a1dec7aaff62d81709a11b85aba6c0ed1df63e distroprefs/URI.File-Slurp.yml SHA1 ce39e72eb1d10d968193d7eb3aba216f6bf5a254 distroprefs/XML-Twig.yml SHA1 3b10aeaedfa9d8ddcf0faa0818b9e7db7d4b70b8 distroprefs/ZEV.Test-Dependencies.01.yml SHA1 efbe8e6882a2caa0d741b113959a706830ab5882 inc/Test/Builder.pm SHA1 ae1d68262bedc2475e2c6fd478d99b259b4fb109 inc/Test/More.pm -SHA1 7df71f0d50acda9193eb3aaf498e85e1d2fe2648 lib/CPAN.pm +SHA1 19799f32e70bdd961536fd7b7b8bf294158e10d3 lib/CPAN.pm SHA1 e093af1fcd72420fe4bdc85a5bec2b92a301ab97 lib/CPAN/Admin.pm SHA1 aa9e4d9384c88c55f9f457e2c2123242d7989406 lib/CPAN/Debug.pm -SHA1 029116c11d693152f01027a5a9969245ae2adf68 lib/CPAN/FirstTime.pm -SHA1 0d9a1532ee752b1a73e72a0023064fd74f7c868f lib/CPAN/HandleConfig.pm +SHA1 b0461d7d86faed00d1b063baedaa168dd0109459 lib/CPAN/FirstTime.pm +SHA1 110af59d79e04f4c9353c8c8b1bc539c0b17bd65 lib/CPAN/HandleConfig.pm SHA1 17a1ad839531642ace9bf198bf52964c252f3318 lib/CPAN/Nox.pm SHA1 caeaa439558a19b64119321aa9105980928862f5 lib/CPAN/Queue.pm SHA1 fc6de4175a275a4c6791091f2ffcee2636a4a0f2 lib/CPAN/Tarzip.pm @@ -78,9 +89,9 @@ SHA1 67e80e1cfc3530932de7743dd0c833b2c387609d t/02nox.t SHA1 deb594e0f60aa9c40706f117198ca202cb424b46 t/03pkgs.t SHA1 18368a653b17c7166f43686f8e315fd5e88bbcfa t/10version.t SHA1 325d8a2f72d59c4cd2400c72403c05cd614c3abc t/11mirroredby.t -SHA1 7696ade95e8c4943a3e3e6a13c03c450cec8d030 t/12cpan.t +SHA1 281dfbbd397314ae740c7cf362218da675960b75 t/12cpan.t SHA1 fa075e989a5923e73684d13d5e94baa0711bb360 t/30shell.coverage -SHA1 2be932cd1e10f43fd0b48c9381934e058b9fca42 t/30shell.t +SHA1 e71f6ec4ddbdab2362c4ed85a00c82a4a54b42c9 t/30shell.t SHA1 6a79f15a10337bd3450604abf39d4462df2a550b t/50pod.t SHA1 6c194eb30cce245737fe5e1a35118ed78abae0d1 t/51pod.t SHA1 c98f4c2aa680bb0e88569f6ab4a9ca4e8deb5c1e t/52podcover.t @@ -88,6 +99,7 @@ SHA1 413dd29cf8968e69292a2d652e0e0496a8137a01 t/60credentials.t SHA1 7efe930efd0a07d8101679ed15d4700dcf208137 t/CPAN/CpanTestDummies-1.55.pm SHA1 310b5562df76ff28ab05d741e144d84fb5b5369b t/CPAN/TestConfig.pm SHA1 081ed556ae14a75c43ca31e67cfc99d180c9ef41 t/CPAN/TestMirroredBy +SHA1 455480f7053abe4ac853a4c456d52b83e8b922e8 t/CPAN/TestPatch.txt SHA1 b4fd27234696da334ac6a1716222c70610a98c3a t/CPAN/authors/01mailrc.txt SHA1 c00fc12776a5cc317828630610a6e8e5d977be04 t/CPAN/authors/id/A/AN/ANDK/CHECKSUMS SHA1 d1a101f24d2d0719c9991df28ede729d58005bb4 t/CPAN/authors/id/A/AN/ANDK/CHECKSUMS.2nd @@ -110,7 +122,7 @@ SHA1 f4c1a524de16347b37df6427ca01f98dd27f3c81 t/CPAN/modules/03modlist.data -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) -iD8DBQFFMy0a7IA58KMXwV0RAop/AJ4qoF8fx1dtH3HgDsyihs9K+B7xbgCgwIJg -IrhPQIx1NjZrVXFvw5W1EgY= -=Iarj +iD8DBQFFPbzb7IA58KMXwV0RApkOAKC2uwwgcroM6ABYBrM8z20ULMKAPwCgoIB4 +6kKlP0+qbcbfqEXq22QW+mQ= +=Wbtc -----END PGP SIGNATURE-----