some work on enzyme, portageTools and equo
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@456 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
43
client/equo
43
client/equo
@@ -22,10 +22,7 @@
|
||||
|
||||
import sys
|
||||
import string
|
||||
import equoTools
|
||||
import entropyTools
|
||||
from entropyConstants import *
|
||||
from clientConstants import *
|
||||
sys.path.append('../libraries')
|
||||
from outputTools import *
|
||||
|
||||
# CONSTANTS
|
||||
@@ -71,34 +68,40 @@ def print_help():
|
||||
|
||||
print_info(" \t"+blue("database")+brown("\t handle installed packages database"))
|
||||
print_info(" \t\t"+darkgreen("generate")+red("\t\t generate installed packages database"))
|
||||
print_info(" \t\t"+red("--exact")+"\t\t only install packages whose version match exactly")
|
||||
print_info(" \t"+blue("cleanup")+brown("\t\t remove downloaded packages and clean temporary directories"))
|
||||
|
||||
options = sys.argv[1:]
|
||||
|
||||
# preliminary options parsing
|
||||
_options = []
|
||||
for opt in options:
|
||||
if (opt == "--nocolor"):
|
||||
entropyTools.nocolor()
|
||||
elif (opt == "--debug"):
|
||||
entropyTools.enableDebug()
|
||||
else:
|
||||
_options.append(opt)
|
||||
options = _options
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
entropyTools.print_generic(APPNAME+": "+APPVERSION)
|
||||
print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
entropyTools.print_error("not enough parameters")
|
||||
print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
import equoTools
|
||||
import entropyTools
|
||||
from entropyConstants import *
|
||||
from clientConstants import *
|
||||
|
||||
# preliminary options parsing
|
||||
_options = []
|
||||
for opt in options:
|
||||
if (opt == "--nocolor"):
|
||||
nocolor()
|
||||
elif (opt == "--debug"):
|
||||
entropyTools.enableDebug()
|
||||
else:
|
||||
_options.append(opt)
|
||||
options = _options
|
||||
|
||||
|
||||
try:
|
||||
# sync mirrors tool
|
||||
if (options[0] == "update") or (options[0] == "repoinfo") or (options[0] == "status"):
|
||||
@@ -132,8 +135,8 @@ except SystemExit:
|
||||
pass
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
except Timeout:
|
||||
pass
|
||||
#except Timeout:
|
||||
# pass
|
||||
except:
|
||||
from entropyTools import askquestion
|
||||
from remoteTools import getOnlineContent, reportApplicationError
|
||||
|
||||
@@ -31,7 +31,7 @@ from entropyConstants import *
|
||||
from clientConstants import *
|
||||
from outputTools import *
|
||||
from remoteTools import downloadData, getOnlineContent
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, dep_getcpv, isjustname, dep_getkey, compareVersions as entropyCompareVersions, catpkgsplit, filterDuplicatedEntries, extactDuplicatedEntries, isspecific, uncompressTarBz2, extractXpak, filterDuplicatedEntries, applicationLockCheck, countdown
|
||||
from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTimeToHumanTime, askquestion, getRandomNumber, dep_getcpv, isjustname, dep_getkey, compareVersions as entropyCompareVersions, catpkgsplit, filterDuplicatedEntries, extactDuplicatedEntries, isspecific, uncompressTarBz2, extractXpak, filterDuplicatedEntries, applicationLockCheck, countdown, dep_striptag, istagged
|
||||
from databaseTools import etpDatabase
|
||||
import xpak
|
||||
import time
|
||||
@@ -326,6 +326,8 @@ def atomMatchInRepository(atom, dbconn, caseSensitive = True):
|
||||
strippedAtom = string.join(strippedAtom.split("-t")[:len(strippedAtom.split("-t"))-1],"-t")
|
||||
# get version
|
||||
data = 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"):
|
||||
@@ -411,7 +413,7 @@ def atomMatchInRepository(atom, dbconn, caseSensitive = True):
|
||||
|
||||
if (foundIDs):
|
||||
# now we have to handle direction
|
||||
if (direction):
|
||||
if (direction) or (direction == '' and not justname) or (direction == '' and not justname and strippedAtom.endswith("*")):
|
||||
# check if direction is used with justname, in this case, return an error
|
||||
if (justname):
|
||||
#print "justname"
|
||||
@@ -419,8 +421,11 @@ def atomMatchInRepository(atom, dbconn, caseSensitive = True):
|
||||
atomMatchInRepositoryCache[atom]['dbconn'] = dbconn
|
||||
atomMatchInRepositoryCache[atom]['result'] = -1,3
|
||||
return -1,3 # error, cannot use directions when not specifying version
|
||||
|
||||
if (direction == "~") or (direction == "="): # any revision within the version specified OR the specified version
|
||||
|
||||
if (direction == "~") or (direction == "=") or (direction == '' and not justname) or (direction == '' and not justname and strippedAtom.endswith("*")): # any revision within the version specified OR the specified version
|
||||
|
||||
if (direction == '' and not justname):
|
||||
direction = "="
|
||||
|
||||
#print direction+" direction"
|
||||
# remove revision (-r0 if none)
|
||||
@@ -442,8 +447,9 @@ def atomMatchInRepository(atom, dbconn, caseSensitive = True):
|
||||
# media-libs/test-1.2* support
|
||||
if pkgversion.endswith("*"):
|
||||
testpkgver = pkgversion[:len(pkgversion)-1]
|
||||
combodb = dbtag+dbver
|
||||
combopkg = pkgtag+testpkgver
|
||||
#print testpkgver
|
||||
combodb = dbver+dbtag
|
||||
combopkg = testpkgver+pkgtag
|
||||
#print combodb
|
||||
#print combopkg
|
||||
if combodb.startswith(combopkg):
|
||||
@@ -1043,8 +1049,8 @@ def generateDependencyTree(atomInfo, emptydeps = False):
|
||||
else:
|
||||
# found, get its deps
|
||||
mydeps = getDependencies(atom)
|
||||
if (emptydeps):
|
||||
mydeps = filterSatisfiedDependencies(mydeps)
|
||||
if (not emptydeps):
|
||||
mydeps, xxx = filterSatisfiedDependencies(mydeps)
|
||||
for dep in mydeps:
|
||||
remainingDeps.append(dep)
|
||||
xmatch = atomMatchInRepository(undep,clientDbconn)
|
||||
@@ -1193,7 +1199,6 @@ def generateRemovalTree(idpackages, output = False):
|
||||
xatom = clientDbconn.retrieveAtom(x)
|
||||
xdep = clientDbconn.searchDepends(dep_getkey(xatom))
|
||||
dictDeps[x] = set(xdep)
|
||||
|
||||
|
||||
remainingDeps = dependencies[:]
|
||||
dependencies = set(dependencies)
|
||||
@@ -1219,9 +1224,13 @@ def generateRemovalTree(idpackages, output = False):
|
||||
depends = dictDeps[dep].copy()
|
||||
#print "--------"
|
||||
#print depends
|
||||
#print clientDbconn.retrieveAtom(dep)
|
||||
#atx = clientDbconn.retrieveAtom(dep)
|
||||
#if atx.find("virtual/jdk") != -1:
|
||||
#print atx
|
||||
#print "--------"
|
||||
|
||||
|
||||
|
||||
for depend in depends:
|
||||
if depend in treeview:
|
||||
#print "changed"
|
||||
@@ -1789,7 +1798,7 @@ def database(options):
|
||||
databaseExactMatch = False
|
||||
_options = []
|
||||
for opt in options:
|
||||
if opt == "--exact":
|
||||
if opt == "--exact": # removed
|
||||
databaseExactMatch = True
|
||||
else:
|
||||
_options.append(opt)
|
||||
@@ -1843,10 +1852,7 @@ def database(options):
|
||||
missingPackages = portagePackages[:]
|
||||
for portagePackage in portagePackages: # for portagePackage in remainingPackages
|
||||
print_info(red(" Analyzing ")+bold(portagePackage), back = True)
|
||||
if (databaseExactMatch):
|
||||
data = atomMatch("="+portagePackage)
|
||||
else:
|
||||
data = atomMatch(portagePackage)
|
||||
data = atomMatch("~"+portagePackage)
|
||||
if (data[0] != -1):
|
||||
foundPackages.append(data)
|
||||
missingPackages.remove(portagePackage)
|
||||
|
||||
@@ -301,6 +301,20 @@ def pkgsplit(mypkg,silent=1):
|
||||
else:
|
||||
return None
|
||||
|
||||
def dep_striptag(mydepx):
|
||||
mydep = mydepx[:]
|
||||
if not isjustname(mydep):
|
||||
if mydep.split("-")[len(mydep.split("-"))-1].endswith("t"): # tag -> remove
|
||||
tag = mydep.split("-")[len(mydep.split("-"))-1]
|
||||
mydep = mydep[:len(mydep)-len(tag)-2]
|
||||
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.
|
||||
@@ -315,10 +329,7 @@ def dep_getkey(mydepx):
|
||||
@return: The package category/package-version
|
||||
"""
|
||||
mydep = mydepx[:]
|
||||
if not isjustname(mydep):
|
||||
if mydep.split("-")[len(mydep.split("-"))-1].endswith("t"): # tag -> remove
|
||||
tag = mydep.split("-")[len(mydep.split("-"))-1]
|
||||
mydep = mydep[:len(mydep)-len(tag)-2]
|
||||
mydep = dep_striptag(mydep)
|
||||
|
||||
mydep = dep_getcpv(mydep)
|
||||
if mydep and isspecific(mydep):
|
||||
|
||||
@@ -280,7 +280,7 @@ def build(atoms):
|
||||
atoms = "="+atoms[0]
|
||||
|
||||
if (not enzymeRequestForceRepackage):
|
||||
print_info(green(" Sanity check on packages..."))
|
||||
print_info(green(" Checking packages..."))
|
||||
atomdeps, atomconflicts = calculateFullAtomsDependencies(atoms,enzymeRequestDeep)
|
||||
for conflict in atomconflicts:
|
||||
if getInstalledAtom(conflict) is not None:
|
||||
|
||||
@@ -95,6 +95,8 @@ def getPackagesInSystem():
|
||||
for z in y:
|
||||
sysoutput.append(z)
|
||||
sysoutput.append("sys-kernel/linux-sabayon") # our kernel
|
||||
sysoutput.append("dev-db/sqlite") # our interface
|
||||
sysoutput.append("dev-python/pysqlite") # our python interface to our interface (lol)
|
||||
return sysoutput
|
||||
|
||||
def getConfigProtectAndMask():
|
||||
@@ -154,6 +156,7 @@ def calculateFullAtomsDependencies(atoms, deep = False, extraopts = ""):
|
||||
useflags += getUSEFlags()
|
||||
useflags += "' "
|
||||
|
||||
# FIXME: rewrite this
|
||||
cmd = useflags+cdbRunEmerge+" --pretend --color=n --quiet "+deepOpt+" "+extraopts+" "+atoms
|
||||
result = commands.getoutput(cmd).split("\n")
|
||||
for line in result:
|
||||
@@ -185,26 +188,178 @@ def calculateFullAtomsDependencies(atoms, deep = False, extraopts = ""):
|
||||
sys.exit(100)
|
||||
|
||||
|
||||
def calculateAtomUSEFlags(atom):
|
||||
def calculateAtomUSEFlags(atom, format = True):
|
||||
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"calculateAtomUSEFlags: called -> "+str(atom))
|
||||
|
||||
try:
|
||||
useflags = "USE='"+os.environ['USE']+"' "
|
||||
except:
|
||||
useflags = ""
|
||||
cmd = useflags+cdbRunEmerge+" --pretend --color=n --nodeps --quiet --verbose "+atom
|
||||
result = commands.getoutput(cmd).split("\n")
|
||||
useparm = ""
|
||||
for line in result:
|
||||
if line.startswith("[ebuild") and (line.find("USE=") != -1):
|
||||
useparm = line.split('USE="')[len(line.split('USE="'))-1].split('"')[0].strip()
|
||||
useparm = useparm.split()
|
||||
_useparm = []
|
||||
|
||||
uses = getUSEFlags()
|
||||
uses = uses.split()
|
||||
iuses = getPackageIUSE(atom)
|
||||
iuses = iuses.split()
|
||||
olduses = getInstalledPackageVar(atom,'USE') # FIXME: this should be a key and the function should handle slots
|
||||
olduses = olduses.split()
|
||||
useforce = getUSEForce()
|
||||
usemask = getUSEMask()
|
||||
|
||||
iuses.sort()
|
||||
|
||||
useparm = []
|
||||
for iuse in iuses:
|
||||
if iuse in uses:
|
||||
if iuse in olduses:
|
||||
useparm.append(iuse)
|
||||
else:
|
||||
useparm.append(iuse+"*")
|
||||
else:
|
||||
if iuse in olduses:
|
||||
useparm.append("-"+iuse+"*")
|
||||
elif iuse in useforce:
|
||||
useparm.append("("+iuse+")")
|
||||
else:
|
||||
if iuse in usemask:
|
||||
useparm.append("(-"+iuse+")")
|
||||
else:
|
||||
useparm.append("-"+iuse)
|
||||
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"calculateAtomUSEFlags: USE flags -> "+str(useparm))
|
||||
|
||||
for use in useparm:
|
||||
# pack properly
|
||||
enabled = []
|
||||
new = []
|
||||
disabled = []
|
||||
disabled_new = []
|
||||
impossible = []
|
||||
|
||||
for x in useparm:
|
||||
if x.startswith("("):
|
||||
impossible.append(x)
|
||||
elif x.startswith("-") and not x.endswith("*"):
|
||||
disabled.append(x)
|
||||
elif x.startswith("-") and x.endswith("*"):
|
||||
disabled_new.append(x)
|
||||
elif x.endswith("*"):
|
||||
new.append(x)
|
||||
else:
|
||||
enabled.append(x)
|
||||
|
||||
useparm = []
|
||||
useparm = enabled
|
||||
if (new):
|
||||
useparm += new
|
||||
if (disabled_new):
|
||||
useparm += disabled_new
|
||||
if (disabled):
|
||||
useparm += disabled
|
||||
if (impossible):
|
||||
useparm += impossible
|
||||
|
||||
|
||||
linguas = []
|
||||
video_cards = []
|
||||
input_devices = []
|
||||
lirc_devices = []
|
||||
alsa_pcm_plugins = []
|
||||
alsa_cards = []
|
||||
if (format):
|
||||
linguas = [x for x in useparm if x.startswith("linguas_") or x.startswith("-linguas_")]
|
||||
if (linguas):
|
||||
useparm = [x for x in useparm if not x.startswith("linguas_") and not x.startswith("-linguas_")]
|
||||
linguas_en = [x[8:] for x in linguas if not x.startswith("-")]
|
||||
linguas_dis = ["-"+x[9:] for x in linguas if x.startswith("-")]
|
||||
linguas = linguas_en
|
||||
linguas += linguas_dis
|
||||
linguas = string.join(linguas," ")
|
||||
|
||||
video_cards = [x for x in useparm if x.startswith("video_cards_") or x.startswith("-video_cards_") or x.startswith("(video_cards_") or x.startswith("(-video_cards_")]
|
||||
if (video_cards):
|
||||
useparm = [x for x in useparm if not x.startswith("video_cards_") and not x.startswith("-video_cards_") and not x.startswith("(video_cards_") and not x.startswith("(-video_cards_")]
|
||||
cards_en = [x[12:] for x in video_cards if not x.startswith("-") and not x.startswith("(")]
|
||||
cards_dis = ["-"+x[13:] for x in video_cards if x.startswith("-")]
|
||||
cards_impossible = ["(-"+x[14:] for x in video_cards if x.startswith("(")]
|
||||
video_cards = cards_en
|
||||
video_cards += cards_dis
|
||||
video_cards += cards_impossible
|
||||
video_cards = string.join(video_cards," ")
|
||||
|
||||
input_devices = [x for x in useparm if x.startswith("input_devices_") or x.startswith("-input_devices_") or x.startswith("(input_devices_") or x.startswith("(-input_devices_")]
|
||||
if (input_devices):
|
||||
useparm = [x for x in useparm if not x.startswith("input_devices_") and not x.startswith("-input_devices_") and not x.startswith("(input_devices_") and not x.startswith("(-video_cards_")]
|
||||
input_en = [x[14:] for x in input_devices if not x.startswith("-") and not x.startswith("(")]
|
||||
input_dis = ["-"+x[15:] for x in input_devices if x.startswith("-")]
|
||||
input_impossible = ["(-"+x[16:] for x in input_devices if x.startswith("(")]
|
||||
input_devices = input_en
|
||||
input_devices += input_dis
|
||||
input_devices += input_impossible
|
||||
input_devices = string.join(input_devices," ")
|
||||
|
||||
lirc_devices = [x for x in useparm if x.startswith("lirc_devices_") or x.startswith("-lirc_devices_") or x.startswith("(lirc_devices_") or x.startswith("(-lirc_devices_")]
|
||||
if (lirc_devices):
|
||||
useparm = [x for x in useparm if not x.startswith("lirc_devices_") and not x.startswith("-lirc_devices_") and not x.startswith("(lirc_devices_") and not x.startswith("(-lirc_devices_")]
|
||||
lirc_en = [x[13:] for x in lirc_devices if not x.startswith("-") and not x.startswith("(")]
|
||||
lirc_dis = ["-"+x[14:] for x in lirc_devices if x.startswith("-")]
|
||||
lirc_impossible = ["(-"+x[15:] for x in lirc_devices if x.startswith("(")]
|
||||
lirc_devices = lirc_en
|
||||
lirc_devices += lirc_dis
|
||||
lirc_devices += lirc_impossible
|
||||
lirc_devices = string.join(lirc_devices," ")
|
||||
|
||||
alsa_pcm_plugins = [x for x in useparm if x.startswith("alsa_pcm_plugins_") or x.startswith("-alsa_pcm_plugins_") or x.startswith("(alsa_pcm_plugins_") or x.startswith("(-alsa_pcm_plugins_")]
|
||||
if (alsa_pcm_plugins):
|
||||
useparm = [x for x in useparm if not x.startswith("alsa_pcm_plugins_") and not x.startswith("-alsa_pcm_plugins_") and not x.startswith("(alsa_pcm_plugins_") and not x.startswith("(-alsa_pcm_plugins_")]
|
||||
alsa_en = [x[17:] for x in alsa_pcm_plugins if not x.startswith("-") and not x.startswith("(")]
|
||||
alsa_dis = ["-"+x[18:] for x in alsa_pcm_plugins if x.startswith("-")]
|
||||
alsa_impossible = ["(-"+x[19:] for x in alsa_pcm_plugins if x.startswith("(")]
|
||||
alsa_pcm_plugins = alsa_en
|
||||
alsa_pcm_plugins += alsa_dis
|
||||
alsa_pcm_plugins += alsa_impossible
|
||||
alsa_pcm_plugins = string.join(alsa_pcm_plugins," ")
|
||||
|
||||
alsa_cards = [x for x in useparm if x.startswith("alsa_cards_") or x.startswith("-alsa_cards_") or x.startswith("(alsa_cards_") or x.startswith("(-alsa_cards_")]
|
||||
if (alsa_cards):
|
||||
useparm = [x for x in useparm if not x.startswith("alsa_cards_") and not x.startswith("-alsa_cards_") and not x.startswith("(alsa_cards_") and not x.startswith("(-alsa_cards_")]
|
||||
alsa_en = [x[11:] for x in alsa_cards if not x.startswith("-") and not x.startswith("(")]
|
||||
alsa_dis = ["-"+x[12:] for x in alsa_cards if x.startswith("-")]
|
||||
alsa_impossible = ["(-"+x[13:] for x in alsa_cards if x.startswith("(")]
|
||||
alsa_cards = alsa_en
|
||||
alsa_cards += alsa_dis
|
||||
alsa_cards += alsa_impossible
|
||||
alsa_cards = string.join(alsa_cards," ")
|
||||
|
||||
useparm = string.join(useparm," ")
|
||||
useparm = colorizeUseflags(useparm)
|
||||
if (format):
|
||||
if (linguas):
|
||||
linguas = colorizeUseflags(linguas)
|
||||
linguas = bold(" LINGUAS=( ")+linguas+bold(" )")
|
||||
useparm += linguas
|
||||
if (video_cards):
|
||||
video_cards = colorizeUseflags(video_cards)
|
||||
video_cards = bold(" VIDEO_CARDS=( ")+video_cards+bold(" )")
|
||||
useparm += video_cards
|
||||
if (input_devices):
|
||||
input_devices = colorizeUseflags(input_devices)
|
||||
input_devices = bold(" INPUT_DEVICES=( ")+input_devices+bold(" )")
|
||||
useparm += input_devices
|
||||
if (lirc_devices):
|
||||
lirc_devices = colorizeUseflags(lirc_devices)
|
||||
lirc_devices = bold(" LIRC_DEVICES=( ")+lirc_devices+bold(" )")
|
||||
useparm += lirc_devices
|
||||
if (alsa_pcm_plugins):
|
||||
alsa_pcm_plugins = colorizeUseflags(alsa_pcm_plugins)
|
||||
alsa_pcm_plugins = bold(" ALSA_PCM_PLUGINS=( ")+alsa_pcm_plugins+bold(" )")
|
||||
useparm += alsa_pcm_plugins
|
||||
if (alsa_cards):
|
||||
alsa_cards = colorizeUseflags(alsa_cards)
|
||||
alsa_cards = bold(" ALSA_CARDS=( ")+alsa_cards+bold(" )")
|
||||
useparm += alsa_cards
|
||||
|
||||
return useparm
|
||||
|
||||
|
||||
def colorizeUseflags(usestring):
|
||||
out = []
|
||||
for use in usestring.split():
|
||||
# -cups
|
||||
if use.startswith("-") and (not use.endswith("*")):
|
||||
use = darkblue(use)
|
||||
@@ -219,10 +374,8 @@ def calculateAtomUSEFlags(atom):
|
||||
use = green(use)
|
||||
else:
|
||||
use = darkred(use)
|
||||
_useparm.append(use)
|
||||
useparm = string.join(_useparm," ")
|
||||
return useparm
|
||||
|
||||
out.append(use)
|
||||
return string.join(out," ")
|
||||
|
||||
# should be only used when a pkgcat/pkgname <-- is not specified (example: db, amarok, AND NOT media-sound/amarok)
|
||||
def getAtomCategory(atom):
|
||||
@@ -617,26 +770,44 @@ def getPackageDependencyList(atom):
|
||||
return pkgSplittedDeps
|
||||
|
||||
def getUSEFlags():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getUSEFlags: called. ")
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getUSEFlags: called.")
|
||||
return portage.settings['USE']
|
||||
|
||||
def getUSEForce():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getUSEForce: called.")
|
||||
return portage.settings.useforce
|
||||
|
||||
def getUSEMask():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getUSEMask: called.")
|
||||
return portage.settings.usemask
|
||||
|
||||
def getMAKEOPTS():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getMAKEOPTS: called. ")
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getMAKEOPTS: called.")
|
||||
return portage.settings['MAKEOPTS']
|
||||
|
||||
def getCFLAGS():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getCFLAGS: called. ")
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getCFLAGS: called.")
|
||||
return portage.settings['CFLAGS']
|
||||
|
||||
def getLDFLAGS():
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getLDFLAGS: called. ")
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getLDFLAGS: called.")
|
||||
return portage.settings['LDFLAGS']
|
||||
|
||||
# you must provide a complete atom
|
||||
def getPackageIUSE(atom):
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getPackageIUSE: called. ")
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getPackageIUSE: called.")
|
||||
return getPackageVar(atom,"IUSE")
|
||||
|
||||
def getInstalledPackageVar(atom, var):
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getInstalledPackageVar: called.")
|
||||
try:
|
||||
if atom.startswith("="):
|
||||
return portage.db['/']['vartree'].dbapi.aux_get(atom[1:], [var])[0]
|
||||
else:
|
||||
return portage.db['/']['vartree'].dbapi.aux_get(atom, [var])[0]
|
||||
except:
|
||||
return ''
|
||||
|
||||
def getPackageVar(atom,var):
|
||||
portageLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"getPackageVar: called -> "+atom+" | var: "+var)
|
||||
if atom.startswith("="):
|
||||
|
||||
35
server/activator
vendored
35
server/activator
vendored
@@ -27,10 +27,6 @@ import sys
|
||||
import string
|
||||
|
||||
sys.path.append('../libraries')
|
||||
import entropyTools
|
||||
import activatorTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
from outputTools import *
|
||||
|
||||
# CONSTANTS
|
||||
@@ -62,6 +58,23 @@ def print_help():
|
||||
|
||||
options = sys.argv[1:]
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
import entropyTools
|
||||
import activatorTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
|
||||
# preliminary options parsing
|
||||
_options = []
|
||||
for opt in options:
|
||||
@@ -73,20 +86,8 @@ for opt in options:
|
||||
_options.append(opt)
|
||||
options = _options
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
entropyTools.print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
entropyTools.print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
if (not entropyTools.isRoot()):
|
||||
entropyTools.print_error("you must be root in order to run "+APPNAME)
|
||||
print_error("you must be root in order to run "+APPNAME)
|
||||
sys.exit(2)
|
||||
|
||||
# sync mirrors tool
|
||||
|
||||
@@ -27,10 +27,6 @@ import sys
|
||||
import string
|
||||
|
||||
sys.path.append('../libraries')
|
||||
import entropyTools
|
||||
import enzymeTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
from outputTools import *
|
||||
|
||||
# CONSTANTS
|
||||
@@ -90,6 +86,23 @@ def print_help():
|
||||
|
||||
options = sys.argv[1:]
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
import entropyTools
|
||||
import enzymeTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
|
||||
# preliminary options parsing
|
||||
_options = []
|
||||
for opt in options:
|
||||
@@ -101,20 +114,8 @@ for opt in options:
|
||||
_options.append(opt)
|
||||
options = _options
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
entropyTools.print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
entropyTools.print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
if (not entropyTools.isRoot()):
|
||||
entropyTools.print_error("you must be root in order to run "+APPNAME)
|
||||
print_error("you must be root in order to run "+APPNAME)
|
||||
sys.exit(2)
|
||||
|
||||
# world tool
|
||||
|
||||
@@ -28,11 +28,6 @@ import sys
|
||||
import string
|
||||
|
||||
sys.path.append('../libraries')
|
||||
import entropyTools
|
||||
import reagentTools
|
||||
import databaseTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
from outputTools import *
|
||||
|
||||
# CONSTANTS
|
||||
@@ -70,6 +65,24 @@ def print_help():
|
||||
|
||||
options = sys.argv[1:]
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
import entropyTools
|
||||
import reagentTools
|
||||
import databaseTools
|
||||
from entropyConstants import *
|
||||
from serverConstants import *
|
||||
|
||||
# preliminary options parsing
|
||||
_options = []
|
||||
for opt in options:
|
||||
@@ -81,17 +94,7 @@ for opt in options:
|
||||
_options.append(opt)
|
||||
options = _options
|
||||
|
||||
# print version
|
||||
if (string.join(options).find("--version") != -1) or (string.join(options).find(" -V") != -1):
|
||||
entropyTools.print_generic(APPNAME+": "+APPVERSION)
|
||||
sys.exit(0)
|
||||
|
||||
# print help
|
||||
if len(options) < 1 or string.join(options).find("--help") != -1 or string.join(options).find(" -h") != -1:
|
||||
print_help()
|
||||
if len(options) < 1:
|
||||
entropyTools.print_error("not enough parameters")
|
||||
sys.exit(1)
|
||||
|
||||
if (not entropyTools.isRoot()):
|
||||
print_error("you must be root in order to run "+APPNAME)
|
||||
|
||||
Reference in New Issue
Block a user