diff options
| author | fuzzyray <fuzzyray@gentoo.org> | 2005-10-14 05:20:38 +0000 |
|---|---|---|
| committer | fuzzyray <fuzzyray@gentoo.org> | 2005-10-14 05:20:38 +0000 |
| commit | ff812973f68caff6b8e12fa7723d924d29905193 (patch) | |
| tree | 45cb8bdee7a83cbbd7054faa3ae7c416ab3cb6b9 /trunk/src/equery | |
| parent | e634a73027598a23fa07aaa5a44fc907fa564ae6 (diff) | |
| download | gentoolkit-ff812973f68caff6b8e12fa7723d924d29905193.tar.gz | |
Add qpkg --dups functionality to equery list command
svn path=/; revision=246
Diffstat (limited to 'trunk/src/equery')
| -rwxr-xr-x | trunk/src/equery/equery | 31 | ||||
| -rw-r--r-- | trunk/src/equery/equery.1 | 5 |
2 files changed, 33 insertions, 3 deletions
diff --git a/trunk/src/equery/equery b/trunk/src/equery/equery index 7e10225..cde8cd0 100755 --- a/trunk/src/equery/equery +++ b/trunk/src/equery/equery @@ -1123,7 +1123,8 @@ class CmdListPackages(Command): "includePortTree": 0, "includeOverlayTree": 0, "includeMasked": 1, - "regex": 0 + "regex": 0, + "duplicates": 0 } def parseArgs(self, args): @@ -1155,9 +1156,17 @@ class CmdListPackages(Command): opts["includeMasked"] = 0 elif x in ["-f", "--full-regex"]: opts["regex"] = 1 + elif x in ["-d", "--duplicates"]: + opts["duplicates"] = 1 else: query = x + # Only search installed packages when listing duplicated packages + if opts["duplicates"]: + opts["includeInstalled"] = 1 + opts["includePortTree"] = 0 + opts["includeOverlayTree"] = 0 + if need_help: print_info(0, self.longHelp()) sys.exit(-1) @@ -1215,6 +1224,23 @@ class CmdListPackages(Command): filter_fn = lambda x: True matches = package_finder(filter_fn) + # Find duplicate packages + if opts["duplicates"]: + dups = {} + newmatches = [] + for pkg in matches: + pkgname = pkg.get_name() + if dups.has_key(pkgname): + dups[pkgname].append(pkg) + else: + dups[pkgname] = [pkg] + + for pkgname in dups.keys(): + if len(dups[pkgname]) > 1: + newmatches += dups[pkgname] + + matches = newmatches + matches = gentoolkit.sort_package_list(matches) # If no version supplied, fix regular expression @@ -1297,7 +1323,8 @@ class CmdListPackages(Command): " " + pp.localoption("-I, --exclude-installed") + " - do not search installed packages\n" + \ " " + 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("-f, --full-regex") + " - query is a regular expression\n" + \ + " " + pp.localoption("-d, --duplicates") + " - list only installed duplicate packages\n" class CmdFindUSEs(Command): """Find all packages with a particular USE flag.""" diff --git a/trunk/src/equery/equery.1 b/trunk/src/equery/equery.1 index 05cb0af..17565ff 100644 --- a/trunk/src/equery/equery.1 +++ b/trunk/src/equery/equery.1 @@ -176,7 +176,7 @@ 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. -<local\-opts> must not include only \-I; +<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], @@ -197,6 +197,9 @@ also search in overlay tree (/usr/local/portage) .br .B \-f, \-\-full\-regex query is a regular expression +.br +.B \-d, \-\-duplicates +only list installed duplicate packages .PP .TP .B size <local\-opts> pkgspec |
