diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-10-14 23:18:29 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-10-14 23:18:29 +0000 |
commit | 1e8f9a0ace00bb04d0a9c26dcdcc93db65da08d8 (patch) | |
tree | 7fc540c5069d2057336b2c6b89beb11ee02bce6e /lib/CPAN | |
parent | 1bd6a86e85991bbfc5b5a2502a5f6fce329aa510 (diff) | |
download | perl-1e8f9a0ace00bb04d0a9c26dcdcc93db65da08d8.tar.gz |
Upgrade to CPAN-1.88_54.
p4raw-id: //depot/perl@29020
Diffstat (limited to 'lib/CPAN')
-rw-r--r-- | lib/CPAN/FirstTime.pm | 75 | ||||
-rw-r--r-- | lib/CPAN/HandleConfig.pm | 9 |
2 files changed, 69 insertions, 15 deletions
diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 692f6c9cd5..f04985b0d1 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -19,7 +19,7 @@ use File::Basename (); use File::Path (); use File::Spec; use vars qw($VERSION $urllist); -$VERSION = sprintf "%.6f", substr(q$Rev: 924 $,4)/1000000 + 5.4; +$VERSION = sprintf "%.6f", substr(q$Rev: 1012 $,4)/1000000 + 5.4; =head1 NAME @@ -144,7 +144,7 @@ sub init { } } - if (!$matcher or 'cpan_home keep_source_where build_dir' =~ /$matcher/){ + if (!$matcher or 'cpan_home keep_source_where build_dir prefs_dir' =~ /$matcher/){ $CPAN::Frontend->myprint($prompts{config_intro}); if (!$matcher or 'cpan_home' =~ /$matcher/) { @@ -165,6 +165,7 @@ Shall we use it as the general CPAN build and cache directory? } $default = $cpan_home; + my $loop = 0; while ($ans = prompt("CPAN build and cache directory?",$default)) { unless (File::Spec->file_name_is_absolute($ans)) { require Cwd; @@ -187,6 +188,9 @@ Shall we use it as the general CPAN build and cache directory? } else { $CPAN::Frontend->mywarn("Couldn't find directory $ans\n". "or directory is not writable. Please retry.\n"); + if (++$loop > 5) { + $CPAN::Frontend->mydie("Giving up"); + } } } $CPAN::Config->{cpan_home} = $ans; @@ -205,6 +209,13 @@ Shall we use it as the general CPAN build and cache directory? $matcher ); } + + if (!$matcher or 'prefs_dir' =~ /$matcher/) { + my_dflt_prompt("prefs_dir", + File::Spec->catdir($CPAN::Config->{cpan_home},"prefs"), + $matcher + ); + } } # @@ -212,21 +223,16 @@ Shall we use it as the general CPAN build and cache directory? # if (!$matcher or 'build_cache' =~ /$matcher/){ - $CPAN::Frontend->myprint($prompts{build_cache_intro}); - # large enough to build large dists like Tk my_dflt_prompt(build_cache => 100, $matcher); } if (!$matcher or 'index_expire' =~ /$matcher/) { - $CPAN::Frontend->myprint($prompts{index_expire_intro}); - my_dflt_prompt(index_expire => 1, $matcher); } if (!$matcher or 'scan_cache' =~ /$matcher/){ $CPAN::Frontend->myprint($prompts{scan_cache_intro}); - my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|never'); } @@ -278,6 +284,13 @@ Shall we use it as the general CPAN build and cache directory? } # + #= YAML vs. YAML::Syck + # + if (!$matcher or "yaml_module" =~ /$matcher/) { + my_dflt_prompt(yaml_module => "YAML", $matcher); + } + + # #= External programs # @@ -370,8 +383,6 @@ Shall we use it as the general CPAN build and cache directory? } if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/){ - $CPAN::Frontend->myprint($prompts{makepl_arg_intro}); - my_dflt_prompt(makepl_arg => "", $matcher); my_dflt_prompt(make_arg => "", $matcher); } @@ -388,10 +399,7 @@ Shall we use it as the general CPAN build and cache directory? $matcher); if (!$matcher or 'mbuildpl_arg mbuild_arg' =~ /$matcher/){ - $CPAN::Frontend->myprint($prompts{mbuildpl_arg_intro}); - my_dflt_prompt(mbuildpl_arg => "", $matcher); - my_dflt_prompt(mbuild_arg => "", $matcher); } @@ -574,6 +582,9 @@ sub my_dflt_prompt { $DB::single = 1; if (!$m || $item =~ /$m/) { + if (my $intro = $prompts{$item . "_intro"}) { + $CPAN::Frontend->myprint($intro); + } $CPAN::Config->{$item} = prompt($prompts{$item}, $default); } else { $CPAN::Config->{$item} = $default; @@ -845,6 +856,7 @@ put them on one line, separated by blanks, hyphenated ranges allowed sub bring_your_own { my %seen = map (($_ => 1), @$urllist); my($ans,@urls); + my $eacnt = 0; # empty answers do { my $prompt = "Enter another URL or RETURN to quit:"; unless (%seen) { @@ -871,6 +883,13 @@ later if you\'re sure it\'s right.\n}, || "configuration file", )); } + } else { + if (++$eacnt >= 5) { + $CPAN::Frontend-> + mywarn("Giving up.\n"); + $CPAN::Frontend->mysleep(5); + return; + } } } while $ans || !%seen; @@ -929,7 +948,7 @@ config_intro => qq{ The following questions are intended to help you with the configuration. The CPAN module needs a directory of its own to cache important index files and maybe keep a temporary mirror of CPAN files. -This may be a site-wide directory or a personal directory. +This may be a site-wide or a personal directory. }, @@ -961,6 +980,24 @@ build_dir => "Directory where the build process takes place?", +prefs_dir_intro => qq{ + +CPAN.pm can store customized build environments based on regular +expressions for distribution names. These are YAML files where the +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 +the CPAN.pm distribution to get a quick start into the prefs system. + +}, + +prefs_dir => + +"Directory where to store default options/environment/dialogs for +building modules that need some customization?", + scan_cache_intro => qq{ By default, each time the CPAN module is started, cache scanning is @@ -1344,6 +1381,18 @@ build_requires_install_policy => qq{Policy on installing 'build_requires' modules (yes, no, ask/yes, ask/no)?}, +yaml_module_intro => qq{ + +At the time of this writing there are two competing YAML modules, +YAML.pm and YAML::Syck. The latter is faster but needs a C compiler +installed on your system. There may be more alternative YAML +conforming modules but at the time of writing a potential third +player, YAML::Tiny, is not yet sufficiently similar to the other two. + +}, + +yaml_module => qq{Which YAML implementation would you prefer?}, + ); die "Coding error in \@prompts declaration. Odd number of elements, above" diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm index 557aac5fed..b6af22b7c2 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: 984 $,4)/1000000 + 5.4; +$VERSION = sprintf "%.6f", substr(q$Rev: 987 $,4)/1000000 + 5.4; %can = ( commit => "Commit changes to disk", @@ -11,6 +11,9 @@ $VERSION = sprintf "%.6f", substr(q$Rev: 984 $,4)/1000000 + 5.4; init => "Interactive setting of all options", ); +# 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", @@ -58,6 +61,7 @@ $VERSION = sprintf "%.6f", substr(q$Rev: 984 $,4)/1000000 + 5.4; "password", "prefer_installer", "prerequisites_policy", + "prefs_dir", "proxy_pass", "proxy_user", "scan_cache", @@ -72,6 +76,7 @@ $VERSION = sprintf "%.6f", substr(q$Rev: 984 $,4)/1000000 + 5.4; "username", "wait_list", "wget", + "yaml_module", ); if ($^O eq "MSWin32") { for my $k (qw( @@ -581,7 +586,7 @@ package use strict; use vars qw($AUTOLOAD $VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 984 $,4)/100; +$VERSION = sprintf "%.2f", substr(q$Rev: 987 $,4)/100; # formerly CPAN::HandleConfig was known as CPAN::Config sub AUTOLOAD { |