Split a config.validate() method and move PORTAGE_TMPDIR sanity check to doebuild.
authorZac Medico <zmedico@gentoo.org>
Tue, 25 Apr 2006 04:40:12 +0000 (04:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 25 Apr 2006 04:40:12 +0000 (04:40 -0000)
svn path=/main/trunk/; revision=3224

pym/portage.py

index 8ab65b1f0fe3872d04fad50ce40353f83f3299fa..e69310d9f4af989c05843f755350d6cc69ccc292 100644 (file)
@@ -1263,6 +1263,13 @@ class config:
                        self["CBUILD"] = self["CHOST"]
                        self.backup_changes("CBUILD")
 
+               if mycpv:
+                       self.setcpv(mycpv)
+
+       def validate(self):
+               """Validate miscellaneous settings and display warnings if necessary.
+               (This code was previously in the global scope of portage.py)"""
+
                groups = self["ACCEPT_KEYWORDS"].split()
                archlist = self.archlist()
                if not archlist:
@@ -1278,9 +1285,6 @@ class config:
                        writemsg("!!! It should point into a profile within %s/profiles/\n" % self["PORTDIR"])
                        writemsg("!!! (You can safely ignore this message when syncing. It's harmless.)\n\n\n")
 
-               if mycpv:
-                       self.setcpv(mycpv)
-
        def loadVirtuals(self,root):
                """Not currently used by portage."""
                writemsg("DEPRECATED: portage.config.loadVirtuals\n")
@@ -2563,6 +2567,15 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
                retval = spawn(EBUILD_SH_BINARY+" depend",mysettings)
                return retval
 
+       if not os.path.exists(mysettings["PORTAGE_TMPDIR"]):
+               writemsg("The directory specified in your PORTAGE_TMPDIR variable, '%s',\n" % mysettings["PORTAGE_TMPDIR"])
+               writemsg("does not exist.  Please create this directory or correct your PORTAGE_TMPDIR setting.\n")
+               return 1
+       elif not os.path.isdir(mysettings["PORTAGE_TMPDIR"]):
+               writemsg("portage: the directory specified in your PORTAGE_TMPDIR variable, '%s',\n" % mysettings["PORTAGE_TMPDIR"])
+               writemsg("is not a directory.  Please correct your PORTAGE_TMPDIR setting.\n")
+               return 1
+
        logfile=None
        # Build directory creation isn't required for any of these.
        if mydo not in ["fetch","digest","manifest"]:
@@ -6786,6 +6799,7 @@ settings.reset() # XXX: Regenerate use after we get a vartree -- GLOBAL
 portdb=portdbapi(settings["PORTDIR"])
 
 settings.lock()
+settings.validate()
 
 if 'selinux' in settings["USE"].split(" "):
        try:
@@ -6856,15 +6870,6 @@ if root!="/":
 
 thirdpartymirrors = settings.thirdpartymirrors()
 
-if not os.path.exists(settings["PORTAGE_TMPDIR"]):
-       writemsg("portage: the directory specified in your PORTAGE_TMPDIR variable, \""+settings["PORTAGE_TMPDIR"]+",\"\n")
-       writemsg("does not exist.  Please create this directory or correct your PORTAGE_TMPDIR setting.\n")
-       sys.exit(1)
-if not os.path.isdir(settings["PORTAGE_TMPDIR"]):
-       writemsg("portage: the directory specified in your PORTAGE_TMPDIR variable, \""+settings["PORTAGE_TMPDIR"]+",\"\n")
-       writemsg("is not a directory.  Please correct your PORTAGE_TMPDIR setting.\n")
-       sys.exit(1)
-
 # COMPATABILITY -- This shouldn't be used.
 pkglines = settings.packages