summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-02 14:31:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-02 14:31:23 +0000
commite3a2f316c390cf3fe24e103d7d018acab7de81f0 (patch)
tree7dc89ca711624e4366e53662cea5ad2bd3704f59
parent43f0942f8e4a865d26817e365f23d20095868fe4 (diff)
downloadurpmi-e3a2f316c390cf3fe24e103d7d018acab7de81f0.tar
urpmi-e3a2f316c390cf3fe24e103d7d018acab7de81f0.tar.gz
urpmi-e3a2f316c390cf3fe24e103d7d018acab7de81f0.tar.bz2
urpmi-e3a2f316c390cf3fe24e103d7d018acab7de81f0.tar.xz
urpmi-e3a2f316c390cf3fe24e103d7d018acab7de81f0.zip
normalize options passing: through %options or $urpm->{options}
-rw-r--r--urpm/args.pm8
-rw-r--r--urpme20
2 files changed, 13 insertions, 15 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index 83561845..903ab2b2 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -185,11 +185,8 @@ my %options_spec = (
},
urpme => {
- auto => \$::auto,
- a => \$::matches,
- noscripts => \$::noscripts,
- repackage => \$::repackage,
- restricted => \$::restricted,
+ a => \$options{matches},
+ restricted => \$options{restricted},
},
#- see also below, autogenerated callbacks
@@ -411,6 +408,7 @@ foreach my $k ('allow-medium-change', 'auto', 'auto-select', 'force', 'expect-in
$options_spec{gurpmi2} = $options_spec{gurpmi};
foreach my $k ("help|h", "version", "no-locales", "test!", "force", "root=s", "use-distrib=s",
+ 'repackage', 'noscripts', 'auto',
"parallel=s")
{
$options_spec{urpme}{$k} = $options_spec{urpmi}{$k};
diff --git a/urpme b/urpme
index 8c33a5dd..d853c137 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, $force, $noscripts, $repackage, $restricted);
+our ($test, $parallel, $force);
my $yesexpr =
#-PO: Add here the keys which might be pressed in the "Yes"-case.
N("Yy");
@@ -71,8 +71,8 @@ if ($< && !$test) {
}
#- rurpme checks
-if ($restricted) {
- urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $noscripts || $parallel;
+if ($options{restricted}) {
+ urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $urpm->{options}{noscripts} || $parallel;
}
unless ($test) {
@@ -92,7 +92,7 @@ urpm::media::configure($urpm,
my @toremove = urpm::select::find_packages_to_remove($urpm,
$state,
\@cmdline_pkgs_to_remove,
- matches => $matches,
+ matches => $options{matches},
force => $force,
callback_notfound => sub {
my $urpm = shift @_;
@@ -115,11 +115,11 @@ my @toremove = urpm::select::find_packages_to_remove($urpm,
) or $urpm->{fatal}(0, N("Nothing to remove"));
my $list = urpm::select::translate_why_removed($urpm, $state, @toremove);
-if ($test && $auto) {
+if ($test && $options{auto}) {
#- Warning : the following message is parsed in urpm::parallel_*
my $msg = N("Checking to remove the following packages");
print STDOUT "$msg:\n$list\n";
-} elsif (($parallel || @toremove > @cmdline_pkgs_to_remove) && !$auto) {
+} elsif (($parallel || @toremove > @cmdline_pkgs_to_remove) && !$options{auto}) {
my $msg =
P("To satisfy dependencies, the following package will be removed",
"To satisfy dependencies, the following %d packages will be removed",
@@ -135,15 +135,15 @@ my @errors = $parallel
\@toremove,
test => $test,
force => $force,
- noscripts => $noscripts,
- repackage => $repackage || $urpm->{options}{repackage},
+ noscripts => $urpm->{options}{noscripts},
+ repackage => $urpm->{options}{repackage},
)
: urpm::install::install($urpm,
\@toremove, {}, {},
test => $test,
force => $force,
- noscripts => $noscripts,
- repackage => $repackage || $urpm->{options}{repackage},
+ noscripts => $urpm->{options}{noscripts},
+ repackage => $urpm->{options}{repackage},
);
if (@errors) {