From 45f8214f69c52e4cbc7bc61b055c8d0ec2308bec Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 10 Jan 2002 13:31:38 +0000 Subject: fix distant list file support. --- urpm.pm | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 2ad606ae..981f895f 100644 --- a/urpm.pm +++ b/urpm.pm @@ -287,7 +287,11 @@ sub probe_medium { local *L; open L, "$urpm->{statedir}/$medium->{list}"; while () { - /^(.*)\/[^\/]*/ and $probe{$1} = undef; + #- /./ is end of url marker in list file (typically generated by a + #- find . -name "*.rpm" > list + #- for exportable list file. + /^(.*)\/\.\// and $probe{$1} = undef; + /^(.*)\/[^\/]*$/ and $probe{$1} = undef; } close L; foreach (sort { length($a) <=> length($b) } keys %probe) { @@ -832,21 +836,23 @@ sub update_media { /\/([^\/]*)-[^-\/]*-[^-\/]*\.[^\/]*\.rpm/; $list{"$prefix:/$_\n"} = ($urpm->{params}{names}{$1} || { id => 1000000000 })->{id}; } - } elsif (-s "$urpm->{cachedir}/partial/list") { - local (*F, $_); - while () { - /\/([^\/]*)-[^-\/]*-[^-\/]*\.[^\/]*\.rpm/; - $list{"$medium->{url}/$_\n"} = ($urpm->{params}{names}{$1} || { id => 1000000000 })->{id}; - } - close F; } else { local (*F, $_); + my %filename2pathname; + if ($medium->{hdlist} ne 'list' && -s "$urpm->{cachedir}/partial/list") { + open F, "$urpm->{cachedir}/partial/list"; + while () { + /\/([^\/]*)\.rpm$/ and $filename2pathname{$1} = "$medium->{url}/$_"; + } + close F; + } unless ($medium->{synthesis}) { open F, "parsehdlist --name '$urpm->{cachedir}/partial/$medium->{hdlist}' |"; while () { - /^([^\/]*):name:([^\/\s:]*)(?::(.*)\.rpm)?$/; - $list{"$medium->{url}/". ($3 || $2) .".rpm\n"} = ($urpm->{params}{names}{$1} || { id => 1000000000 } - )->{id}; + /^([^\/]*):name:([^\/\s:]*)(?::(.*)\.rpm)?$/ or next; + $list{$filename2pathname{$3 || $2} || + "$medium->{url}/". ($3 || $2) .".rpm\n"} = ($urpm->{params}{names}{$1} || + { id => 1000000000 })->{id}; } close F or $medium->{synthesis} = 1; #- try hdlist as a synthesis (for probe) } @@ -856,9 +862,9 @@ sub update_media { #- parse_synthesis returns all full name of package read from it. foreach (@founds) { my $fullname = "$_->{name}-$_->{version}-$_->{release}.$_->{arch}"; - $list{"$medium->{url}/". ($_->{file} || $fullname) .".rpm\n"} = ($urpm->{params}{names}{$_->{name}} || - { id => 1000000000 } - )->{id}; + $list{$filename2pathname{$_->{file} || $fullname} || + "$medium->{url}/". ($_->{file} || $fullname) .".rpm\n"} = ($urpm->{params}{names}{$_->{name}} || + { id => 1000000000 })->{id}; } } else { $error = 1, $urpm->{error}(_("unable to parse hdlist file of \"%s\"", $medium->{name})); -- cgit v1.2.1