summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry.Vignaud <thierry.vignaud@gmail.com>2014-05-28 22:37:24 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-05-28 22:37:24 +0200
commitad091cefb8808e29e13fa8d9fcb651dd85e96304 (patch)
tree157e61c9e8175868408882cce6026cbed5a6f668 /perl-install
parent279ee686301222fd40cc71f0129b3949c9f6367e (diff)
downloaddrakx-ad091cefb8808e29e13fa8d9fcb651dd85e96304.tar
drakx-ad091cefb8808e29e13fa8d9fcb651dd85e96304.tar.gz
drakx-ad091cefb8808e29e13fa8d9fcb651dd85e96304.tar.bz2
drakx-ad091cefb8808e29e13fa8d9fcb651dd85e96304.tar.xz
drakx-ad091cefb8808e29e13fa8d9fcb651dd85e96304.zip
podify mirrors
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/mirror.pm50
1 files changed, 50 insertions, 0 deletions
diff --git a/perl-install/mirror.pm b/perl-install/mirror.pm
index 1e959f9ac..d062c29c8 100644
--- a/perl-install/mirror.pm
+++ b/perl-install/mirror.pm
@@ -7,6 +7,16 @@ use feature 'state';
use common;
use log;
+=head1 SYNOPSYS
+
+B<mirror> enables to manage Mageia distribution mirrors
+
+=head1 Functions
+
+=over
+
+=cut
+
my %land2tzs = (
N_("Australia") => [ 'Australia/Sydney' ],
N_("Austria") => [ 'Europe/Vienna', 'Europe/Brussels', 'Europe/Berlin' ],
@@ -42,11 +52,23 @@ my %land2tzs = (
N_("United States") => [ 'America/New_York', 'Canada/Atlantic', 'Asia/Tokyo', 'Australia/Sydney', 'Europe/Paris' ],
);
+=item mirror2text($mirror)
+
+Returns a displayable string from a mirror struct
+
+=cut
+
sub mirror2text {
my ($mirror) = @_;
translate($mirror->{country}) . '|' . $mirror->{host} . ($mirror->{method} ? " ($mirror->{method})" : '');
}
+=item register_downloader($func)
+
+Sets a downloader program
+
+=cut
+
my $downloader;
sub register_downloader {
my ($func) = @_;
@@ -78,6 +100,15 @@ sub _mirrors_raw_standalone {
@lines;
}
+=item mirrors_raw($product_id)
+
+Returns a list of mirrors hash refs from http://mirrors.mageia.org
+
+Note that in standalone mode, one has to actually use register_downloader()
+first in order to provide a downloader callback.
+
+=cut
+
sub mirrors_raw {
my ($product_id) = @_;
@@ -91,6 +122,15 @@ sub mirrors_raw {
map { common::parse_LDAP_namespace_structure(chomp_($_)) } @lines;
}
+=item list($product_id, $type)
+
+
+Returns a list of mirrors hash refs as returned by mirrors_raw() but filters it.
+
+One can select the type of mirrors ('distrib', 'updates', ...) or 'all'
+
+=cut
+
sub list {
my ($product_id, $type) = @_;
@@ -112,6 +152,12 @@ sub list {
@mirrors && \@mirrors;
}
+=item nearest($timezone, $mirrors)
+
+Randomly returns one of the nearest mirror
+
+=cut
+
sub nearest {
my ($timezone, $mirrors) = @_;
@@ -128,4 +174,8 @@ sub nearest {
$possible[rand @possible];
}
+=back
+
+=cut
+
1;