diff options
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -287,7 +287,11 @@ sub probe_medium { local *L; open L, "$urpm->{statedir}/$medium->{list}"; while (<L>) { - /^(.*)\/[^\/]*/ 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 (<F>) { - /\/([^\/]*)-[^-\/]*-[^-\/]*\.[^\/]*\.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 (<F>) { + /\/([^\/]*)\.rpm$/ and $filename2pathname{$1} = "$medium->{url}/$_"; + } + close F; + } unless ($medium->{synthesis}) { open F, "parsehdlist --name '$urpm->{cachedir}/partial/$medium->{hdlist}' |"; while (<F>) { - /^([^\/]*):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})); |