From 7edb0f509e6d635a030a924f74906093d6fee490 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 17 Oct 2005 17:42:23 +0000 Subject: New options. Change callback generation method. --- man/C/urpmf.8 | 13 ++++++- urpm/args.pm | 5 +++ urpmf | 113 ++++++++++++++++++++++++++++++++-------------------------- 3 files changed, 79 insertions(+), 52 deletions(-) diff --git a/man/C/urpmf.8 b/man/C/urpmf.8 index 8b193238..68146905 100644 --- a/man/C/urpmf.8 +++ b/man/C/urpmf.8 @@ -1,4 +1,4 @@ -.TH urpmf 8 "12 Sep 2005" "Mandriva" "Mandriva Linux" +.TH urpmf 8 "17 Oct 2005" "Mandriva" "Mandriva Linux" .IX urpmf .SH NAME urpmf \- Finds the packages matching some conditions @@ -20,12 +20,21 @@ system's rpm database). Prints a help message and exit. .IP "\fB\--all\fP" Prints and searches through all parameters listed below. +.IP "\fB\--arch\fP" +Prints and searches through the architecture tag. .IP "\fB\--buildhost\fP" Prints and searches through the BuildHost tag. +.IP "\fB\--buildtime\fP" +Prints and searches through the BuildTime tag. +.IP "\fB\--conffiles\fP" +Prints and searches through the list of configuration files contained in the +rpm. .IP "\fB\--conflicts\fP" Prints and searches through the Conflicts tags. .IP "\fB\--description\fP" Prints and searches through the Description tag. +.IP "\fB\--distribution\fP" +Prints and searches through the Distribution tag. .IP "\fB\--env\fP \fIdirectory\fP" Use a different environment directly from a bug report to replay a bug. .IP "\fB\--epoch\fP" @@ -70,6 +79,8 @@ Use only update media. This means \fBurpmi\fP will search and resolve dependencies only in media marked as update. .IP "\fB\--url\fP" Prints and searches through url. +.IP "\fB\--vendor\fP" +Prints and searches through the Vendor tag. .IP "\fB\--verbose\fP" Verbose mode. urpmf will emit various messages related to the parsing of hdlist files for your media. diff --git a/urpm/args.pm b/urpm/args.pm index 7d8b75b1..dc6d5b90 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -141,10 +141,14 @@ my %options_spec = ( packager buildhost url provides requires files conflicts obsoletes)) { $::params{$k} = 1 } }, + arch => \$::params{arch}, buildhost => \$::params{buildhost}, + buildtime => \$::params{buildtime}, + conffiles => \$::params{conf_files}, conflicts => \$::params{conflicts}, debug => \$::debug, description => \$::params{description}, + distribution => \$::params{distribution}, epoch => \$::params{epoch}, files => \$::params{files}, group => \$::params{group}, @@ -159,6 +163,7 @@ my %options_spec = ( summary => \$::params{summary}, 'uniq|u' => \$::uniq, url => \$::params{url}, + vendor => \$::params{vendor}, 'verbose|v' => \$::verbose, m => \$::params{media}, i => sub { $::pattern = 'i' }, diff --git a/urpmf b/urpmf index 99a6e3d9..16f8081a 100755 --- a/urpmf +++ b/urpmf @@ -2,7 +2,7 @@ # $Id$ -#- Copyright (C) 2002, 2003, 2004 Mandriva +#- Copyright (C) 2002, 2003, 2004, 2005 Mandriva #- #- This program is free software; you can redistribute it and/or modify #- it under the terms of the GNU General Public License as published by @@ -29,42 +29,46 @@ Copyright (C) 2002-2004 Mandriva. This is free software and may be redistributed under the terms of the GNU GPL. usage: -", $urpm::VERSION) . N(" --help - print this help message. -") . N(" --all - print all tags. -") . N(" --buildhost - print tag buildhost: build host. -") . N(" --conflicts - print tag conflicts: all conflicts. -") . N(" --description - print tag description: description. -") . N(" --env - use specific environment (typically a bug - report). -") . N(" --epoch - print tag epoch: epoch. -") . N(" --excludemedia - do not use the given media, separated by comma. -") . N(" --files - print tag files: all files. -") . N(" --group - print tag group: group. +", $urpm::VERSION) . N(" --help - print this help message +") . N(" --all - print all tags +") . N(" --arch - print architecture +") . N(" --buildhost - print build host +") . N(" --buildtime - print build time +") . N(" --conffiles - print configuration files +") . N(" --conflicts - print conflict tags +") . N(" --distribution - print distribution +") . N(" --description - print package description +") . N(" --env - use specific environment (typically a bug report) +") . N(" --epoch - print epoch +") . N(" --excludemedia - do not use the given media, separated by comma +") . N(" --files - print the package's files +") . N(" --group - print group ") . N(" --literal - don't match patterns, but use argument as a literal string -") . N(" --media - use only the given media, separated by comma. -") . N(" --name - print only package names. -") . N(" --obsoletes - print tag obsoletes: all obsoletes. -") . N(" --packager - print tag packager: packager. -") . N(" --provides - print tag provides: all provides. -") . N(" --requires - print tag requires: all requires. -") . N(" --size - print tag size: size. -") . N(" --sortmedia - sort media according to substrings separated by comma. -") . N(" --sourcerpm - print tag sourcerpm: source rpm. -") . N(" --summary - print tag summary: summary. -") . N(" --synthesis - use the synthesis given instead of urpmi db. -") . N(" --uniq - do not print identical lines. -") . N(" --update - use only update media. -") . N(" --url - print tag url: url. -") . N(" --verbose - verbose mode. -") . N(" -m - print the media in which the package was found. -") . N(" -i - ignore case distinctions in every pattern. -") . N(" -f - print version, release and arch with name. -") . N(" -e - include perl code directly as perl -e. -") . N(" -a - binary AND operator, true if both expression are true. -") . N(" -o - binary OR operator, true if one expression is true. -") . N(" ! - unary NOT, true if expression is false. -") . N(" ( - left parenthesis to open group expression. -") . N(" ) - right parenthesis to close group expression. +") . N(" --media - use only the given media, separated by comma +") . N(" --name - print only package names +") . N(" --obsoletes - print obsoletes tags +") . N(" --packager - print packager +") . N(" --provides - print provides tags +") . N(" --requires - print requires tags +") . N(" --size - print installed size +") . N(" --sortmedia - sort media according to substrings separated by comma +") . N(" --sourcerpm - print source rpm name +") . N(" --summary - print summary +") . N(" --synthesis - use the synthesis given instead of urpmi db +") . N(" --uniq - do not print identical lines +") . N(" --update - use only update media +") . N(" --url - print url +") . N(" --vendor - print vendor +") . N(" --verbose - verbose mode +") . N(" -m - print the media in which the package was found +") . N(" -i - ignore case distinctions in every pattern +") . N(" -f - print version, release and arch with name +") . N(" -e - include perl code directly as perl -e +") . N(" -a - binary AND operator, true if both expression are true +") . N(" -o - binary OR operator, true if one expression is true +") . N(" ! - unary NOT, true if expression is false +") . N(" ( - left parenthesis to open group expression +") . N(" ) - right parenthesis to close group expression "); exit(0); } @@ -96,16 +100,27 @@ unless (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 my $tag (qw( +my $callback = 'sub { + my ($urpm, $pkg) = @_;'; +if ($uniq) { + $uniq = "\n\t" . '$uniq{$_} and next; $uniq{$_} = 1;'; +} +#- XXX name and fullname are for later +foreach my $tag (grep { $params{$_} } qw( + arch buildhost + buildtime + conf_files conflicts description + distribution epoch filename files + fullname group media + name obsoletes packager provides @@ -114,20 +129,18 @@ foreach my $tag (qw( sourcerpm summary url + vendor )) { - if ($params{$tag}) { - my $fi = $tag eq 'media' ? '$urpm::currentmedia->{name}' : '$pkg->' . $tag; - $callback .= ' - foreach my $e (' . $fi . ') { - local $_ = $pkg->' . $full . 'name.":$e"; - ' . $expr . ' or next; - ' . ($uniq && 'exists $uniq{$_} and next; $uniq{$_} = undef; - ') . 'print "$_\n"; - }'; - } + my $fi = $tag eq 'media' ? '$urpm::currentmedia->{name}' : '$pkg->' . $tag; + $callback .= qq{ + foreach my \$e ($fi) { + local \$_ = \$pkg->${full}name.":\$e"; + $expr or next;$uniq + print "\$_\\n"; + }}; } $callback .= ' - 1; + 1; }'; $urpm->{error}(N("callback is:\n%s\n", $callback)) if our $debug; $callback = eval $callback; @@ -178,5 +191,3 @@ if ($use_hdlist) { print N("You may want to use --name to search for package names.\n") if !$params{filename}; } } - -#- that'all! all has been done by callback above. -- cgit v1.2.1