From 275fecaa3dbaabf97aa7bd03f3bff2b17eac95a0 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 11 Feb 2004 13:18:06 +0000 Subject: send download errors to error output instead of log output (in order to display them in non-verbose mode too) --- urpm.pm | 17 +++++++++-------- urpmi | 2 +- urpmi.spec | 8 ++++++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/urpm.pm b/urpm.pm index 1f484850..eb7f26bb 100644 --- a/urpm.pm +++ b/urpm.pm @@ -326,7 +326,7 @@ sub sync_curl { propagate_sync_callback($options, 'end', $file); $file = undef; } - } elsif ($buf =~ /^curl:/) { #- probably an error reported by curl + } elsif ($buf =~ /^curl:/) { #- likely to be an error reported by curl local $/ = "\n"; chomp $buf; propagate_sync_callback($options, 'error', $file, $buf); @@ -452,6 +452,9 @@ sub sync_logger { print STDERR $text, " " x (79 - length($text)), "\r"; } elsif ($mode eq 'end') { print STDERR " " x 79, "\r"; + } elsif ($mode eq 'error') { + #- error is 3rd argument, saved in $percent + print STDERR N("...retrieving failed: %s", $percent), "\n"; } } @@ -1049,7 +1052,7 @@ sub add_distrib_media { reduce_pathname("$url/Mandrake/base/hdlists")); $urpm->{log}(N("...retrieving done")); }; - $@ and $urpm->{log}(N("...retrieving failed: %s", $@)); + $@ and $urpm->{error}(N("...retrieving failed: %s", $@)); if (-e "$urpm->{cachedir}/partial/hdlists") { $hdlists_file = "$urpm->{cachedir}/partial/hdlists"; } else { @@ -1708,7 +1711,7 @@ this could happen if you mounted manually the directory when creating the medium proxy => $urpm->{proxy} }, reduce_pathname("$medium->{url}/$medium->{with_hdlist}")); }; if ($@) { - $urpm->{log}(N("...retrieving failed: %s", $@)); + $urpm->{error}(N("...retrieving failed: %s", $@)); unlink "$urpm->{cachedir}/partial/$basename"; } } @@ -1717,7 +1720,7 @@ this could happen if you mounted manually the directory when creating the medium if (-s "$urpm->{cachedir}/partial/$basename" > 32 && $retrieved_md5sum) { $urpm->{log}(N("computing md5sum of retrieved source hdlist (or synthesis)")); unless ((split ' ', `md5sum '$urpm->{cachedir}/partial/$basename'`)[0] eq $retrieved_md5sum) { - $urpm->{log}(N("...retrieving failed: %s", N("md5sum mismatch"))); + $urpm->{error}(N("...retrieving failed: %s", N("md5sum mismatch"))); unlink "$urpm->{cachedir}/partial/$basename"; } } @@ -2320,7 +2323,7 @@ sub register_rpms { $urpm->{log}(N("...retrieving done")); $_ = "$urpm->{cachedir}/partial/$basename"; }; - $@ and $urpm->{log}(N("...retrieving failed: %s", $@)); + $@ and $urpm->{error}(N("...retrieving failed: %s", $@)); } else { -r $_ or $error = 1, $urpm->{error}(N("unable to access rpm file [%s]", $_)), next; } @@ -3000,9 +3003,7 @@ sub download_packages_of_distant_media { values %distant_sources); $urpm->{log}(N("...retrieving done")); }; - if ($@) { - $urpm->{log}(N("...retrieving failed: %s", $@)); - } + $@ and $urpm->{error}(N("...retrieving failed: %s", $@)); #- clean files that have not been downloaded, but keep mind there #- has been problem downloading them at least once, this is #- necessary to keep track of failing download in order to diff --git a/urpmi b/urpmi index b09a55dd..7a1ed657 100755 --- a/urpmi +++ b/urpmi @@ -665,7 +665,7 @@ foreach my $set (@{$state->{transaction} || []}) { print SAVEERR " " x 79, "\r"; } elsif ($mode eq 'error') { #- error is 3rd argument, saved in $percent - print STDERR N("...retrieving failed: %s"), $percent, "\n"; + print STDERR N("...retrieving failed: %s", $percent), "\n"; } } }, diff --git a/urpmi.spec b/urpmi.spec index a4a27f79..d6ff74eb 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -8,7 +8,7 @@ %define name urpmi %define version 4.4.5 -%define release 4mdk +%define release 5mdk %define group %(perl -e 'printf "%%s\\n", "%_vendor" =~ /mandrake/i ? "System/Configuration/Packaging" : "System Environment/Base"') @@ -236,7 +236,11 @@ $urpm->update_media(nolock => 1, nopubkey => 1); %{compat_perl_vendorlib}/urpm/parallel_ssh.pm %changelog -- gurpmi: don't escape "," in translatable string, do it after translation +* Fri Jan 30 2004 Olivier Blin 4.4.5-5mdk +- send download errors to error output instead of log output + (in order to display them in non-verbose mode too) +- From Guillaume Cottenceau : + - gurpmi: don't escape "," in translatable string, do it after translation * Mon Feb 9 2004 Guillaume Cottenceau 4.4.5-4mdk - fix bug #7472: progressbar forced to be thicker than default -- cgit v1.2.1