From a00d3f1c44736ead44c338d6a4597fadcc6a6b4f Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 4 Oct 2004 01:22:45 +0000 Subject: Don't panic when one can't build a synthesis file from a local directory containing rpms. --- urpm.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 07f6b674..7fd76c17 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1808,11 +1808,17 @@ this could happen if you mounted manually the directory when creating the medium hdlist => "$urpm->{statedir}/$medium->{hdlist}", ); #- synthesis needs to be created, since the medium has been built from rpm files. - $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 ($@) { + $urpm->{error}(N("Unable to build hdlist and synthesis files for medium \"%s\"."), $medium->{name}); + unlink "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{statedir}/synthesis.$medium->{hdlist}"; + } else { + $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); + } #- keep in mind we have a modified database, sure at this point. $urpm->{modified} = 1; } elsif ($medium->{synthesis}) { @@ -1843,8 +1849,7 @@ this could happen if you mounted manually the directory when creating the medium 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}); + $urpm->{error}(N("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})); -- cgit v1.2.1