summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-10-13 14:38:31 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-10-13 14:38:31 +0000
commitacdc7d784b7c855c63409dfa755dd698a9e52ed7 (patch)
tree57fc303459fbdf6996a2fb0d200cb0e965b747c2
parentc24083ed20645836e23db3955224fe1f796a604b (diff)
downloadurpmi-acdc7d784b7c855c63409dfa755dd698a9e52ed7.tar
urpmi-acdc7d784b7c855c63409dfa755dd698a9e52ed7.tar.gz
urpmi-acdc7d784b7c855c63409dfa755dd698a9e52ed7.tar.bz2
urpmi-acdc7d784b7c855c63409dfa755dd698a9e52ed7.tar.xz
urpmi-acdc7d784b7c855c63409dfa755dd698a9e52ed7.zip
Add a --literal option to urpmf
-rw-r--r--man/C/urpmf.82
-rw-r--r--urpm/args.pm9
-rwxr-xr-xurpmf2
3 files changed, 11 insertions, 2 deletions
diff --git a/man/C/urpmf.8 b/man/C/urpmf.8
index e85cabd1..fe67b8e2 100644
--- a/man/C/urpmf.8
+++ b/man/C/urpmf.8
@@ -37,6 +37,8 @@ Prints and searches through the list of files contained in the rpm (this is the
default).
.IP "\fB\--group\fP"
Prints and searches through the Group tag.
+.IP "\fB\--literal\fP"
+Match literally instead of interpreting the argument as a regular expression.
.IP "\fB\--media\fP \fImedium1,...,mediumN\fP"
Select specific media to be used, instead of defaulting to all available media
(or all update media if \fB--update\fP is used).
diff --git a/urpm/args.pm b/urpm/args.pm
index a9c12513..e84b9a37 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -148,6 +148,7 @@ my %options_spec = (
epoch => \$::params{epoch},
files => \$::params{files},
group => \$::params{group},
+ literal => \$::literal,
name => \$::params{filename},
obsoletes => \$::params{obsoletes},
packager => \$::params{packager},
@@ -178,8 +179,12 @@ my %options_spec = (
}
else {
# This is for non-option arguments.
- # quote "+" chars for packages with + in their names
- $p =~ s/\+/\\+/g;
+ if ($literal) {
+ $p = quotemeta $p;
+ } else {
+ # quote "+" chars for packages with + in their names
+ $p =~ s/\+/\\+/g;
+ }
$::expr .= "m{$p}" . $::pattern;
}
},
diff --git a/urpmf b/urpmf
index 96c892fc..b6dbaa3d 100755
--- a/urpmf
+++ b/urpmf
@@ -40,6 +40,7 @@ usage:
") . N(" --excludemedia - do not use the given media, separated by comma.
") . N(" --files - print tag files: all files.
") . N(" --group - print tag group: 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.
@@ -81,6 +82,7 @@ our $quiet;
our $uniq = '';
our $pattern = ''; # regexp match flags ("i" or "")
our $full = ''; # -f : print rpm fullname instead of rpm name
+our $literal = 0; # should we quotemeta the pattern
our $env;
our (%params, %uniq);