summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-07-30 13:16:04 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-07-30 13:16:04 +0000
commit9c692705a7df1d92e5e0f3c4aa2453bf0bdab170 (patch)
treeac5564422c3ac9a116d9c2d98d6a4d8495ebe372
parentacbc56d621004e5ea6588391f9822dfc4347a8fe (diff)
downloadurpmi-9c692705a7df1d92e5e0f3c4aa2453bf0bdab170.tar
urpmi-9c692705a7df1d92e5e0f3c4aa2453bf0bdab170.tar.gz
urpmi-9c692705a7df1d92e5e0f3c4aa2453bf0bdab170.tar.bz2
urpmi-9c692705a7df1d92e5e0f3c4aa2453bf0bdab170.tar.xz
urpmi-9c692705a7df1d92e5e0f3c4aa2453bf0bdab170.zip
slight clean-up in wget downloading handling
-rw-r--r--urpm/download.pm15
-rw-r--r--urpm/dudf.pm2
2 files changed, 9 insertions, 8 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 01f3644d..30930077 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -457,6 +457,7 @@ sub sync_curl {
#- http files (and other files) are correctly managed by curl wrt conditional download.
#- options for ftp files, -R (-O <file>)*
#- options for http files, -R (-O <file>)*
+ my $result;
if (my @all_files = (
(map { ("-O", $_) } @ftp_files),
(map { m|/| ? ("-O", $_) : @{[]} } @other_files)))
@@ -480,15 +481,14 @@ sub sync_curl {
"--stderr", "-", # redirect everything to stdout
@all_files);
$options->{debug} and $options->{debug}($cmd);
- _curl_action($cmd,$options,@l,"download",$cwd);
- } else {
- chdir $cwd;
+ $result = _curl_action($cmd,$options,@l);
}
-
+ chdir $cwd;
+ $result;
}
sub _curl_action {
- my ($cmd, $options, @l, $updown, $cwd) = @_;
+ my ($cmd, $options, @l, $o_is_upload) = @_;
my ($buf, $file); $buf = '';
my $curl_pid = open(my $curl, "$cmd |");
@@ -507,7 +507,9 @@ sub _curl_action {
if (propagate_sync_callback($options, 'progress', $file, $percent, $total, $eta, $speed) eq 'canceled') {
kill 15, $curl_pid;
close $curl;
- die N("curl failed: ".$updown." canceled\n");
+
+ die N("curl failed: upload canceled\n") if $o_is_upload;
+ die N("curl failed: download canceled\n");
}
#- this checks that download has actually started
if ($_ eq "\n"
@@ -527,7 +529,6 @@ sub _curl_action {
$buf = '';
}
}
- chdir $cwd;
close $curl or _error('curl');
}
diff --git a/urpm/dudf.pm b/urpm/dudf.pm
index f03e35be..8a8aec49 100644
--- a/urpm/dudf.pm
+++ b/urpm/dudf.pm
@@ -275,7 +275,7 @@ sub upload_dudf {
"-F id=" . $self->{dudf_uid},
$self->{upload_url},
);
- urpm::download::_curl_action($cmd, $options, @l, "upload", $cwd);
+ urpm::download::_curl_action($cmd, $options, @l, 1);
unlink $self->{dudf_file} . ".gz";
unlink $self->{dudf_file};
print N("\nYou can see your DUDF report at the following URL :\n\t");