From 2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 13 Nov 2006 14:39:35 +0000 Subject: revalidate $medium instead of searching by name twice --- urpm.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/urpm.pm b/urpm.pm index 8d45bb55..0fe8946c 100644 --- a/urpm.pm +++ b/urpm.pm @@ -748,16 +748,18 @@ sub add_medium { $urpm->write_config; delete $urpm->{media}; $urpm->read_config(nocheck_access => 1); + + #- need getting the fresh datastructure after read_config + ($medium) = grep { $_->{name} eq $name } @{$urpm->{media}}; + #- Remember that the database has been modified and base files need to #- be updated. This will be done automatically by transferring the #- "modified" flag from medium to global. - $_->{name} eq $name and $_->{modified} = 1 foreach @{$urpm->{media}}; + $medium->{modified} = 1; $urpm->{modified} = 1; } if ($has_password) { - foreach (grep { $_->{name} eq $name } @{$urpm->{media}}) { - $_->{url} = $url; - } + $medium->{url} = $url; } $options{nolock} or $urpm->unlock_urpmi_db; -- cgit v1.2.1