import portage
import dispatch_conf
-from portage_exec import find_binary
+from portage.process import find_binary
FIND_EXTANT_CONFIGS = "find '%s' %s -iname '._cfg????_%s'"
DIFF_CONTENTS = 'diff -Nu %s %s'
count = 0
- self.options = dispatch_conf.read_config(MANDATORY_OPTS)
+ self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
if self.options.has_key("log-file"):
if os.path.isfile(self.options["log-file"]):
mrgconf = re.sub(r'\._cfg', '._mrg', conf['new'])
archive = os.path.join(self.options['archive-dir'], conf['current'].lstrip('/'))
if self.options['use-rcs'] == 'yes':
- mrgfail = dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf)
+ mrgfail = portage.dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf)
else:
- mrgfail = dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf)
+ mrgfail = portage.dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf)
if os.path.exists(archive + '.dist'):
unmodified = len(commands.getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0
else:
def post_process(self, curconf):
archive = os.path.join(self.options['archive-dir'], curconf.lstrip('/'))
if self.options['use-rcs'] == 'yes':
- dispatch_conf.rcs_archive_post_process(archive)
+ portage.dispatch_conf.rcs_archive_post_process(archive)
else:
- dispatch_conf.file_archive_post_process(archive)
+ portage.dispatch_conf.file_archive_post_process(archive)
def massage (self, newconfigs):
sys.path.insert(0, "/usr/lib/portage/pym")
import portage
-import portage_const, portage_exception
+import portage.const, portage.exception
class WorldHandler(object):
def name():
self.invalid = []
self.not_installed = []
self.okay = []
- self.world_file = os.path.join("/", portage_const.WORLD_FILE)
+ self.world_file = os.path.join("/", portage.const.WORLD_FILE)
self.found = os.access(self.world_file, os.R_OK)
for atom in open(self.world_file).read().split():
errors = []
try:
portage.write_atomic(self.world_file, "\n".join(self.okay))
- except portage_exception.PortageException:
+ except portage.exception.PortageException:
errors.append(self.world_file + " could not be opened for writing")
return errors
self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"]
for p in self.list:
- mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep
+ mydir = os.path.join(os.sep, portage.settings["ROOT"], portage.const.VDB_PATH, p)+os.sep
ismissing = True
for k in self.keys:
if os.path.exists(mydir+k):
errors = []
for p in self.missing:
- mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep
+ mydir = os.path.join(os.sep, portage.settings["ROOT"], portage.const.VDB_PATH, p)+os.sep
if not os.access(mydir+"environment.bz2", os.R_OK):
errors.append("Can't access %s" % (mydir+"environment.bz2"))
elif not os.access(mydir, os.W_OK):
import portage
del os.environ["PORTAGE_LEGACY_GLOBALS"]
-import portage_checksum
-import portage_const
-import portage_dep
-import portage_exception
+import portage.checksum
+import portage.const
+import portage.dep
+import portage.exception
import cvstree
import time
import codecs
-from portage_manifest import Manifest
-from portage_exception import ParseError
-from portage_exec import spawn
+from portage.manifest import Manifest
+from portage.exception import ParseError
+from portage.process import spawn
-from output import bold, darkgreen, darkred, green, nocolor, red, turquoise, yellow
+from portage.output import bold, darkgreen, darkred, green, nocolor, red, turquoise, yellow
from commands import getstatusoutput
from fileinput import input
# A sane umask is needed for files that portage creates.
os.umask(022)
repoman_settings = portage.config(local_config=False,
- config_incrementals=portage_const.INCREMENTALS)
+ config_incrementals=portage.const.INCREMENTALS)
repoman_settings.lock()
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
# Now that PORTDIR_OVERLAY is properly overridden, create the portdb.
repoman_settings = portage.config(local_config=False,
- config_incrementals=portage_const.INCREMENTALS)
+ config_incrementals=portage.const.INCREMENTALS)
trees = portage.create_trees()
trees["/"]["porttree"].settings = repoman_settings
portdb = trees["/"]["porttree"].dbapi
fails["digest.partial"].append(y+"::"+myf)
elif "assume-digests" not in repoman_settings.features:
if os.path.exists(myff):
- if not portage_checksum.verify_all(myff, mydigests[myf]):
+ if not portage.checksum.verify_all(myff, mydigests[myf]):
stats["digest.fail"] += 1
fails["digest.fail"].append(y+"::"+myf)
elif repolevel == 3:
# if x.startswith("no"):
# print "Bad RESTRICT value: %s" % x
- myaux["PROVIDE"] = portage_dep.use_reduce(portage_dep.paren_reduce(myaux["PROVIDE"]), matchall=1)
+ myaux["PROVIDE"] = portage.dep.use_reduce(portage.dep.paren_reduce(myaux["PROVIDE"]), matchall=1)
myaux["PROVIDE"] = " ".join(portage.flatten(myaux["PROVIDE"]))
for myprovide in myaux["PROVIDE"].split():
prov_cp = portage.dep_getkey(myprovide)
try:
# Missing closing parenthesis will result in a ValueError
- mydeplist = portage_dep.paren_reduce(mydepstr)
+ mydeplist = portage.dep.paren_reduce(mydepstr)
# Missing opening parenthesis will result in a final "" element
if "" in mydeplist or "(" in mydeplist:
raise ValueError
mydeplist = []
try:
- portage_dep.use_reduce(mydeplist, excludeall=myiuse)
- except portage_exception.InvalidDependString, e:
+ portage.dep.use_reduce(mydeplist, excludeall=myiuse)
+ except portage.exception.InvalidDependString, e:
badsyntax.append(str(e))
for token in operator_tokens:
else:
dep_settings = portage.config(
config_profile_path=profdir,
- config_incrementals=portage_const.INCREMENTALS,
+ config_incrementals=portage.const.INCREMENTALS,
local_config=False)
arch_caches[prof[0]] = dep_settings
while True:
myuse = myaux["LICENSE"]
# Parse the LICENSE variable, remove USE conditions and
# flatten it.
- myuse=portage_dep.use_reduce(portage_dep.paren_reduce(myuse), matchall=1)
+ myuse=portage.dep.use_reduce(portage.dep.paren_reduce(myuse), matchall=1)
myuse=portage.flatten(myuse)
# Check each entry to ensure that it exists in PORTDIR's
# license directory.
fails["ebuild.allmasked"].append(x)
#Pickle and save results for instant reuse in last and lfull
-if os.access(portage_const.CACHE_PATH, os.W_OK):
+if os.access(portage.const.CACHE_PATH, os.W_OK):
for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"):
- fpath = os.path.join(portage_const.CACHE_PATH, fname)
+ fpath = os.path.join(portage.const.CACHE_PATH, fname)
savef = open(fpath, 'w')
pickle.dump(myobj, savef)
savef.close()
print "!!! Exiting on ebuild digest (shell) error code:",retval
sys.exit(retval)
- mycvstree=cvstree.getentries("./",recursive=1)
+ mycvstree=portage.cvstree.getentries("./",recursive=1)
if isCvs and not mycvstree:
print "!!! It seems we don't have a cvs tree?"
sys.exit(3)
- myunadded=cvstree.findunadded(mycvstree,recursive=1,basedir="./")
+ myunadded=portage.cvstree.findunadded(mycvstree,recursive=1,basedir="./")
myautoadd=[]
if myunadded:
for x in range(len(myunadded)-1,-1,-1):
sys.exit(retval)
if isCvs:
- mycvstree=cvstree.getentries("./",recursive=1)
- mychanged=cvstree.findchanged(mycvstree,recursive=1,basedir="./")
- mynew=cvstree.findnew(mycvstree,recursive=1,basedir="./")
- myremoved=cvstree.findremoved(mycvstree,recursive=1,basedir="./")
+ mycvstree=portage.cvstree.getentries("./",recursive=1)
+ mychanged=portage.cvstree.findchanged(mycvstree,recursive=1,basedir="./")
+ mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./")
+ myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./")
if not (mychanged or mynew or myremoved):
print
print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"\n"
# Setup the GPG commands
def gpgsign(filename):
if "PORTAGE_GPG_KEY" not in repoman_settings:
- raise portage_exception.MissingParameter("PORTAGE_GPG_KEY is unset!")
+ raise portage.exception.MissingParameter("PORTAGE_GPG_KEY is unset!")
if "PORTAGE_GPG_DIR" not in repoman_settings:
if os.environ.has_key("HOME"):
repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(os.environ["HOME"], ".gnupg")
if quiet < 1:
print "Automatically setting PORTAGE_GPG_DIR to",repoman_settings["PORTAGE_GPG_DIR"]
else:
- raise portage_exception.MissingParameter("PORTAGE_GPG_DIR is unset!")
+ raise portage.exception.MissingParameter("PORTAGE_GPG_DIR is unset!")
gpg_dir = repoman_settings["PORTAGE_GPG_DIR"]
if gpg_dir.startswith("~") and "HOME" in os.environ:
repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(
os.environ["HOME"], gpg_dir[1:].lstrip(os.path.sep))
if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
- raise portage_exception.InvalidLocation(
+ raise portage.exception.InvalidLocation(
"Unable to access directory: PORTAGE_GPG_DIR='%s'" % \
repoman_settings["PORTAGE_GPG_DIR"])
gpgcmd = "gpg --sign --clearsign --yes "
if rValue == os.EX_OK:
os.rename(filename+".asc", filename)
else:
- raise portage_exception.PortageException("!!! gpg exited with '" + str(rValue) + "' status")
+ raise portage.exception.PortageException("!!! gpg exited with '" + str(rValue) + "' status")
manifest_commit_required = True
if myheaders or myupdates or myremoved or mynew:
mydone.append("/".join(xs[:2]))
repoman_settings["O"] = os.path.join(".", xs[0], xs[1])
gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
- except portage_exception.PortageException, e:
+ except portage.exception.PortageException, e:
portage.writemsg("!!! %s\n" % str(e))
portage.writemsg("!!! Disabled FEATURES='sign'\n")
signed = False