From 8255b4073db51f84772ec1f174962eb97060801e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 15 Nov 2006 15:33:39 +0000 Subject: cleanup (if we sync_fetch something, we really want it to succeed) --- urpm.pm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 99f66283..e3ff0010 100644 --- a/urpm.pm +++ b/urpm.pm @@ -853,13 +853,13 @@ sub add_distrib_media { \%options, quiet => 1); $urpm->{log}(N("...retrieving done")); }; - $@ and $urpm->{error}(N("...retrieving failed: %s", $@)); - if (-e "$urpm->{cachedir}/partial/media.cfg") { - $distribconf->parse_mediacfg("$urpm->{cachedir}/partial/media.cfg") - or $urpm->{error}(N("unable to parse media.cfg")), return(); - } else { + if ($@) { + $urpm->{error}(N("...retrieving failed: %s", $@)); $urpm->{error}(N("unable to access the distribution medium (no media.cfg file found)")); return (); + } else { + $distribconf->parse_mediacfg("$urpm->{cachedir}/partial/media.cfg") + or $urpm->{error}(N("unable to parse media.cfg")), return(); } } @@ -1343,11 +1343,7 @@ sub _update_medium__get_descriptions_remote { sync_webfetch($urpm, $medium, [ reduce_pathname("$medium->{url}/media_info/descriptions") ], $options, quiet => 1); }; - #- 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") { + if ($@) { eval { #- try older location sync_webfetch($urpm, $medium, [ reduce_pathname("$medium->{url}/../descriptions") ], -- cgit v1.2.1