diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-01-29 22:25:45 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-01-29 22:25:45 +0000 |
commit | 500cba9448af25e460962c25a478b826dfe3bd71 (patch) | |
tree | 69b372188b3062430940c1a7b9079ede92140761 | |
parent | acdcd7674e0570d77686ab47140aa9c30b406710 (diff) | |
download | rpmdrake-500cba9448af25e460962c25a478b826dfe3bd71.tar rpmdrake-500cba9448af25e460962c25a478b826dfe3bd71.tar.gz rpmdrake-500cba9448af25e460962c25a478b826dfe3bd71.tar.bz2 rpmdrake-500cba9448af25e460962c25a478b826dfe3bd71.tar.xz rpmdrake-500cba9448af25e460962c25a478b826dfe3bd71.zip |
(choose_mirror,mirrors) use urpm::download::sync() instead of
curl_download::download() in order to download mirror list from
api.mandriva.com, thus using the downloader set up with urpmi instead
of forcing curl, and using urpmi's proxy options
-rw-r--r-- | Rpmdrake/edit_urpm_sources.pm | 2 | ||||
-rw-r--r-- | Rpmdrake/pkg.pm | 2 | ||||
-rw-r--r-- | rpmdrake.pm | 13 |
3 files changed, 8 insertions, 9 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm index afc85805..deafbea2 100644 --- a/Rpmdrake/edit_urpm_sources.pm +++ b/Rpmdrake/edit_urpm_sources.pm @@ -122,7 +122,7 @@ of sources."), my $distro = $rpmdrake::mandrake_release; my $real_arch = arch(); $distro =~ s/$real_arch/$arch/; - my ($mirror) = choose_mirror(message => + my ($mirror) = choose_mirror($urpm, message => N("This will attempt to install all official sources corresponding to your distribution (%s). diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 1db5b7e6..f0fffa7b 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -220,7 +220,7 @@ column). Then, restart \"%s\".", N("Enabled"), $rpmdrake::myname_update)); myexit(-1); } - my ($mirror) = choose_mirror(transient => $w->{real_window} || $::main_window, + my ($mirror) = choose_mirror($urpm, transient => $w->{real_window} || $::main_window, message => join("\n\n", N("You have no configured update media. MandrivaUpdate cannot operate without any update media."), N("I need to contact the Mandriva website to get the mirror list. diff --git a/rpmdrake.pm b/rpmdrake.pm index c368c001..549428a3 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -41,7 +41,6 @@ use POSIX qw(_exit); use common; use Locale::gettext; -use curl_download; our @ISA = qw(Exporter); our $VERSION = '2.27'; @@ -508,8 +507,8 @@ sub compat_arch_for_updates($) { } sub mirrors { - my ($cachedir, $want_base_distro, $o_arch) = @_; - $cachedir ||= '/root'; + my ($urpm, $want_base_distro, $o_arch) = @_; + my $cachedir = $urpm->{cachedir} || '/root'; use mirror; mirror::register_downloader(sub { my ($url) = @_; @@ -517,8 +516,8 @@ sub mirrors { $file =~ s!.*/!$cachedir/!; unlink $file; # prevent "partial file" errors before_leaving(sub { unlink $file }); - my $res = curl_download::download($url, $cachedir, sub {}); - $res and do { c::set_tagged_utf8($res); die $res }; + my $res = urpm::download::sync($urpm, undef, [ $url ], dir => $cachedir); + $res or do { c::set_tagged_utf8($res); die $res }; return cat_($file); }); my @mirrors = @{ mirror::list(common::parse_LDAP_namespace_structure(cat_('/etc/product.id')), @@ -538,7 +537,7 @@ sub mirrors { } sub choose_mirror { - my (%options) = @_; + my ($urpm, %options) = @_; my $message = $options{message} ? $options{message} : $branded ? N("I need to access internet to get the mirror list. @@ -558,7 +557,7 @@ Is it ok to continue?"); : N("Please wait, downloading mirror addresses from the Mandriva website.")), @transient_options ); - my @mirrors = eval { mirrors('/var/cache/urpmi', $options{want_base_distro}, $options{arch}) }; + my @mirrors = eval { mirrors($urpm, $options{want_base_distro}, $options{arch}) }; my $error = $@; remove_wait_msg($wait); if ($error) { |