diff options
-rw-r--r-- | man/C/urpmf.8 | 2 | ||||
-rw-r--r-- | urpm.pm | 1 | ||||
-rw-r--r-- | urpm/args.pm | 1 | ||||
-rwxr-xr-x | urpmf | 10 |
4 files changed, 11 insertions, 3 deletions
diff --git a/man/C/urpmf.8 b/man/C/urpmf.8 index efc1f7ee..0ab5840e 100644 --- a/man/C/urpmf.8 +++ b/man/C/urpmf.8 @@ -75,6 +75,8 @@ argument is the same argument given to \fB--bug\fP option. Ignore case distinctions in any patterns. .IP "\fB-f\fP" Print version, release and arch along with name of package. +.IP "\fB-m\fP" +Print the name of the media in which the package has been found. .IP "\fB-e\fP" Include code directly in generated perl expression. Use it with \fB--verbose\fP to look at perl code generated. But in any cases, use it only if you know perl. @@ -481,6 +481,7 @@ sub configure { my $second_pass; do { foreach (grep { !$_->{ignore} && (!$options{update} || $_->{update}) } @{$urpm->{media} || []}) { + our $currentmedia = $_; #- hack for urpmf delete @$_{qw(start end)}; if ($_->{virtual}) { my $path = $_->{url} =~ m{^(?:file:/*)?(/[^/].*[^/])/*$} && $1; diff --git a/urpm/args.pm b/urpm/args.pm index 8c3d589b..afe63c66 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -150,6 +150,7 @@ my %options_spec = ( files => \$::params{files}, conflicts => \$::params{conflicts}, obsoletes => \$::params{obsoletes}, + m => \$::params{media}, i => sub { $::pattern = 'i' }, f => sub { $::full = 'full' }, 'e=s' => sub { $::expr .= "($_[1])" }, @@ -66,6 +66,7 @@ usage: ") . N(" ( - left parenthesis to open group expression. ") . N(" ) - right parenthesis to close group expression. "); +#") . N(" -m - print the media in which the package was found. exit(0); } @@ -100,14 +101,17 @@ foreach (scalar(grep { defined $_ } values %params)) { #- build the callback matching the expression. my $callback = 'sub { my ($urpm, $pkg) = @_; '; #- it is a good start for a sub, no ;-) foreach (qw(filename group size epoch summary description sourcerpm packager buildhost url - provides requires files conflicts obsoletes)) { - $params{$_} and $callback .= ' - foreach my $e ($pkg->'.$_.') { + provides requires files conflicts obsoletes media)) { + if ($params{$_}) { + my $fi = $_ eq 'media' ? '$urpm::currentmedia->{name}' : '$pkg->'.$_; + $callback .= ' + foreach my $e ('.$fi.') { local $_ = $pkg->'.$full.'name."'.(!$quiet && ":$_").':$e"; '.$expr.' or next; '.($uniq && 'exists $uniq{$_} and next; $uniq{$_} = undef; ').'print "$_\n"; }'; + } } $callback .= ' 1; |