aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Rpmdrake/edit_urpm_sources.pm10
-rw-r--r--Rpmdrake/pkg.pm9
-rw-r--r--rpmdrake.pm13
3 files changed, 15 insertions, 17 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm
index 07ae7c5f..8c4f7728 100644
--- a/Rpmdrake/edit_urpm_sources.pm
+++ b/Rpmdrake/edit_urpm_sources.pm
@@ -136,8 +136,6 @@ Is it ok to continue?", $distro),
arch => $arch,
) or return 0;
ref $mirror or return;
- my $url = $mirror->{url};
- my $is_update = $mirror->{type} eq 'updates';
my $wait = wait_msg(N("Please wait, adding media..."));
my $medium_name;
if ($rpmdrake::mandrake_release =~ /(\d+\.\d+) \((\w+)\)/) {
@@ -147,13 +145,7 @@ Is it ok to continue?", $distro),
}
#- ensure a unique medium name
my $initial_number = 1 + max map { $_->{name} =~ /\(\Q$medium_name\E(\d+)\b/ ? $1 : 0 } @{$urpm->{media}};
- add_medium_and_check(
- $urpm,
- { nolock => 1, distrib => 1 },
- $medium_name, $url, probe_with => 'synthesis', initial_number => $initial_number,
- usedistrib => 1,
- if_($is_update, only_updates => 1),
- );
+ add_distrib_update_media($urpm, $medium_name, $mirror, initial_number => $initial_number);
remove_wait_msg($wait);
return 1;
}
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm
index dcd90762..bbd8d001 100644
--- a/Rpmdrake/pkg.pm
+++ b/Rpmdrake/pkg.pm
@@ -212,14 +212,7 @@ launch the Software Media Manager, and then add a `Security
updates' medium.
Then, restart %s.", $rpmdrake::myname_update)), myexit(-1);
- my $is_update = $mirror->{type} eq 'updates';
- add_medium_and_check(
- $urpm,
- { nolock => 1, distrib => 1 },
- $update_name, $m, probe_with => 'synthesis', update => 1,
- usedistrib => 1,
- if_($is_update, only_updates => 1),
- );
+ add_distrib_update_media($urpm, $update_name, $mirror);
@update_medias = { name => $update_name }; #- hack to simulate a medium for parsing of descriptions
}
}
diff --git a/rpmdrake.pm b/rpmdrake.pm
index c2809932..512b473f 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -54,6 +54,7 @@ our @EXPORT = qw(
$tree_mode
$tree_flat
$typical_width
+ add_distrib_update_media
distro_type
to_utf8
myexit
@@ -876,6 +877,18 @@ It will be disabled.",
1;
}
+sub add_distrib_update_media {
+ my ($urpm, $name, $mirror, %options) = @_;
+ my $is_update = $mirror->{type} eq 'updates';
+ add_medium_and_check(
+ $urpm,
+ { nolock => 1, distrib => 1 },
+ $name, $mirror->{url}, probe_with => 'synthesis', %options,
+ usedistrib => 1,
+ if_($is_update, only_updates => 1),
+ );
+}
+
sub open_help {
my ($mode) = @_;
use run_program;