summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-10-08 16:59:21 +0000
committerFrancois Pons <fpons@mandriva.com>2001-10-08 16:59:21 +0000
commit4fe91335bb07dcff1ecf8174cfd0170dfd632739 (patch)
treefe272f764bd3a5c5957fe6cf0ba4defcd9f6169b
parent046f4775d1a5a719cdea1e4d3cbc5a0bd081bcc4 (diff)
downloadurpmi-4fe91335bb07dcff1ecf8174cfd0170dfd632739.tar
urpmi-4fe91335bb07dcff1ecf8174cfd0170dfd632739.tar.gz
urpmi-4fe91335bb07dcff1ecf8174cfd0170dfd632739.tar.bz2
urpmi-4fe91335bb07dcff1ecf8174cfd0170dfd632739.tar.xz
urpmi-4fe91335bb07dcff1ecf8174cfd0170dfd632739.zip
make sure to remove a stale rpm file in cache (if size is 0), seems to have been
avoid for final 8.1 ?
-rw-r--r--urpm.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/urpm.pm b/urpm.pm
index b3ed17c1..898711ef 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1518,17 +1518,22 @@ sub get_source_packages {
#- examine the local repository, which is trusted.
opendir D, "$urpm->{cachedir}/rpms";
while (defined($_ = readdir D)) {
- if (/([^\/]*)\.rpm/ && -s "$urpm->{cachedir}/rpms/$1.rpm") {
- if (keys(%{$file2fullnames{$1} || {}}) > 1) {
- $urpm->{error}(_("there are multiples packages with the same rpm filename \"%s\""), $1);
- next;
- } elsif (keys(%{$file2fullnames{$1} || {}}) == 1) {
- my ($fullname) = keys(%{$file2fullnames{$1} || {}});
- if (defined delete $fullname2id{$fullname}) {
- push @local_sources, "$urpm->{cachedir}/rpms/$1.rpm";
- } else {
- push @local_to_removes, "$urpm->{cachedir}/rpms/$1.rpm";
+ if (/([^\/]*)\.rpm/) {
+ if (-s "$urpm->{cachedir}/rpms/$1.rpm") {
+ if (keys(%{$file2fullnames{$1} || {}}) > 1) {
+ $urpm->{error}(_("there are multiples packages with the same rpm filename \"%s\""), $1);
+ next;
+ } elsif (keys(%{$file2fullnames{$1} || {}}) == 1) {
+ my ($fullname) = keys(%{$file2fullnames{$1} || {}});
+ if (defined delete $fullname2id{$fullname}) {
+ push @local_sources, "$urpm->{cachedir}/rpms/$1.rpm";
+ } else {
+ push @local_to_removes, "$urpm->{cachedir}/rpms/$1.rpm";
+ }
}
+ } else {
+ #- this is an invalid file in cache, remove it and ignore it.
+ unlink "$urpm->{cachedir}/rpms/$1.rpm";
}
} #- no error on unknown filename located in cache (because .listing)
}