summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-29 14:39:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-29 14:39:18 +0000
commitdf95f65347ad42a943b273e0bbaaf865826c93cc (patch)
treefd78a201e90f35fb22051d468df7b643de432383 /urpm
parentd5358dfaa2c196e595693b09dee13da02578b5d7 (diff)
downloadurpmi-df95f65347ad42a943b273e0bbaaf865826c93cc.tar
urpmi-df95f65347ad42a943b273e0bbaaf865826c93cc.tar.gz
urpmi-df95f65347ad42a943b273e0bbaaf865826c93cc.tar.bz2
urpmi-df95f65347ad42a943b273e0bbaaf865826c93cc.tar.xz
urpmi-df95f65347ad42a943b273e0bbaaf865826c93cc.zip
factorize --nolock and --root option handling
Diffstat (limited to 'urpm')
-rw-r--r--urpm/args.pm21
1 files changed, 8 insertions, 13 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index a8260803..b1d10f32 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -120,11 +120,11 @@ my %options_spec = (
'skip=s' => \$options{skip},
'root=s' => sub {
require File::Spec;
- $::root = File::Spec->rel2abs($_[1]);
- if (!-d $::root) {
+ $options{root} = File::Spec->rel2abs($_[1]);
+ if (!-d $options{root}) {
$urpm->{fatal}->(9, N("chroot directory doesn't exist"));
}
- $::nolock = 1;
+ $options{nolock} = 1;
},
'use-distrib=s' => \$options{usedistrib},
'probe-synthesis' => sub { $options{probe_with} = 'synthesis' },
@@ -137,7 +137,7 @@ my %options_spec = (
repackage => sub { $urpm->{options}{repackage} = 1 },
'more-choices' => sub { $urpm->{options}{morechoices} = 1 },
'expect-install!' => \$::expect_install,
- 'nolock' => \$::nolock,
+ 'nolock' => \$options{nolock},
restricted => \$::restricted,
'no-md5sum' => \$::nomd5sum,
'force-key' => \$::forcekey,
@@ -229,14 +229,6 @@ my %options_spec = (
sources => \$options{sources},
force => \$options{force},
'skip=s' => \$options{skip},
- 'root=s' => sub {
- require File::Spec;
- $options{root} = File::Spec->rel2abs($_[1]);
- if (!-d $options{root}) {
- $urpm->{fatal}->(9, N("chroot directory doesn't exist"));
- }
- $options{nolock} = 1;
- },
'use-distrib=s' => sub {
if ($< != 0) {
print STDERR N("You need to be root to use --use-distrib"), "\n";
@@ -246,7 +238,6 @@ my %options_spec = (
},
'parallel=s' => \$options{parallel},
'env=s' => \$options{env},
- 'nolock' => \$options{nolock},
d => \$options{deps},
u => \$options{upgrade},
a => \$options{all},
@@ -365,6 +356,10 @@ foreach my $k ("help|h", "version", "no-locales", "test!", "force", "root=s", "u
{
$options_spec{urpme}{$k} = $options_spec{urpmi}{$k};
}
+foreach my $k ("root=s", "nolock")
+{
+ $options_spec{urpmq}{$k} = $options_spec{urpmi}{$k};
+}
foreach my $k ("help|h", "version", "no-locales", "update", "media|mediums=s",
"excludemedia|exclude-media=s", "sortmedia|sort-media=s",