Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29954

Modified Files:
        ChangeLog Configure.pm 
Log Message:
choose mirror fixes, see bug 1083563

Index: Configure.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Configure.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- Configure.pm        4 Aug 2005 17:00:38 -0000       1.45
+++ Configure.pm        27 Aug 2005 13:14:48 -0000      1.46
@@ -407,7 +407,7 @@
                                $default_continent) ],
                        choices => [
                                map { length($_)==3 ? ($keyinfo->{$_},$_) : () }
-                                       sort keys %$keyinfo
+                                       sort { $keyinfo->{$a} cmp 
$keyinfo->{$b} } keys %$keyinfo
                        ]
                );
                $config->set_param("MirrorContinent", $continent);
@@ -423,7 +423,8 @@
                                $default_country) ], # Fails gracefully if 
continent wrong for country
                        choices => [
                                "No selection - display all mirrors on the 
continent" => $continent,
-                               map { /^$continent-/ ? ($keyinfo->{$_},$_) : () 
} sort keys %$keyinfo
+                               map { /^$continent-/ ? ($keyinfo->{$_},$_) : () 
}
+                                       sort { $keyinfo->{$a} cmp 
$keyinfo->{$b} } keys %$keyinfo
                        ]
                );
                $config->set_param("MirrorCountry", $country);
@@ -451,7 +452,9 @@
                $all_mirrors = &read_properties_multival($mirrorfile);
 
                @mirrors = ();
-
+               my %seen;
+               
+               # Add current setting
                if ($obsolete_mirrors{$mirrorname}) {
                        $current_prompt = "Current setting (not on current list 
of mirrors):\n\t\t ";
                        $default_response = 2;
@@ -462,22 +465,38 @@
                $def_value = $config->param_default("Mirror-$mirrorname", "");
                if ($def_value) {
                        push @mirrors, ( "$current_prompt $def_value" => 
$def_value );
+                       $seen{$def_value} = 1;
                }
-
+               
+               # Add primary
                if (exists $all_mirrors->{primary}) {
-                       push @mirrors, map { ( "Primary: $_" => $_ ) } 
@{$all_mirrors->{primary}};
+                       push @mirrors, map { ( "Primary: $_" => $_ ) }
+                               grep { !$seen{$_}++ } 
@{$all_mirrors->{primary}};
                }
-               if ($country ne $continent and exists $all_mirrors->{$country}) 
{
-                       push @mirrors, map { ( $keyinfo->{$country}.": $_" => 
$_ ) } @{$all_mirrors->{$country}};
+               
+               # Add local mirrors
+               my @places;
+               if ($country ne $continent) {   # We chose a country
+                       @places = ($country, $continent);
+               } else {                                                # We 
want everything on the continent
+                       @places = ($continent, sort { $keyinfo->{$a} cmp 
$keyinfo->{$b} }
+                               grep { /^$continent-/ } keys %$all_mirrors);
                }
-               if (exists $all_mirrors->{$continent}) {
-                       push @mirrors, map { ( $keyinfo->{$continent}.": $_" => 
$_ ) } @{$all_mirrors->{$continent}};
+               for my $place (@places) {
+                       next unless exists $all_mirrors->{$place};
+                       push @mirrors, map { $keyinfo->{$place} . ": $_" => $_ }
+                               grep { !$seen{$_}++ } @{$all_mirrors->{$place}};
                }
-
+               
+               # Should we limit the number of mirrors?
+               
+               # Can't pick second result if there isn't one! (2 cuz it's 
doubled)
+               $default_response = 1 unless scalar(@mirrors) > 2;
+               
                my @timeout = $mirrors_postinstall ? (timeout => 60) : (); 
                $answer = &prompt_selection("Mirror for $mirrortitle?",
                                                intro   => "Choose a mirror for 
'$mirrortitle':",
-                                               default => [ number => 1 ],
+                                               default => [ number => 
$default_response ],
                                                choices => [EMAIL PROTECTED],
                                                @timeout,);
                $config->set_param("Mirror-$mirrorname", $answer);

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1109
retrieving revision 1.1110
diff -u -d -r1.1109 -r1.1110
--- ChangeLog   27 Aug 2005 12:21:00 -0000      1.1109
+++ ChangeLog   27 Aug 2005 13:14:48 -0000      1.1110
@@ -1,5 +1,13 @@
 2005-08-26  Dave Vasilevsky  <[EMAIL PROTECTED]>
 
+       * Configure.pm: Mirror choosing improvements:
+               - Really default to the second option when the current one is 
obsolete
+               - Actually print all mirrors on the continent when the user 
asked for it
+               - Sort by country name rather than by country code (eg: de -> 
Germany)
+               - Don't show mirrors twice.
+
+2005-08-26  Dave Vasilevsky  <[EMAIL PROTECTED]>
+
        * Engine.pm: Don't just promise to remove on-disk cache in 'index 
--full',
        actually do it.
        * Package.pm, PkgVersion.pm: Don't allow user to interrupt when Storable



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to