From d594077fc061527d36a603e58c8867a3df6b45eb Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Tue, 28 Sep 2004 07:28:28 +0000 Subject: Better error message when updating a media fails because the hdlist is corrupted. --- urpm.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/urpm.pm b/urpm.pm index b7090278..7fc05b6c 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1836,11 +1836,18 @@ this could happen if you mounted manually the directory when creating the medium #- check if the synthesis file can be built. if (($second_pass || $medium->{modified_synthesis}) && !$medium->{modified}) { unless ($medium->{virtual}) { - $urpm->build_synthesis(start => $medium->{start}, - end => $medium->{end}, - synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", - ); - $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); + eval { $urpm->build_synthesis( + start => $medium->{start}, + end => $medium->{end}, + synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", + ) }; + if ($@) { + #- TODO translate this + $urpm->{error}("Unable to build synthesis file for medium \"%s\". Your hdlist file may be corrupted.", $medium->{name}); + unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}"; + } else { + $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); + } } #- keep in mind we have modified database, sure at this point. $urpm->{modified} = 1; -- cgit v1.2.1