From 79f7c0fc83b31b3d6971277735875baa2eb8f49a Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 13 Aug 2007 09:07:20 +0000 Subject: (set_root) split it out in order to be reused by rpmdrake --- urpm/args.pm | 19 +++++++++++-------- 1 file 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}; -- cgit v1.2.1