summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-14 15:18:30 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-14 15:18:30 +0000
commitb67b7d701bd914153095b0ba121918d94ad9805b (patch)
tree1ac18220ba3ec6cd5c72e8cef93138b5d858e390
parent53ec6b3a03eee6945c48acb405c3af9061b9af84 (diff)
downloadurpmi-b67b7d701bd914153095b0ba121918d94ad9805b.tar
urpmi-b67b7d701bd914153095b0ba121918d94ad9805b.tar.gz
urpmi-b67b7d701bd914153095b0ba121918d94ad9805b.tar.bz2
urpmi-b67b7d701bd914153095b0ba121918d94ad9805b.tar.xz
urpmi-b67b7d701bd914153095b0ba121918d94ad9805b.zip
Allow to put rpm names on the gurpmi command-line
-rw-r--r--gurpmi6
-rw-r--r--gurpmi.pm11
-rwxr-xr-xgurpmi23
3 files changed, 18 insertions, 2 deletions
diff --git a/gurpmi b/gurpmi
index 57420ad4..35eb5289 100644
--- a/gurpmi
+++ b/gurpmi
@@ -61,6 +61,12 @@ foreach (@all_rpms) {
You probably didn't want to install it on your computer (installing it would allow you to make modifications to its sourcecode then compile it).
What would you like to do?", $srpms->[0])
+ : @all_rpms == 0
+ ? N("You are about to install the following software packages on your computer:
+
+%s
+
+Proceed?", @gurpmi::names)
: @all_rpms == 1
? N("You are about to install the following software package on your computer:
diff --git a/gurpmi.pm b/gurpmi.pm
index 7fd3693a..9385d233 100644
--- a/gurpmi.pm
+++ b/gurpmi.pm
@@ -36,9 +36,11 @@ sub fatal { my $s = $_[0]; print STDERR "$s\n"; exit 1 }
#- Parse command line
#- puts options in %gurpmi::options
+#- puts bare names (not rpm filenames) in @gurpmi::names
sub parse_command_line {
my @all_rpms;
our %options;
+ our @names;
# Expand *.urpmi arguments
my @ARGV_expanded;
foreach my $a (@ARGV) {
@@ -59,9 +61,14 @@ sub parse_command_line {
/^--?[hv?]/ and usage();
fatal(N("Unknown option %s", $_));
}
- push @all_rpms, $_;
+ if (/^[-a-zA-Z0-9_+]+\z/) { # is this an rpm name ?
+ push @names, $_;
+ } else { # assume it's a filename
+ push @all_rpms, $_;
+ }
}
- return @all_rpms or fatal(N("No packages specified"));
+ @all_rpms + @names or fatal(N("No packages specified"));
+ return @all_rpms;
}
sub but ($) { " $_[0] " }
diff --git a/gurpmi2 b/gurpmi2
index b10fdfab..bdf36daf 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -64,6 +64,9 @@ $mainw->add($mainbox);
my $urpm = configure_urpm();
my $state = {};
my %requested = $urpm->register_rpms(@all_rpms);
+if (@gurpmi::names) {
+ $urpm->search_packages(\%requested, [ @gurpmi::names ]);
+}
$urpm->resolve_dependencies(
$state,
\%requested,