diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index a583e9ede..bda91ef9a 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -87,7 +87,7 @@ def database(options): print_info(green(" * ")+red("Analyzing: ")+bold(pkg), back = True) currCounter += 1 print_info(green(" (")+ blue(str(currCounter))+"/"+red(str(atomsnumber))+green(") ")+red("Analyzing ")+bold(pkg)+red(" ...")) - etpData = reagentTools.extractPkgData(etpConst['packagesbindir']+"/"+pkg) + etpData = reagentTools.extractPkgData(package = etpConst['packagesbindir']+"/"+pkg, structuredLayout = True) # remove shait entropyTools.spawnCommand("rm -rf "+etpConst['packagestmpdir']+"/"+pkg) diff --git a/libraries/portageTools.py b/libraries/portageTools.py index c849ce14c..c2a207744 100644 --- a/libraries/portageTools.py +++ b/libraries/portageTools.py @@ -677,29 +677,32 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): useFlagQuestion = False dependencies = "" conflicts = "" + useflags = useflags.split() for atom in roughDependencies: if atom.endswith("?"): # we need to see if that useflag is enabled useFlag = atom.split("?")[0] - useFlagQuestion = True - for i in useflags.split(): - if useFlag.startswith("!"): - checkFlag = "-"+useFlag[1:] - if (i == checkFlag): - useMatch = True - break + useFlagQuestion = True # V + if useFlag.startswith("!"): + checkFlag = "-"+useFlag[1:] + try: + useflags.index(checkFlag) + useMatch = True + except: useMatch = False - else: - if (i == useFlag): - useMatch = True - break + else: + try: + useflags.index(useFlag) + useMatch = True # V + except: useMatch = False + if atom.startswith("("): if (openOr): - openParenthesisFromOr += 1 - openParenthesis += 1 # 1 | 2 | 3 + openParenthesisFromOr += 1 # 1 + openParenthesis += 1 # 1 | 2 if atom.startswith(")"): if (openOr): @@ -722,7 +725,7 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): if atom.startswith("||"): openOr = True # V - if atom.find("/") != -1 and (not atom.startswith("!")) and (not atom.endswith("?")): + if (atom.find("/") != -1) and (not atom.startswith("!")) and (not atom.endswith("?")): # it's a package name /-??? if ((useFlagQuestion) and (useMatch)) or ((not useFlagQuestion) and (not useMatch)): # check if there's an OR @@ -734,6 +737,7 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None): else: dependencies += dbOR else: + dependencies += atom dependencies += " " if atom.startswith("!") and (not atom.endswith("?")): diff --git a/libraries/reagentTools.py b/libraries/reagentTools.py index ff34799db..d6392e6c9 100644 --- a/libraries/reagentTools.py +++ b/libraries/reagentTools.py @@ -175,7 +175,7 @@ def enzyme(options): print_info(green(" * ")+red("Statistics: ")+blue("Entries created/updated: ")+bold(str(etpCreated))+yellow(" - ")+darkblue("Entries discarded: ")+bold(str(etpNotCreated))) # This function extracts all the info from a .tbz2 file and returns them -def extractPkgData(package, etpBranch = "unstable"): +def extractPkgData(package, etpBranch = "unstable", structuredLayout = False): reagentLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"extractPkgData: called -> package: "+str(package)) @@ -214,6 +214,16 @@ def extractPkgData(package, etpBranch = "unstable"): etpData['name'] = pkgname etpData['version'] = pkgver + if (structuredLayout): + # extract tbz2 + structuredPackageDir = etpConst['packagestmpdir']+"/"+etpData['name']+"-"+etpData['version']+"-structured" + if os.path.isdir(structuredPackageDir): + spawnCommand("rm -rf "+structuredPackageDir) + os.makedirs(structuredPackageDir) + uncompressTarBz2(tbz2File,structuredPackageDir) + tbz2filename = os.path.basename(tbz2File) + tbz2File = structuredPackageDir+etpConst['packagecontentdir']+"/"+tbz2filename + print_info(yellow(" * ")+red("Getting package md5..."),back = True) # .tbz2 md5 etpData['digest'] = md5sum(tbz2File) @@ -582,6 +592,9 @@ def extractPkgData(package, etpBranch = "unstable"): # removing temporary directory os.system("rm -rf "+tbz2TmpDir) + if (structuredLayout): + if os.path.isdir(structuredPackageDir): + spawnCommand("rm -rf "+structuredPackageDir) print_info(yellow(" * ")+red("Done"),back = True) return etpData