atom = atom.evaluate_conditionals(use)
return atom
+def uses_eroot(function):
+ function.uses_eroot = True
+ return function
+
#-----------------------------------------------------------------------------
#
# To add functionality to this tool, add a function below.
# and will automaticly add a command by the same name as the function!
#
+@uses_eroot
def has_version(argv):
"""<eroot> <category/package>
Return code 0 if it's available, 1 otherwise.
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
noiselevel=-1)
return 2
-has_version.uses_eroot = True
+@uses_eroot
def best_version(argv):
"""<eroot> <category/package>
Returns category/package-version (without .ebuild).
print(portage.best(mylist))
except KeyError:
return 1
-best_version.uses_eroot = True
+@uses_eroot
def mass_best_version(argv):
"""<eroot> [<category/package>]+
Returns category/package-version (without .ebuild).
print(pack+":"+portage.best(mylist))
except KeyError:
return 1
-mass_best_version.uses_eroot = True
+
+@uses_eroot
def metadata(argv):
if (len(argv) < 4):
print("ERROR: insufficient parameters!", file=sys.stderr)
""" % ','.join(sorted(x for x in portage.auxdbkeys \
if not x.startswith('UNUSED_')))
-metadata.uses_eroot = True
+@uses_eroot
def contents(argv):
"""<eroot> <category/package>
List the files that are installed for a given package, with
treetype="vartree", vartree=vartree)
writemsg_stdout(''.join('%s\n' % x for x in sorted(db.getcontents())),
noiselevel=-1)
-contents.uses_eroot = True
+
+@uses_eroot
def owners(argv):
"""<eroot> [<filename>]+
Given a list of files, print the packages that own the files and which
return 0
return 1
-owners.uses_eroot = True
+@uses_eroot
def is_protected(argv):
"""<eroot> <filename>
Given a single filename, return code 0 if it's protected, 1 otherwise.
return 0
return 1
-is_protected.uses_eroot = True
+@uses_eroot
def filter_protected(argv):
"""<eroot>
Read filenames from stdin and write them to stdout if they are protected.
return 0
-filter_protected.uses_eroot = True
+@uses_eroot
def best_visible(argv):
"""<eroot> [pkgtype] <atom>
Returns category/package-version (without .ebuild).
writemsg_stdout("\n", noiselevel=-1)
return 1
-best_visible.uses_eroot = True
+@uses_eroot
def mass_best_visible(argv):
"""<eroot> [<type>] [<category/package>]+
Returns category/package-version (without .ebuild).
best_visible([root, pkgtype, pack])
except KeyError:
return 1
-mass_best_visible.uses_eroot = True
+@uses_eroot
def all_best_visible(argv):
"""<eroot>
Returns all best_visible packages (without .ebuild).
mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg))
if mybest:
print(mybest)
-all_best_visible.uses_eroot = True
+@uses_eroot
def match(argv):
"""<eroot> <atom>
Returns a \\n separated list of category/package-version.
results = vardb.match(atom)
for cpv in results:
print(cpv)
-match.uses_eroot = True
+
+@uses_eroot
def expand_virtual(argv):
"""<eroot> <atom>
Returns a \\n separated list of atoms expanded from a
return os.EX_OK
-expand_virtual.uses_eroot = True
def vdb_path(argv):
"""
print(portage.settings["GENTOO_MIRRORS"])
+@uses_eroot
def repositories_configuration(argv):
"""<eroot>
Returns the configuration of repositories.
return 3
sys.stdout.write(portage.db[argv[0]]["vartree"].settings.repositories.config_string())
sys.stdout.flush()
-repositories_configuration.uses_eroot = True
def portdir(argv):
else:
print(portage.settings[arg])
+
+@uses_eroot
def get_repos(argv):
"""<eroot>
Returns all repos with names (repo_name file) argv[0] = $EROOT
return 2
print(" ".join(reversed(portage.db[argv[0]]["vartree"].settings.repositories.prepos_order)))
-get_repos.uses_eroot = True
+@uses_eroot
def master_repositories(argv):
"""<eroot> <repo_id>+
Returns space-separated list of master repositories for specified repository.
else:
print(" ".join(x.name for x in repo.masters))
-master_repositories.uses_eroot = True
+@uses_eroot
def get_repo_path(argv):
"""<eroot> <repo_id>+
Returns the path to the repo named argv[1], argv[0] = $EROOT
return 1
print(path)
-get_repo_path.uses_eroot = True
+@uses_eroot
def available_eclasses(argv):
"""<eroot> <repo_id>+
Returns space-separated list of available eclasses for specified repository.
else:
print(" ".join(sorted(repo.eclass_db.eclasses)))
-available_eclasses.uses_eroot = True
+@uses_eroot
def eclass_path(argv):
"""<eroot> <repo_id> <eclass>+
Returns the path to specified eclass for specified repository.
print(eclass.location)
return retval
-eclass_path.uses_eroot = True
+@uses_eroot
def license_path(argv):
"""<eroot> <repo_id> <license>+
Returns the path to specified license for specified repository.
print(eclass_path)
return retval
-license_path.uses_eroot = True
+@uses_eroot
def list_preserved_libs(argv):
"""<eroot>
Print a list of libraries preserved during a package update in the form
msg.append('\n')
writemsg_stdout(''.join(msg), noiselevel=-1)
return rValue
-list_preserved_libs.uses_eroot = True
+
class MaintainerEmailMatcher(object):
def __init__(self, maintainer_emails):
herds = self._herds
return any(x in herds for x in metadata_xml.herds())
+
+@uses_eroot
def pquery(parser, pquery_option_groups, opts, args):
"""[options] [atom]+
Emulates a subset of Pkgcore's pquery tool.
return os.EX_OK
-pquery.uses_eroot = False
#-----------------------------------------------------------------------------
#
# DO NOT CHANGE CODE BEYOND THIS POINT - IT'S NOT NEEDED!
#
-non_commands = frozenset(['elog', 'eval_atom_use', 'exithandler', 'main', 'usage'])
+non_commands = frozenset(['elog', 'eval_atom_use', 'exithandler', 'main', 'usage', 'uses_eroot'])
commands = sorted(k for k, v in globals().items() \
if k not in non_commands and isinstance(v, types.FunctionType) and v.__module__ == "__main__")