summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trunk/ChangeLog5
-rwxr-xr-xtrunk/src/equery/equery26
-rw-r--r--trunk/src/equery/equery.120
3 files changed, 39 insertions, 12 deletions
diff --git a/trunk/ChangeLog b/trunk/ChangeLog
index 2d962b4..c9e50e3 100644
--- a/trunk/ChangeLog
+++ b/trunk/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-23 Paul Varner <fuzzyray@gentoo.org>
+ * equery: Changed default behavior for equery list to search for
+ partial name matches. Added equery list examples to the equery man
+ page. (Bugs 113032, 113134)
+
2005-11-15 Marius Mauch <genone@gentoo.org>
* glsa-check: Changed several messages to stderr instead of stdout
* glsa-check: Added new --cve option as requested by solar (bug 98589)
diff --git a/trunk/src/equery/equery b/trunk/src/equery/equery
index 857cc73..8807ee0 100755
--- a/trunk/src/equery/equery
+++ b/trunk/src/equery/equery
@@ -1127,6 +1127,7 @@ class CmdListPackages(Command):
"includeOverlayTree": 0,
"includeMasked": 1,
"regex": 0,
+ "exact": 0,
"duplicates": 0
}
@@ -1159,6 +1160,9 @@ class CmdListPackages(Command):
opts["includeMasked"] = 0
elif x in ["-f", "--full-regex"]:
opts["regex"] = 1
+ opts["exact"] = 1
+ elif x in ["-e", "--exact-name"]:
+ opts["exact"] = 1
elif x in ["-d", "--duplicates"]:
opts["duplicates"] = 1
else:
@@ -1215,16 +1219,18 @@ class CmdListPackages(Command):
# replace empty strings with .* and escape regular expression syntax
if query != "":
if not opts["regex"]:
- filter_fn = lambda x: (cat+"/"+name in x)
- matches = package_finder(filter_fn)
cat, name, ver, rev = [re.sub('^$', ".*", re.escape(x)) for x in cat, name, ver, rev]
else:
cat, name, ver, rev = [re.sub('^$', ".*", x) for x in cat, name, ver, rev]
- try:
+
+ try:
+ if opts["exact"]:
filter_fn = lambda x: re.match(cat+"/"+name, x)
- matches = package_finder(filter_fn)
- except:
- die(2, "The query '" + pp.regexpquery(query) + "' does not appear to be a valid regular expression")
+ else:
+ filter_fn = lambda x: re.match(cat+"/.*"+name, x)
+ matches = package_finder(filter_fn)
+ except:
+ die(2, "The query '" + pp.regexpquery(query) + "' does not appear to be a valid regular expression")
else:
cat, name, ver, rev = [re.sub('^$', ".*", x) for x in cat, name, ver, rev]
filter_fn = lambda x: True
@@ -1253,9 +1259,12 @@ class CmdListPackages(Command):
if ver == ".*": ver = "[0-9]+[^-]*"
if rev != ".*": # revision supplied
- rx = re.compile(cat + "/" + name + "-" + ver + "-" + rev)
- else:
+ ver = ver + "-" + rev
+
+ if opts["exact"]:
rx = re.compile(cat + "/" + name + "-" + ver)
+ else:
+ rx = re.compile(cat + "/.*" + name + ".*-" + ver)
if opts["includeInstalled"]:
self._print_installed(matches, rx)
@@ -1330,6 +1339,7 @@ class CmdListPackages(Command):
" " + pp.localoption("-p, --portage-tree") + " - also search in portage tree (" + gentoolkit.settings["PORTDIR"] + ")\n" + \
" " + pp.localoption("-o, --overlay-tree") + " - also search in overlay tree (" + gentoolkit.settings["PORTDIR_OVERLAY"] + ")\n" + \
" " + pp.localoption("-f, --full-regex") + " - query is a regular expression\n" + \
+ " " + pp.localoption("-e, --exact-name") + " - list only those packages that exactly match\n" + \
" " + pp.localoption("-d, --duplicates") + " - list only installed duplicate packages\n"
class CmdFindUSEs(Command):
diff --git a/trunk/src/equery/equery.1 b/trunk/src/equery/equery.1
index 17565ff..9b070af 100644
--- a/trunk/src/equery/equery.1
+++ b/trunk/src/equery/equery.1
@@ -174,14 +174,13 @@ also search in overlay tree (/usr/local/portage)
.B list <local\-opts> pkgspec
This command lists packages matching pkgspec in a user\-specified combination
of installed packages, packages which are not installed, the portage tree, and
-the portage overlay tree.
+the portage overlay tree. By default the list command searches for partial name matches.
<local\-opts> \-I cannot be used by itself;
if \-I is used, \-p and/or \-o must be also be present. By default, only installed
packages are searched. \-o searches only the overlay tree [and possibly
installed packages],
-.I not
-the main portage tree.
+\fInot\fR the main portage tree.
.B \-i, \-\-installed
search installed packages (default)
@@ -198,10 +197,23 @@ also search in overlay tree (/usr/local/portage)
.B \-f, \-\-full\-regex
query is a regular expression
.br
+.B \-e, \-\-exact\-name
+list only those packages that exactly match
+.br
.B \-d, \-\-duplicates
only list installed duplicate packages
+.br
+
+\fBExamples:\fR
+
+equery list zilla \- list all installed versions of packages containing the string 'zilla'
+
+equery list \-\-exact\-name x11\-libs/gtk+ \- list all installed versions of x11\-libs/gtk+
+
+equery list \-\-full\-regex '(mozilla\-firefox|mozilla\-thunderbird)' \- list all installed versions of mozilla\-firefox and mozilla\-thunderbird
+
+equery list \-\-duplicates \- list all installed slotted packages
.PP
-.TP
.B size <local\-opts> pkgspec
This command outputs the number of files in the specified package, as well as
their total size in an appropriate unit.