change dependencies handling, filtering |and| and |or| server side

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@422 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2007-08-08 22:39:38 +00:00
parent 40de3d9cdd
commit 23ce62debd
2 changed files with 35 additions and 31 deletions
+1 -30
View File
@@ -881,37 +881,8 @@ def getDependencies(packageInfo):
if dep.startswith("!"):
continue # FIXME: add conflicts SUPPORT
_depend.append(dep)
if dep.find("|or|") != -1:
deps = dep.split("|or|")
# find the best
versions = []
for x in deps:
if x.find("|and|"):
anddeps = x.split("|and|")
outanddeps = anddeps[:]
for y in anddeps:
ykey = dep_getkey(y)
ycat = ykey.split("/")[0]
yname = ykey.split("/")[1]
yresult = dbconn.searchPackagesByNameAndCategory(yname,ycat)
if (yresult):
outanddeps.remove(y)
if (not outanddeps):
# all dependencies are found and ok
for y in anddeps:
_depend.append(y)
break
key = dep_getkey(deps[0])
cat = key.split("/")[0]
name = key.split("/")[1]
result = dbconn.searchPackagesByNameAndCategory(name,cat)
if (result):
_depend.append(x)
break
else:
_depend.append(dep)
depend = _depend
dbconn.closeDB()
+34 -1
View File
@@ -747,7 +747,40 @@ def synthetizeRoughDependencies(roughDependencies, useflags = None):
dependencies = ''
for i in tmpDeps:
tmpData.append(i)
dependencies = string.join(tmpData," ")
# now filter |or| and |and|
_tmpData = []
for dep in tmpData:
if dep.find("|or|") != -1:
deps = dep.split("|or|")
# find the best
results = []
for x in deps:
if x.find("|and|") != -1:
anddeps = x.split("|and|")
results.append(anddeps)
else:
if x:
results.append([x])
# now parse results
for result in results:
outdeps = result[:]
for y in result:
yresult = getInstalledAtoms(y)
if (yresult != None):
outdeps.remove(y)
if (not outdeps):
# find it
for y in result:
_tmpData.append(y)
break
else:
_tmpData.append(dep)
dependencies = string.join(_tmpData," ")
return dependencies, conflicts