projects
/
grml-mirrors.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f514926
)
Add a fallback to generate_mirror_map for broken regions
author
Alexander Wirt
<formorer@grml.org>
Mon, 25 Mar 2013 09:29:26 +0000
(10:29 +0100)
committer
Alexander Wirt
<formorer@grml.org>
Mon, 25 Mar 2013 09:29:26 +0000
(10:29 +0100)
bin/generate_mirror_map
patch
|
blob
|
history
diff --git
a/bin/generate_mirror_map
b/bin/generate_mirror_map
index
224cbcd
..
a1c34ad
100755
(executable)
--- a/
bin/generate_mirror_map
+++ b/
bin/generate_mirror_map
@@
-11,18
+11,26
@@
$state = $m->state ; # the mirmon state
use Data::Dumper;
my $mirrors;
use Data::Dumper;
my $mirrors;
+my $regions_hash;
foreach my $url ( keys %{$state} ) {
next unless $url =~ /^http/;
$mirror = $state -> { $url } ; # a Mirmon::Mirror object
my ($time, $history) = split('-', $mirror->{state_history});
my $last_state = substr($history,-1,1);
foreach my $url ( keys %{$state} ) {
next unless $url =~ /^http/;
$mirror = $state -> { $url } ; # a Mirmon::Mirror object
my ($time, $history) = split('-', $mirror->{state_history});
my $last_state = substr($history,-1,1);
- next if $last_state eq 'f';
my $region = $mirror->region;
my $region = $mirror->region;
+ $regions_hash->{$region} = 1;
+ next if $last_state eq 'f';
$mirrors->{ $region } ||= [];
$url =~ s/^http:\/\///;
push @{$mirrors->{ $region }}, $url;
}
$mirrors->{ $region } ||= [];
$url =~ s/^http:\/\///;
push @{$mirrors->{ $region }}, $url;
}
-foreach my $region (keys %{$mirrors}) {
- printf ("%s %s\n", lc($region), join('|', @{$mirrors->{$region}}));
+my @regions = keys(%$regions_hash);
+
+foreach my $region (@regions) {
+ if (scalar(@{$mirrors->{$region}}) == 0) {
+ printf ("%s %s\n", lc($region), join('|', @{$mirrors->{'DE'}}));
+ } else {
+ printf ("%s %s\n", lc($region), join('|', @{$mirrors->{$region}}));
+ }
}
}