summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-12-04 12:53:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-12-04 12:53:22 +0000
commit543591b1ecd27284fbfe0ad92d26801f9291b549 (patch)
tree9cf3b05c2770e32f9765f6f1d8e58444179d1b7d /urpm
parent062defe10f205b1cb9d93bbabc06f3279850a6ad (diff)
downloadurpmi-543591b1ecd27284fbfe0ad92d26801f9291b549.tar
urpmi-543591b1ecd27284fbfe0ad92d26801f9291b549.tar.gz
urpmi-543591b1ecd27284fbfe0ad92d26801f9291b549.tar.bz2
urpmi-543591b1ecd27284fbfe0ad92d26801f9291b549.tar.xz
urpmi-543591b1ecd27284fbfe0ad92d26801f9291b549.zip
use media_info_dir for media just created with "... with <relative hdlist>"
Diffstat (limited to 'urpm')
-rw-r--r--urpm/media.pm33
1 files changed, 26 insertions, 7 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index cfb3e438..bbed628c 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -239,6 +239,21 @@ sub check_existing_medium {
}
}
+sub _migrate__with_hdlist {
+ my ($medium) = @_;
+
+ grep { $_ eq '..' } split('/', $medium->{with_hdlist}) and return;
+
+ #- try to migrate to media_info_dir
+ my $b = basename($medium->{with_hdlist});
+ if ($b eq ($medium->{synthesis} ? 'synthesis.hdlist.cz' : 'hdlist.cz')) {
+ $medium->{media_info_dir} = dirname(delete $medium->{with_hdlist});
+ 1;
+ } else {
+ 0;
+ }
+}
+
#- probe medium to be used, take old medium into account too.
sub add_existing_medium {
my ($urpm, $medium, $b_nocheck_access, $b_auto_correct) = @_;
@@ -248,12 +263,7 @@ sub add_existing_medium {
return;
}
- if ($medium->{with_hdlist} && ! grep { $_ eq '..' } split('/', $medium->{with_hdlist})) {
- #- try to migrate to media_info_dir
- my $b = basename($medium->{with_hdlist});
- if ($b eq ($medium->{synthesis} ? 'synthesis.hdlist.cz' : 'hdlist.cz')) {
- $medium->{media_info_dir} = dirname(delete $medium->{with_hdlist});
- }
+ if ($medium->{with_hdlist} && _migrate__with_hdlist($medium)) {
$urpm->{modified} = 1;
}
@@ -667,7 +677,15 @@ sub add_medium {
probe_removable_device($urpm, $medium);
}
- $with_hdlist and $medium->{with_hdlist} = $with_hdlist;
+ if ($with_hdlist) {
+ if ($with_hdlist =~ m!(^|/)synthesis\.!) {
+ $medium->{synthesis} = 1;
+ } else {
+ $medium->{hdlist} = _hdlist($medium);
+ }
+ $medium->{with_hdlist} = $with_hdlist;
+ _migrate__with_hdlist($medium);
+ }
#- local media have priority, other are added at the end.
my $inserted;
@@ -879,6 +897,7 @@ sub _probe_with_try_list {
foreach my $media_info_dir (@media_info_dirs) {
if ($probe->($want_synthesis, $media_info_dir)) {
+ return 1 if $probe_with;
last;
}
}