From eca6d6ec5889409b6a44584d37d4fd0f81cfcefa Mon Sep 17 00:00:00 2001 From: lxnay Date: Sun, 4 Feb 2007 17:34:32 +0000 Subject: [PATCH] fixed some bugs on the dependencies' side git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@56 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/entropyConstants.py | 6 +++++- libraries/entropyTools.py | 40 ++++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/libraries/entropyConstants.py b/libraries/entropyConstants.py index 8236fdd7d..3e38a2af6 100644 --- a/libraries/entropyConstants.py +++ b/libraries/entropyConstants.py @@ -26,7 +26,9 @@ pData = { 'etpapi': "", # blockers } -ETP_API = "1.0" +ETP_API = "1" +ETP_API_SUBLEVEL = ".0" + # variables # should we import these into make.conf ? @@ -50,8 +52,10 @@ if not pBinHost.endswith("/"): import commands if (commands.getoutput("q -V").find("portage-utils") != -1): pFindLibrary = "qfile -qC " + pFindLibraryXT = "qfile -qeC " else: pFindLibrary = "equery belongs -n " + pFindLibraryXT = "equery belongs -en " # Portage /var/db///* # you never know if gentoo devs change these things diff --git a/libraries/entropyTools.py b/libraries/entropyTools.py index 139d2d340..07dc2ad4d 100644 --- a/libraries/entropyTools.py +++ b/libraries/entropyTools.py @@ -6,16 +6,28 @@ import portage import portage_const +from portage_dep import isvalidatom, isjustname, dep_getkey from entropyConstants import * import commands -# resolve atoms automagically +# resolve atoms automagically (best, not current!) # sys-libs/application --> sys-libs/application-1.2.3-r1 def getBestAtom(atom): rc = portage.portdb.xmatch("bestmatch-visible",str(atom)) return rc +def getArch(): + return portage.settings["ARCH"] + +def getInstalledAtom(atom): + if (isjustname(atom) == 1): + # resolve name to atom + rc = portage.db['/']['vartree'].dep_match(str(atom)) + return rc[len(rc)-1] + else: + return atom + def print_error(msg): print "* erro * : "+msg @@ -116,6 +128,9 @@ def extractPkgData(package): tmpIUSE = f.readline().strip().split() f.close() + # fill KEYWORDS + + for i in tmpIUSE: if tmpUSE.find(i) != -1: pData['useflags'] += i+" " @@ -244,13 +259,21 @@ def extractPkgData(package): neededLibraries = list(set(neededLibraries)) runtimeNeededPackages = [] + runtimeNeededPackagesXT = [] for i in neededLibraries: - pkgs = commands.getoutput(pFindLibrary+i).split("\n") + pkgs = commands.getoutput(pFindLibraryXT+i).split("\n") if (pkgs[0] != ""): for y in pkgs: - runtimeNeededPackages.append(y) + runtimeNeededPackagesXT.append(y) + y = dep_getkey(y) + runtimeNeededPackages.append(y) + #pkgsXT = commands.getoutput(pFindLibraryXT+i).split("\n") + #if (pkgs[0] != ""): + # for y in pkgsXT: + # runtimeNeededPackagesXT.append(y) runtimeNeededPackages = list(set(runtimeNeededPackages)) + runtimeNeededPackagesXT = list(set(runtimeNeededPackagesXT)) # now keep only the ones not available in pData['dependencies'] for i in runtimeNeededPackages: @@ -258,16 +281,23 @@ def extractPkgData(package): # filter itself if (i != pData['category']+"/"+pData['name']): pData['rundependencies'] += i+" " - i = getBestAtom(i) + + for i in runtimeNeededPackagesXT: + x = dep_getkey(i) + if pData['dependencies'].find(x) == -1: + # filter itself + if (x != pData['category']+"/"+pData['name']): pData['rundependenciesXT'] += i+" " + # format properly if pData['rundependencies'].endswith(" "): pData['rundependencies'] = pData['rundependencies'][:len(pData['rundependencies'])-1] + if pData['rundependenciesXT'].endswith(" "): pData['rundependenciesXT'] = pData['rundependenciesXT'][:len(pData['rundependenciesXT'])-1] # write API info - pData['etpapi'] = ETP_API + pData['etpapi'] = ETP_API+ETP_API_SUBLEVEL return pData