summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-01 15:44:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-01 15:44:40 +0000
commite6d6502758210991a8fff3159b62f386138f6477 (patch)
tree50a33822b47b59db949174e8dd12abe3b58d0122
parent348de183f06992ca578503bdba9ce28f15f6ba76 (diff)
downloadurpmi-e6d6502758210991a8fff3159b62f386138f6477.tar
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.gz
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.bz2
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.xz
urpmi-e6d6502758210991a8fff3159b62f386138f6477.zip
factorize handling of -q|--quiet and -v|--verbose for all tools
this fixes -q option not handled by urpmi.update (#31890)
-rw-r--r--NEWS2
-rw-r--r--urpm/args.pm16
-rw-r--r--urpme3
-rwxr-xr-xurpmf2
-rwxr-xr-xurpmi3
-rwxr-xr-xurpmi.addmedia2
-rwxr-xr-xurpmi.removemedia2
-rwxr-xr-xurpmi.update2
-rwxr-xr-xurpmq2
9 files changed, 10 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index 14e1b7a0..7488de4f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- urpmi.update
+ o handle -q option (#31890)
- urpmq
o --whatrequires: fix skipping packages through provides provided by other
packages, when the other package is the same pkg name (#31773)
diff --git a/urpm/args.pm b/urpm/args.pm
index be510c83..52576485 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -49,6 +49,8 @@ my %options_spec_all = (
$options{verbose}++;
$urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" };
},
+ 'q|quiet' => sub { --$options{verbose} },
+ 'v|verbose' => sub { ++$options{verbose} },
'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) },
'use-copied-hdlist' => sub { $urpm->{options}{use_copied_hdlist} = 1 },
);
@@ -152,8 +154,6 @@ my %options_spec = (
'no-md5sum' => \$::nomd5sum,
'force-key' => \$::forcekey,
a => \$::all,
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
p => sub { $::use_provides = 1 },
P => sub { $::use_provides = 0 },
y => sub { $urpm->{options}{fuzzy} = 1 },
@@ -162,7 +162,6 @@ my %options_spec = (
urpme => {
auto => \$::auto,
- 'v|verbose' => \$options{verbose},
a => \$::matches,
noscripts => \$::noscripts,
repackage => \$::repackage,
@@ -182,7 +181,6 @@ my %options_spec = (
},
'qf=s' => \$::qf,
'uniq|u' => \$::uniq,
- 'verbose|v' => \$options{verbose},
m => add_param_closure('media'),
i => sub { $::pattern = 'i' },
I => sub { $::pattern = '' },
@@ -254,7 +252,6 @@ my %options_spec = (
'whatrequires-recursive' => sub { $options{what_requires_recursive} = $options{what_requires} = 1 },
y => sub { $urpm->{options}{fuzzy} = 1; $options{all} = 1 },
Y => sub { $urpm->{options}{fuzzy} = 1; $options{all} = $options{caseinsensitive} = 1 },
- 'verbose|v' => \$options{verbose},
i => \$options{info},
l => \$options{list_files},
r => sub {
@@ -291,8 +288,6 @@ my %options_spec = (
'force-key' => \$options{forcekey},
'no-md5sum' => \$options{nomd5sum},
'noa|d' => \my $_dummy, #- default, kept for compatibility
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
'norebuild!' => sub { $urpm->{options}{'build-hdlist-on-error'} = !$_[1]; $options{force} = 0 },
'probe-rpms' => sub { $options{probe_with} = 'rpms' },
'<>' => sub {
@@ -312,8 +307,6 @@ my %options_spec = (
'from=s' => \$options{mirrors_url},
virtual => \$options{virtual},
nopubkey => \$options{nopubkey},
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
raw => \$options{raw},
},
@@ -389,7 +382,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 ("a", "c", 'v|verbose', 'q|quiet', '<>') {
+foreach my $k ("a", "c", '<>') {
$options_spec{'urpmi.removemedia'}{$k} = $options_spec{'urpmi.update'}{$k};
}
foreach my $k ("y") {
@@ -416,6 +409,9 @@ 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 {};
+
if ($tool ne 'urpmi.addmedia' && $tool ne 'urpmi.update' &&
$options{probe_with} && !$options{usedistrib}) {
die N("Can't use %s without %s", "--probe-$options{probe_with}", "--use-distrib");
diff --git a/urpme b/urpme
index 1f30714b..f07eb369 100644
--- a/urpme
+++ b/urpme
@@ -69,9 +69,6 @@ urpm::args::parse_cmdline(urpm => $urpm) or exit(1);
my $state = {};
-#- remove verbose if not asked.
-$options{verbose} or $urpm->{log} = sub {};
-
if ($< && !$test) {
$urpm->{fatal}(1, N("Only superuser is allowed to remove packages"));
}
diff --git a/urpmf b/urpmf
index fd67412b..ab681795 100755
--- a/urpmf
+++ b/urpmf
@@ -120,7 +120,7 @@ if ($full) { $qf =~ s/%name\b/%fullname/ }
#- we really don't want logs on stdout, and remove verbose if not asked.
$urpm->{info} = sub { print STDERR "$_[0]\n" };
-$urpm->{log} = $options{verbose} ? sub { print STDERR "$_[0]\n" } : sub {};
+$urpm->{log} = sub { print STDERR "$_[0]\n" } if $options{verbose} > 0;
my $multitag = '';
my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires);
diff --git a/urpmi b/urpmi
index 0a776a57..b0991ac0 100755
--- a/urpmi
+++ b/urpmi
@@ -317,9 +317,6 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
select STDERR; $| = 1;
select STDOUT; $| = 1;
-#- log is only for verbose runs.
-$options{verbose} > 0 or $urpm->{log} = sub {};
-
if (exists $urpm->{options}{'priority-upgrade'} && $urpm->{options}{'priority-upgrade'} eq '') {
# we were run with --no-priority-upgrade (we were just restarted.)
# so, no need to update the media again
diff --git a/urpmi.addmedia b/urpmi.addmedia
index e1d0eece..c8bb7076 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -103,8 +103,6 @@ my $urpm = new urpm;
urpm::args::parse_cmdline(urpm => $urpm) or usage();
our ($name, $url, $with, $relative_hdlist) = our @cmdline;
-#- remove verbose if not asked.
-$options{verbose} > 0 or $urpm->{log} = sub {};
$options{quiet} = 1 if $options{verbose} < 0;
$url or ($url, $name) = ($name, '');
diff --git a/urpmi.removemedia b/urpmi.removemedia
index 54474da9..a3485282 100755
--- a/urpmi.removemedia
+++ b/urpmi.removemedia
@@ -59,8 +59,6 @@ our @cmdline; #- set by urpm::args
urpm::args::parse_cmdline(urpm => $urpm) or exit(1);
-$options{verbose} > 0 or $urpm->{log} = sub {};
-
if ($< != 0) {
$urpm->{fatal}(1, N("Only superuser is allowed to remove media"));
}
diff --git a/urpmi.update b/urpmi.update
index d47e7a70..b0993770 100755
--- a/urpmi.update
+++ b/urpmi.update
@@ -65,8 +65,6 @@ $options{noclean} = 1;
urpm::args::parse_cmdline(urpm => $urpm) or exit(1);
-$options{verbose} > 0 or $urpm->{log} = sub {};
-
if ($< != 0) {
$urpm->{fatal}(1, N("Only superuser is allowed to update media"));
}
diff --git a/urpmq b/urpmq
index 65a95ade..ce367196 100755
--- a/urpmq
+++ b/urpmq
@@ -121,7 +121,7 @@ urpm::args::parse_cmdline(urpm => $urpm) or exit(1);
#- we really don't want logs on stdout, and remove verbose if not asked.
$urpm->{info} = sub { print STDERR "$_[0]\n" };
-$urpm->{log} = $options{verbose} ? sub { print STDERR "$_[0]\n" } : sub {};
+$urpm->{log} = sub { print STDERR "$_[0]\n" } if $options{verbose} > 0;
#- improve speed if using any list_... options.
$options{nodepslist} = $options{list_aliases}