From 13368e7dbf44ec8474673c7bbb51df3ae55b9a9e Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Thu, 25 Jan 2007 17:25:47 +0000 Subject: Namespace sanitizing, step 4 svn path=/main/trunk/; revision=5784 --- bin/archive-conf | 10 +++++----- bin/clean_locks | 6 +++--- bin/dispatch-conf | 12 +++++------ bin/ebuild | 12 +++++------ bin/emaint | 10 +++++----- bin/fix-db.py | 2 +- bin/md5check.py | 4 ++-- bin/repoman | 60 +++++++++++++++++++++++++++---------------------------- 8 files changed, 58 insertions(+), 58 deletions(-) (limited to 'bin') diff --git a/bin/archive-conf b/bin/archive-conf index bec5b3f0f..874b5cecb 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -51,7 +51,7 @@ def archive_conf(): content_files = [] md5_match_hash = {} - options = dispatch_conf.read_config(MANDATORY_OPTS) + options = portage.dispatch_conf.read_config(MANDATORY_OPTS) for conf in sys.argv[1:]: if not os.path.isabs(conf): @@ -92,13 +92,13 @@ def archive_conf(): for conf in args: archive = os.path.join(options['archive-dir'], conf.lstrip('/')) if options['use-rcs'] == 'yes': - dispatch_conf.rcs_archive(archive, conf, md5_match_hash[conf], '') + portage.dispatch_conf.rcs_archive(archive, conf, md5_match_hash[conf], '') if md5_match_hash[conf]: - dispatch_conf.rcs_archive_post_process(archive) + portage.dispatch_conf.rcs_archive_post_process(archive) else: - dispatch_conf.file_archive(archive, conf, md5_match_hash[conf], '') + portage.dispatch_conf.file_archive(archive, conf, md5_match_hash[conf], '') if md5_match_hash[conf]: - dispatch_conf.file_archive_post_process(archive) + portage.dispatch_conf.file_archive_post_process(archive) # run if len(sys.argv) > 1: diff --git a/bin/clean_locks b/bin/clean_locks index 71db0b8e2..3b3c33c5c 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -5,10 +5,10 @@ import os,sys,errno try: - import portage_locks + import portage.locks except ImportError: sys.path.insert(0, "/usr/lib/portage/pym") - import portage_locks + import portage.locks if not sys.argv[1:] or "--help" in sys.argv or "-h" in sys.argv: import portage @@ -31,7 +31,7 @@ for x in sys.argv[1:]: if x == "--force": continue try: - for y in portage_locks.hardlock_cleanup(x, remove_all_locks=force): + for y in portage.locks.hardlock_cleanup(x, remove_all_locks=force): print y print diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 3033f1649..397dfd420 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -25,7 +25,7 @@ except ImportError: 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' @@ -69,7 +69,7 @@ class dispatch: 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"]): @@ -124,9 +124,9 @@ class dispatch: 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: @@ -288,9 +288,9 @@ class dispatch: 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): diff --git a/bin/ebuild b/bin/ebuild index f5c8d1f69..bcf324873 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -27,16 +27,16 @@ except ImportError: sys.path.insert(0, "/usr/lib/portage/pym") import portage -import portage_util, portage_const +import portage.util, portage.const # do this _after_ 'import portage' to prevent unnecessary tracing if debug and "python-trace" in portage.features: - import portage_debug - portage_debug.set_trace(True) + import portage.debug + portage.debug.set_trace(True) if portage.settings["NOCOLOR"] in ("yes","true") or not sys.stdout.isatty(): import output - output.nocolor() + portage.output.nocolor() ebuild = pargs.pop(0) if not os.path.isabs(ebuild): @@ -66,7 +66,7 @@ if not portage.catpkgsplit(cpv): print "!!! %s does not follow correct package syntax." % (cpv) sys.exit(1) -if ebuild.startswith(portage.root + portage_const.VDB_PATH): +if ebuild.startswith(portage.root + portage.const.VDB_PATH): mytree = "vartree" portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv) @@ -108,7 +108,7 @@ def discard_digests(myebuild, mysettings, mydbapi): fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi) cat, pkg = pkgdir.split(os.sep)[-2:] cpv = cat + "/" + os.path.basename(myebuild)[:-7] - from portage_manifest import Manifest + from portage.manifest import Manifest mf = Manifest(pkgdir, mysettings["DISTDIR"], fetchlist_dict=fetchlist_dict) mf.create(requiredDistfiles=None, diff --git a/bin/emaint b/bin/emaint index bff6856f8..ee9336667 100755 --- a/bin/emaint +++ b/bin/emaint @@ -10,7 +10,7 @@ except ImportError: 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(): @@ -21,7 +21,7 @@ class WorldHandler(object): 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(): @@ -45,7 +45,7 @@ class WorldHandler(object): 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 @@ -60,7 +60,7 @@ class VdbKeyHandler(object): 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): @@ -77,7 +77,7 @@ class VdbKeyHandler(object): 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): diff --git a/bin/fix-db.py b/bin/fix-db.py index e8bbad2ca..a7be2affa 100755 --- a/bin/fix-db.py +++ b/bin/fix-db.py @@ -12,7 +12,7 @@ except ImportError: import portage from stat import * -from output import * +from portage.output import * from portage import lockfile,unlockfile,VDB_PATH,root diff --git a/bin/md5check.py b/bin/md5check.py index 359a0bf00..4cc6d86f9 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -10,7 +10,7 @@ try: except ImportError: sys.path.insert(0, "/usr/lib/portage/pym") import portage -import portage_util +import portage.util def cstrip(mystr,mychars): newstr = "" @@ -68,7 +68,7 @@ for mycpv in hugelist: continue if mybn not in md5sums.keys(): - portage_util.writemsg("Missing md5sum: %s in %s\n" % (mybn, mycpv)) + portage.util.writemsg("Missing md5sum: %s in %s\n" % (mybn, mycpv)) else: if mybn in md5_list.keys(): if (md5_list[mybn]["MD5"] != md5sums[mybn]["MD5"]) or \ diff --git a/bin/repoman b/bin/repoman index 08d6ad4c1..9f7f1731b 100755 --- a/bin/repoman +++ b/bin/repoman @@ -30,19 +30,19 @@ except ImportError: 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 @@ -52,7 +52,7 @@ from stat import S_ISDIR, ST_CTIME, ST_GID, ST_MTIME # 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 \ @@ -475,7 +475,7 @@ if quiet < 2: # 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 @@ -885,7 +885,7 @@ for x in scanlist: 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: @@ -1007,7 +1007,7 @@ for x in scanlist: # 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) @@ -1083,7 +1083,7 @@ for x in scanlist: 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 @@ -1092,8 +1092,8 @@ for x in scanlist: 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: @@ -1151,7 +1151,7 @@ for x in scanlist: 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: @@ -1267,7 +1267,7 @@ for x in scanlist: 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. @@ -1369,9 +1369,9 @@ for x in scanlist: 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() @@ -1465,12 +1465,12 @@ else: 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): @@ -1542,10 +1542,10 @@ else: 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" @@ -1632,20 +1632,20 @@ else: # 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 " @@ -1659,7 +1659,7 @@ else: 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: @@ -1744,7 +1744,7 @@ else: 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 -- cgit v1.2.3-1-g7c22