--- /usr/bin/equery 2005-05-05 06:11:52.000000000 +0000 +++ bin/equery-edit 2005-05-07 11:09:29.000000000 +0000 @@ -872,7 +872,10 @@ """Display the filename of the ebuild for a given package that would be used by Portage with the current configuration.""" def __init__(self): - self.default_opts = {} + self.default_opts = { + "includeMasked": True, + "baseDirectory": False + } def parseArgs(self, args): @@ -891,6 +894,10 @@ if x in ["-h","--help"]: need_help = 1 break + elif x in ["-m","--exclude-masked"]: + opts["includeMasked"] = False + elif x in ["-b","--base-directory"]: + opts["baseDirectory"] = True else: query = x @@ -903,21 +910,41 @@ def perform(self, args): (query, opts) = self.parseArgs(args) - matches = gentoolkit.find_packages(query, True) + matches = gentoolkit.find_packages(query, opts["includeMasked"]) matches = gentoolkit.sort_package_list(matches) if matches: - print_info(0, os.path.normpath(matches[-1].get_ebuild_path())) + if opts["baseDirectory"]: + non_overlay_found = False + + for pkg in matches: + if not pkg.is_overlay(): + print_info(0, os.path.normpath(pkg.get_package_path())) + non_overlay_found = True + break + + if not non_overlay_found: + # Package is only in an overlay. Print the path of one of them + print_info(0, os.path.normpath(matches[0].get_package_path())) + else: + print_info(0, os.path.normpath(matches[-1].get_ebuild_path())) else: - print_error("No masked or unmasked packages found for " + pp.pkgquery(query)) + if opts["includeMasked"]: + print_error("No masked or unmasked packages found for " + pp.pkgquery(query)) + else: + print_error("No unmasked packages found for " + pp.pkgquery(query)) def shortHelp(self): - return pp.pkgquery("pkgspec") + " - print full path to ebuild for package " + pp.pkgquery("pkgspec") + return pp.localoption(" ") + pp.pkgquery("pkgspec") + " - print full path to ebuild for package " + pp.pkgquery("pkgspec") def longHelp(self): return "Print full path to ebuild for a given package" + \ "\n" + \ "Syntax:\n" + \ - " " + pp.command("which ") + pp.pkgquery("pkgspec") + " " + pp.command("which") + pp.localoption(" ") + pp.pkgquery("pkgspec") + \ + "\n" + \ + pp.localoption("") + " is either of: \n" + \ + " " + pp.localoption("-m, --nomasked") + " - exclude masked packages\n" + \ + " " + pp.localoption("-b, --base-directory") + " - print base directory instead of path to ebuild\n" class CmdListGLSAs(Command): """List outstanding GLSAs."""