summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2006-01-05 05:33:25 +0000
committerBrian Harring <ferringb@gentoo.org>2006-01-05 05:33:25 +0000
commitb914e83041ec8f57f24ea199a7b8caf07cd5111f (patch)
treea07772598fad10ab4055242fc7dbe752971d62c9 /pym/portage.py
parenta49c023410104aecbd8e138e9cc7826f8f19bf24 (diff)
downloadportage-b914e83041ec8f57f24ea199a7b8caf07cd5111f.tar.gz
portage-b914e83041ec8f57f24ea199a7b8caf07cd5111f.tar.bz2
portage-b914e83041ec8f57f24ea199a7b8caf07cd5111f.zip
'k. reverted use_reduce filtering of empty lists (was resulting in ["||"] as elements, which are invalid), added
a recursive filter of empty sets/resolved || and && nodes; in the process, keeps portage from using an empty bool as a satisfier in || () restriction sets. svn path=/main/trunk/; revision=2528
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 186555700..6105e0810 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3374,6 +3374,26 @@ def dep_check(depstring,mydbapi,mysettings,use="yes",mode=None,myuse=None,use_ca
#if mysplit==None, then we have a parse error (paren mismatch or misplaced ||)
#up until here, we haven't needed to look at the database tree
+ # recursive cleansing of empty arrays.
+ # without this, portage eats itself if fed a || ()
+ def f(a):
+ x = 0
+ l = len(a)
+ while x < l:
+ if isinstance(a[x], list):
+ l2 = len(a[x])
+ if l2 == 0:
+ a.pop(x)
+ elif l2 == 1 and a[x][0] in ("||", "&&"):
+ a.pop(x)
+ else:
+ f(a[x])
+ x+=1
+ continue
+ l-=1
+ x+=1
+ f(mysplit)
+
if mysplit==None:
return [0,"Parse Error (parentheses mismatch?)"]
elif mysplit==[]: