diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-23 05:12:13 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-23 05:12:13 +0000 |
commit | f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00 (patch) | |
tree | caa9d0289aabfacf2beab026790c56b070080b2f /urpm.pm | |
parent | 82a0ea4489d7cf5267fdc3bda5f0815d53cede0c (diff) | |
download | urpmi-f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00.tar urpmi-f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00.tar.gz urpmi-f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00.tar.bz2 urpmi-f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00.tar.xz urpmi-f0a00bbc6f7c09aa81e35635529eb0ba7db5ab00.zip |
Better error handling for copy failures
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -68,7 +68,10 @@ sub sync_webfetch { push @{$files{$1}}, $_; } if ($files{removable} || $files{file}) { - sync_file($options, @{$files{removable} || []}, @{$files{file} || []}); + eval { + sync_file($options, @{$files{removable} || []}, @{$files{file} || []}); + }; + $urpm->{fatal}(10, $@) if $@; delete @files{qw(removable file)}; } if ($files{ftp} || $files{http} || $files{https}) { @@ -674,8 +677,9 @@ sub add_distrib_media { if (-e $hdlists_file) { unlink "$urpm->{cachedir}/partial/hdlists"; $urpm->{log}(N("copying hdlists file...")); - system("cp", "-p", "-R", $hdlists_file, "$urpm->{cachedir}/partial/hdlists") ? - $urpm->{log}(N("...copying failed")) : $urpm->{log}(N("...copying done")); + system("cp", "-p", "-R", $hdlists_file, "$urpm->{cachedir}/partial/hdlists") + ? $urpm->{error}(N("...copying failed")) + : $urpm->{log}(N("...copying done")); } else { $urpm->{error}(N("unable to access first installation medium (no hdlists file found)")), return; } @@ -1057,8 +1061,9 @@ this could happen if you mounted manually the directory when creating the medium if (-e "$dir/../descriptions") { $urpm->{log}(N("copying description file of \"%s\"...", $medium->{name})); system("cp", "-p", "-R", "$dir/../descriptions", - "$urpm->{statedir}/descriptions.$medium->{name}") ? - $urpm->{log}(N("...copying failed")) : $urpm->{log}(N("...copying done")); + "$urpm->{statedir}/descriptions.$medium->{name}") + ? $urpm->{error}(N("...copying failed")) + : $urpm->{log}(N("...copying done")); } #- examine if a distant MD5SUM file is available. @@ -1147,8 +1152,8 @@ this could happen if you mounted manually the directory when creating the medium $options{callback} && $options{callback}('copy', $medium->{name}); if (system("cp", "-p", "-R", $with_hdlist_dir, "$urpm->{cachedir}/partial/$medium->{hdlist}")) { $options{callback} && $options{callback}('failed', $medium->{name}); - $urpm->{log}(N("...copying failed")); - unlink "$urpm->{cachedir}/partial/$medium->{hdlist}"; #- force error... + #- force error, reported afterwards + unlink "$urpm->{cachedir}/partial/$medium->{hdlist}"; } else { $options{callback} && $options{callback}('done', $medium->{name}); $urpm->{log}(N("...copying done")); @@ -1210,7 +1215,7 @@ this could happen if you mounted manually the directory when creating the medium -e $path_list or $path_list = "$dir/list"; if (-e $path_list) { system("cp", "-p", "-R", $path_list, "$urpm->{cachedir}/partial/list") - and $urpm->{log}(N("...copying failed")); + and $urpm->{error}(N("...copying failed")); } } } else { @@ -1267,7 +1272,7 @@ this could happen if you mounted manually the directory when creating the medium -e $path_pubkey or $path_pubkey = "$dir/pubkey"; -e $path_pubkey and system("cp", "-p", "-R", $path_pubkey, "$urpm->{cachedir}/partial/pubkey") - and $urpm->{log}(N("...copying failed")); + and $urpm->{error}(N("...copying failed")); } } else { #- check for a reconfig.urpmi file (if not already reconfigured) @@ -1461,13 +1466,13 @@ this could happen if you mounted manually the directory when creating the medium and system("cp", "-p", "-R", "$urpm->{statedir}/synthesis.$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename") - and $urpm->{log}(N("...copying failed")); + and $urpm->{error}(N("...copying failed")); } else { -e "$urpm->{statedir}/$medium->{hdlist}" and system("cp", "-p", "-R", "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename") - and $urpm->{log}(N("...copying failed")); + and $urpm->{error}(N("...copying failed")); } } eval { |