From acdc7d784b7c855c63409dfa755dd698a9e52ed7 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 13 Oct 2005 14:38:31 +0000 Subject: Add a --literal option to urpmf --- man/C/urpmf.8 | 2 ++ urpm/args.pm | 9 +++++++-- urpmf | 2 ++ 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); -- cgit v1.2.1