summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-01 15:14:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-01 15:14:19 +0000
commit89ea15bf14b7cc5298d21a414d268f69e648fe07 (patch)
tree597b300a37ffc16d1cde43669827515e11cbb649
parent2006fe16a22483e438ddf3793bf05c9133cdd36a (diff)
downloadurpmi-89ea15bf14b7cc5298d21a414d268f69e648fe07.tar
urpmi-89ea15bf14b7cc5298d21a414d268f69e648fe07.tar.gz
urpmi-89ea15bf14b7cc5298d21a414d268f69e648fe07.tar.bz2
urpmi-89ea15bf14b7cc5298d21a414d268f69e648fe07.tar.xz
urpmi-89ea15bf14b7cc5298d21a414d268f69e648fe07.zip
- normalize verbose option handling over $options{verbose}
- handle $rpm_opt where it is used
-rw-r--r--urpm/args.pm10
-rw-r--r--urpme4
-rwxr-xr-xurpmf3
-rwxr-xr-xurpmi15
4 files changed, 15 insertions, 17 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index ecca014f..be510c83 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -46,7 +46,7 @@ END { $::debug_exit and print STDERR "EXITING (pid=$$)\n" }
my %options_spec_all = (
'debug' => sub {
$::debug_exit = 1;
- $::verbose++; $options{verbose}++;
+ $options{verbose}++;
$urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" };
},
'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) },
@@ -152,8 +152,8 @@ my %options_spec = (
'no-md5sum' => \$::nomd5sum,
'force-key' => \$::forcekey,
a => \$::all,
- 'q|quiet' => sub { --$::verbose; $::rpm_opt = '' },
- 'v|verbose' => sub { ++$::verbose; $::rpm_opt = 'vh' },
+ '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,7 @@ my %options_spec = (
urpme => {
auto => \$::auto,
- 'v|verbose' => \$::verbose,
+ 'v|verbose' => \$options{verbose},
a => \$::matches,
noscripts => \$::noscripts,
repackage => \$::repackage,
@@ -182,7 +182,7 @@ my %options_spec = (
},
'qf=s' => \$::qf,
'uniq|u' => \$::uniq,
- 'verbose|v' => \$::verbose,
+ 'verbose|v' => \$options{verbose},
m => add_param_closure('media'),
i => sub { $::pattern = 'i' },
I => sub { $::pattern = '' },
diff --git a/urpme b/urpme
index 1d5989d1..1f30714b 100644
--- a/urpme
+++ b/urpme
@@ -31,7 +31,7 @@ use urpm::select;
$ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin";
delete @ENV{qw(ENV BASH_ENV IFS CDPATH)};
-our ($test, $parallel, $auto, $matches, $verbose, $force, $noscripts, $repackage, @l, $bundle, $restricted);
+our ($test, $parallel, $auto, $matches, $force, $noscripts, $repackage, @l, $bundle, $restricted);
my $yesexpr =
#-PO: Add here the keys which might be pressed in the "Yes"-case.
N("Yy");
@@ -70,7 +70,7 @@ urpm::args::parse_cmdline(urpm => $urpm) or exit(1);
my $state = {};
#- remove verbose if not asked.
-$verbose or $urpm->{log} = sub {};
+$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 5b61b775..fd67412b 100755
--- a/urpmf
+++ b/urpmf
@@ -98,7 +98,6 @@ our $sortmedia = '';
our $synthesis = '';
our $uniq = ''; # --uniq
our $update = 0; # --update
-our $verbose = 0; # --verbose
#- globals used in callback
our $expr; # regexp to match against
@@ -121,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} = $verbose ? sub { print STDERR "$_[0]\n" } : sub {};
+$urpm->{log} = $options{verbose} ? sub { print STDERR "$_[0]\n" } : sub {};
my $multitag = '';
my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires);
diff --git a/urpmi b/urpmi
index 10829950..0a776a57 100755
--- a/urpmi
+++ b/urpmi
@@ -57,9 +57,7 @@ our $parallel = '';
our $env = '';
our $test = 0;
our $all = 0;
-our $rpm_opt = "vh";
our $use_provides = 1;
-our $verbose = 0;
our $logfile = '';
our $restricted = 0;
our $nomd5sum = 0;
@@ -320,7 +318,7 @@ select STDERR; $| = 1;
select STDOUT; $| = 1;
#- log is only for verbose runs.
-$verbose > 0 or $urpm->{log} = sub {};
+$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.)
@@ -368,7 +366,7 @@ if ($auto_update && !$bug && !$env) {
all => 1,
callback => \&urpm::download::sync_logger,
noclean => $noclean,
- quiet => $verbose < 0,
+ quiet => $options{verbose} < 0,
nomd5sum => $nomd5sum,
forcekey => $forcekey,
);
@@ -648,7 +646,7 @@ foreach my $set (@{$state->{transaction} || []}) {
my (@transaction_list, %transaction_sources);
#- put a blank line to separate with previous transaction or user question.
- print "\n" if $verbose >= 0;
+ print "\n" if $options{verbose} >= 0;
#- prepare transaction...
urpm::install::prepare_transaction($urpm, $set, $list, \%sources, \@transaction_list, \%transaction_sources);
@@ -658,7 +656,7 @@ foreach my $set (@{$state->{transaction} || []}) {
\@transaction_list,
\%transaction_sources,
\%error_sources,
- quiet => $verbose < 0,
+ quiet => $options{verbose} < 0,
callback => sub {
# my ($mode, $file, $percent, $total, $eta, $speed) = @_;
goto &urpm::download::sync_logger;
@@ -689,6 +687,7 @@ foreach my $set (@{$state->{transaction} || []}) {
#- install source package only (whatever the user is root or not, but use rpm for that).
if ($install_src) {
if (my @l = grep { /\.src\.rpm$/ } values %transaction_sources_install, values %transaction_sources) {
+ my $rpm_opt = $options{verbose} >= 0 ? 'vh' : '';
system("rpm", "-i$rpm_opt", @l, ($urpm->{root} ? ("--root", $urpm->{root}) : @{[]}));
#- Warning : the following message is parsed in urpm::parallel_*
if ($?) {
@@ -721,7 +720,7 @@ foreach my $set (@{$state->{transaction} || []}) {
excludepath => $urpm->{options}{excludepath}, excludedocs => $urpm->{options}{excludedocs},
);
} else {
- if ($verbose >= 0) {
+ if ($options{verbose} >= 0) {
my @packnames = (values %transaction_sources_install, values %transaction_sources);
(my $common_prefix) = $packnames[0] =~ m!^(.*)/!;
if (length($common_prefix) && @packnames == grep { m!^\Q$common_prefix/! } @packnames) {
@@ -828,7 +827,7 @@ if ($nok) {
print N("Installation is possible"), "\n";
} elsif (@names || @src_names || @files || @src_files || $auto_select) {
if (@{$state->{transaction} || []} == 0 && @ask_unselect == 0) {
- if ($verbose >= 0) {
+ if ($options{verbose} >= 0) {
if ($auto_select) {
print N("Packages are up to date"), "\n";
} else {