From: Zac Medico Date: Mon, 30 Jul 2007 03:45:08 +0000 (-0000) Subject: For bug #181355, detect parenthesis mismatch in paren_reduce(), raise an InvalidDepen... X-Git-Tag: v2.1.2.11~58 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=08474a7948ea80c25955262b6f6d2d6fa2992fcf;p=portage.git For bug #181355, detect parenthesis mismatch in paren_reduce(), raise an InvalidDependString exception, and make sure that all callers handle the exception properly. (branches/2.1.2 r6798) svn path=/main/branches/2.1.2.9/; revision=7459 --- diff --git a/bin/repoman b/bin/repoman index 3a939d9ac..c033a0d44 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1129,6 +1129,10 @@ for x in scanlist: except ValueError: badsyntax.append("parenthesis mismatch") mydeplist = [] + except portage_exception.InvalidDependString, e: + badsyntax.append(str(e)) + del e + mydeplist = [] try: portage_dep.use_reduce(mydeplist, excludeall=myiuse) diff --git a/pym/portage.py b/pym/portage.py index 1e9d104af..ebe2c96a6 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3064,9 +3064,14 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m if not eapi_is_supported(eapi): # can't do anything with this. raise portage_exception.UnsupportedAPIException(mycpv, eapi) - mysettings["PORTAGE_RESTRICT"] = " ".join(flatten( - portage_dep.use_reduce(portage_dep.paren_reduce( - mysettings["RESTRICT"]), uselist=mysettings["USE"].split()))) + try: + mysettings["PORTAGE_RESTRICT"] = " ".join(flatten( + portage_dep.use_reduce(portage_dep.paren_reduce( + mysettings.get("RESTRICT","")), + uselist=mysettings.get("USE","").split()))) + except portage_exception.InvalidDependString: + # RESTRICT is validated again inside doebuild, so let this go + mysettings["PORTAGE_RESTRICT"] = "" if mysplit[2] == "r0": mysettings["PVR"]=mysplit[1] @@ -4368,7 +4373,10 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, myusesplit=[] #convert parenthesis to sublists - mysplit = portage_dep.paren_reduce(depstring) + try: + mysplit = portage_dep.paren_reduce(depstring) + except portage_exception.InvalidDependString, e: + return [0, str(e)] mymasks = set() useforce = set()