diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-17 11:57:37 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-17 11:57:37 +0000 |
commit | 2864278acd38b3b4bd5410c2022d21bf3154e933 (patch) | |
tree | 4ad7fed58db7e7d5f2a6e592e4baf4f9436c82ef | |
parent | af7637f44d8b40f1945607f12f1b066a54dc6a8b (diff) | |
download | urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.gz urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.bz2 urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.tar.xz urpmi-2864278acd38b3b4bd5410c2022d21bf3154e933.zip |
- urpmq:
o add --provides
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | pod/urpmq.8.pod | 4 | ||||
-rw-r--r-- | urpm/args.pm | 1 | ||||
-rw-r--r-- | urpm/util.pm | 9 | ||||
-rw-r--r-- | urpmi.bash-completion | 2 | ||||
-rwxr-xr-x | urpmq | 11 |
6 files changed, 27 insertions, 2 deletions
@@ -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 \ @@ -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; |