Code: Select all
emerge -pve world | grep flagJesore
Code: Select all
emerge -pve world | grep flagCode: Select all
cd /usr/portage && grep -e 'IUSE=".*mysql.*"' -R * | cut -d "/" -f 2Thanks, but this script just covers INSTALLED ebuildsxmit wrote:Jesore,
I found this script helpful:
http://forums.gentoo.org/viewtopic.php? ... =flagusers
You do need to understand german to use it. Type 'flagusers GNOME' and it lists all packages that make use of the flag GNOME.
mg
Code: Select all
emerge -pev world | grep flagCode: Select all
#!/usr/bin/python
############################################################
# finduse: Python script to search Portage database for
# packages that can make use of specific useflags.
#
# Requirements:
# Python v2.3 or better is required for the optparse module.
# Gentoolkit
#
# Licence: GPL
# Author : Robert Morris (singular) robert@twilightsedge.com
#############################################################
import sys
from optparse import OptionParser
# Make sure gentoolkit module is in the path
sys.path.insert(0, "/usr/lib/gentoolkit/pym")
import gentoolkit
def filter_packages(pkglist, useflag, enabled=1):
"""Filter packages based on if the useflag was enabled or disabled."""
result = []
for pkg in pkglist:
use = pkg.get_use_flags()
if (enabled and useflag in use)\
or (not enabled and not useflag in use):
result.append(pkg)
return result
def find_packages(useflag, installedonly=0):
"""Walk through the portage tree and return all packages that can
make use of a specific useflag.
"""
result = []
# First we'll get a list of all category/package pairs listed
# in portage, or just the ones installed if requested.
if installedonly:
pkglist = gentoolkit.vartree.getallnodes()
else:
pkglist = gentoolkit.porttree.getallnodes()
# Next we walk through the list and see if they have the useflag.
for catpkg in pkglist:
matches = gentoolkit.find_packages(catpkg)
for pkg in matches:
use = pkg.get_env_var("IUSE")
if (useflag in use) and (not installedonly or pkg.is_installed()):
result.append(pkg)
return result
def print_packages(packages, useflag, with_versions=0, verbose=0):
"""Prints out the packages found during the search.
The verbose option also displays if the useflag was enabled or not.
"""
pkglist = []
for pkg in packages:
if with_versions:
name = pkg.get_cpv()
else:
name = pkg.get_category() + "/" + pkg.get_name()
# If we don't need version numbers we'll
# trim the list to avoid duplicates.
if name in pkglist:
continue
pkglist.append(name)
if verbose:
enabled = ["-", "+"][useflag in pkg.get_use_flags()]
print "%s [%s%s]" % (name, enabled, useflag)
else:
print name
def main():
usage="""usage: %prog [OPTIONS] USEFLAG
Search Portage database for packages that make use of USEFLAG."""
parser = OptionParser(usage=usage)
parser.add_option("-d", "--disabled",
action="store_const",
const=1,
default=0,
dest="disabled",
help="find packages with USEFLAG disabled. Implies -i")
parser.add_option("-e", "--enabled",
action="store_const",
const=1,
default=0,
dest="enabled",
help="find packages with USEFLAG enabled. Implies -i")
parser.add_option("-i", "--installed",
action="store_const",
const=1,
default=0,
dest="installed",
help="search only installed packages.")
parser.add_option("-v", "--verbose",
action="store_const",
const=1,
default=0,
dest="verbose",
help="verbose output.")
parser.add_option("-w", "--with-versions",
action="store_const",
const=1,
default=0,
dest="with_versions",
help="print version numbers.")
(options, args) = parser.parse_args()
if len(args) != 1:
parser.error("incorrect number of arguments")
if options.enabled or options.disabled:
options.installed = 1
useflag = args[0]
pkgs = find_packages(useflag, options.installed)
if options.enabled ^ options.disabled:
enabled = options.enabled and not options.disabled
pkgs = filter_packages(pkgs, useflag, enabled)
print_packages(pkgs, useflag, options.with_versions, options.verbose)
if __name__ == "__main__":
main()
