"""List all packages owning a particular file
Note: Normally, only one package will own a file. If multiple packages own
- the same file, it usually consitutes a problem, and should be reported.
+ the same file, it usually constitutes a problem, and should be reported.
"""
__docformat__ = 'epytext'
# Find all packages matching the dependency
depstr = dependency[0] + dependency[2]
if not depstr in DEPPKGS:
- depcpvs = find_packages(depstr)
+ depcpvs = find_packages(depstr,
+ include_masked=QUERY_OPTS["includePortTree"])
DEPPKGS[depstr] = depcpvs
else:
depcpvs = DEPPKGS[depstr]
if matches:
find_dependencies(matches, None)
else:
- pp.print_error("No matching package found for %s" % query)
+ if QUERY_OPTS['includePortTree']:
+ pp.print_error("No matching package found for %s" % query)
+ else:
+ pp.print_error(
+ "No matching package or all versions masked for %s" % query
+ )
first_run = False
def get_herd(xml_tree):
"""Return a list of text nodes for <herd>."""
+
+ result = []
+ for elem in xml_tree.findall("herd"):
+ herd_mail = get_herd_email(elem.text)
+ if herd_mail and Config['verbose']:
+ result.append("%s (%s)" % (elem.text, herd_mail))
+ else:
+ result.append(elem.text)
+
+ return result
+
- return [e.text for e in xml_tree.findall("herd")]
+def get_herd_email(herd):
+ """Return the email of the given herd if it's in herds.xml, else None."""
+
+ herds_path = os.path.join(PORTDIR[0], "metadata/herds.xml")
+
+ try:
+ herds_tree = ET.parse(herds_path)
+ except IOError, err:
+ pp.print_error(str(err))
+ return None
+
+ # Some special herds are not listed in herds.xml
+ if herd in ('no-herd', 'maintainer-wanted', 'maintainer-needed'):
+ return None
+
+ for node in herds_tree.getiterator("herd"):
+ if node.findtext("name") == herd:
+ return node.findtext("email")
def get_description(xml_tree):
if not package_dir:
raise errors.GentoolkitNoMatches(query)
metadata_path = os.path.join(package_dir, "metadata.xml")
-
+
# --------------------------------
# Check options and call functions
# --------------------------------