summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-08-13 09:07:20 +0000
committerThierry Vignaud <tv@mandriva.org>2007-08-13 09:07:20 +0000
commit79f7c0fc83b31b3d6971277735875baa2eb8f49a (patch)
tree1b23880360d842574a5095fbcf62f8f3fbbaa16b
parente19d9995e525fe989b3a674579c063a19825a272 (diff)
downloadurpmi-79f7c0fc83b31b3d6971277735875baa2eb8f49a.tar
urpmi-79f7c0fc83b31b3d6971277735875baa2eb8f49a.tar.gz
urpmi-79f7c0fc83b31b3d6971277735875baa2eb8f49a.tar.bz2
urpmi-79f7c0fc83b31b3d6971277735875baa2eb8f49a.tar.xz
urpmi-79f7c0fc83b31b3d6971277735875baa2eb8f49a.zip
(set_root) split it out in order to be reused by rpmdrake
-rw-r--r--urpm/args.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index efe0349e..6bb25f20 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -134,14 +134,7 @@ my %options_spec = (
'test!' => \$::test,
'skip=s' => \$options{skip},
'prefer=s' => \$options{prefer},
- 'root=s' => sub {
- require File::Spec;
- $urpm->{root} = File::Spec->rel2abs($_[1]);
- if (!-d $urpm->{root}) {
- $urpm->{fatal}->(9, N("chroot directory doesn't exist"));
- }
- $options{nolock} = 1;
- },
+ 'root=s' => sub { set_root($urpm, $_[1]) },
'use-distrib=s' => \$options{usedistrib},
'probe-synthesis' => sub { $options{probe_with} = 'synthesis' },
'probe-hdlist' => sub { $options{probe_with} = 'hdlist' },
@@ -406,6 +399,16 @@ foreach my $k ("help|h", "version") {
$options_spec{'urpmi.recover'}{$k} = $options_spec{urpmi}{$k};
}
+sub set_root {
+ my ($urpm, $root) = @_;
+ require File::Spec;
+ $urpm->{root} = File::Spec->rel2abs($root);
+ if (!-d $urpm->{root}) {
+ $urpm->{fatal}->(9, N("chroot directory doesn't exist"));
+ }
+ $options{nolock} = 1;
+ }
+
sub parse_cmdline {
my %args = @_;
$urpm = $args{urpm};