diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | urpm/args.pm | 16 |
2 files changed, 13 insertions, 5 deletions
@@ -1,5 +1,5 @@ - library: - o enable rpmdrake to support --debug option + o enable rpmdrake to support --debug, -q & -v options o fix urpm::download::sync() return value (used by rpmdrake) (#43639) Version 6.9 - 9 September 2008, Pascal "Pixel" Rigaux diff --git a/urpm/args.pm b/urpm/args.pm index 35775da8..95fda9d2 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -49,13 +49,17 @@ sub set_debug { $urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" }; } +sub set_verbose { + $options{verbose} += $_[0]; +} + # options specifications for Getopt::Long my %options_spec_all = ( 'debug' => sub { set_debug($urpm) }, 'debug-librpm' => sub { URPM::setVerbosity(7) }, # 7 == RPMLOG_DEBUG - 'q|quiet' => sub { --$options{verbose} }, - 'v|verbose' => sub { ++$options{verbose} }, + 'q|quiet' => sub { set_verbose(-1) }, + 'v|verbose' => sub { set_verbose(1) }, 'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) }, 'wait-lock' => \$options{wait_lock}, 'use-copied-hdlist' => sub { $urpm->{options}{use_copied_hdlist} = 1 }, @@ -467,6 +471,11 @@ sub set_root { } } +sub set_verbosity { + $options{verbose} >= 0 or $urpm->{info} = sub {}; + $options{verbose} > 0 or $urpm->{log} = sub {}; +} + sub parse_cmdline { my %args = @_; $urpm = $args{urpm}; @@ -475,8 +484,7 @@ sub parse_cmdline { } my $ret = GetOptions(%{$options_spec{$tool}}, %options_spec_all); - $options{verbose} >= 0 or $urpm->{info} = sub {}; - $options{verbose} > 0 or $urpm->{log} = sub {}; + set_verbosity(); $urpm->{tune_rpm} and urpm::tune_rpm($urpm); |