From f076742409681509eee3d28369b21f495ed19d42 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 28 Nov 2006 10:04:00 +0000 Subject: - add {debug} level messages - add some debug message before downloading - always display the retrieved url (using {log}) --- urpm/args.pm | 3 ++- urpm/download.pm | 8 +++++++- urpm/media.pm | 3 --- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'urpm') diff --git a/urpm/args.pm b/urpm/args.pm index 54b95022..41ed2b1e 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -108,6 +108,7 @@ my %options_spec = ( }, 'bug=s' => \$options{bug}, 'env=s' => \$::env, + 'debug' => sub { $urpm->{debug} = sub { print STDERR "$_[0]\n" } }, 'verify-rpm!' => sub { $urpm->{options}{'verify-rpm'} = $_[1] }, 'strict-arch!' => sub { $urpm->{options}{'strict-arch'} = $_[1] }, 'norebuild!' => sub { $urpm->{options}{'build-hdlist-on-error'} = !$_[1] }, @@ -390,7 +391,7 @@ foreach my $k ("help|h", "wget", "curl", "prozilla", "proxy=s", "proxy-user=s", $options_spec{'urpmi.addmedia'}{$k} = $options_spec{'urpmi.update'}{$k}; } -foreach my $k ("probe-synthesis", "probe-hdlist") +foreach my $k ("probe-synthesis", "probe-hdlist", 'debug') { $options_spec{'urpmi.addmedia'}{$k} = $options_spec{urpme}{$k} = diff --git a/urpm/download.pm b/urpm/download.pm index 7d2b8d6a..ceb6ffff 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -632,7 +632,13 @@ sub sync { $all_options{$cpt} = $urpm->{options}{$cpt} if defined $urpm->{options}{$cpt}; } - eval { _sync_webfetch_raw($urpm, $files, \%all_options); 1 }; + $urpm->{debug}(N("retrieving %s", join(' ', @$files))); + + eval { + _sync_webfetch_raw($urpm, $files, \%all_options); + $urpm->{log}(N("retrieved %s", join(' ', @$files))); + 1; + }; } #- syncing algorithms. diff --git a/urpm/media.pm b/urpm/media.pm index 27655d04..ad8d9824 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -676,7 +676,6 @@ sub add_distrib_media { if (urpm::download::sync($urpm, undef, [ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg') ], quiet => 1)) { - $urpm->{log}(N("...retrieving done")); $distribconf->parse_mediacfg("$urpm->{cachedir}/partial/media.cfg") or $urpm->{error}(N("unable to parse media.cfg")), return(); } else { @@ -1196,7 +1195,6 @@ sub get_hdlist_or_synthesis__remote { if (urpm::download::sync($urpm, $medium, [ _url_with_hdlist($medium) ], quiet => $quiet, callback => $callback) && file_size(cachedir_with_hdlist($urpm, $medium)) >= 20) { - $urpm->{log}(N("...retrieving done")); 1; } else { chomp(my $err = $@); @@ -1428,7 +1426,6 @@ sub _update_medium__parse_if_unmodified__remote { $options->{force} and unlink $f; if (urpm::download::sync($urpm, $medium, [ reduce_pathname("$medium->{url}/$with_hdlist") ], quiet => $options->{quiet}, callback => $options->{callback}) && file_size($f) >= 20) { - $urpm->{log}(N("...retrieving done")); $medium->{with_hdlist} = $with_hdlist; $urpm->{log}(N("found probed hdlist (or synthesis) as %s", $medium->{with_hdlist})); last; #- found a suitable with_hdlist in the list above. -- cgit v1.2.1