summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm18
-rw-r--r--urpm/args.pm7
-rw-r--r--urpm/download.pm23
-rwxr-xr-xurpmi.addmedia9
4 files changed, 41 insertions, 16 deletions
diff --git a/urpm.pm b/urpm.pm
index bccaf8d6..1685a71c 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -678,7 +678,7 @@ sub add_distrib_media {
quiet => 1,
limit_rate => $options{limit_rate},
compress => $options{compress},
- proxy => $urpm->{proxy},
+ proxy => get_proxy(),
},
reduce_pathname("$url/Mandrake/base/hdlists"),
);
@@ -1218,7 +1218,7 @@ this could happen if you mounted manually the directory when creating the medium
quiet => 1,
limit_rate => $options{limit_rate},
compress => $options{compress},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
reduce_pathname("$medium->{url}/../descriptions"),
@@ -1248,7 +1248,7 @@ this could happen if you mounted manually the directory when creating the medium
quiet => 1,
limit_rate => $options{limit_rate},
compress => $options{compress},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../MD5SUM"),
@@ -1348,7 +1348,7 @@ this could happen if you mounted manually the directory when creating the medium
limit_rate => $options{limit_rate},
compress => $options{compress},
callback => $options{callback},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
reduce_pathname("$medium->{url}/$with_hdlist"),
@@ -1388,7 +1388,7 @@ this could happen if you mounted manually the directory when creating the medium
limit_rate => $options{limit_rate},
compress => $options{compress},
callback => $options{callback},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
reduce_pathname("$medium->{url}/$medium->{with_hdlist}"),
@@ -1455,7 +1455,7 @@ this could happen if you mounted manually the directory when creating the medium
quiet => 1,
limit_rate => $options{limit_rate},
compress => $options{compress},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
$_
@@ -1483,7 +1483,7 @@ this could happen if you mounted manually the directory when creating the medium
quiet => 1,
limit_rate => $options{limit_rate},
compress => $options{compress},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($medium->{name}),
media => $medium->{name},
},
$_,
@@ -1875,7 +1875,7 @@ sub register_rpms {
unlink "$urpm->{cachedir}/partial/$basename";
eval {
$urpm->{log}(N("retrieving rpm file [%s] ...", $_));
- $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => $urpm->{proxy} }, $_);
+ $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => get_proxy() }, $_);
$urpm->{log}(N("...retrieving done"));
$_ = "$urpm->{cachedir}/partial/$basename";
};
@@ -2575,7 +2575,7 @@ sub download_packages_of_distant_media {
resume => $options{resume},
compress => $options{compress},
callback => $options{callback},
- proxy => $urpm->{proxy},
+ proxy => get_proxy($urpm->{media}[$_]{name}),
media => $urpm->{media}[$_]{name},
},
values %distant_sources,
diff --git a/urpm/args.pm b/urpm/args.pm
index 67da7130..c55bf10e 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -4,6 +4,7 @@ use strict;
use warnings;
no warnings 'once';
use Getopt::Long;# 2.33;
+use urpm::download;
# The program that invokes us
(my $tool = $0) =~ s!.*/!!;
@@ -85,12 +86,14 @@ my %options_spec = (
my ($proxy, $port) = $value =~ m,^(?:http://)?([^:]+(:\d+)?)/*$,
or die N("bad proxy declaration on command line\n");
$proxy .= ":1080" unless $port;
- $urpm->{proxy}{http_proxy} = "http://$proxy";
+ $urpm->{proxy}{http_proxy} = "http://$proxy"; #- obsolete, for compat
+ urpm::download::set_cmdline_proxy(http_proxy => "http://$proxy");
},
'proxy-user=s' => sub {
my (undef, $value) = @_;
$value =~ /(.+):(.+)/ or die N("bad proxy declaration on command line\n");
- @{$urpm->{proxy}}{qw(user pwd)} = ($1, $2);
+ @{$urpm->{proxy}}{qw(user pwd)} = ($1, $2); #- obsolete, for compat
+ urpm::download::set_cmdline_proxy(user => $1, pwd => $2);
},
'bug=s' => \$options{bug},
'env=s' => \$::env,
diff --git a/urpm/download.pm b/urpm/download.pm
index 4308f9f6..8f46df6d 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -47,12 +47,27 @@ sub load_proxy_config () {
sub get_proxy (;$) {
my ($o_media) = @_; $o_media ||= '';
load_proxy_config();
- return $proxy_config->{$o_media} || {
- http_proxy => undef ,
- ftp_proxy => undef ,
+ return $proxy_config->{cmd_line}
+ || $proxy_config->{$o_media}
+ || $proxy_config->{''}
+ || {
+ http_proxy => undef,
+ ftp_proxy => undef,
+ user => undef,
+ pwd => undef,
+ };
+}
+
+#- overrides the config file proxy settings with values passed via command-line
+sub set_cmdline_proxy {
+ my (%h) = @_;
+ $proxy_config->{cmd_line} ||= {
+ http_proxy => undef,
+ ftp_proxy => undef,
user => undef,
- pwd => undef
+ pwd => undef,
};
+ $proxy_config->{cmd_line}{$_} = $h{$_} for keys %h;
}
#- set up the environment for proxy usage for the appropriate tool.
diff --git a/urpmi.addmedia b/urpmi.addmedia
index 3a8fc082..7efd2a6e 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -133,7 +133,14 @@ sub main {
unlink "$urpm->{cachedir}/partial/$basename";
eval {
$urpm->{log}(N("retrieving mirrors at %s ...", $options{from}));
- $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => $urpm->{proxy} }, $options{from});
+ $urpm->{sync}(
+ {
+ dir => "$urpm->{cachedir}/partial",
+ quiet => 1,
+ proxy => get_proxy(),
+ },
+ $options{from},
+ );
$urpm->{log}(N("...retrieving done"));
};
$@ and $urpm->{log}(N("...retrieving failed: %s", $@));