summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--pod/urpmq.8.pod4
-rw-r--r--urpm/args.pm1
-rw-r--r--urpm/util.pm9
-rw-r--r--urpmi.bash-completion2
-rwxr-xr-xurpmq11
6 files changed, 27 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 9839788b..9b0deb72 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
- all tools:
o deprecate --curl and --wget in favor of --downloader curl
and --downloader --wget
+- urpmq:
+ o add --provides
Version 5.1 - 16 January 2008, by Pascal "Pixel" Rigaux
diff --git a/pod/urpmq.8.pod b/pod/urpmq.8.pod
index 686800f2..2cb4e876 100644
--- a/pod/urpmq.8.pod
+++ b/pod/urpmq.8.pod
@@ -199,6 +199,10 @@ If the urpmi or rpm db is busy, wait until it is available
Prints the package changelog.
+=item B<--provides>
+
+Prints the package provides.
+
=item B<--sourcerpm>
Prints the sourcerpm of the package
diff --git a/urpm/args.pm b/urpm/args.pm
index b2542bd7..42422de8 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -234,6 +234,7 @@ my %options_spec = (
keep => \$options{keep},
list => \$options{list},
changelog => \$options{changelog},
+ provides => \$options{provides},
sourcerpm => \$options{sourcerpm},
'summary|S' => \$options{summary},
'list-media:s' => sub { $options{list_media} = $_[1] || 'all' },
diff --git a/urpm/util.pm b/urpm/util.pm
index 19209a3a..81534aa8 100644
--- a/urpm/util.pm
+++ b/urpm/util.pm
@@ -11,7 +11,7 @@ our @EXPORT = qw(min max quotespace unquotespace
untaint
copy_and_own
same_size_and_mtime
- partition put_in_hash uniq
+ partition put_in_hash uniq uniq_
difference2 member file_size cat_ cat_utf8 output_safe dirname basename
);
@@ -135,6 +135,13 @@ sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
sub cat_ { my @l = map { my $F; open($F, '<', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l }
sub cat_utf8 { my @l = map { my $F; open($F, '<:utf8', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l }
+sub uniq_(&@) {
+ my $f = shift;
+ my %l;
+ $l{$f->($_)} = 1 foreach @_;
+ grep { delete $l{$f->($_)} } @_;
+}
+
sub output_safe {
my ($file, $content) = @_;
diff --git a/urpmi.bash-completion b/urpmi.bash-completion
index 1f45a759..65aaa3cd 100644
--- a/urpmi.bash-completion
+++ b/urpmi.bash-completion
@@ -176,7 +176,7 @@ _urpmq()
-r -f -l --update --media --excludemedia \
--sortmedia --synthesis --auto-select --fuzzy --keep --nokeep \
--list --list-url --list-media --list-nodes --list-aliases \
- --src --sources --summary --sourcerpm --force --parallel --wget --curl --prozilla \
+ --src --sources --provides --summary --sourcerpm --force --parallel --wget --curl --prozilla \
--changelog --proxy --proxy-user --env --dump-config \
--whatprovides --whatrequires --whatrequires-recursive \
--skip --prefer \
diff --git a/urpmq b/urpmq
index ae9c5db7..e874c055 100755
--- a/urpmq
+++ b/urpmq
@@ -77,6 +77,7 @@ usage:
authentication (format is <user:password>).
") . N(" --env - use specific environment (typically a bug report).
") . N(" --changelog - print changelog.
+") . N(" --provides - print provides.
") . N(" --sourcerpm - print sourcerpm.
") . N(" --summary, -S - print summary.
") . N(" --verbose, -v - verbose mode.
@@ -440,6 +441,16 @@ if ($options{list_aliases}) {
}
}
exit 0;
+ } elsif ($options{provides}) {
+ my @l = uniq_ { scalar $_->fullname } map { $urpm->{depslist}[$_] } map { split /\|/, $_ } keys %{$state->{selected}};
+ foreach my $pkg (@l) {
+ if (@l > 1) {
+ printf "%s: %s\n", $pkg->name, $_ foreach $pkg->provides;
+ } else {
+ print "$_\n" foreach $pkg->provides;
+ }
+ }
+ exit 0;
}
}
$urpmi_lock and $urpmi_lock->unlock;