From 047f52b5d439573cc673a189096ba33c1817b882 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Tue, 10 Aug 2010 21:09:09 +0200 Subject: portage.dep.use_reduce: Work on depstrings instead of paren_reduce'd dep arrays This change makes paren_reduce and paren_normalize calls for use_reduce redundant, resp. wrong. All consumers inside portage are adopted. --- bin/quickpkg | 5 ++--- bin/repoman | 29 ++++++----------------------- 2 files changed, 8 insertions(+), 26 deletions(-) (limited to 'bin') diff --git a/bin/quickpkg b/bin/quickpkg index b703ee675..8734a2bf5 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -21,7 +21,7 @@ except ImportError: from portage import os from portage import xpak from portage.dbapi.dep_expand import dep_expand -from portage.dep import flatten, paren_reduce, use_reduce +from portage.dep import flatten, use_reduce from portage.exception import InvalidAtom, InvalidData, InvalidDependString, PackageSetNotFound from portage.util import ConfigProtect, ensure_dirs, shlex_split from portage.dbapi.vartree import dblink, tar_contents @@ -78,8 +78,7 @@ def quickpkg_atom(options, infos, arg, eout): iuse = [ x.lstrip("+-") for x in iuse.split() ] use = use.split() try: - restrict = flatten(use_reduce( - paren_reduce(restrict), uselist=use)) + restrict = flatten(use_reduce(restrict, uselist=use)) except InvalidDependString as e: eout.eerror("Invalid RESTRICT metadata " + \ "for '%s': %s; skipping" % (cpv, str(e))) diff --git a/bin/repoman b/bin/repoman index e57976323..fdfd822d7 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1,5 +1,5 @@ #!/usr/bin/python -O -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Next to do: dep syntax checking in mask files @@ -1447,8 +1447,7 @@ for x in scanlist: if not src_uri_error: # Check that URIs don't reference a server from thirdpartymirrors. - for uri in portage.flatten(portage.dep.use_reduce( - portage.dep.paren_reduce(myaux["SRC_URI"]), matchall=True)): + for uri in portage.flatten(portage.dep.use_reduce(myaux["SRC_URI"], matchall=True)): contains_mirror = False for mirror in thirdpartymirrors: if uri.startswith(mirror): @@ -1462,8 +1461,7 @@ for x in scanlist: "%s: '%s' found in thirdpartymirrors" % \ (relative_path, mirror)) - provide = portage.flatten(portage.dep.use_reduce( - portage.dep.paren_reduce(pkg.metadata['PROVIDE']), matchall=1)) + provide = portage.flatten(portage.dep.use_reduce(pkg.metadata['PROVIDE'], matchall=1)) provide_cps = [] # The Package class automatically evaluates USE conditionals. @@ -1609,21 +1607,7 @@ for x in scanlist: badsyntax.append("'?' preceded by space") try: - # Missing closing parenthesis will result in a ValueError - mydeplist = portage.dep.paren_reduce(mydepstr) - # Missing opening parenthesis will result in a final "" element - if "" in mydeplist or "(" in mydeplist: - raise ValueError - except ValueError: - badsyntax.append("parenthesis mismatch") - mydeplist = [] - except portage.exception.InvalidDependString as e: - badsyntax.append(str(e)) - del e - mydeplist = [] - - try: - portage.dep.use_reduce(mydeplist, matchall=1) + portage.dep.use_reduce(mydepstr, matchall=1) except portage.exception.InvalidDependString as e: badsyntax.append(str(e)) @@ -1742,7 +1726,7 @@ for x in scanlist: myuse = myaux["LICENSE"] # Parse the LICENSE variable, remove USE conditions and # flatten it. - myuse=portage.dep.use_reduce(portage.dep.paren_reduce(myuse), matchall=1) + myuse=portage.dep.use_reduce(myuse, matchall=1) myuse=portage.flatten(myuse) # Check each entry to ensure that it exists in PORTDIR's # license directory. @@ -1772,8 +1756,7 @@ for x in scanlist: #restrict checks myrestrict = None try: - myrestrict = portage.dep.use_reduce( - portage.dep.paren_reduce(myaux["RESTRICT"]), matchall=1) + myrestrict = portage.dep.use_reduce(myaux["RESTRICT"], matchall=1) except portage.exception.InvalidDependString as e: stats["RESTRICT.syntax"] = stats["RESTRICT.syntax"] + 1 fails["RESTRICT.syntax"].append( -- cgit v1.2.3-1-g7c22