From a9a5e0fdfcd99e49051e169618f43ba1877748db Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 17 Sep 2003 12:33:57 +0000 Subject: fixed virtual media not examining list file. --- urpm.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 6805533d..effea779 100644 --- a/urpm.pm +++ b/urpm.pm @@ -2544,8 +2544,16 @@ sub get_source_packages { if (defined $medium->{start} && defined $medium->{end} && !$medium->{ignore}) { #- always prefer a list file is available. - if ($medium->{list} && -r "$urpm->{statedir}/$medium->{list}") { - open F, "$urpm->{statedir}/$medium->{list}"; + my $file = $medium->{list} && "$urpm->{statedir}/$medium->{list}"; + if (!$file && $medium->{virtual}) { + my ($dir) = $medium->{url} =~ /^(?:removable[^:]*|file)?:\/(.*)/; + my $with_hdlist_dir = reduce_pathname($dir . ($medium->{with_hdlist} ? "/$medium->{with_hdlist}" : "/..")); + my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list'; + $file = reduce_pathname("$with_hdlist_dir/../$local_list"); + -s $file or $file = "$dir/list"; + } + if (-r $file) { + open F, $file; while () { if (my ($filename) = /\/([^\/]*\.rpm)$/) { if (keys(%{$file2fullnames{$filename} || {}}) > 1) { @@ -2553,14 +2561,14 @@ sub get_source_packages { next; } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); - defined($id = $fullname2id{$fullname}) and $sources{$id} = $_; + defined($id = $fullname2id{$fullname}) and $sources{$id} = + $medium->{virtual} ? "$medium->{url}/$_" : $_; $list_examined{$fullname} = $examined{$fullname} = undef; } } else { chomp; $error = 1; - $urpm->{error}(N("unable to correctly parse [%s] on value \"%s\"", - "$urpm->{statedir}/$medium->{list}", $_)); + $urpm->{error}(N("unable to correctly parse [%s] on value \"%s\"", $file, $_)); last; } } -- cgit v1.2.1