aboutsummaryrefslogtreecommitdiffstats
path: root/rpmdrake.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-01 18:39:07 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-01 18:39:07 +0000
commit63af5109a6f74a24a95e1d6fb8de48dc53b46559 (patch)
treeff8893ab58b6bdb7aba1a34ecaac89446393f0bf /rpmdrake.pm
parent2baf7db592b2e1f33e9d24fa1da633b3a66e4c9c (diff)
downloadrpmdrake-63af5109a6f74a24a95e1d6fb8de48dc53b46559.tar
rpmdrake-63af5109a6f74a24a95e1d6fb8de48dc53b46559.tar.gz
rpmdrake-63af5109a6f74a24a95e1d6fb8de48dc53b46559.tar.bz2
rpmdrake-63af5109a6f74a24a95e1d6fb8de48dc53b46559.tar.xz
rpmdrake-63af5109a6f74a24a95e1d6fb8de48dc53b46559.zip
Implement --distrib for adding media via the software media manager
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r--rpmdrake.pm21
1 files changed, 14 insertions, 7 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm
index c3f1bf29..cb6e5438 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -669,13 +669,18 @@ sub update_sources_interactive {
sub add_medium_and_check {
my ($urpm, $options) = splice @_, 0, 2;
-
+ my @newnames = ($_[0]); #- names of added media
my $fatal_msg;
my @error_msgs;
local $urpm->{fatal} = sub { printf STDERR "Fatal: %s\n", $_[1]; $fatal_msg = to_utf8($_[1]); goto fatal_error };
local $urpm->{error} = sub { printf STDERR "Error: %s\n", $_[0]; push @error_msgs, to_utf8($_[0]) };
- standalone::explanations("Adding medium @_");
- $urpm->add_medium(@_);
+ if ($options->{distrib}) {
+ standalone::explanations("Adding distrib media @_");
+ @newnames = $urpm->add_distrib_media(@_);
+ } else {
+ standalone::explanations("Adding medium @_");
+ $urpm->add_medium(@_);
+ }
if (@error_msgs) {
interactive_msg('rpmdrake',
N("Unable to add medium, errors reported:\n\n%s",
@@ -683,9 +688,11 @@ sub add_medium_and_check {
return 0;
}
- urpm::download::set_proxy_config($_, $options->{proxy}{$_}, $_[0]) foreach keys %{$options->{proxy} || {}};
+ for my $name (@newnames) {
+ urpm::download::set_proxy_config($_, $options->{proxy}{$_}, $name) foreach keys %{$options->{proxy} || {}};
+ }
- if (update_sources_check($urpm, $options, N_("Unable to add medium, errors reported:\n\n%s"), $_[0])) {
+ if (update_sources_check($urpm, $options, N_("Unable to add medium, errors reported:\n\n%s"), @newnames)) {
$urpm->write_config;
$options->{proxy} and urpm::download::dump_proxy_config();
} else {
@@ -693,8 +700,8 @@ sub add_medium_and_check {
return 0;
}
- my ($medium) = grep { $_->{name} eq $_[0] } @{$urpm->{media}};
- if ($medium) {
+ my %newnames; @newnames{@newnames} = ();
+ if (any { exists $newnames{$_->{name}} } @{$urpm->{media}}) {
return 1;
} else {
interactive_msg('rpmdrake', N("Unable to create medium."));