Namespace sanitizing, step 4
authorMarius Mauch <genone@gentoo.org>
Thu, 25 Jan 2007 17:25:47 +0000 (17:25 -0000)
committerMarius Mauch <genone@gentoo.org>
Thu, 25 Jan 2007 17:25:47 +0000 (17:25 -0000)
svn path=/main/trunk/; revision=5784

bin/archive-conf
bin/clean_locks
bin/dispatch-conf
bin/ebuild
bin/emaint
bin/fix-db.py
bin/md5check.py
bin/repoman

index bec5b3f0f0e01ffef2bdf82472140506bbd746a6..874b5cecb9bbb566d603a025c793c2637239627f 100755 (executable)
@@ -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:
index 71db0b8e216addcc58f4dbbbdd9de627c218003d..3b3c33c5c3f47ab984d70805f3281e20222d3aac 100755 (executable)
@@ -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
                
index 3033f164941af7261ddc59f40e6aee65d115a5cc..397dfd4208837cb6cba17b3db68a03f7add98dee 100755 (executable)
@@ -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):
index f5c8d1f699d07fc79be0ba1194cf94ca4cfe0d41..bcf32487386f001b76e345a5e423b55249c60c7f 100755 (executable)
@@ -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,
index bff6856f807e73ee5a3967a552564fd411437e0b..ee9336667c2ccddfc99480823d85719e8ed93545 100755 (executable)
@@ -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):
index e8bbad2caff2803d82bfe5dab3ea6e2e2feba3f6..a7be2affaf830a4355218e37f2022460409552c6 100755 (executable)
@@ -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
 
 
index 359a0bf004205ecbf2c6de2e15db0577fbad1239..4cc6d86f9babcc632ceabcffa75f4b382f9aa007 100755 (executable)
@@ -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 \
index 08d6ad4c17935ccb3de9d3d2c235a2c87b50776a..9f7f1731b11ab31488eb78fd9a31b5d51ce244fd 100755 (executable)
@@ -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