Entropy/Client/Interface:
- split Client class into single ones - deprecated camelCase methods - remove a few, unused or useless Entropy/docs: - update APICHANGES Entropy/*: - adapt the code to work with non-deprecated methods git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@3154 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -293,10 +293,10 @@ def showdiff(fromfile,tofile):
|
||||
f.flush()
|
||||
f.close()
|
||||
print
|
||||
os.system("cat /tmp/"+os.path.basename(fromfile)+" | less --no-init --QUIT-AT-EOF")
|
||||
os.system("cat \"%s\" | less --no-init --QUIT-AT-EOF" % ("/tmp/"+os.path.basename(fromfile),))
|
||||
try:
|
||||
os.remove("/tmp/"+os.path.basename(fromfile))
|
||||
except:
|
||||
except OSError:
|
||||
pass
|
||||
if output == ['']: output = [] #FIXME beautify
|
||||
return output
|
||||
|
||||
+16
-16
@@ -208,11 +208,11 @@ def searchChangeLog(atoms, dbconn = None, Equo = None):
|
||||
print_info(darkred("%s: %s" % (_("No match for"),bold(atom),)))
|
||||
continue
|
||||
else:
|
||||
idpackage, r_id = Equo.atomMatch(atom)
|
||||
idpackage, r_id = Equo.atom_match(atom)
|
||||
if idpackage == -1:
|
||||
print_info(darkred("%s: %s" % (_("No match for"),bold(atom),)))
|
||||
continue
|
||||
dbconn = Equo.openRepositoryDatabase(r_id)
|
||||
dbconn = Equo.open_repository(r_id)
|
||||
|
||||
db_atom = dbconn.retrieveAtom(idpackage)
|
||||
if etpUi['quiet']: print_generic("%s :" % (db_atom,))
|
||||
@@ -236,10 +236,10 @@ def searchDepends(atoms, idreturn = False, dbconn = None, Equo = None):
|
||||
if (not idreturn) and (not etpUi['quiet']):
|
||||
print_info(darkred(" @@ ")+darkgreen("%s..." % (_("Depends Search"),) ))
|
||||
|
||||
# XXX hack to get Equo.atomMatch to not raise AttributeError
|
||||
# XXX hack to get Equo.atom_match to not raise AttributeError
|
||||
match_repo = True
|
||||
try:
|
||||
x = Equo.atomMatch
|
||||
x = Equo.atom_match
|
||||
del x
|
||||
except AttributeError:
|
||||
match_repo = False
|
||||
@@ -256,14 +256,14 @@ def searchDepends(atoms, idreturn = False, dbconn = None, Equo = None):
|
||||
repoMasked = False
|
||||
if (result[0] == -1) and match_repo:
|
||||
matchInRepo = True
|
||||
result = Equo.atomMatch(atom)
|
||||
result = Equo.atom_match(atom)
|
||||
if (result[0] == -1) and match_repo:
|
||||
result = Equo.atomMatch(atom, packagesFilter = False)
|
||||
result = Equo.atom_match(atom, packagesFilter = False)
|
||||
if result[0] != -1:
|
||||
repoMasked = True
|
||||
if (result[0] != -1):
|
||||
if (matchInRepo):
|
||||
dbconn = Equo.openRepositoryDatabase(result[1])
|
||||
dbconn = Equo.open_repository(result[1])
|
||||
else:
|
||||
dbconn = clientDbconn
|
||||
found_atom = dbconn.retrieveAtom(result[0])
|
||||
@@ -467,7 +467,7 @@ def searchOrphans(Equo = None):
|
||||
filepath = Equo.entropyTools.getRandomTempFile()
|
||||
if os.path.isfile(filepath):
|
||||
os.remove(filepath)
|
||||
tdbconn = Equo.openGenericDatabase(filepath)
|
||||
tdbconn = Equo.open_generic_database(filepath)
|
||||
tdbconn.initializeDatabase()
|
||||
for xdir in dirs:
|
||||
try:
|
||||
@@ -686,7 +686,7 @@ def searchPackage(packages, idreturn = False, Equo = None):
|
||||
if (not idreturn) and (not etpUi['quiet']):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
for package in packages:
|
||||
slot = Equo.entropyTools.dep_getslot(package)
|
||||
tag = Equo.entropyTools.dep_gettag(package)
|
||||
@@ -735,7 +735,7 @@ def matchPackage(packages, idreturn = False, multiMatch = False, multiRepo = Fal
|
||||
if (not idreturn) and (not etpUi['quiet']):
|
||||
print_info(blue(" # ")+bold(package))
|
||||
|
||||
match = Equo.atomMatch(package, multiMatch = multiMatch, multiRepo = multiRepo, packagesFilter = False)
|
||||
match = Equo.atom_match(package, multiMatch = multiMatch, multiRepo = multiRepo, packagesFilter = False)
|
||||
if match[1] != 1:
|
||||
if not multiMatch:
|
||||
if multiRepo:
|
||||
@@ -748,7 +748,7 @@ def matchPackage(packages, idreturn = False, multiMatch = False, multiRepo = Fal
|
||||
if (idreturn):
|
||||
dataInfo.add(tuple(match))
|
||||
else:
|
||||
dbconn = Equo.openRepositoryDatabase(match[1])
|
||||
dbconn = Equo.open_repository(match[1])
|
||||
printPackageInfo(match[0],dbconn, showRepoOnQuiet = showRepo, showDescOnQuiet = showDesc, Equo = Equo)
|
||||
found = True
|
||||
if (not idreturn) and (not etpUi['quiet']):
|
||||
@@ -784,7 +784,7 @@ def searchSlottedPackages(slots, datareturn = False, dbconn = None, Equo = None)
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
if dbclose:
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
for slot in slots:
|
||||
results = dbconn.searchSlottedPackages(slot, atoms = True)
|
||||
for result in results:
|
||||
@@ -814,7 +814,7 @@ def searchPackageSets(items, datareturn = False, Equo = None):
|
||||
|
||||
matchNumber = 0
|
||||
for item in items:
|
||||
results = Equo.packageSetSearch(item)
|
||||
results = Equo.package_set_search(item)
|
||||
for repo, set_name, set_data in results:
|
||||
matchNumber += 1
|
||||
if (not datareturn) and (not etpUi['quiet']):
|
||||
@@ -854,7 +854,7 @@ def searchTaggedPackages(tags, datareturn = False, dbconn = None, Equo = None):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
if dbclose:
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
for tag in tags:
|
||||
results = dbconn.searchTaggedPackages(tag, atoms = True)
|
||||
for result in results:
|
||||
@@ -891,7 +891,7 @@ def searchLicenses(licenses, datareturn = False, dbconn = None, Equo = None):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
if dbclose:
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
for mylicense in licenses:
|
||||
results = dbconn.searchLicenses(mylicense, atoms = True)
|
||||
if not results:
|
||||
@@ -927,7 +927,7 @@ def searchDescription(descriptions, idreturn = False, Equo = None):
|
||||
if (not idreturn) and (not etpUi['quiet']):
|
||||
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
|
||||
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
dataInfo, descdata = searchDescriptions(descriptions, dbconn, idreturn, Equo = Equo)
|
||||
foundPackages[repo].update(descdata)
|
||||
|
||||
|
||||
+10
-10
@@ -109,12 +109,12 @@ def database(options):
|
||||
# Now reinitialize it
|
||||
mytxt = darkred(" %s %s") % (_("Initializing the new database at"),bold(etpConst['etpdatabaseclientfilepath']),)
|
||||
print_info(mytxt, back = True)
|
||||
Equo.reopenClientDbconn()
|
||||
Equo.reopen_client_repository()
|
||||
dbfile = Equo.clientDbconn.dbFile
|
||||
Equo.clientDbconn.closeDB()
|
||||
if os.path.isfile(dbfile):
|
||||
os.remove(dbfile)
|
||||
Equo.openClientDatabase()
|
||||
Equo.open_client_repository()
|
||||
Equo.clientDbconn.initializeDatabase()
|
||||
mytxt = darkred(" %s %s") % (_("Database reinitialized correctly at"),bold(etpConst['etpdatabaseclientfilepath']),)
|
||||
print_info(mytxt)
|
||||
@@ -219,7 +219,7 @@ def database(options):
|
||||
|
||||
elif (options[0] == "check"):
|
||||
if Equo.clientDbconn.doesTableExist("baseinfo"):
|
||||
Equo.clientDatabaseSanityCheck()
|
||||
Equo.client_repository_sanity_check()
|
||||
else:
|
||||
mytxt = "# %s: %s" % (bold(_("ATTENTION")),red(_("database does not exist or is badly broken")),)
|
||||
print_warning(mytxt)
|
||||
@@ -267,7 +267,7 @@ def database(options):
|
||||
dbpath = etpConst['etpdatabaseclientfilepath']
|
||||
if os.path.isfile(dbpath) and os.access(dbpath,os.W_OK):
|
||||
os.remove(dbpath)
|
||||
dbc = Equo.openGenericDatabase(dbpath, dbname = etpConst['clientdbid']) # don't do this at home
|
||||
dbc = Equo.open_generic_database(dbpath, dbname = etpConst['clientdbid']) # don't do this at home
|
||||
dbc.initializeDatabase()
|
||||
dbc.commitChanges()
|
||||
Equo.clientDbconn = dbc
|
||||
@@ -326,7 +326,7 @@ def database(options):
|
||||
mytxt = red(" %s: %s") % (_("Matching in repository"),etpRepositories[repo]['description'],)
|
||||
print_info(mytxt)
|
||||
# get all idpackages
|
||||
dbconn = Equo.openRepositoryDatabase(repo)
|
||||
dbconn = Equo.open_repository(repo)
|
||||
idpackages = dbconn.listAllIdpackages(branch = etpConst['branch'])
|
||||
count = str(len(idpackages))
|
||||
cnt = 0
|
||||
@@ -419,7 +419,7 @@ def database(options):
|
||||
|
||||
# make it crash
|
||||
Equo.noclientdb = False
|
||||
Equo.reopenClientDbconn()
|
||||
Equo.reopen_client_repository()
|
||||
|
||||
# test if counters table exists, because if not, it's useless to run the diff scan
|
||||
try:
|
||||
@@ -614,7 +614,7 @@ def database(options):
|
||||
|
||||
elif (options[0] == "backup"):
|
||||
|
||||
status, err_msg = Equo.backupDatabase(etpConst['etpdatabaseclientfilepath'])
|
||||
status, err_msg = Equo.backup_database(etpConst['etpdatabaseclientfilepath'])
|
||||
if status:
|
||||
return 0
|
||||
return 1
|
||||
@@ -653,7 +653,7 @@ def database(options):
|
||||
if not os.path.isfile(dbpath): continue
|
||||
break
|
||||
|
||||
status, err_msg = Equo.restoreDatabase(dbpath, etpConst['etpdatabaseclientfilepath'])
|
||||
status, err_msg = Equo.restore_database(dbpath, etpConst['etpdatabaseclientfilepath'])
|
||||
if status:
|
||||
return 0
|
||||
return 1
|
||||
@@ -729,7 +729,7 @@ def pythonUpdater():
|
||||
matchedAtoms = set()
|
||||
for atomkey,slot in keyslots:
|
||||
print_info(brown(" @@ ")+red("%s " % (_("Matching"),) )+bold(atomkey)+red(":")+darkgreen(slot), back = True)
|
||||
match = Equo.atomMatch(atomkey, matchSlot = slot)
|
||||
match = Equo.atom_match(atomkey, matchSlot = slot)
|
||||
if match[0] != -1:
|
||||
matchedAtoms.add((atomkey+":"+slot,match))
|
||||
del idpackages
|
||||
@@ -801,7 +801,7 @@ def getinfo(dict = False):
|
||||
dbfile = etpRepositories[x]['dbpath']+"/"+etpConst['etpdatabasefile']
|
||||
if os.path.isfile(dbfile):
|
||||
# print info about this database
|
||||
dbconn = Equo.openRepositoryDatabase(x)
|
||||
dbconn = Equo.open_repository(x)
|
||||
info['Repository databases'][x] = {}
|
||||
info['Repository databases'][x]['Installation internal protected directories'] = dbconn.listConfigProtectDirectories()
|
||||
info['Repository databases'][x]['Installation internal protected directory masks'] = dbconn.listConfigProtectDirectories(mask = True)
|
||||
|
||||
@@ -237,7 +237,7 @@ def install_packages(fetch = False):
|
||||
# get key + slot
|
||||
key, slot = Equo.clientDbconn.retrieveKeySlot(match[0])
|
||||
# match in repos
|
||||
match = Equo.atomMatch(key, matchSlot = slot)
|
||||
match = Equo.atom_match(key, matchSlot = slot)
|
||||
if match[0] != -1:
|
||||
valid_matches.add(match)
|
||||
|
||||
|
||||
+45
-42
@@ -23,12 +23,13 @@ import shutil
|
||||
from entropy.const import *
|
||||
from entropy.output import *
|
||||
from entropy.i18n import _
|
||||
import text_ui
|
||||
from entropy.client.interfaces import Client
|
||||
Equo = Client()
|
||||
|
||||
def smart(options):
|
||||
|
||||
# check if I am root
|
||||
if (not text_ui.Equo.entropyTools.isRoot()):
|
||||
if (not Equo.entropyTools.isRoot()):
|
||||
mytxt = _("You are not") # you are not root
|
||||
print_error(red(mytxt)+bold("root")+red("."))
|
||||
return 1
|
||||
@@ -90,12 +91,12 @@ def QuickpkgHandler(mypackages, savedir = None):
|
||||
|
||||
packages = []
|
||||
for opt in mypackages:
|
||||
match = text_ui.Equo.clientDbconn.atomMatch(opt)
|
||||
match = Equo.clientDbconn.atomMatch(opt)
|
||||
if match[0] != -1:
|
||||
packages.append(match)
|
||||
else:
|
||||
if not etpUi['quiet']: print_warning(darkred(" * ")+red("%s: " % (_("Cannot find"),))+bold(opt))
|
||||
packages = text_ui.Equo.entropyTools.filterDuplicatedEntries(packages)
|
||||
packages = Equo.entropyTools.filterDuplicatedEntries(packages)
|
||||
if (not packages):
|
||||
print_error(darkred(" * ")+red("%s." % (_("No valid packages specified"),)))
|
||||
return 2
|
||||
@@ -105,21 +106,21 @@ def QuickpkgHandler(mypackages, savedir = None):
|
||||
if (not etpUi['quiet']) or (etpUi['ask']): print_info(darkgreen(" * ")+red(mytxt+":"))
|
||||
pkgInfo = {}
|
||||
for pkg in packages:
|
||||
atom = text_ui.Equo.clientDbconn.retrieveAtom(pkg[0])
|
||||
atom = Equo.clientDbconn.retrieveAtom(pkg[0])
|
||||
pkgInfo[pkg] = {}
|
||||
pkgInfo[pkg]['atom'] = atom
|
||||
pkgInfo[pkg]['idpackage'] = pkg[0]
|
||||
print_info(brown("\t[")+red("%s:" % (_("from"),))+bold(_("installed"))+brown("]")+" - "+atom)
|
||||
|
||||
if (not etpUi['quiet']) or (etpUi['ask']):
|
||||
rc = text_ui.Equo.askQuestion(">> %s" % (_("Would you like to recompose the selected packages ?"),))
|
||||
rc = Equo.askQuestion(">> %s" % (_("Would you like to recompose the selected packages ?"),))
|
||||
if rc == "No":
|
||||
return 0
|
||||
|
||||
for pkg in packages:
|
||||
if not etpUi['quiet']: print_info(brown(" * ")+red("%s: " % (_("Compressing"),))+darkgreen(pkgInfo[pkg]['atom']))
|
||||
pkgdata = text_ui.Equo.clientDbconn.getPackageData(pkgInfo[pkg]['idpackage'])
|
||||
resultfile = text_ui.Equo.quickpkg_handler(pkgdata = pkgdata, dirpath = savedir)
|
||||
pkgdata = Equo.clientDbconn.getPackageData(pkgInfo[pkg]['idpackage'])
|
||||
resultfile = Equo.quickpkg_handler(pkgdata = pkgdata, dirpath = savedir)
|
||||
if resultfile == None:
|
||||
if not etpUi['quiet']:
|
||||
print_error(darkred(" * ") + red("%s: " % (_("Error while creating package for"),)) + \
|
||||
@@ -137,10 +138,10 @@ def CommonFlate(mytbz2s, action, savedir = None):
|
||||
|
||||
# test if portage is available
|
||||
try:
|
||||
Spm = text_ui.Equo.Spm()
|
||||
Spm = Equo.Spm()
|
||||
del Spm
|
||||
except Exception, e:
|
||||
text_ui.Equo.entropyTools.printTraceback()
|
||||
Equo.entropyTools.printTraceback()
|
||||
mytxt = _("Source Package Manager backend not available")
|
||||
print_error(darkred(" * ")+red("%s: %s" % (mytxt,e,)))
|
||||
return 1
|
||||
@@ -155,7 +156,7 @@ def CommonFlate(mytbz2s, action, savedir = None):
|
||||
for tbz2 in mytbz2s:
|
||||
#print_info(brown(" * ")+darkred("Analyzing: ")+tbz2)
|
||||
if not (os.path.isfile(tbz2) and tbz2.endswith(etpConst['packagesext']) and \
|
||||
text_ui.Equo.entropyTools.isEntropyTbz2(tbz2)):
|
||||
Equo.entropyTools.isEntropyTbz2(tbz2)):
|
||||
print_error(darkred(" * ")+bold(tbz2)+red(" %s" % (_("is not a valid Entropy package"),)))
|
||||
return 1
|
||||
|
||||
@@ -180,7 +181,7 @@ def InflateHandler(mytbz2s, savedir):
|
||||
etptbz2path = savedir+"/"+os.path.basename(tbz2)
|
||||
if os.path.realpath(tbz2) != os.path.realpath(etptbz2path): # can convert a file without copying
|
||||
shutil.copy2(tbz2,etptbz2path)
|
||||
mydata = text_ui.Equo.extract_pkg_metadata(etptbz2path)
|
||||
mydata = Equo.extract_pkg_metadata(etptbz2path)
|
||||
# append arbitrary revision
|
||||
mydata['revision'] = 9999
|
||||
mydata['download'] = mydata['download'][:-5]+"~9999.tbz2"
|
||||
@@ -189,18 +190,18 @@ def InflateHandler(mytbz2s, savedir):
|
||||
shutil.move(etptbz2path,final_tbz2path)
|
||||
etptbz2path = final_tbz2path
|
||||
# create temp database
|
||||
dbpath = etpConst['packagestmpdir']+"/"+str(text_ui.Equo.entropyTools.getRandomNumber())
|
||||
dbpath = etpConst['packagestmpdir']+"/"+str(Equo.entropyTools.getRandomNumber())
|
||||
while os.path.isfile(dbpath):
|
||||
dbpath = etpConst['packagestmpdir']+"/"+str(text_ui.Equo.entropyTools.getRandomNumber())
|
||||
dbpath = etpConst['packagestmpdir']+"/"+str(Equo.entropyTools.getRandomNumber())
|
||||
# create
|
||||
mydbconn = text_ui.Equo.openGenericDatabase(dbpath)
|
||||
mydbconn = Equo.open_generic_database(dbpath)
|
||||
mydbconn.initializeDatabase()
|
||||
idpackage, yyy, xxx = mydbconn.addPackage(mydata, revision = mydata['revision'])
|
||||
del yyy, xxx
|
||||
myQA = text_ui.Equo.QA()
|
||||
myQA = Equo.QA()
|
||||
myQA.scan_missing_dependencies([idpackage], mydbconn)
|
||||
mydbconn.closeDB()
|
||||
text_ui.Equo.entropyTools.aggregateEdb(tbz2file = etptbz2path, dbfile = dbpath)
|
||||
Equo.entropyTools.aggregateEdb(tbz2file = etptbz2path, dbfile = dbpath)
|
||||
os.remove(dbpath)
|
||||
print_info(darkgreen(" * ")+darkred("%s: " % (_("Inflated package"),))+etptbz2path)
|
||||
|
||||
@@ -211,9 +212,9 @@ def DeflateHandler(mytbz2s, savedir):
|
||||
# analyze files
|
||||
for tbz2 in mytbz2s:
|
||||
print_info(darkgreen(" * ")+darkred("%s: " % (_("Deflating"),))+tbz2, back = True)
|
||||
mytbz2 = text_ui.Equo.entropyTools.removeEdb(tbz2,savedir)
|
||||
mytbz2 = Equo.entropyTools.removeEdb(tbz2,savedir)
|
||||
tbz2name = os.path.basename(mytbz2)[:-5] # remove .tbz2
|
||||
tbz2name = text_ui.Equo.entropyTools.remove_tag(tbz2name)+etpConst['packagesext']
|
||||
tbz2name = Equo.entropyTools.remove_tag(tbz2name)+etpConst['packagesext']
|
||||
newtbz2 = os.path.dirname(mytbz2)+"/"+tbz2name
|
||||
print_info(darkgreen(" * ")+darkred("%s: " % (_("Deflated package"),))+newtbz2)
|
||||
|
||||
@@ -228,7 +229,7 @@ def ExtractHandler(mytbz2s, savedir):
|
||||
if os.path.isfile(dbpath):
|
||||
os.remove(dbpath)
|
||||
# extract
|
||||
out = text_ui.Equo.entropyTools.extractEdb(tbz2,dbpath = dbpath)
|
||||
out = Equo.entropyTools.extractEdb(tbz2,dbpath = dbpath)
|
||||
print_info(darkgreen(" * ")+darkred("%s: " % (_("Extracted Entropy metadata from"),))+out)
|
||||
|
||||
return 0
|
||||
@@ -241,12 +242,12 @@ def smartPackagesHandler(mypackages):
|
||||
|
||||
packages = []
|
||||
for opt in mypackages:
|
||||
match = text_ui.Equo.atomMatch(opt)
|
||||
match = Equo.atom_match(opt)
|
||||
if match[0] != -1:
|
||||
packages.append(match)
|
||||
else:
|
||||
print_warning(darkred(" * ")+red("%s: " % (_("Cannot find"),))+bold(opt))
|
||||
packages = text_ui.Equo.entropyTools.filterDuplicatedEntries(packages)
|
||||
packages = Equo.entropyTools.filterDuplicatedEntries(packages)
|
||||
if (not packages):
|
||||
print_error(darkred(" * ")+red("%s." % (_("No valid packages specified"),)))
|
||||
return 2
|
||||
@@ -255,12 +256,12 @@ def smartPackagesHandler(mypackages):
|
||||
print_info(darkgreen(" * ")+red("%s:" % (_("This is the list of the packages that would be merged into a single one"),)))
|
||||
pkgInfo = {}
|
||||
for pkg in packages:
|
||||
dbconn = text_ui.Equo.openRepositoryDatabase(pkg[1])
|
||||
dbconn = Equo.open_repository(pkg[1])
|
||||
atom = dbconn.retrieveAtom(pkg[0])
|
||||
pkgInfo[pkg] = atom
|
||||
print_info(brown("\t[")+red("%s:" % (_("from"),))+pkg[1]+brown("]")+" - "+atom)
|
||||
|
||||
rc = text_ui.Equo.askQuestion(">> %s" % (_("Would you like to create the packages above ?"),))
|
||||
rc = Equo.askQuestion(">> %s" % (_("Would you like to create the packages above ?"),))
|
||||
if rc == "No":
|
||||
return 0
|
||||
|
||||
@@ -278,7 +279,7 @@ def smartpackagegenerator(matchedPackages):
|
||||
fetchdata = []
|
||||
matchedAtoms = {}
|
||||
for x in matchedPackages:
|
||||
xdbconn = text_ui.Equo.openRepositoryDatabase(x[1])
|
||||
xdbconn = Equo.open_repository(x[1])
|
||||
matchedAtoms[x] = {}
|
||||
xatom = xdbconn.retrieveAtom(x[0])
|
||||
xdownload = xdbconn.retrieveDownloadURL(x[0])
|
||||
@@ -287,15 +288,16 @@ def smartpackagegenerator(matchedPackages):
|
||||
matchedAtoms[x]['download'] = xdownload
|
||||
matchedAtoms[x]['revision'] = xrevision
|
||||
fetchdata.append(x)
|
||||
import text_ui
|
||||
# run installPackages with onlyfetch
|
||||
rc = text_ui.installPackages(atomsdata = fetchdata, deps = False, onlyfetch = True)
|
||||
if rc[1] != 0:
|
||||
return rc[0]
|
||||
|
||||
# create unpack dir and unpack all packages
|
||||
unpackdir = etpConst['entropyunpackdir']+"/smartpackage-"+str(text_ui.Equo.entropyTools.getRandomNumber())
|
||||
unpackdir = etpConst['entropyunpackdir']+"/smartpackage-"+str(Equo.entropyTools.getRandomNumber())
|
||||
while os.path.isdir(unpackdir):
|
||||
unpackdir = etpConst['entropyunpackdir']+"/smartpackage-"+str(text_ui.Equo.entropyTools.getRandomNumber())
|
||||
unpackdir = etpConst['entropyunpackdir']+"/smartpackage-"+str(Equo.entropyTools.getRandomNumber())
|
||||
if os.path.isdir(unpackdir):
|
||||
shutil.rmtree(unpackdir)
|
||||
os.makedirs(unpackdir)
|
||||
@@ -303,22 +305,22 @@ def smartpackagegenerator(matchedPackages):
|
||||
os.mkdir(unpackdir+"/db")
|
||||
# create master database
|
||||
dbfile = unpackdir+"/db/merged.db"
|
||||
mergeDbconn = text_ui.Equo.openGenericDatabase(dbfile, dbname = "client")
|
||||
mergeDbconn = Equo.open_generic_database(dbfile, dbname = "client")
|
||||
mergeDbconn.initializeDatabase()
|
||||
mergeDbconn.createXpakTable()
|
||||
tmpdbfile = dbfile+"--readingdata"
|
||||
for package in matchedPackages:
|
||||
print_info(darkgreen(" * ")+brown(matchedAtoms[package]['atom'])+": "+red(_("collecting Entropy metadata")))
|
||||
text_ui.Equo.entropyTools.extractEdb(etpConst['entropyworkdir']+"/"+matchedAtoms[package]['download'],tmpdbfile)
|
||||
Equo.entropyTools.extractEdb(etpConst['entropyworkdir']+"/"+matchedAtoms[package]['download'],tmpdbfile)
|
||||
# read db and add data to mergeDbconn
|
||||
mydbconn = text_ui.Equo.openGenericDatabase(tmpdbfile)
|
||||
mydbconn = Equo.open_generic_database(tmpdbfile)
|
||||
idpackages = mydbconn.listAllIdpackages()
|
||||
|
||||
for myidpackage in idpackages:
|
||||
data = mydbconn.getPackageData(myidpackage)
|
||||
if len(idpackages) == 1:
|
||||
# just a plain package that would like to become smart
|
||||
xpakdata = text_ui.Equo.entropyTools.readXpak(etpConst['entropyworkdir']+"/"+matchedAtoms[package]['download'])
|
||||
xpakdata = Equo.entropyTools.readXpak(etpConst['entropyworkdir']+"/"+matchedAtoms[package]['download'])
|
||||
else:
|
||||
xpakdata = mydbconn.retrieveXpakMetadata(myidpackage) # already a smart package
|
||||
# add
|
||||
@@ -334,7 +336,7 @@ def smartpackagegenerator(matchedPackages):
|
||||
# merge packages
|
||||
for package in matchedPackages:
|
||||
print_info(darkgreen(" * ")+brown(matchedAtoms[package]['atom'])+": "+red("unpacking content"))
|
||||
rc = text_ui.Equo.entropyTools.uncompressTarBz2(etpConst['entropyworkdir']+"/"+matchedAtoms[x]['download'], extractPath = unpackdir+"/content")
|
||||
rc = Equo.entropyTools.uncompressTarBz2(etpConst['entropyworkdir']+"/"+matchedAtoms[x]['download'], extractPath = unpackdir+"/content")
|
||||
if rc != 0:
|
||||
print_error(darkred(" * ")+red("%s." % (_("Unpack failed due to unknown reasons"),)))
|
||||
return rc
|
||||
@@ -346,7 +348,7 @@ def smartpackagegenerator(matchedPackages):
|
||||
for x in matchedAtoms:
|
||||
atoms.append(matchedAtoms[x]['atom'].split("/")[1])
|
||||
atoms = '+'.join(atoms)
|
||||
rc = text_ui.Equo.entropyTools.compressTarBz2(etpConst['smartpackagesdir']+"/"+atoms+etpConst['packagesext'],unpackdir+"/content")
|
||||
rc = Equo.entropyTools.compressTarBz2(etpConst['smartpackagesdir']+"/"+atoms+etpConst['packagesext'],unpackdir+"/content")
|
||||
if rc != 0:
|
||||
print_error(darkred(" * ")+red("%s." % (_("Compression failed due to unknown reasons"),)))
|
||||
return rc
|
||||
@@ -355,7 +357,7 @@ def smartpackagegenerator(matchedPackages):
|
||||
print_error(darkred(" * ")+red("%s." % (_("Compressed file does not exist"),)))
|
||||
return 1
|
||||
|
||||
text_ui.Equo.entropyTools.aggregateEdb(etpConst['smartpackagesdir']+"/"+atoms+etpConst['packagesext'],dbfile)
|
||||
Equo.entropyTools.aggregateEdb(etpConst['smartpackagesdir']+"/"+atoms+etpConst['packagesext'],dbfile)
|
||||
print_info("\t"+etpConst['smartpackagesdir']+"/"+atoms+etpConst['packagesext'])
|
||||
shutil.rmtree(unpackdir,True)
|
||||
return 0
|
||||
@@ -374,7 +376,7 @@ def smartappsHandler(mypackages, emptydeps = False):
|
||||
|
||||
packages = set()
|
||||
for opt in mypackages:
|
||||
match = text_ui.Equo.atomMatch(opt)
|
||||
match = Equo.atom_match(opt)
|
||||
if match[0] != -1:
|
||||
packages.add(match)
|
||||
else:
|
||||
@@ -388,12 +390,12 @@ def smartappsHandler(mypackages, emptydeps = False):
|
||||
print_info(darkgreen(" * ")+red("%s:" % (_("This is the list of the packages that would be worked out"),)))
|
||||
pkgInfo = {}
|
||||
for pkg in packages:
|
||||
dbconn = text_ui.Equo.openRepositoryDatabase(pkg[1])
|
||||
dbconn = Equo.open_repository(pkg[1])
|
||||
atom = dbconn.retrieveAtom(pkg[0])
|
||||
pkgInfo[pkg] = atom
|
||||
print_info(brown("\t[")+red("%s:" % (_("from"),))+pkg[1]+red("|SMART")+brown("]")+" - "+atom)
|
||||
|
||||
rc = text_ui.Equo.askQuestion(">> %s" % (_("Would you like to create the packages above ?"),))
|
||||
rc = Equo.askQuestion(">> %s" % (_("Would you like to create the packages above ?"),))
|
||||
if rc == "No":
|
||||
return 0
|
||||
|
||||
@@ -409,7 +411,7 @@ def smartappsHandler(mypackages, emptydeps = False):
|
||||
def smartgenerator(atomInfo, emptydeps = False):
|
||||
|
||||
import entropy.tools as entropyTools
|
||||
dbconn = text_ui.Equo.openRepositoryDatabase(atomInfo[1])
|
||||
dbconn = Equo.open_repository(atomInfo[1])
|
||||
idpackage = atomInfo[0]
|
||||
atom = dbconn.retrieveAtom(idpackage)
|
||||
|
||||
@@ -420,7 +422,7 @@ def smartgenerator(atomInfo, emptydeps = False):
|
||||
pkgfilename = os.path.basename(pkgfilepath)
|
||||
pkgname = pkgfilename.split(etpConst['packagesext'])[0].replace(":","_").replace("~","_")
|
||||
|
||||
pkgdependencies, removal, result = text_ui.Equo.retrieveInstallQueue([atomInfo], empty_deps = emptydeps, deep_deps = False)
|
||||
pkgdependencies, removal, result = Equo.get_install_queue([atomInfo], empty_deps = emptydeps, deep_deps = False)
|
||||
#FIXME: fix dependencies stuff
|
||||
# flatten them
|
||||
if (result == 0):
|
||||
@@ -435,7 +437,7 @@ def smartgenerator(atomInfo, emptydeps = False):
|
||||
if pkgs:
|
||||
print_info(darkgreen(" * ")+red("%s:" % (_("This is the list of the dependencies that would be included"),)))
|
||||
for i in pkgs:
|
||||
mydbconn = text_ui.Equo.openRepositoryDatabase(i[1])
|
||||
mydbconn = Equo.open_repository(i[1])
|
||||
atom = mydbconn.retrieveAtom(i[0])
|
||||
print_info(darkgreen(" (x) ")+red(atom))
|
||||
|
||||
@@ -443,6 +445,7 @@ def smartgenerator(atomInfo, emptydeps = False):
|
||||
fetchdata.append(atomInfo)
|
||||
fetchdata += pkgs
|
||||
# run installPackages with onlyfetch
|
||||
import text_ui
|
||||
rc = text_ui.installPackages(atomsdata = fetchdata, deps = False, onlyfetch = True)
|
||||
if rc[1] != 0:
|
||||
return rc[0]
|
||||
@@ -467,7 +470,7 @@ def smartgenerator(atomInfo, emptydeps = False):
|
||||
|
||||
# now uncompress all the rest
|
||||
for dep in pkgs:
|
||||
mydbconn = text_ui.Equo.openRepositoryDatabase(dep[1])
|
||||
mydbconn = Equo.open_repository(dep[1])
|
||||
download = os.path.basename(mydbconn.retrieveDownloadURL(dep[0]))
|
||||
depbranch = mydbconn.retrieveBranch(dep[0])
|
||||
depatom = mydbconn.retrieveAtom(dep[0])
|
||||
@@ -542,7 +545,7 @@ int main() {
|
||||
smartpath = "%s/%s-%s%s" % (etpConst['smartappsdir'],pkgname,etpConst['currentarch'],etpConst['packagesext'],)
|
||||
print_info(darkgreen(" * ")+red("%s: " % (_("Compressing smart application"),))+bold(atom))
|
||||
print_info("\t%s" % (smartpath,))
|
||||
text_ui.Equo.entropyTools.compressTarBz2(smartpath,pkgtmpdir)
|
||||
Equo.entropyTools.compressTarBz2(smartpath,pkgtmpdir)
|
||||
shutil.rmtree(pkgtmpdir,True)
|
||||
|
||||
return 0
|
||||
+20
-20
@@ -317,13 +317,13 @@ def _scanPackages(packages, tbz2):
|
||||
foundAtoms = []
|
||||
|
||||
# expand package
|
||||
packages = Equo.packagesExpand(packages)
|
||||
packages = Equo.packages_expand(packages)
|
||||
|
||||
for package in packages:
|
||||
# clear masking reasons
|
||||
match = Equo.atomMatch(package)
|
||||
match = Equo.atom_match(package)
|
||||
if match[0] == -1:
|
||||
masked_matches = Equo.atomMatch(package, packagesFilter = False, multiMatch = True)
|
||||
masked_matches = Equo.atom_match(package, packagesFilter = False, multiMatch = True)
|
||||
if masked_matches[1] == 0:
|
||||
|
||||
mytxt = "%s %s %s %s." % (
|
||||
@@ -345,7 +345,7 @@ def _scanPackages(packages, tbz2):
|
||||
for idreason, reason in sorted(m_reasons.keys()):
|
||||
print_warning(bold(" # ")+red("Reason: ")+blue(reason))
|
||||
for m_idpackage, m_repo in m_reasons[(idreason, reason)]:
|
||||
dbconn = Equo.openRepositoryDatabase(m_repo)
|
||||
dbconn = Equo.open_repository(m_repo)
|
||||
try:
|
||||
m_atom = dbconn.retrieveAtom(m_idpackage)
|
||||
except TypeError:
|
||||
@@ -380,7 +380,7 @@ def _scanPackages(packages, tbz2):
|
||||
)
|
||||
print_info(mytxt)
|
||||
for m_idpackage, m_repo in items:
|
||||
dbc = Equo.openRepositoryDatabase(m_repo)
|
||||
dbc = Equo.open_repository(m_repo)
|
||||
key, slot = dbc.retrieveKeySlot(m_idpackage)
|
||||
if (key,slot) not in items_cache:
|
||||
print_info(red(" # ")+blue(key)+":"+brown(str(slot))+red(" ?"))
|
||||
@@ -423,7 +423,7 @@ def _showPackageInfo(foundAtoms, deps):
|
||||
for idpackage,reponame in foundAtoms:
|
||||
atomscounter += 1
|
||||
# open database
|
||||
dbconn = Equo.openRepositoryDatabase(reponame)
|
||||
dbconn = Equo.open_repository(reponame)
|
||||
|
||||
# get needed info
|
||||
pkgatom = dbconn.retrieveAtom(idpackage)
|
||||
@@ -508,13 +508,13 @@ def _generateRunQueue(foundAtoms, deps, emptydeps, deepdeps):
|
||||
|
||||
if deps:
|
||||
print_info(red(" @@ ")+blue("%s ...") % (_("Calculating dependencies"),) )
|
||||
runQueue, removalQueue, status = Equo.retrieveInstallQueue(foundAtoms, emptydeps, deepdeps)
|
||||
runQueue, removalQueue, status = Equo.get_install_queue(foundAtoms, emptydeps, deepdeps)
|
||||
if status == -2:
|
||||
|
||||
print_error(red(" @@ ")+blue("%s: " % (_("Cannot find needed dependencies"),) ))
|
||||
for package in runQueue:
|
||||
|
||||
masked_matches = Equo.atomMatch(package, packagesFilter = False, multiMatch = True)
|
||||
masked_matches = Equo.atom_match(package, packagesFilter = False, multiMatch = True)
|
||||
if masked_matches[1] == 0:
|
||||
|
||||
mytxt = "%s %s %s %s." % (
|
||||
@@ -536,7 +536,7 @@ def _generateRunQueue(foundAtoms, deps, emptydeps, deepdeps):
|
||||
for idreason, reason in sorted(m_reasons.keys()):
|
||||
print_warning(bold(" # ")+red("Reason: ")+blue(reason))
|
||||
for m_idpackage, m_repo in m_reasons[(idreason, reason)]:
|
||||
dbconn = Equo.openRepositoryDatabase(m_repo)
|
||||
dbconn = Equo.open_repository(m_repo)
|
||||
try:
|
||||
m_atom = dbconn.retrieveAtom(m_idpackage)
|
||||
except TypeError:
|
||||
@@ -674,7 +674,7 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
|
||||
for idpackage,reponame in runQueue:
|
||||
count += 1
|
||||
|
||||
dbconn = Equo.openRepositoryDatabase(reponame)
|
||||
dbconn = Equo.open_repository(reponame)
|
||||
pkgatom = dbconn.retrieveAtom(idpackage)
|
||||
if not pkgatom:
|
||||
continue
|
||||
@@ -909,7 +909,7 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
|
||||
return 128,-1
|
||||
|
||||
if skipfirst and runQueue:
|
||||
runQueue, x, status = Equo.retrieveInstallQueue(runQueue[1:], emptydeps, deepdeps)
|
||||
runQueue, x, status = Equo.get_install_queue(runQueue[1:], emptydeps, deepdeps)
|
||||
del x # was removalQueue
|
||||
# save new queues
|
||||
resume_cache['runQueue'] = runQueue
|
||||
@@ -948,7 +948,7 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
|
||||
for key in keys:
|
||||
print_info(red(" :: %s: " % (_("License"),) )+bold(key)+red(", %s:" % (_("needed by"),) ))
|
||||
for match in licenses[key]:
|
||||
dbconn = Equo.openRepositoryDatabase(match[1])
|
||||
dbconn = Equo.open_repository(match[1])
|
||||
atom = dbconn.retrieveAtom(match[0])
|
||||
print_info(blue(" ## ")+"["+brown(_("from"))+":"+red(match[1])+"] "+bold(atom))
|
||||
while 1:
|
||||
@@ -1114,7 +1114,7 @@ def configurePackages(packages = []):
|
||||
etpUi['pretend'] = True
|
||||
|
||||
foundAtoms = []
|
||||
packages = Equo.packagesExpand(packages)
|
||||
packages = Equo.packages_expand(packages)
|
||||
|
||||
for package in packages:
|
||||
idpackage, result = Equo.clientDbconn.atomMatch(package)
|
||||
@@ -1206,7 +1206,7 @@ def removePackages(packages = [], atomsdata = [], deps = True, deep = False, sys
|
||||
else:
|
||||
|
||||
# expand package
|
||||
packages = Equo.packagesExpand(packages)
|
||||
packages = Equo.packages_expand(packages)
|
||||
|
||||
for package in packages:
|
||||
idpackage, result = Equo.clientDbconn.atomMatch(package)
|
||||
@@ -1259,7 +1259,7 @@ def removePackages(packages = [], atomsdata = [], deps = True, deep = False, sys
|
||||
continue
|
||||
|
||||
if systemPackagesCheck:
|
||||
valid = Equo.validatePackageRemoval(idpackage)
|
||||
valid = Equo.validate_package_removal(idpackage)
|
||||
if not valid:
|
||||
mytxt = " %s (%s/%s) %s: %s. %s." % (
|
||||
bold("!!!"),
|
||||
@@ -1307,7 +1307,7 @@ def removePackages(packages = [], atomsdata = [], deps = True, deep = False, sys
|
||||
|
||||
if lookForOrphanedPackages:
|
||||
choosenRemovalQueue = []
|
||||
choosenRemovalQueue = Equo.retrieveRemovalQueue(plainRemovalQueue, deep = deep)
|
||||
choosenRemovalQueue = Equo.get_removal_queue(plainRemovalQueue, deep = deep)
|
||||
if choosenRemovalQueue:
|
||||
print_info(red(" @@ ")+blue("%s:" % (_("This is the new removal queue"),) ))
|
||||
totalatoms = str(len(choosenRemovalQueue))
|
||||
@@ -1485,7 +1485,7 @@ def dependenciesTest():
|
||||
crying_atoms[dep] = set()
|
||||
crying_atoms[dep].add(iatom)
|
||||
|
||||
match = Equo.atomMatch(dep)
|
||||
match = Equo.atom_match(dep)
|
||||
if match[0] != -1:
|
||||
found_deps.add(dep)
|
||||
continue
|
||||
@@ -1496,7 +1496,7 @@ def dependenciesTest():
|
||||
for c_idpackage in c_idpackages:
|
||||
key, slot = Equo.clientDbconn.retrieveKeySlot(c_idpackage)
|
||||
key_slot = "%s:%s" % (key,slot,)
|
||||
match = Equo.atomMatch(key, matchSlot = slot)
|
||||
match = Equo.atom_match(key, matchSlot = slot)
|
||||
|
||||
cmpstat = 0
|
||||
if match[0] != -1:
|
||||
@@ -1570,14 +1570,14 @@ def librariesTest(listfiles = False):
|
||||
print_info(darkgreen(" ## ")+red("%s:" % (_("Matched"),) ))
|
||||
for mylib in packagesMatched:
|
||||
for idpackage, repoid in packagesMatched[mylib]:
|
||||
dbconn = Equo.openRepositoryDatabase(repoid)
|
||||
dbconn = Equo.open_repository(repoid)
|
||||
myatom = dbconn.retrieveAtom(idpackage)
|
||||
atomsdata.add((idpackage,repoid))
|
||||
print_info(" "+red(mylib)+" => "+brown(myatom)+" ["+red(repoid)+"]")
|
||||
else:
|
||||
for mylib in packagesMatched:
|
||||
for idpackage, repoid in packagesMatched[mylib]:
|
||||
dbconn = Equo.openRepositoryDatabase(repoid)
|
||||
dbconn = Equo.open_repository(repoid)
|
||||
myatom = dbconn.retrieveAtom(idpackage)
|
||||
atomsdata.add((idpackage,repoid))
|
||||
print myatom
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ configprotectmask|/etc/pam.d
|
||||
# default: unset, internal variable will be used (this is stored into the repository database)
|
||||
#
|
||||
# 2: Installation/Removal protection skip
|
||||
configprotectskip|/usr/kde/3.5/share/config/kdm/kdmrc
|
||||
configprotectskip|/usr/kde/3.5/share/config/kdm/kdmrc /etc/conf.d/hostname /etc/sudoers
|
||||
|
||||
# Configuration files backup
|
||||
# Option to enable/disable automatic backup of files merged by "equo conf update"
|
||||
|
||||
+37
-1
@@ -16,4 +16,40 @@ From SVN 3112 there have been several API changes:
|
||||
|
||||
- entropyTools API changes:
|
||||
entropyTools.parallelTask and TimeScheduled moved to entropy.misc
|
||||
entropyTools.lifobuffer moved to entropy.misc as Lifo
|
||||
entropyTools.lifobuffer moved to entropy.misc as Lifo
|
||||
|
||||
- EquoInterface (now entropy.client.interfaces.Client) API changes:
|
||||
|
||||
- now deprecated:
|
||||
closeAllRepositoryDatabases => close_all_repositories
|
||||
addRepository => add_repository
|
||||
removeRepository => remove_repository
|
||||
shiftRepository => shift_repository
|
||||
enableRepository => enable_repository
|
||||
disableRepository => disable_repository
|
||||
reopenClientDbconn => reopen_client_repository
|
||||
openClientDatabase => open_client_repository
|
||||
clientDatabaseSanityCheck => client_repository_sanity_check
|
||||
retrieveInstallQueue => get_install_queue
|
||||
validatePackageRemoval => validate_package_removal
|
||||
retrieveWorldQueue => get_world_queue
|
||||
packageSetMatch => package_set_match
|
||||
packageSetSearch => package_set_search
|
||||
packageSetList => package_set_list
|
||||
packageSetExpand => package_set_expand
|
||||
packagesExpand => packages_expand
|
||||
atomMatch => atom_match
|
||||
|
||||
- property changes
|
||||
repoDbCache => __repodb_cache
|
||||
repo_error_messages_cache => __repo_error_messages_cache
|
||||
securityCache => __security_cache
|
||||
QACache => __QA_cache
|
||||
memoryDbInstances => _memory_db_instances
|
||||
package_match_validator_cache => _package_match_validator_cache
|
||||
spmCache => __spm_cache
|
||||
|
||||
|
||||
- removed methods
|
||||
check_equo_updates
|
||||
|
||||
|
||||
@@ -734,7 +734,7 @@ class EntropyApplet:
|
||||
names = {}
|
||||
entropy_data = {}
|
||||
for pkg in self.available_packages:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(pkg[1])
|
||||
dbconn = self.Entropy.open_repository(pkg[1])
|
||||
atom = dbconn.retrieveAtom(pkg[0])
|
||||
avail = dbconn.retrieveVersion(pkg[0])
|
||||
avail_rev = dbconn.retrieveRevision(pkg[0])
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# from entropy.client.interfaces import Client as EquoInterface, Package as PackageInterface, Repository as RepoInterface
|
||||
# from entropy.db import LocalRepository as EntropyDatabaseInterface, dbapi2
|
||||
# from entropy.spm import Spm as SpmInterface
|
||||
# from entropy.client.misc import FileUpdatesInterface
|
||||
# from entropy.client.misc import FileUpdates
|
||||
# from entropy.services.interfaces import SocketHost as SocketHostInterface
|
||||
# from entropy.services.skel import SocketCommands as SocketCommandsSkel, \
|
||||
# SocketAuthenticator as SocketAuthenticatorSkel, RemoteDatabase as RemoteDbSkelInterface, \
|
||||
|
||||
+2102
-1868
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@ from entropy.const import etpConst, etpCache
|
||||
from entropy.output import darkred, darkgreen, red, brown, blue
|
||||
from entropy.tools import getstatusoutput
|
||||
|
||||
class FileUpdatesInterface:
|
||||
class FileUpdates:
|
||||
|
||||
def __init__(self, EquoInstance):
|
||||
if not isinstance(EquoInstance,Client):
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
'''
|
||||
|
||||
|
||||
from __future__ import with_statement
|
||||
import sys, os, stat
|
||||
from entropy.i18n import _
|
||||
|
||||
@@ -203,6 +203,11 @@ def const_defaultSettings(rootdir):
|
||||
ETP_SYSLOG_DIR = rootdir+"/var/log/entropy/"
|
||||
ETP_VAR_DIR = rootdir+"/var/tmp/entropy"
|
||||
edbCOUNTER = rootdir+"/var/cache/edb/counter"
|
||||
cmdline = []
|
||||
cmdline_file = "/proc/cmdline"
|
||||
if os.access(cmdline_file,os.R_OK) and os.path.isfile(cmdline_file):
|
||||
with open(cmdline_file,"r") as f:
|
||||
cmdline = f.readline().strip().split()
|
||||
|
||||
etpConst.clear()
|
||||
myConst = {
|
||||
@@ -210,6 +215,7 @@ def const_defaultSettings(rootdir):
|
||||
'community': {
|
||||
'mode': False,
|
||||
},
|
||||
'cmdline': cmdline,
|
||||
'backed_up': {},
|
||||
'installdir': '/usr/lib/entropy', # entropy default installation directory
|
||||
'packagestmpdir': ETP_DIR+ETP_TMPDIR, # etpConst['packagestmpdir'] --> temp directory
|
||||
@@ -1255,12 +1261,7 @@ def const_add_entropy_group():
|
||||
f.close()
|
||||
|
||||
def const_islive():
|
||||
if not os.path.isfile("/proc/cmdline"):
|
||||
return False
|
||||
f = open("/proc/cmdline")
|
||||
cmdline = f.readline().strip().split()
|
||||
f.close()
|
||||
if "cdroot" in cmdline:
|
||||
if "cdroot" in etpConst['cmdline']:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
+13
-13
@@ -4287,7 +4287,7 @@ class LocalRepository:
|
||||
if idpackage in user_package_mask_ids:
|
||||
# sorry, masked
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_package_mask']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
return -1,myr
|
||||
|
||||
def _idpackageValidator_user_package_unmask(self, idpackage, reponame, live):
|
||||
@@ -4303,7 +4303,7 @@ class LocalRepository:
|
||||
self.ServiceInterface.SystemSettings[mykw] = user_package_unmask_ids
|
||||
if idpackage in user_package_unmask_ids:
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_package_unmask']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
return idpackage,myr
|
||||
|
||||
def _idpackageValidator_packages_db_mask(self, idpackage, reponame, live):
|
||||
@@ -4323,7 +4323,7 @@ class LocalRepository:
|
||||
repos_mask[mask_repo_id] = repomask_ids
|
||||
if idpackage in repomask_ids:
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['repository_packages_db_mask']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
return -1,myr
|
||||
|
||||
def _idpackageValidator_package_license_mask(self, idpackage, reponame, live):
|
||||
@@ -4334,7 +4334,7 @@ class LocalRepository:
|
||||
for mylicense in mylicenses:
|
||||
if mylicense not in lic_mask: continue
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_license_mask']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
return -1,myr
|
||||
|
||||
def _idpackageValidator_keyword_mask(self, idpackage, reponame, live):
|
||||
@@ -4347,7 +4347,7 @@ class LocalRepository:
|
||||
for key in etpConst['keywords']:
|
||||
if key not in mykeywords: continue
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['system_keyword']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
return idpackage,myr
|
||||
|
||||
# if we get here, it means we didn't find mykeywords in etpConst['keywords']
|
||||
@@ -4360,7 +4360,7 @@ class LocalRepository:
|
||||
if not keyword_data: continue
|
||||
if "*" in keyword_data: # all packages in this repo with keyword "keyword" are ok
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_repo_package_keywords_all']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
return idpackage,myr
|
||||
kwd_key = "%s_ids" % (keyword,)
|
||||
keyword_data_ids = self.ServiceInterface.SystemSettings['keywords']['repositories'][reponame].get(kwd_key)
|
||||
@@ -4373,7 +4373,7 @@ class LocalRepository:
|
||||
self.ServiceInterface.SystemSettings['keywords']['repositories'][reponame][kwd_key] = keyword_data_ids
|
||||
if idpackage in keyword_data_ids:
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_repo_package_keywords']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
return idpackage,myr
|
||||
|
||||
# if we get here, it means we didn't find a match in repositories
|
||||
@@ -4396,13 +4396,13 @@ class LocalRepository:
|
||||
if idpackage in keyword_data_ids:
|
||||
# valid!
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['user_package_keywords']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = idpackage,myr
|
||||
return idpackage,myr
|
||||
|
||||
|
||||
|
||||
# function that validate one atom by reading keywords settings
|
||||
# self.ServiceInterface.package_match_validator_cache = {} >> function cache
|
||||
# self.ServiceInterface._package_match_validator_cache = {} >> function cache
|
||||
def idpackageValidator(self,idpackage, live = True):
|
||||
|
||||
if self.dbname == etpConst['clientdbid']:
|
||||
@@ -4416,12 +4416,12 @@ class LocalRepository:
|
||||
return idpackage,0
|
||||
|
||||
reponame = self.dbname[5:]
|
||||
cached = self.ServiceInterface.package_match_validator_cache.get((idpackage,reponame,live))
|
||||
cached = self.ServiceInterface._package_match_validator_cache.get((idpackage,reponame,live))
|
||||
if cached != None:
|
||||
return cached
|
||||
# avoid memleaks
|
||||
if len(self.ServiceInterface.package_match_validator_cache) > 10000:
|
||||
self.ServiceInterface.package_match_validator_cache.clear()
|
||||
if len(self.ServiceInterface._package_match_validator_cache) > 10000:
|
||||
self.ServiceInterface._package_match_validator_cache.clear()
|
||||
|
||||
if live:
|
||||
data = self._idpackageValidator_live(idpackage, reponame)
|
||||
@@ -4444,7 +4444,7 @@ class LocalRepository:
|
||||
|
||||
# holy crap, can't validate
|
||||
myr = self.ServiceInterface.SystemSettings['pkg_masking_reference']['completely_masked']
|
||||
self.ServiceInterface.package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
self.ServiceInterface._package_match_validator_cache[(idpackage,reponame,live)] = -1,myr
|
||||
return -1,myr
|
||||
|
||||
# packages filter used by atomMatch, input must me foundIDs, a list like this:
|
||||
|
||||
@@ -279,7 +279,7 @@ class SecurityInterface:
|
||||
valid = False
|
||||
skipping_keys = set()
|
||||
for a_key in affected_keys:
|
||||
match = self.Entropy.atomMatch(a_key)
|
||||
match = self.Entropy.atom_match(a_key)
|
||||
if match[0] != -1:
|
||||
# it's in the repos, it's valid
|
||||
valid = True
|
||||
|
||||
@@ -648,7 +648,7 @@ class Server(Singleton,TextInterface):
|
||||
|
||||
xdeps = dbconn.retrieveDependencies(idpackage)
|
||||
for xdep in xdeps:
|
||||
xmatch = self.atomMatch(xdep)
|
||||
xmatch = self.atom_match(xdep)
|
||||
if xmatch[0] == -1:
|
||||
deps_not_satisfied.add(xdep)
|
||||
|
||||
@@ -866,7 +866,7 @@ class Server(Singleton,TextInterface):
|
||||
header = darkgreen(" * "),
|
||||
back = True
|
||||
)
|
||||
dbconn = self.ClientService.openGenericDatabase(dbpath)
|
||||
dbconn = self.ClientService.open_generic_database(dbpath)
|
||||
dbconn.initializeDatabase()
|
||||
dbconn.commitChanges()
|
||||
dbconn.closeDB()
|
||||
@@ -1662,29 +1662,29 @@ class Server(Singleton,TextInterface):
|
||||
def get_branch_from_download_relative_uri(self, mypath):
|
||||
return self.ClientService.get_branch_from_download_relative_uri(mypath)
|
||||
|
||||
def packageSetList(self, *args, **kwargs):
|
||||
def package_set_list(self, *args, **kwargs):
|
||||
repos = etpConst['server_repositories'].keys()
|
||||
kwargs['server_repos'] = repos
|
||||
kwargs['serverInstance'] = self
|
||||
return self.ClientService.packageSetList(*args,**kwargs)
|
||||
return self.ClientService.package_set_list(*args,**kwargs)
|
||||
|
||||
def packageSetSearch(self, *args, **kwargs):
|
||||
def package_set_search(self, *args, **kwargs):
|
||||
repos = etpConst['server_repositories'].keys()
|
||||
kwargs['server_repos'] = repos
|
||||
kwargs['serverInstance'] = self
|
||||
return self.ClientService.packageSetSearch(*args,**kwargs)
|
||||
return self.ClientService.package_set_search(*args,**kwargs)
|
||||
|
||||
def packageSetMatch(self, *args, **kwargs):
|
||||
def package_set_match(self, *args, **kwargs):
|
||||
repos = etpConst['server_repositories'].keys()
|
||||
kwargs['server_repos'] = repos
|
||||
kwargs['serverInstance'] = self
|
||||
return self.ClientService.packageSetMatch(*args,**kwargs)
|
||||
return self.ClientService.package_set_match(*args,**kwargs)
|
||||
|
||||
def atomMatch(self, *args, **kwargs):
|
||||
def atom_match(self, *args, **kwargs):
|
||||
repos = etpConst['server_repositories'].keys()
|
||||
kwargs['server_repos'] = repos
|
||||
kwargs['serverInstance'] = self
|
||||
return self.ClientService.atomMatch(*args,**kwargs)
|
||||
return self.ClientService.atom_match(*args,**kwargs)
|
||||
|
||||
def scan_package_changes(self):
|
||||
|
||||
@@ -3997,7 +3997,7 @@ class MirrorsServer:
|
||||
type = "info",
|
||||
header = darkgreen(" * ")
|
||||
)
|
||||
sets_data = self.Entropy.packageSetList(matchRepo = repo)
|
||||
sets_data = self.Entropy.package_set_list(matchRepo = repo)
|
||||
if not sets_data:
|
||||
self.Entropy.updateProgress(
|
||||
"%s" % (_("None configured"),),
|
||||
|
||||
@@ -199,7 +199,7 @@ class Server(SocketHost):
|
||||
cached = self.syscache['db'].get(dbpath)
|
||||
if cached != None:
|
||||
return cached
|
||||
dbc = self.Entropy.openGenericDatabase(
|
||||
dbc = self.Entropy.open_generic_database(
|
||||
dbpath,
|
||||
xcache = False,
|
||||
readOnly = True,
|
||||
|
||||
@@ -117,7 +117,7 @@ def repositories(options):
|
||||
# match
|
||||
idpackages = []
|
||||
for package in atoms:
|
||||
match = Entropy.atomMatch(package, matchRepo = [repo], matchTag = '')
|
||||
match = Entropy.atom_match(package, matchRepo = [repo], matchTag = '')
|
||||
if (match[1] == repo):
|
||||
idpackages.append(match[0])
|
||||
else:
|
||||
@@ -142,7 +142,7 @@ def repositories(options):
|
||||
# match
|
||||
idpackages = []
|
||||
for package in atoms:
|
||||
match = Entropy.atomMatch(package, matchRepo = [repo], matchTag = '')
|
||||
match = Entropy.atom_match(package, matchRepo = [repo], matchTag = '')
|
||||
if match[1] == repo:
|
||||
idpackages.append(match[0])
|
||||
else:
|
||||
@@ -211,7 +211,7 @@ def repositories(options):
|
||||
if "world" not in myopts:
|
||||
# match
|
||||
for package in myopts:
|
||||
match = Entropy.atomMatch(package, matchRepo = [repoid])
|
||||
match = Entropy.atom_match(package, matchRepo = [repoid])
|
||||
if (match[1] == repoid):
|
||||
matches.append(match)
|
||||
else:
|
||||
@@ -358,7 +358,7 @@ def update(options):
|
||||
try:
|
||||
Entropy.quickpkg(x[0],Entropy.get_local_store_directory())
|
||||
except OSError:
|
||||
entropyTools.printTraceback()
|
||||
Entropy.entropyTools.printTraceback()
|
||||
print_info(brown(" !!! ")+bold("%s..." % (_("Ignoring broken Spm entry, please recompile it"),) ))
|
||||
|
||||
tbz2files = os.listdir(Entropy.get_local_store_directory())
|
||||
@@ -435,7 +435,7 @@ def database(options):
|
||||
dbconn = Entropy.openServerDatabase(read_only = True, no_upload = True)
|
||||
|
||||
pkglist = dbconn.listAllIdpackages(branch = from_branch)
|
||||
myatoms = options[3:]
|
||||
#myatoms = options[3:]
|
||||
|
||||
print_info(darkgreen(" * ")+red("%s %s: %s %s" % (_("These are the packages that would be marked"),to_branch,len(pkglist),_("packages"),)))
|
||||
|
||||
@@ -561,7 +561,7 @@ def database(options):
|
||||
elif (options[0] == "backup"):
|
||||
|
||||
db_path = Entropy.get_local_database_file()
|
||||
rc, err_msg = Entropy.ClientService.backupDatabase(db_path, backup_dir = os.path.dirname(db_path))
|
||||
rc, err_msg = Entropy.ClientService.backup_database(db_path, backup_dir = os.path.dirname(db_path))
|
||||
if not rc:
|
||||
print_info(darkred(" ** ")+red("%s: %s" % (_("Error"),err_msg,) ))
|
||||
return 1
|
||||
@@ -605,7 +605,7 @@ def database(options):
|
||||
if not os.path.isfile(dbpath): continue
|
||||
break
|
||||
|
||||
status, err_msg = Entropy.ClientService.restoreDatabase(dbpath, db_file)
|
||||
status, err_msg = Entropy.ClientService.restore_database(dbpath, db_file)
|
||||
if status:
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -5972,7 +5972,7 @@ class LicenseDialog:
|
||||
license_text = ''
|
||||
for package in packages:
|
||||
repoid = package[1]
|
||||
dbconn = self.Entropy.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Entropy.open_repository(repoid)
|
||||
if dbconn.isLicensedataKeyAvailable(license_identifier):
|
||||
license_text = dbconn.retrieveLicenseText(license_identifier)
|
||||
break
|
||||
@@ -6000,7 +6000,7 @@ class LicenseDialog:
|
||||
parent = self.model.append( None, [lic,True] )
|
||||
packages = licenses[lic]
|
||||
for match in packages:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(match[1])
|
||||
dbconn = self.Entropy.open_repository(match[1])
|
||||
atom = dbconn.retrieveAtom(match[0])
|
||||
self.model.append( parent, [atom,None] )
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class QueueExecutor:
|
||||
for match in self.Spritz.etpbase.unmaskingPackages:
|
||||
result = self.Entropy.unmask_match(match)
|
||||
if not result or self.Entropy.is_match_masked(match):
|
||||
dbconn = self.Entropy.openRepositoryDatabase(match[1])
|
||||
dbconn = self.Entropy.open_repository(match[1])
|
||||
atom = dbconn.retrieveAtom(match[0])
|
||||
okDialog( self.Spritz.ui.main, "%s: %s" % (_("Error enabling masked package"),atom) )
|
||||
return -2,1
|
||||
@@ -72,7 +72,7 @@ class QueueExecutor:
|
||||
runQueue = []
|
||||
conflicts_queue = []
|
||||
if install_queue:
|
||||
runQueue, conflicts_queue, status = self.Entropy.retrieveInstallQueue(install_queue,False,False)
|
||||
runQueue, conflicts_queue, status = self.Entropy.get_install_queue(install_queue,False,False)
|
||||
if removal_queue:
|
||||
removalQueue += [(x,False) for x in removal_queue if x not in conflicts_queue]
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class EntropyPackage:
|
||||
if self.pkgset:
|
||||
|
||||
# must be available!
|
||||
set_from, set_name, set_deps = EquoIntf.packageSetMatch(self.matched_atom[1:])[0]
|
||||
set_from, set_name, set_deps = EquoIntf.package_set_match(self.matched_atom[1:])[0]
|
||||
self.from_installed = False
|
||||
self.dbconn = None
|
||||
self.dummy_type = -2
|
||||
@@ -99,7 +99,7 @@ class EntropyPackage:
|
||||
|
||||
elif self.remote:
|
||||
|
||||
self.dbconn = EquoIntf.openMemoryDatabase()
|
||||
self.dbconn = EquoIntf.open_memory_database()
|
||||
idpackage, revision, mydata_upd = self.dbconn.addPackage(self.remote)
|
||||
self.matched_atom = (idpackage,matched_atom[1])
|
||||
self.from_installed = False
|
||||
@@ -110,7 +110,7 @@ class EntropyPackage:
|
||||
self.dbconn = EquoIntf.clientDbconn
|
||||
self.from_installed = True
|
||||
else:
|
||||
self.dbconn = EquoIntf.openRepositoryDatabase(matched_atom[1])
|
||||
self.dbconn = EquoIntf.open_repository(matched_atom[1])
|
||||
self.from_installed = False
|
||||
|
||||
if isinstance(self.matched_atom,tuple):
|
||||
@@ -155,7 +155,7 @@ class EntropyPackage:
|
||||
def isUserMasked(self):
|
||||
if self.from_installed:
|
||||
key, slot = self.dbconn.retrieveKeySlot(self.matched_id)
|
||||
m_id, m_r = EquoIntf.atomMatch(key, matchSlot = slot)
|
||||
m_id, m_r = EquoIntf.atom_match(key, matchSlot = slot)
|
||||
if m_id == -1: return False
|
||||
return EquoIntf.is_match_masked_by_user((m_id, m_r,))
|
||||
return EquoIntf.is_match_masked_by_user(self.matched_atom)
|
||||
@@ -163,7 +163,7 @@ class EntropyPackage:
|
||||
def isUserUnmasked(self):
|
||||
if self.from_installed:
|
||||
key, slot = self.dbconn.retrieveKeySlot(self.matched_id)
|
||||
m_id, m_r = EquoIntf.atomMatch(key, matchSlot = slot)
|
||||
m_id, m_r = EquoIntf.atom_match(key, matchSlot = slot)
|
||||
if m_id == -1: return False
|
||||
return EquoIntf.is_match_unmasked_by_user((m_id, m_r,))
|
||||
return EquoIntf.is_match_unmasked_by_user(self.matched_atom)
|
||||
@@ -235,7 +235,7 @@ class EntropyPackage:
|
||||
match = self.installed_match
|
||||
|
||||
# check if it's a system package
|
||||
s = EquoIntf.validatePackageRemoval(match[0])
|
||||
s = EquoIntf.validate_package_removal(match[0])
|
||||
return not s
|
||||
|
||||
# 0: from installed db, so it's installed for sure
|
||||
|
||||
+7
-7
@@ -72,7 +72,7 @@ class SpritzQueue:
|
||||
if type(match[1]) is int: # installed package
|
||||
dbconn = self.Entropy.clientDbconn
|
||||
else:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(match[1])
|
||||
dbconn = self.Entropy.open_repository(match[1])
|
||||
keyslot = dbconn.retrieveKeySlot(match[0])
|
||||
if keyslot in self.keyslotFilter:
|
||||
blocked.append(pkg)
|
||||
@@ -95,7 +95,7 @@ class SpritzQueue:
|
||||
|
||||
def checkSystemPackage(self, pkg):
|
||||
# check if it's a system package
|
||||
valid = self.Entropy.validatePackageRemoval(pkg.matched_atom[0])
|
||||
valid = self.Entropy.validate_package_removal(pkg.matched_atom[0])
|
||||
if not valid:
|
||||
pkg.queued = None
|
||||
return valid
|
||||
@@ -111,7 +111,7 @@ class SpritzQueue:
|
||||
newdepends = set()
|
||||
# get depends tree
|
||||
if new_proposed_idpackages_queue:
|
||||
newdepends = self.Entropy.retrieveRemovalQueue(new_proposed_idpackages_queue)
|
||||
newdepends = self.Entropy.get_removal_queue(new_proposed_idpackages_queue)
|
||||
|
||||
for idpackage in to_be_reinserted:
|
||||
if idpackage not in newdepends:
|
||||
@@ -174,7 +174,7 @@ class SpritzQueue:
|
||||
|
||||
atoms = []
|
||||
for idpackage, repoid in crying_items:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Entropy.open_repository(repoid)
|
||||
mystring = "<span foreground='%s'>%s</span>\n<small><span foreground='%s'>%s</span></small>" % (
|
||||
SpritzConf.color_title,
|
||||
dbconn.retrieveAtom(idpackage),
|
||||
@@ -242,7 +242,7 @@ class SpritzQueue:
|
||||
|
||||
xlist = [x.matched_atom[0] for x in self.packages[action[0]] if x not in pkgs]
|
||||
#toberemoved_idpackages = [x.matched_atom[0] for x in pkgs]
|
||||
mydepends = set(self.Entropy.retrieveRemovalQueue([x.matched_atom[0] for x in pkgs]))
|
||||
mydepends = set(self.Entropy.get_removal_queue([x.matched_atom[0] for x in pkgs]))
|
||||
mydependencies = set()
|
||||
myQA = self.Entropy.QA()
|
||||
for pkg in pkgs:
|
||||
@@ -365,7 +365,7 @@ class SpritzQueue:
|
||||
if status != 0:
|
||||
return status
|
||||
|
||||
(runQueue, removalQueue, status) = self.Entropy.retrieveInstallQueue(xlist,False,deep_deps, quiet = True)
|
||||
(runQueue, removalQueue, status) = self.Entropy.get_install_queue(xlist,False,deep_deps, quiet = True)
|
||||
if status == -2: # dependencies not found
|
||||
confirmDialog = self.dialogs.ConfirmationDialog( self.ui.main,
|
||||
runQueue,
|
||||
@@ -477,7 +477,7 @@ class SpritzQueue:
|
||||
return x.matched_atom[0]
|
||||
|
||||
r_cache = set(map(r_cache_map,self.packages['r']))
|
||||
removalQueue = self.Entropy.retrieveRemovalQueue(mylist)
|
||||
removalQueue = self.Entropy.get_removal_queue(mylist)
|
||||
|
||||
if removalQueue:
|
||||
todo = []
|
||||
|
||||
@@ -238,7 +238,7 @@ class EntropyPackages:
|
||||
set_matches.append((set_dep,None,))
|
||||
set_installed_matches.append((set_dep,None,))
|
||||
else:
|
||||
set_match = self.Entropy.atomMatch(set_dep)
|
||||
set_match = self.Entropy.atom_match(set_dep)
|
||||
if set_match[0] != -1: set_matches.append(set_match)
|
||||
else: install_incomplete = True
|
||||
set_installed_match = self.Entropy.clientDbconn.atomMatch(set_dep)
|
||||
@@ -338,7 +338,7 @@ class EntropyPackages:
|
||||
|
||||
def isReinstallable(self, atom, slot, revision):
|
||||
for repoid in self.Entropy.validRepositories:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Entropy.open_repository(repoid)
|
||||
idpackage, idreason = dbconn.isPackageScopeAvailable(atom, slot, revision)
|
||||
if idpackage == -1:
|
||||
continue
|
||||
@@ -346,13 +346,13 @@ class EntropyPackages:
|
||||
return None
|
||||
|
||||
def getPackageSets(self):
|
||||
return self.Entropy.packageSetList()
|
||||
return self.Entropy.package_set_list()
|
||||
|
||||
def getMaskedPackages(self):
|
||||
maskdata = []
|
||||
|
||||
for repoid in self.Entropy.validRepositories:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Entropy.open_repository(repoid)
|
||||
repodata = dbconn.listAllIdpackages(branch = etpConst['branch'], branch_operator = "<=", order_by = 'atom')
|
||||
def fm(idpackage):
|
||||
idpackage_filtered, idreason = dbconn.idpackageValidator(idpackage)
|
||||
@@ -373,7 +373,7 @@ class EntropyPackages:
|
||||
return 'rr'
|
||||
|
||||
def getInstalledMatch(self, match):
|
||||
dbconn = self.Entropy.openRepositoryDatabase(match[1])
|
||||
dbconn = self.Entropy.open_repository(match[1])
|
||||
try:
|
||||
atom, slot, revision = dbconn.getStrictScopeData(match[0])
|
||||
except TypeError:
|
||||
@@ -391,7 +391,7 @@ class EntropyPackages:
|
||||
|
||||
matched_data = set()
|
||||
for repoid in self.Entropy.validRepositories:
|
||||
dbconn = self.Entropy.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Entropy.open_repository(repoid)
|
||||
repodata = dbconn.listAllPackages(get_scope = True, branch = etpConst['branch'], branch_operator = "<=")
|
||||
mydata = {}
|
||||
for idpackage, atom, slot, revision in repodata:
|
||||
|
||||
+21
-21
@@ -748,7 +748,7 @@ class SpritzApplication(Controller):
|
||||
def on_dbBackupButton_clicked(self, widget):
|
||||
self.show_wait_window()
|
||||
self.startWorking()
|
||||
status, err_msg = self.Equo.backupDatabase(etpConst['etpdatabaseclientfilepath'])
|
||||
status, err_msg = self.Equo.backup_database(etpConst['etpdatabaseclientfilepath'])
|
||||
self.endWorking()
|
||||
if not status:
|
||||
self.hide_wait_window()
|
||||
@@ -766,9 +766,9 @@ class SpritzApplication(Controller):
|
||||
dbpath = model.get_value(myiter, 0)
|
||||
self.show_wait_window()
|
||||
self.startWorking()
|
||||
status, err_msg = self.Equo.restoreDatabase(dbpath, etpConst['etpdatabaseclientfilepath'])
|
||||
status, err_msg = self.Equo.restore_database(dbpath, etpConst['etpdatabaseclientfilepath'])
|
||||
self.endWorking()
|
||||
self.Equo.reopenClientDbconn()
|
||||
self.Equo.reopen_client_repository()
|
||||
self.resetSpritzCacheStatus()
|
||||
self.addPackages()
|
||||
if not status:
|
||||
@@ -1528,12 +1528,12 @@ class SpritzApplication(Controller):
|
||||
print "processPackageQueue: cleared caches"
|
||||
|
||||
for myrepo in remove_repos:
|
||||
self.Equo.removeRepository(myrepo)
|
||||
self.Equo.remove_repository(myrepo)
|
||||
|
||||
self.resetSpritzCacheStatus()
|
||||
if self.do_debug:
|
||||
print "processPackageQueue: closed repo dbs"
|
||||
self.Equo.reopenClientDbconn()
|
||||
self.Equo.reopen_client_repository()
|
||||
if self.do_debug:
|
||||
print "processPackageQueue: cleared caches (again)"
|
||||
# regenerate packages information
|
||||
@@ -1651,7 +1651,7 @@ class SpritzApplication(Controller):
|
||||
if not matches:
|
||||
# resolve atoms ?
|
||||
for atom in atoms:
|
||||
match = self.Equo.atomMatch(atom)
|
||||
match = self.Equo.atom_match(atom)
|
||||
if match[0] != -1:
|
||||
matches.add(match)
|
||||
if not matches:
|
||||
@@ -1760,7 +1760,7 @@ class SpritzApplication(Controller):
|
||||
path = iterdata[0].get_path(iterdata[1])[0]
|
||||
if path > 0 and idx > 0:
|
||||
idx -= 1
|
||||
self.Equo.shiftRepository(repoid, idx)
|
||||
self.Equo.shift_repository(repoid, idx)
|
||||
# get next iter
|
||||
prev = iterdata[0].get_iter(path-1)
|
||||
self.repoView.store.swap(iterdata[1],prev)
|
||||
@@ -1771,7 +1771,7 @@ class SpritzApplication(Controller):
|
||||
next = iterdata[0].iter_next(iterdata[1])
|
||||
if next:
|
||||
idx += 1
|
||||
self.Equo.shiftRepository(repoid, idx)
|
||||
self.Equo.shift_repository(repoid, idx)
|
||||
self.repoView.store.swap(iterdata[1],next)
|
||||
|
||||
def on_mirrorDown_clicked( self, widget ):
|
||||
@@ -1861,9 +1861,9 @@ class SpritzApplication(Controller):
|
||||
disable = False
|
||||
if etpRepositoriesExcluded.has_key(repodata['repoid']):
|
||||
disable = True
|
||||
self.Equo.removeRepository(repodata['repoid'], disable = disable)
|
||||
self.Equo.remove_repository(repodata['repoid'], disable = disable)
|
||||
if not disable:
|
||||
self.Equo.addRepository(repodata)
|
||||
self.Equo.add_repository(repodata)
|
||||
self.resetSpritzCacheStatus()
|
||||
|
||||
self.setupRepoView()
|
||||
@@ -1885,7 +1885,7 @@ class SpritzApplication(Controller):
|
||||
# 2-3 more cycles than having unattended
|
||||
# behaviours
|
||||
self.Equo.SystemSettings.clear()
|
||||
self.Equo.closeAllRepositoryDatabases()
|
||||
self.Equo.close_all_repositories()
|
||||
|
||||
def __validateRepoSubmit(self, repodata, edit = False):
|
||||
errors = []
|
||||
@@ -1934,7 +1934,7 @@ class SpritzApplication(Controller):
|
||||
# validate
|
||||
errors = self.__validateRepoSubmit(repodata)
|
||||
if not errors:
|
||||
self.Equo.addRepository(repodata)
|
||||
self.Equo.add_repository(repodata)
|
||||
self.resetSpritzCacheStatus()
|
||||
self.setupRepoView()
|
||||
self.addrepo_ui.addRepoWin.hide()
|
||||
@@ -1969,7 +1969,7 @@ class SpritzApplication(Controller):
|
||||
if repoid == etpConst['officialrepositoryid']:
|
||||
okDialog( self.ui.main, _("You! Why do you want to remove the main repository ?"))
|
||||
return True
|
||||
self.Equo.removeRepository(repoid)
|
||||
self.Equo.remove_repository(repoid)
|
||||
self.resetSpritzCacheStatus()
|
||||
self.setupRepoView()
|
||||
msg = "%s '%s' %s '%s' %s" % (_("You must now either press the"),_("Update Repositories"),_("or the"),_("Regenerate Cache"),_("now"))
|
||||
@@ -2131,9 +2131,9 @@ class SpritzApplication(Controller):
|
||||
return
|
||||
|
||||
def clean_n_quit(newrepo):
|
||||
self.Equo.removeRepository(newrepo)
|
||||
self.Equo.remove_repository(newrepo)
|
||||
self.resetSpritzCacheStatus()
|
||||
self.Equo.reopenClientDbconn()
|
||||
self.Equo.reopen_client_repository()
|
||||
# regenerate packages information
|
||||
self.setupSpritz()
|
||||
|
||||
@@ -2361,7 +2361,7 @@ class SpritzApplication(Controller):
|
||||
if type(repoid) is int:
|
||||
dbconn = self.Equo.clientDbconn
|
||||
else:
|
||||
dbconn = self.Equo.openRepositoryDatabase(repoid)
|
||||
dbconn = self.Equo.open_repository(repoid)
|
||||
if dbconn.isLicensedataKeyAvailable(license_identifier):
|
||||
license_text = dbconn.retrieveLicenseText(license_identifier)
|
||||
found = True
|
||||
@@ -2526,7 +2526,7 @@ class SpritzApplication(Controller):
|
||||
|
||||
def on_pkgsetAddButton_clicked(self, widget):
|
||||
|
||||
current_sets = self.Equo.packageSetList()
|
||||
current_sets = self.Equo.package_set_list()
|
||||
def fake_callback(s):
|
||||
if (s not in current_sets) and (" " not in s) and (not s.startswith(etpConst['packagesetprefix'])):
|
||||
return True
|
||||
@@ -2535,7 +2535,7 @@ class SpritzApplication(Controller):
|
||||
def lv_callback(atom):
|
||||
c_id, c_rc = self.Equo.clientDbconn.atomMatch(atom)
|
||||
if c_id != -1: return True
|
||||
c_id, c_rc = self.Equo.atomMatch(atom)
|
||||
c_id, c_rc = self.Equo.atom_match(atom)
|
||||
if c_id != -1: return True
|
||||
return False
|
||||
|
||||
@@ -2566,7 +2566,7 @@ class SpritzApplication(Controller):
|
||||
if set_from == etpConst['userpackagesetsid']:
|
||||
return set_name
|
||||
return 0
|
||||
avail_pkgsets = [x for x in map(mymf,self.Equo.packageSetList()) if x != 0]
|
||||
avail_pkgsets = [x for x in map(mymf,self.Equo.package_set_list()) if x != 0]
|
||||
|
||||
def fake_callback(s):
|
||||
return s
|
||||
@@ -2606,7 +2606,7 @@ class SpritzApplication(Controller):
|
||||
found_deps = set()
|
||||
not_all = False
|
||||
for dep in deps_not_matched:
|
||||
match = self.Equo.atomMatch(dep)
|
||||
match = self.Equo.atom_match(dep)
|
||||
if match[0] != -1:
|
||||
found_deps.add(dep)
|
||||
continue
|
||||
@@ -2617,7 +2617,7 @@ class SpritzApplication(Controller):
|
||||
for c_idpackage in c_idpackages:
|
||||
key, slot = self.Equo.clientDbconn.retrieveKeySlot(c_idpackage)
|
||||
key_slot = "%s:%s" % (key,slot,)
|
||||
match = self.Equo.atomMatch(key, matchSlot = slot)
|
||||
match = self.Equo.atom_match(key, matchSlot = slot)
|
||||
cmpstat = 0
|
||||
if match[0] != -1:
|
||||
cmpstat = self.Equo.get_package_action(match)
|
||||
|
||||
+8
-8
@@ -747,7 +747,7 @@ class EntropyPackageView:
|
||||
|
||||
exp_atoms = set()
|
||||
for pkgset in pkgsets:
|
||||
exp_atoms |= self.Equo.packageSetExpand(pkgset)
|
||||
exp_atoms |= self.Equo.package_set_expand(pkgset)
|
||||
|
||||
exp_matches = set()
|
||||
if remove_action:
|
||||
@@ -757,7 +757,7 @@ class EntropyPackageView:
|
||||
exp_matches.add(exp_match)
|
||||
else:
|
||||
for exp_atom in exp_atoms:
|
||||
exp_match = self.Equo.atomMatch(exp_atom)
|
||||
exp_match = self.Equo.atom_match(exp_atom)
|
||||
if exp_match[0] == -1: continue
|
||||
exp_matches.add(exp_match)
|
||||
|
||||
@@ -841,9 +841,9 @@ class EntropyPackageView:
|
||||
repo_objs = []
|
||||
for idpackage,rid in exp_matches:
|
||||
key, slot = self.Equo.clientDbconn.retrieveKeySlot(idpackage)
|
||||
if not self.Equo.validatePackageRemoval(idpackage):
|
||||
if not self.Equo.validate_package_removal(idpackage):
|
||||
continue
|
||||
mymatch = self.Equo.atomMatch(key, matchSlot = slot)
|
||||
mymatch = self.Equo.atom_match(key, matchSlot = slot)
|
||||
if mymatch[0] == -1: continue
|
||||
yp, new = self.etpbase.getPackageItem(mymatch,True)
|
||||
repo_objs.append(yp)
|
||||
@@ -942,7 +942,7 @@ class EntropyPackageView:
|
||||
objs = []
|
||||
for x in self.selected_objs:
|
||||
key, slot = x.keyslot
|
||||
m = self.Equo.atomMatch(key, matchSlot = slot)
|
||||
m = self.Equo.atom_match(key, matchSlot = slot)
|
||||
if m[0] != -1: objs.append(m)
|
||||
|
||||
busyCursor(self.main_window)
|
||||
@@ -1131,7 +1131,7 @@ class EntropyPackageView:
|
||||
mydummy = DummyEntropyPackage(namedesc = cat_text, dummy_type = SpritzConf.dummy_category, onlyname = category)
|
||||
mydummy.color = SpritzConf.color_package_category
|
||||
if pkgsets:
|
||||
set_data = self.Equo.packageSetMatch(category)[0]
|
||||
set_data = self.Equo.package_set_match(category)[0]
|
||||
if not set_data: continue
|
||||
set_from, set_name, set_deps = set_data
|
||||
mydummy.set_category = category
|
||||
@@ -1686,10 +1686,10 @@ class EntropyRepoView:
|
||||
if repoid != etpConst['officialrepositoryid']:
|
||||
if state:
|
||||
self.store.set_value(myiter,1, not state)
|
||||
self.Equo.disableRepository(repoid)
|
||||
self.Equo.disable_repository(repoid)
|
||||
initConfig_entropyConstants(etpSys['rootdir'])
|
||||
else:
|
||||
self.Equo.enableRepository(repoid)
|
||||
self.Equo.enable_repository(repoid)
|
||||
initConfig_entropyConstants(etpSys['rootdir'])
|
||||
self.Spritz.resetSpritzCacheStatus()
|
||||
self.Spritz.addPackages(back_to_page = "repos")
|
||||
|
||||
Reference in New Issue
Block a user