From 3fc070c42b6158f085de20f843697d689a32842b Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 1 Feb 2006 17:43:19 +0000 Subject: Patch by Shlomi Fish to fix error recovery on download of description files. --- urpm.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 504eff54..cc0d0f08 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1438,10 +1438,16 @@ this could happen if you mounted manually the directory when creating the medium media => $medium->{name}, }; eval { $urpm->{sync}($syncopts, reduce_pathname("$medium->{url}/media_info/descriptions")) }; - -e "$urpm->{cachedir}/partial/descriptions" or eval { - #- try older location - $urpm->{sync}($syncopts, reduce_pathname("$medium->{url}/../descriptions")); - }; + #- It is possible that the original fetch of the descriptions + #- failed, but the file still remains in partial/ because it was + #- moved from $urpm->{statedir} earlier. So we need to check if + #- the previous download failed. + if ($@ || (! -e "$urpm->{cachedir}/partial/descriptions")) { + eval { + #- try older location + $urpm->{sync}($syncopts, reduce_pathname("$medium->{url}/../descriptions")); + }; + } if (-e "$urpm->{cachedir}/partial/descriptions") { urpm::util::move("$urpm->{cachedir}/partial/descriptions", "$urpm->{statedir}/descriptions.$medium->{name}"); } -- cgit v1.2.1