summaryrefslogtreecommitdiffstats
path: root/gurpmi.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-03 15:08:40 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-03 15:08:40 +0000
commit6ecb1b70b2b7410995a52b4f7fd010f5be0da525 (patch)
treef6ae56b4ec8a42c6ba676c64c21f4a7dc158d38a /gurpmi.pm
parent05ca1f54f8aea97462a1265f3d151a792b838296 (diff)
downloadurpmi-6ecb1b70b2b7410995a52b4f7fd010f5be0da525.tar
urpmi-6ecb1b70b2b7410995a52b4f7fd010f5be0da525.tar.gz
urpmi-6ecb1b70b2b7410995a52b4f7fd010f5be0da525.tar.bz2
urpmi-6ecb1b70b2b7410995a52b4f7fd010f5be0da525.tar.xz
urpmi-6ecb1b70b2b7410995a52b4f7fd010f5be0da525.zip
(gurpmi::parse_command_line) reuse common shared code of urpm::args,
thus fixing --root option
Diffstat (limited to 'gurpmi.pm')
-rw-r--r--gurpmi.pm23
1 files changed, 9 insertions, 14 deletions
diff --git a/gurpmi.pm b/gurpmi.pm
index 5660989e..66899af1 100644
--- a/gurpmi.pm
+++ b/gurpmi.pm
@@ -22,6 +22,7 @@ use strict;
use Gtk2;
use urpm::util;
use urpm::msg;
+use urpm::args;
use Exporter;
our @ISA = qw(Exporter);
@@ -53,6 +54,13 @@ sub parse_command_line() {
my @all_rpms;
our %options;
our @names;
+
+ # keep a copy for gurpmi2
+ {
+ local @ARGV = @ARGV;
+ urpm::args::parse_cmdline(urpm => { options => \%options});
+ }
+
# Expand *.urpmi arguments
my @ARGV_expanded;
foreach my $a (@ARGV) {
@@ -64,21 +72,8 @@ sub parse_command_line() {
push @ARGV_expanded, $a;
}
}
- my $nextopt;
foreach (@ARGV_expanded) {
- if ($nextopt) { $options{$nextopt} = $_; undef $nextopt; next }
- if (/^-/) {
- if (/^--(no-verify-rpm|auto-select|auto)$/) {
- $options{$1} = 1;
- next;
- }
- if (/^--(media|searchmedia|root)$/) {
- $nextopt = $1;
- next;
- }
- /^--?[hv?]/ and usage();
- fatal(N("Unknown option %s", $_));
- }
+ next if /^-/;
if (-f $_) {
push @all_rpms, $_;
} else {