diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-10-23 01:10:24 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-10-23 01:10:24 +0000 |
commit | c5b13377fad1b2bdac6f0ac39c41d3e46af30426 (patch) | |
tree | c202c8d4c7cef9feb2228d2c27c33525b9baaf0a | |
parent | 104d1e448c04aabf656cf499a2ca60558ce03b05 (diff) | |
download | rpmdrake-c5b13377fad1b2bdac6f0ac39c41d3e46af30426.tar rpmdrake-c5b13377fad1b2bdac6f0ac39c41d3e46af30426.tar.gz rpmdrake-c5b13377fad1b2bdac6f0ac39c41d3e46af30426.tar.bz2 rpmdrake-c5b13377fad1b2bdac6f0ac39c41d3e46af30426.tar.xz rpmdrake-c5b13377fad1b2bdac6f0ac39c41d3e46af30426.zip |
(add_distrib_update_media) factorize computing unique media names
-rw-r--r-- | Rpmdrake/edit_urpm_sources.pm | 10 | ||||
-rw-r--r-- | Rpmdrake/pkg.pm | 2 | ||||
-rw-r--r-- | rpmdrake.pm | 7 |
3 files changed, 7 insertions, 12 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm index 79cf19e2..b44abdd8 100644 --- a/Rpmdrake/edit_urpm_sources.pm +++ b/Rpmdrake/edit_urpm_sources.pm @@ -137,15 +137,7 @@ Is it ok to continue?", $distro), ) or return 0; ref $mirror or return; my $wait = wait_msg(N("Please wait, adding media...")); - my $medium_name; - if ($rpmdrake::mandrake_release =~ /(\d+\.\d+) \((\w+)\)/) { - $medium_name = $2 . $1 . '-'; - } else { - $medium_name = 'distrib'; - } - #- ensure a unique medium name - my $initial_number = 1 + max map { $_->{name} =~ /\(\Q$medium_name\E(\d+)\b/ ? $1 : 0 } @{$urpm->{media}}; - add_distrib_update_media($urpm, $medium_name, $mirror, initial_number => $initial_number); + add_distrib_update_media($urpm, $mirror); remove_wait_msg($wait); return 1; } diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index bbd8d001..033b301e 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -212,7 +212,7 @@ launch the Software Media Manager, and then add a `Security updates' medium. Then, restart %s.", $rpmdrake::myname_update)), myexit(-1); - add_distrib_update_media($urpm, $update_name, $mirror); + add_distrib_update_media($urpm, $mirror); @update_medias = { name => $update_name }; #- hack to simulate a medium for parsing of descriptions } } diff --git a/rpmdrake.pm b/rpmdrake.pm index 13274a2d..212b15a7 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -878,12 +878,15 @@ It will be disabled.", } sub add_distrib_update_media { - my ($urpm, $medium_name, $mirror, %options) = @_; + my ($urpm, $mirror, %options) = @_; my $is_update = $mirror->{type} eq 'updates'; + #- ensure a unique medium name + my $medium_name = $rpmdrake::mandrake_release =~ /(\d+\.\d+) \((\w+)\)/ ? $2 . $1 . '-' : 'distrib'; + 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, $mirror->{url}, probe_with => 'synthesis', %options, + $medium_name, $mirror->{url}, probe_with => 'synthesis', initial_number => $initial_number, %options, usedistrib => 1, if_($is_update, only_updates => 1), ); |