summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-13 14:39:35 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-13 14:39:35 +0000
commit2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb (patch)
tree08900aecc859ab134302edcdb73e1fd32a9faf4c
parentfe8a32f8feca0bc27e3009721b3fb1ecbf6cbea6 (diff)
downloadurpmi-2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb.tar
urpmi-2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb.tar.gz
urpmi-2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb.tar.bz2
urpmi-2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb.tar.xz
urpmi-2891a057f46c7cc0c0df58fa26c8a364f7b5bdeb.zip
revalidate $medium instead of searching by name twice
-rw-r--r--urpm.pm10
1 files 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;