From a78f05238863a0d3e9a44b490bf9f00a982786d0 Mon Sep 17 00:00:00 2001 From: lxnay Date: Sun, 5 Aug 2007 12:57:23 +0000 Subject: [PATCH] test new dependency handling git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@390 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/portageTools.py | 56 +++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/libraries/portageTools.py b/libraries/portageTools.py index 63bbac40a..2c8e3011f 100644 --- a/libraries/portageTools.py +++ b/libraries/portageTools.py @@ -681,36 +681,68 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): dependencies = "" conflicts = "" useflags = useflags.split() - for atom in roughDependencies: + + length = len(roughDependencies) + global atomcount + atomcount = -1 + while atomcount < length: + + atomcount += 1 + try: + atom = roughDependencies[atomcount] + except: + break + if atom.startswith("("): if (openOr): openParenthesisFromOr += 1 # 1 - openParenthesis += 1 # 1 + openParenthesis += 1 # 1 | 2 + curparenthesis = openParenthesis + if (useFlagQuestion == True) and (useMatch == False): + skip = True + action = False + while (skip == True): + atomcount += 1 + atom = roughDependencies[atomcount] + if atom.startswith("("): + action = True + curparenthesis += 1 + elif atom.startswith(")"): + curparenthesis -= 1 + if (action) and (curparenthesis == openParenthesis): + skip = False + useFlagQuestion = False elif atom.endswith("?"): - if (useFlagQuestion) and (not useMatch): # if we're already in a question and the question is not accepted, skip the cycle - continue + #if (useFlagQuestion) and (not useMatch): # if we're already in a question and the question is not accepted, skip the cycle + # continue # we need to see if that useflag is enabled useFlag = atom.split("?")[0] useFlagQuestion = True # V + #openParenthesisFromLastUseFlagQuestion = 0 if useFlag.startswith("!"): checkFlag = "-"+useFlag[1:] try: useflags.index(checkFlag) useMatch = True except: - useMatch = False # V + useMatch = False else: try: useflags.index(useFlag) - useMatch = True + useMatch = True # V except: - useMatch = False # V - - + useMatch = False + elif atom.startswith(")"): + + openParenthesis -= 1 + if (openParenthesis == 0): + useFlagQuestion = False + useMatch = False + if (openOr): # remove last "_or_" from dependencies if (openParenthesisFromOr == 1): @@ -723,10 +755,6 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): dependencies = dependencies[:len(dependencies)-len("|and|")] dependencies += dbOR openParenthesisFromOr -= 1 - openParenthesis -= 1 - if (openParenthesis == 0): - useFlagQuestion = False - useMatch = False elif atom.startswith("||"): openOr = True # V @@ -753,7 +781,7 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): conflicts += dbOR else: conflicts += " " - + # format properly tmpConflicts = list(set(conflicts.split()))