Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5311
Modified Files:
Tag: branch_0_24
ChangeLog Configure.pm
Log Message:
choose_mirrors now examines the current choices for outdated entires, and
prompts the user about this; the default values (chosen after a timeout when
running in the fink-mirrors postinstall script) will replace any outdated
choices of the user by currently acceptable choices; also backported the
binary return value for choose_mirrors
Index: Configure.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Configure.pm,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -u -d -r1.38 -r1.38.2.1
--- Configure.pm 22 Feb 2005 16:15:30 -0000 1.38
+++ Configure.pm 16 Apr 2005 17:21:16 -0000 1.38.2.1
@@ -229,7 +229,8 @@
=item choose_mirrors
-mirror selection
+mirror selection (returns boolean indicating if mirror selections are
+unchanged: true means no changes, false means changed)
=cut
@@ -242,6 +243,11 @@
my ($keyinfo, $listinfo);
my ($mirrorfile, $mirrorname, $mirrortitle);
my ($all_mirrors, @mirrors, $site, $mirror_order);
+ my %obsolete_mirrors = ();
+ my ($current_value, $list_of_mirrors, $property_value);
+ my ($mirror_item, $is_obsolete, $obsolete_only);
+ my @mirrors_to_choose;
+ my ($current_prompt, $default_response, $obsolete_question);
print "\n";
&print_breaking("Mirror selection");
@@ -252,14 +258,35 @@
### step 0: determine and ask if we need to change anything
+
$missing = 0;
foreach $mirrorname (split(/\s+/, $listinfo->{order})) {
next if $mirrorname =~ /^\s*$/;
if (!$config->has_param("Mirror-$mirrorname")) {
$missing = 1;
+ } else {
+ $current_value = $config->param("Mirror-$mirrorname");
+ $is_obsolete = 1;
+ $list_of_mirrors =
&read_properties_multival("$libpath/mirror/$mirrorname");
+# print "\n mirrorname: $mirrorname, current value:
$current_value\n";
+ foreach $property_value (values %{$list_of_mirrors}) {
+ foreach $mirror_item (@{$property_value}) {
+# print " $mirror_item ";
+ if ($current_value eq $mirror_item) {
+ $is_obsolete = 0;
+# print "current value
$current_value; mirrorname $mirrorname \n";
+ }
+ }
+ }
+ if ($is_obsolete) {
+ $obsolete_mirrors{$mirrorname} = 1;
+ }
}
}
+
+# print "obsolete mirrors\n %obsolete_mirrors \n";
+
if (!$missing) {
if ($mirrors_postinstall) {
# called from dpkg postinst script of fink-mirrors pkg
@@ -273,10 +300,22 @@
default => 0);
}
if (!$answer) {
- return;
+ if (%obsolete_mirrors) {
+ $obsolete_question = "One or more of your
mirrors is set to a value which is not on the current list of mirror choices.
Do you want to leave these as you have set them?";
+ if ($mirrors_postinstall) {
+ $obsolete_only =
!&prompt_boolean($obsolete_question, default => 0, timeout => 60);
+ } else {
+ $obsolete_only =
!&prompt_boolean($obsolete_question, default => 0);
+ }
+ }
+ if (!$obsolete_only) {
+ return 1;
+ }
}
}
-
+
+if ((!$obsolete_only) or (!$config->has_param("MirrorOrder"))) {
+
&print_breaking("\nThe Fink team maintains mirrors known as \"Master\"
mirrors, which contain ".
"the sources for all fink packages. You can
choose to use these mirrors first, ".
"last, never, or mixed in with
regular mirrors. If you don't care, just select the default.\n");
@@ -292,8 +331,15 @@
=> "ClosestFirst"
]);
$config->set_param("MirrorOrder", $mirror_order);
+
+} else {
+ $mirror_order = $config->param("MirrorOrder");
+}
### step 1: choose a continent
+
+if ((!$obsolete_only) or (!$config->has_param("MirrorContinent"))) {
+
&print_breaking("Choose a continent:");
$continent = &prompt_selection("Your continent?",
default => [ value => $config->param_default("MirrorContinent",
"-") ],
@@ -304,7 +350,14 @@
);
$config->set_param("MirrorContinent", $continent);
+} else {
+ $continent = $config->param("MirrorContinent");
+}
+
### step 2: choose a country
+
+if ((!$obsolete_only) or (!$config->has_param("MirrorCountry"))) {
+
print "\n";
&print_breaking("Choose a country:");
$country = &prompt_selection("Your country?",
@@ -316,9 +369,20 @@
);
$config->set_param("MirrorCountry", $country);
+} else {
+ $country = $config->param("MirrorCountry");
+}
+
### step 3: mirrors
- foreach $mirrorname (split(/\s+/, $listinfo->{order})) {
+ if ($obsolete_only) {
+ @mirrors_to_choose = keys %obsolete_mirrors;
+# print "mirrors to choose @mirrors_to_choose\n";
+ } else {
+ @mirrors_to_choose = split(/\s+/, $listinfo->{order});
+ }
+
+ foreach $mirrorname (@mirrors_to_choose) {
next if $mirrorname =~ /^\s*$/;
$mirrorfile = "$libpath/mirror/$mirrorname";
@@ -331,9 +395,16 @@
@mirrors = ();
+ if ($obsolete_mirrors{$mirrorname}) {
+ $current_prompt = "Current setting (not on current list
of mirrors):\n\t\t ";
+ $default_response = 2;
+ } else {
+ $current_prompt = "Current setting:";
+ $default_response = 1;
+ }
$def_value = $config->param_default("Mirror-$mirrorname", "");
if ($def_value) {
- push @mirrors, ( "Current setting: $def_value" =>
$def_value );
+ push @mirrors, ( "$current_prompt $def_value" =>
$def_value );
}
if (exists $all_mirrors->{primary}) {
@@ -348,11 +419,19 @@
print "\n";
&print_breaking("Choose a mirror for '$mirrortitle':");
+ if ($mirrors_postinstall) {
$answer = &prompt_selection("Mirror for $mirrortitle?",
- default => [ number => 1 ],
+ default => [ number =>
$default_response ],
+ choices => [EMAIL PROTECTED],
+ timeout => 60 );
+ } else {
+ $answer = &prompt_selection("Mirror for $mirrortitle?",
+ default => [ number =>
$default_response ],
choices => [EMAIL PROTECTED] );
+ }
$config->set_param("Mirror-$mirrorname", $answer);
}
+ return 0;
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.873.2.16
retrieving revision 1.873.2.17
diff -u -d -r1.873.2.16 -r1.873.2.17
--- ChangeLog 11 Apr 2005 22:25:54 -0000 1.873.2.16
+++ ChangeLog 16 Apr 2005 17:21:14 -0000 1.873.2.17
@@ -1,3 +1,13 @@
+2005-04-16 Dave Morrison <[EMAIL PROTECTED]>
+
+ * Configure.pm: choose_mirrors now examines the current choices
+ for outdated entires, and prompts the user about this; the default
+ values (chosen after a timeout when running in the fink-mirrors
+ postinstall script) will replace any outdated choices of the user
+ by currently acceptable choices
+ * Configure.pm: also backported the binary return value for
+ choose_mirrors
+
2005-04-11 Dave Morrison <[EMAIL PROTECTED]>
* PkgVersion.pm: add a default for CXXFLAGS for recent distributions
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits