equo: a lot of new things, break backward compatibility for good
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@604 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
TODO list:
|
||||
CLIENT:
|
||||
- limit items/size in on-disk cache?
|
||||
- add external triggerable hooks support
|
||||
- atom|tag ?
|
||||
|
||||
- include more triggers
|
||||
- optimize database interface
|
||||
- add multithreading support
|
||||
- limit items/size in on-disk cache?
|
||||
|
||||
|
||||
Project Status:
|
||||
- reagent: complete. Stabilization mode.
|
||||
|
||||
@@ -73,6 +73,7 @@ def print_help():
|
||||
print_info(" \t\t"+darkgreen("needed")+red("\t\t\t print runtime libraries needed for the provided atoms"))
|
||||
print_info(" \t\t"+darkgreen("files")+red("\t\t\t search files owned by the provided atoms"))
|
||||
print_info(" \t\t"+darkgreen("removal")+red("\t\t\t print the removal tree for specified atoms"))
|
||||
print_info(" \t\t"+darkgreen("tags")+red("\t\t\t search packages that have the specified tags"))
|
||||
print_info(" \t\t\t"+red("--deep")+"\t\t also pull unused dependencies where depends list is empty")
|
||||
print_info(" \t\t"+darkgreen("list")+red("\t\t\t list packages based on the chosen parameter below"))
|
||||
print_info(" \t\t\t"+green("installed")+red("\t list installed packages"))
|
||||
|
||||
+4
-5
@@ -29,7 +29,7 @@ from entropyConstants import *
|
||||
from clientConstants import *
|
||||
from outputTools import *
|
||||
from remoteTools import downloadData, getOnlineContent
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, isjustname, dep_getkey, compareVersions as entropyCompareVersions, filterDuplicatedEntries, extactDuplicatedEntries, uncompressTarBz2, extractXpak, applicationLockCheck, countdown, isRoot, spliturl, dep_striptag, md5sum, allocateMaskedFile, istextfile, isnumber
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, isjustname, dep_getkey, compareVersions as entropyCompareVersions, filterDuplicatedEntries, extactDuplicatedEntries, uncompressTarBz2, extractXpak, applicationLockCheck, countdown, isRoot, spliturl, remove_tag, dep_striptag, md5sum, allocateMaskedFile, istextfile, isnumber
|
||||
from databaseTools import etpDatabase
|
||||
import triggerTools
|
||||
import confTools
|
||||
@@ -334,7 +334,6 @@ def fetchRepositoryIfNotAvailable(reponame):
|
||||
'''
|
||||
def atomMatch(atom, caseSentitive = True, matchSlot = None, matchBranches = (), xcache = True): # no one seems to use matchBranches :D
|
||||
|
||||
#print atom
|
||||
if xcache:
|
||||
cached = atomMatchCache.get(atom)
|
||||
if cached:
|
||||
@@ -365,7 +364,7 @@ def atomMatch(atom, caseSentitive = True, matchSlot = None, matchBranches = (),
|
||||
|
||||
# handle repoResults
|
||||
packageInformation = {}
|
||||
|
||||
|
||||
# nothing found
|
||||
if len(repoResults) == 0:
|
||||
atomMatchCache[atom] = {}
|
||||
@@ -759,7 +758,7 @@ def generateDependencyTree(atomInfo, emptydeps = False, deepdeps = False):
|
||||
#FIXME: we bastardly ignore the missing library for now
|
||||
continue
|
||||
# retrieve packages that need it, in the right branch!
|
||||
|
||||
|
||||
# add to the tree level
|
||||
tree[treedepth].add(undep)
|
||||
treecache[undep] = True
|
||||
@@ -1148,7 +1147,7 @@ def removePackage(infoDict):
|
||||
|
||||
# Handle gentoo database
|
||||
if (etpConst['gentoo-compat']):
|
||||
gentooAtom = dep_striptag(atom) # FIXME: tags will be removed
|
||||
gentooAtom = dep_striptag(remove_tag(atom)) # FIXME: remove dep_striptag asap
|
||||
equoLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_NORMAL,"Removing package from Gentoo database: "+str(gentooAtom))
|
||||
removePackageFromGentooDatabase(gentooAtom)
|
||||
|
||||
|
||||
+57
-23
@@ -27,7 +27,7 @@ from entropyConstants import *
|
||||
from clientConstants import *
|
||||
from outputTools import *
|
||||
from databaseTools import etpDatabase
|
||||
from entropyTools import dep_getkey, dep_getslot, remove_slot
|
||||
from entropyTools import dep_getkey, dep_getslot, remove_slot, dep_gettag, remove_tag
|
||||
from equoTools import openClientDatabase, openRepositoryDatabase, printPackageInfo, generateDependsTree, atomMatch # move them away?
|
||||
|
||||
########################################################
|
||||
@@ -75,6 +75,10 @@ def query(options):
|
||||
elif myopts[0] == "removal":
|
||||
rc = searchRemoval(myopts[1:], quiet = equoRequestQuiet, deep = equoRequestDeep)
|
||||
|
||||
elif myopts[0] == "tags":
|
||||
if (len(myopts) > 1):
|
||||
rc = searchTaggedPackages(myopts[1:], quiet = equoRequestQuiet)
|
||||
|
||||
elif myopts[0] == "orphans":
|
||||
rc = searchOrphans(quiet = equoRequestQuiet)
|
||||
|
||||
@@ -98,12 +102,15 @@ def searchInstalledPackages(packages, idreturn = False, quiet = False):
|
||||
print_info(yellow(" @@ ")+darkgreen("Searching..."))
|
||||
|
||||
clientDbconn = openClientDatabase()
|
||||
dataInfo = [] # when idreturn is True
|
||||
dataInfo = set() # when idreturn is True
|
||||
|
||||
for package in packages:
|
||||
slot = dep_getslot(package)
|
||||
tag = dep_gettag(package)
|
||||
package = remove_slot(package)
|
||||
result = clientDbconn.searchPackages(package, slot = slot)
|
||||
package = remove_tag(package)
|
||||
|
||||
result = clientDbconn.searchPackages(package, slot = slot, tag = tag)
|
||||
if (result):
|
||||
# print info
|
||||
if (not idreturn) and (not quiet):
|
||||
@@ -114,7 +121,7 @@ def searchInstalledPackages(packages, idreturn = False, quiet = False):
|
||||
atom = pkg[0]
|
||||
branch = clientDbconn.retrieveBranch(idpackage)
|
||||
if (idreturn):
|
||||
dataInfo.append(idpackage)
|
||||
dataInfo.add(idpackage)
|
||||
else:
|
||||
printPackageInfo(idpackage, clientDbconn, clientSearch = True, quiet = quiet)
|
||||
|
||||
@@ -132,7 +139,7 @@ def searchBelongs(files, idreturn = False, quiet = False):
|
||||
print_info(yellow(" @@ ")+darkgreen("Belong Search..."))
|
||||
|
||||
clientDbconn = openClientDatabase()
|
||||
dataInfo = [] # when idreturn is True
|
||||
dataInfo = set() # when idreturn is True
|
||||
|
||||
results = {}
|
||||
flatresults = {}
|
||||
@@ -160,7 +167,7 @@ def searchBelongs(files, idreturn = False, quiet = False):
|
||||
print_info(blue(" Found: ")+bold("\t"+str(len(result)))+red(" entries"))
|
||||
for idpackage in result:
|
||||
if (idreturn):
|
||||
dataInfo.append(idpackage)
|
||||
dataInfo.add(idpackage)
|
||||
elif (quiet):
|
||||
print clientDbconn.retrieveAtom(idpackage)
|
||||
else:
|
||||
@@ -182,7 +189,7 @@ def searchDepends(atoms, idreturn = False, verbose = False, quiet = False):
|
||||
|
||||
clientDbconn = openClientDatabase()
|
||||
|
||||
dataInfo = [] # when idreturn is True
|
||||
dataInfo = set() # when idreturn is True
|
||||
for atom in atoms:
|
||||
result = clientDbconn.atomMatch(atom)
|
||||
matchInRepo = False
|
||||
@@ -215,7 +222,7 @@ def searchDepends(atoms, idreturn = False, verbose = False, quiet = False):
|
||||
print_info(blue(" Found: ")+bold("\t"+str(len(searchResults)))+red(" entries")+where)
|
||||
for idpackage in searchResults:
|
||||
if (idreturn):
|
||||
dataInfo.append(idpackage)
|
||||
dataInfo.add(idpackage)
|
||||
else:
|
||||
if (verbose):
|
||||
printPackageInfo(idpackage, dbconn, clientSearch = True, quiet = quiet)
|
||||
@@ -239,7 +246,7 @@ def searchNeeded(atoms, idreturn = False, quiet = False):
|
||||
print_info(yellow(" @@ ")+darkgreen("Needed Search..."))
|
||||
|
||||
clientDbconn = openClientDatabase()
|
||||
dataInfo = [] # when idreturn is True
|
||||
dataInfo = set() # when idreturn is True
|
||||
|
||||
for atom in atoms:
|
||||
match = clientDbconn.atomMatch(atom)
|
||||
@@ -252,7 +259,7 @@ def searchNeeded(atoms, idreturn = False, quiet = False):
|
||||
print_info(blue(" Found: ")+bold("\t"+str(len(myneeded)))+red(" libraries"))
|
||||
for needed in myneeded:
|
||||
if (idreturn):
|
||||
dataInfo.append(needed)
|
||||
dataInfo.add(needed)
|
||||
elif (quiet):
|
||||
print needed
|
||||
else:
|
||||
@@ -272,7 +279,7 @@ def searchFiles(atoms, idreturn = False, quiet = False):
|
||||
|
||||
results = searchInstalledPackages(atoms, idreturn = True)
|
||||
clientDbconn = openClientDatabase()
|
||||
dataInfo = [] # when idreturn is True
|
||||
dataInfo = set() # when idreturn is True
|
||||
for result in results:
|
||||
if (result != -1):
|
||||
files = clientDbconn.retrieveContent(result)
|
||||
@@ -282,7 +289,7 @@ def searchFiles(atoms, idreturn = False, quiet = False):
|
||||
print_info(blue(" Package: ")+bold("\t"+atom))
|
||||
print_info(blue(" Found: ")+bold("\t"+str(len(files)))+red(" files"))
|
||||
if (idreturn):
|
||||
dataInfo.append([result,files])
|
||||
dataInfo.add((result,files))
|
||||
else:
|
||||
if quiet:
|
||||
for file in files:
|
||||
@@ -463,6 +470,7 @@ def searchInstalled(idreturn = False, verbose = False, quiet = False):
|
||||
def searchPackage(packages, idreturn = False):
|
||||
|
||||
foundPackages = {}
|
||||
dataInfo = set() # when idreturn is True
|
||||
|
||||
if (not idreturn):
|
||||
print_info(yellow(" @@ ")+darkgreen("Searching..."))
|
||||
@@ -477,14 +485,15 @@ def searchPackage(packages, idreturn = False):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
dbconn = openRepositoryDatabase(repo)
|
||||
dataInfo = [] # when idreturn is True
|
||||
for package in packages:
|
||||
slot = dep_getslot(package)
|
||||
tag = dep_gettag(package)
|
||||
package = remove_slot(package)
|
||||
result = dbconn.searchPackages(package, slot = slot)
|
||||
package = remove_tag(package)
|
||||
result = dbconn.searchPackages(package, slot = slot, tag = tag)
|
||||
|
||||
if (not result): # look for provide
|
||||
provide = dbconn.searchProvide(package, slot = slot)
|
||||
provide = dbconn.searchProvide(package, slot = slot, tag = tag)
|
||||
if (provide):
|
||||
result = [[provide[0],provide[1]]]
|
||||
|
||||
@@ -500,7 +509,7 @@ def searchPackage(packages, idreturn = False):
|
||||
atom = pkg[0]
|
||||
branch = dbconn.retrieveBranch(idpackage)
|
||||
if (idreturn):
|
||||
dataInfo.append([idpackage,repo])
|
||||
dataInfo.add((idpackage,repo))
|
||||
else:
|
||||
printPackageInfo(idpackage,dbconn)
|
||||
|
||||
@@ -509,12 +518,41 @@ def searchPackage(packages, idreturn = False):
|
||||
if (idreturn):
|
||||
return dataInfo
|
||||
|
||||
if searchError:
|
||||
print_warning(yellow(" @@ ")+red("Something bad happened. Please have a look."))
|
||||
return 129
|
||||
return 0
|
||||
|
||||
def searchTaggedPackages(tags, datareturn = False, quiet = False):
|
||||
|
||||
foundPackages = {}
|
||||
|
||||
if (not datareturn) and (not quiet):
|
||||
print_info(yellow(" @@ ")+darkgreen("Tag Search..."))
|
||||
# search inside each available database
|
||||
repoNumber = 0
|
||||
for repo in etpRepositories:
|
||||
foundPackages[repo] = {}
|
||||
repoNumber += 1
|
||||
|
||||
if (not datareturn) and (not quiet):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
dbconn = openRepositoryDatabase(repo)
|
||||
for tag in tags:
|
||||
results = dbconn.searchTaggedPackages(tag, atoms = True)
|
||||
if (not datareturn) and (not quiet):
|
||||
print_info(blue(" Keyword: ")+bold("\t"+tag))
|
||||
print_info(blue(" Found: ")+bold("\t"+str(len(results)))+red(" entries"))
|
||||
for result in results:
|
||||
foundPackages[repo][result[1]] = result[0]
|
||||
# print info
|
||||
if (not datareturn):
|
||||
printPackageInfo(result[1],dbconn, quiet = quiet)
|
||||
|
||||
dbconn.closeDB()
|
||||
|
||||
if (datareturn):
|
||||
return foundPackages
|
||||
|
||||
return 0
|
||||
|
||||
def searchDescription(descriptions, idreturn = False, quiet = False):
|
||||
|
||||
@@ -524,7 +562,6 @@ def searchDescription(descriptions, idreturn = False, quiet = False):
|
||||
print_info(yellow(" @@ ")+darkgreen("Description Search..."))
|
||||
# search inside each available database
|
||||
repoNumber = 0
|
||||
searchError = False
|
||||
for repo in etpRepositories:
|
||||
foundPackages[repo] = {}
|
||||
repoNumber += 1
|
||||
@@ -557,7 +594,4 @@ def searchDescription(descriptions, idreturn = False, quiet = False):
|
||||
if (idreturn):
|
||||
return dataInfo
|
||||
|
||||
if searchError:
|
||||
print_warning(yellow(" @@ ")+red("Something bad happened. Please have a look."))
|
||||
return 129
|
||||
return 0
|
||||
+4
-1
@@ -13,7 +13,10 @@
|
||||
sqlite_query($db, $sql);
|
||||
}
|
||||
|
||||
$pkgfile = urlencode($_GET['package']);
|
||||
$pkgfile = urlencode($_GET['package']);
|
||||
$pkgtag = $_GET['tag'];
|
||||
if ($pkgtag) $pkgfile .= "#".$pkgtag;
|
||||
|
||||
$pkgarch = $_GET['arch'];
|
||||
$pkgpath = "../packages/" . $pkgarch . "/" . $pkgfile;
|
||||
|
||||
|
||||
+82
-27
@@ -318,7 +318,7 @@ def database(options):
|
||||
|
||||
# sync packages
|
||||
import activatorTools
|
||||
#activatorTools.packages(["sync","--ask"])
|
||||
activatorTools.packages(["sync","--ask"])
|
||||
|
||||
print_info(green(" * ")+red("Switching selected packages ..."))
|
||||
import re
|
||||
@@ -940,7 +940,7 @@ class etpDatabase:
|
||||
# look for configured versiontag
|
||||
versiontag = ""
|
||||
if (etpData['versiontag']):
|
||||
versiontag = "-"+etpData['versiontag']
|
||||
versiontag = "#"+etpData['versiontag']
|
||||
|
||||
# baseinfo
|
||||
self.cursor.execute(
|
||||
@@ -1263,7 +1263,7 @@ class etpDatabase:
|
||||
# prepare versiontag
|
||||
versiontag = ""
|
||||
if (etpData['versiontag']):
|
||||
versiontag = "-"+etpData['versiontag']
|
||||
versiontag = "#"+etpData['versiontag']
|
||||
# build atom string
|
||||
pkgatom = etpData['category'] + "/" + etpData['name'] + "-" + etpData['version']+versiontag
|
||||
|
||||
@@ -2787,6 +2787,16 @@ class etpDatabase:
|
||||
|
||||
return self.fetchall2set(self.cursor.fetchall())
|
||||
|
||||
''' search packages whose versiontag matches the one provided '''
|
||||
def searchTaggedPackages(self, tag, atoms = False): # atoms = return atoms directly
|
||||
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"searchTaggedPackages: called for "+tag)
|
||||
if atoms:
|
||||
self.cursor.execute('SELECT atom,idpackage FROM baseinfo WHERE versiontag = "'+tag+'"')
|
||||
return self.cursor.fetchall()
|
||||
else:
|
||||
self.cursor.execute('SELECT idpackage FROM baseinfo WHERE versiontag = "'+tag+'"')
|
||||
return self.fetchall2set(self.cursor.fetchall())
|
||||
|
||||
''' search packages that need the specified library (in neededreference table) specified by keyword '''
|
||||
def searchNeeded(self, keyword):
|
||||
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"searchNeeded: called for "+keyword)
|
||||
@@ -2815,31 +2825,39 @@ class etpDatabase:
|
||||
self.cursor.execute('SELECT idpackage FROM dependencies WHERE iddependency = "'+str(iddep)+'"')
|
||||
return self.fetchall2set(self.cursor.fetchall())
|
||||
|
||||
def searchPackages(self, keyword, sensitive = False, slot = None):
|
||||
def searchPackages(self, keyword, sensitive = False, slot = None, tag = None):
|
||||
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"searchPackages: called for "+keyword)
|
||||
|
||||
slotstring = ''
|
||||
if slot:
|
||||
slotstring = ' and slot = "'+slot+'"'
|
||||
tagstring = ''
|
||||
if tag:
|
||||
tagstring = ' and versiontag = "'+tag+'"'
|
||||
|
||||
if (sensitive):
|
||||
self.cursor.execute('SELECT atom,idpackage,branch FROM baseinfo WHERE atom LIKE "%'+keyword+'%"'+slotstring)
|
||||
self.cursor.execute('SELECT atom,idpackage,branch FROM baseinfo WHERE atom LIKE "%'+keyword+'%"'+slotstring+tagstring)
|
||||
else:
|
||||
self.cursor.execute('SELECT atom,idpackage,branch FROM baseinfo WHERE LOWER(atom) LIKE "%'+string.lower(keyword)+'%"'+slotstring)
|
||||
self.cursor.execute('SELECT atom,idpackage,branch FROM baseinfo WHERE LOWER(atom) LIKE "%'+string.lower(keyword)+'%"'+slotstring+tagstring)
|
||||
return self.cursor.fetchall()
|
||||
|
||||
def searchProvide(self, keyword, slot = None):
|
||||
def searchProvide(self, keyword, slot = None, tag = None):
|
||||
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"searchProvide: called for "+keyword)
|
||||
|
||||
slotstring = ''
|
||||
if slot:
|
||||
slotstring = ' and slot = "'+slot+'"'
|
||||
|
||||
tagstring = ''
|
||||
if tag:
|
||||
tagstring = ' and versiontag = "'+tag+'"'
|
||||
|
||||
idpackage = ''
|
||||
self.cursor.execute('SELECT idpackage FROM provide WHERE atom = "'+keyword+'"')
|
||||
idpackage = self.cursor.fetchone()
|
||||
if not idpackage:
|
||||
return ''
|
||||
|
||||
self.cursor.execute('SELECT atom,idpackage FROM baseinfo WHERE idpackage = "'+str(idpackage[0])+'"'+slotstring)
|
||||
self.cursor.execute('SELECT atom,idpackage FROM baseinfo WHERE idpackage = "'+str(idpackage[0])+'"'+slotstring+tagstring)
|
||||
result = self.cursor.fetchone()
|
||||
if result:
|
||||
return result[0]
|
||||
@@ -3311,7 +3329,7 @@ class etpDatabase:
|
||||
@input multiMatch: bool, return all the available atoms
|
||||
@output: the package id, if found, otherwise -1 plus the status, 0 = ok, 1 = not found, 2 = need more info, 3 = cannot use direction without specifying version
|
||||
'''
|
||||
def atomMatch(self, atom, caseSensitive = True, matchSlot = None, multiMatch = False, matchBranches = ()):
|
||||
def atomMatch(self, atom, caseSensitive = True, matchSlot = None, multiMatch = False, matchBranches = (), matchTag = None):
|
||||
if (self.xcache):
|
||||
cached = dbCacheStore[etpCache['dbMatch']+self.dbname].get(atom)
|
||||
if cached:
|
||||
@@ -3319,16 +3337,23 @@ class etpDatabase:
|
||||
if (matchSlot == cached['matchSlot']) \
|
||||
and (multiMatch == cached['multiMatch']) \
|
||||
and (caseSensitive == cached['caseSensitive']) \
|
||||
and (matchTag == cached['matchTag']) \
|
||||
and (matchBranches == cached['matchBranches']):
|
||||
return cached['result']
|
||||
|
||||
# check if slot is provided -> app-foo/foo-1.2.3:SLOT
|
||||
# check if tag is provided -> app-foo/foo-1.2.3:SLOT|TAG or app-foo/foo-1.2.3|TAG
|
||||
atomTag = entropyTools.dep_gettag(atom)
|
||||
atomSlot = entropyTools.dep_getslot(atom)
|
||||
# then remove
|
||||
atom = entropyTools.remove_slot(atom)
|
||||
if (matchSlot == None) and (atomSlot != None): # new slotdeps support
|
||||
matchSlot = atomSlot
|
||||
|
||||
atom = entropyTools.remove_tag(atom)
|
||||
if (matchTag == None) and (atomTag != None):
|
||||
matchTag = atomTag
|
||||
|
||||
# check if slot is provided -> app-foo/foo-1.2.3:SLOT
|
||||
atom = entropyTools.remove_slot(atom)
|
||||
if (matchSlot == None) and (atomSlot != None):
|
||||
matchSlot = atomSlot
|
||||
|
||||
# check for direction
|
||||
strippedAtom = entropyTools.dep_getcpv(atom)
|
||||
if atom.endswith("*"):
|
||||
@@ -3340,20 +3365,22 @@ class etpDatabase:
|
||||
pkgversion = ''
|
||||
if (not justname):
|
||||
# strip tag
|
||||
strippedAtom = entropyTools.remove_tag(strippedAtom)
|
||||
|
||||
# FIXME: deprecated - will be removed soonly
|
||||
if strippedAtom.split("-")[-1].startswith("t"):
|
||||
strippedAtom = string.join(strippedAtom.split("-t")[:len(strippedAtom.split("-t"))-1],"-t")
|
||||
|
||||
# get version
|
||||
data = entropyTools.catpkgsplit(strippedAtom)
|
||||
if data == None:
|
||||
return -1,3 # atom is badly formatted
|
||||
pkgversion = data[2]+"-"+data[3]
|
||||
pkgtag = ''
|
||||
if atom.split("-")[len(atom.split("-"))-1].startswith("t"):
|
||||
pkgtag = atom.split("-")[len(atom.split("-"))-1]
|
||||
#print "TAG: "+pkgtag
|
||||
#print data
|
||||
#print pkgversion
|
||||
#print pkgtag
|
||||
|
||||
# FIXME: deprecated - will be removed soonly
|
||||
if not atomTag:
|
||||
if atom.split("-")[len(atom.split("-"))-1].startswith("t"):
|
||||
atomTag = atom.split("-")[len(atom.split("-"))-1]
|
||||
|
||||
pkgkey = entropyTools.dep_getkey(strippedAtom)
|
||||
if len(pkgkey.split("/")) == 2:
|
||||
@@ -3417,6 +3444,7 @@ class etpDatabase:
|
||||
# gosh, return and complain
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3458,6 +3486,7 @@ class etpDatabase:
|
||||
#print "justname"
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3495,12 +3524,16 @@ class etpDatabase:
|
||||
testpkgver = pkgversion[:len(pkgversion)-1]
|
||||
#print testpkgver
|
||||
combodb = dbver+dbtag
|
||||
if atomTag == None: pkgtag = ''
|
||||
else: pkgtag = atomTag
|
||||
combopkg = testpkgver+pkgtag
|
||||
#print combodb
|
||||
#print combopkg
|
||||
if combodb.startswith(combopkg):
|
||||
dbpkginfo.append([idpackage,dbver])
|
||||
else:
|
||||
if atomTag == None: pkgtag = ''
|
||||
else: pkgtag = atomTag
|
||||
if (dbver+dbtag == pkgversion+pkgtag):
|
||||
# found
|
||||
dbpkginfo.append([idpackage,dbver])
|
||||
@@ -3516,6 +3549,7 @@ class etpDatabase:
|
||||
if (not dbpkginfo):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3528,11 +3562,15 @@ class etpDatabase:
|
||||
mslot = self.retrieveSlot(x[0])
|
||||
if (str(mslot) != str(matchSlot)):
|
||||
continue
|
||||
if (matchTag != None):
|
||||
if matchTag != self.retrieveVersionTag(x[0]):
|
||||
continue
|
||||
versions.append(x[1])
|
||||
|
||||
if (not versions):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3553,6 +3591,7 @@ class etpDatabase:
|
||||
if (multiMatch):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3567,13 +3606,14 @@ class etpDatabase:
|
||||
versionTags = []
|
||||
for pkg in similarPackages:
|
||||
versionTags.append(self.retrieveVersionTag(pkg[1]))
|
||||
versiontaglist = entropyTools.getNewerVersionTag(versionTags)
|
||||
versiontaglist = entropyTools.getNewerVersionTag(versionTags)
|
||||
newerPackage = similarPackages[versionTags.index(versiontaglist[0])]
|
||||
|
||||
#print newerPackage
|
||||
#print newerPackage[1]
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3614,6 +3654,7 @@ class etpDatabase:
|
||||
# this version is not available
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3628,6 +3669,9 @@ class etpDatabase:
|
||||
mslot = self.retrieveSlot(x[0])
|
||||
if (str(matchSlot) != str(mslot)):
|
||||
continue
|
||||
if (matchTag != None):
|
||||
if matchTag != self.retrieveVersionTag(x[0]):
|
||||
continue
|
||||
if (multiMatch):
|
||||
multiMatchList.append(x[0])
|
||||
versions.append(x[1])
|
||||
@@ -3640,6 +3684,7 @@ class etpDatabase:
|
||||
if (not versions):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3660,6 +3705,7 @@ class etpDatabase:
|
||||
if (multiMatch):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3681,6 +3727,7 @@ class etpDatabase:
|
||||
#print newerPackage[1]
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3690,6 +3737,7 @@ class etpDatabase:
|
||||
else:
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3706,14 +3754,18 @@ class etpDatabase:
|
||||
multiMatchList = []
|
||||
_foundIDs = []
|
||||
for list in foundIDs:
|
||||
if (matchSlot == None):
|
||||
if (matchSlot == None) and (matchTag == None):
|
||||
versionIDs.append(self.retrieveVersion(list[1]))
|
||||
if (multiMatch):
|
||||
multiMatchList.append(list[1])
|
||||
else:
|
||||
foundslot = self.retrieveSlot(list[1])
|
||||
if (str(foundslot) != str(matchSlot)):
|
||||
continue
|
||||
if (matchSlot != None):
|
||||
foundslot = self.retrieveSlot(list[1])
|
||||
if (str(foundslot) != str(matchSlot)):
|
||||
continue
|
||||
if (matchTag != None):
|
||||
if matchTag != self.retrieveVersionTag(list[1]):
|
||||
continue
|
||||
versionIDs.append(self.retrieveVersion(list[1]))
|
||||
if (multiMatch):
|
||||
multiMatchList.append(list[1])
|
||||
@@ -3726,6 +3778,7 @@ class etpDatabase:
|
||||
if (not versionIDs):
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3753,6 +3806,7 @@ class etpDatabase:
|
||||
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
@@ -3763,6 +3817,7 @@ class etpDatabase:
|
||||
# package not found in any branch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom] = {}
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchSlot'] = matchSlot
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchTag'] = matchTag
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['multiMatch'] = multiMatch
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['caseSensitive'] = caseSensitive
|
||||
dbCacheStore[etpCache['dbMatch']+self.dbname][atom]['matchBranches'] = matchBranches
|
||||
|
||||
+28
-10
@@ -454,6 +454,7 @@ def pkgsplit(mypkg,silent=1):
|
||||
else:
|
||||
return None
|
||||
|
||||
# FIXME: deprecated, use remove_tag - will be removed soonly
|
||||
def dep_striptag(mydepx):
|
||||
mydep = mydepx[:]
|
||||
if not (isjustname(mydep)):
|
||||
@@ -462,12 +463,6 @@ def dep_striptag(mydepx):
|
||||
mydep = mydep[:len(mydep)-len(tag)-1]
|
||||
return mydep
|
||||
|
||||
def istagged(mydepx):
|
||||
x = dep_striptag(mydepx)
|
||||
if x != mydepx:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def dep_getkey(mydepx):
|
||||
"""
|
||||
Return the category/package-name of a depstring.
|
||||
@@ -522,7 +517,7 @@ def dep_getcpv(mydep):
|
||||
mydep = mydep[:colon]
|
||||
return mydep
|
||||
|
||||
def dep_getslot(mydep):
|
||||
def dep_getslot(dep):
|
||||
"""
|
||||
Retrieve the slot on a depend.
|
||||
|
||||
@@ -531,13 +526,14 @@ def dep_getslot(mydep):
|
||||
'3'
|
||||
|
||||
@param mydep: The depstring to retrieve the slot of
|
||||
@type mydep: String
|
||||
@type dep: String
|
||||
@rtype: String
|
||||
@return: The slot
|
||||
"""
|
||||
colon = mydep.rfind(":")
|
||||
colon = dep.rfind(":")
|
||||
if colon != -1:
|
||||
return mydep[colon+1:]
|
||||
mydep = dep[colon+1:]
|
||||
return remove_tag(mydep)
|
||||
return None
|
||||
|
||||
def remove_slot(mydep):
|
||||
@@ -546,6 +542,28 @@ def remove_slot(mydep):
|
||||
mydep = mydep[:colon]
|
||||
return mydep
|
||||
|
||||
|
||||
def remove_tag(mydep):
|
||||
colon = mydep.rfind("#")
|
||||
if colon != -1:
|
||||
mydep = mydep[:colon]
|
||||
return mydep
|
||||
|
||||
def dep_gettag(dep):
|
||||
"""
|
||||
Retrieve the slot on a depend.
|
||||
|
||||
Example usage:
|
||||
>>> dep_gettag('app-misc/test#2.6.23-sabayon-r1')
|
||||
'2.6.23-sabayon-r1'
|
||||
|
||||
"""
|
||||
colon = dep.rfind("#")
|
||||
if colon != -1:
|
||||
mydep = dep[colon+1:]
|
||||
return remove_slot(mydep)
|
||||
return None
|
||||
|
||||
def removePackageOperators(atom):
|
||||
if atom.startswith(">") or atom.startswith("<"):
|
||||
atom = atom[1:]
|
||||
|
||||
+23
-13
@@ -314,6 +314,9 @@ def extractPkgData(package, etpBranch = etpConst['branch']):
|
||||
print_info(yellow(" * ")+red(info_package+"Getting package name/version..."),back = True)
|
||||
tbz2File = package
|
||||
package = package.split(".tbz2")[0]
|
||||
package = remove_tag(package)
|
||||
|
||||
# FIXME: deprecated - will be removed soonly
|
||||
if package.split("-")[len(package.split("-"))-1].startswith("t"):
|
||||
package = string.join(package.split("-t")[:len(package.split("-t"))-1],"-t")
|
||||
|
||||
@@ -475,30 +478,28 @@ def extractPkgData(package, etpBranch = etpConst['branch']):
|
||||
|
||||
# [][][] Kernel dependent packages hook [][][]
|
||||
kernelDependentModule = False
|
||||
kernelItself = False
|
||||
for file in etpData['content']:
|
||||
if file.find("/lib/modules/") != -1:
|
||||
kernelDependentModule = True
|
||||
# get the version of the modules
|
||||
kmodver = file.split("/lib/modules/")[1]
|
||||
kmodver = kmodver.split("/")[0]
|
||||
# substitute "-" with "_"
|
||||
kmodver = re.subn("-","_", kmodver)
|
||||
if len(kmodver) >= 2:
|
||||
kmodver = kmodver[0]
|
||||
|
||||
lp = kmodver.split("_")[len(kmodver.split("_"))-1]
|
||||
lp = kmodver.split("-")[len(kmodver.split("-"))-1]
|
||||
if lp.startswith("r"):
|
||||
kname = kmodver.split("_")[len(kmodver.split("_"))-2]
|
||||
kver = kmodver.split("_")[0]+"-"+kmodver.split("_")[len(kmodver.split("_"))-1]
|
||||
kname = kmodver.split("-")[len(kmodver.split("-"))-2]
|
||||
kver = kmodver.split("-")[0]+"-"+kmodver.split("-")[len(kmodver.split("-"))-1]
|
||||
else:
|
||||
kname = kmodver.split("_")[len(kmodver.split("_"))-1]
|
||||
kver = kmodver.split("_")[0]
|
||||
kname = kmodver.split("-")[len(kmodver.split("-"))-1]
|
||||
kver = kmodver.split("-")[0]
|
||||
break
|
||||
# validate the results above
|
||||
if (kernelDependentModule):
|
||||
matchatom = "linux-"+kname+"-"+kver
|
||||
if (matchatom == etpData['name']+"-"+etpData['version']):
|
||||
# discard
|
||||
# discard, it's the kernel itself, add other deps instead
|
||||
kernelItself = True
|
||||
kernelDependentModule = False
|
||||
|
||||
# add strict kernel dependency
|
||||
@@ -507,8 +508,10 @@ def extractPkgData(package, etpBranch = etpConst['branch']):
|
||||
print_info(yellow(" * ")+red(info_package+"Getting package download URL..."),back = True)
|
||||
# Fill download relative URI
|
||||
if (kernelDependentModule):
|
||||
etpData['versiontag'] = "t"+kmodver
|
||||
versiontag = "-"+etpData['versiontag']
|
||||
etpData['versiontag'] = kmodver
|
||||
# force slot == tag:
|
||||
etpData['slot'] = kmodver
|
||||
versiontag = "#"+etpData['versiontag']
|
||||
else:
|
||||
versiontag = ""
|
||||
etpData['download'] = etpConst['binaryurirelativepath']+etpData['branch']+"/"+etpData['name']+"-"+etpData['version']+versiontag+".tbz2"
|
||||
@@ -726,7 +729,14 @@ def extractPkgData(package, etpBranch = etpConst['branch']):
|
||||
|
||||
if (kernelDependentModule):
|
||||
# add kname to the dependency
|
||||
etpData['dependencies'].append("sys-kernel/linux-"+kname+"-"+kver)
|
||||
etpData['dependencies'].append("=sys-kernel/linux-"+kname+"-"+kver)
|
||||
|
||||
if (kernelItself):
|
||||
# it's the kernel, add dependency on all tagged packages
|
||||
try:
|
||||
etpData['dependencies'].append("=sys-kernel/linux-"+kname+"-modules-"+kver)
|
||||
except:
|
||||
pass
|
||||
|
||||
print_info(yellow(" * ")+red(info_package+"Getting System package List..."),back = True)
|
||||
# write only if it's a systempackage
|
||||
|
||||
@@ -52,7 +52,14 @@ def getRemotePackageChecksum(serverName,filename, branch):
|
||||
# not found, does not support HTTP handlers
|
||||
return None
|
||||
|
||||
request = url+etpHandlers['md5sum']+filename+"&branch="+branch
|
||||
# does the package has "#" (== tag) ? hackish thing that works
|
||||
tag = entropyTools.dep_gettag(filename)
|
||||
tagstring = ''
|
||||
if tag:
|
||||
filename = entropyTools.remove_tag(filename)
|
||||
tagstring = "&tag="+tag
|
||||
|
||||
request = url+etpHandlers['md5sum']+filename+"&branch="+branch+tagstring
|
||||
remoteLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getRemotePackageChecksum: requested url -> "+request)
|
||||
|
||||
# now pray the server
|
||||
|
||||
Reference in New Issue
Block a user