Move PORTAGE_LOG_FILE initialization from doebuild to prepare_build_dirs.
authorZac Medico <zmedico@gentoo.org>
Sat, 23 Sep 2006 06:56:16 +0000 (06:56 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 23 Sep 2006 06:56:16 +0000 (06:56 -0000)
svn path=/main/trunk/; revision=4510

pym/portage.py

index b8f984f5c00d1aefd163bdcfbc578181520d9c4a..9486d61c29c86cd0385e2f93e9743d83ddd6e872 100644 (file)
@@ -2792,6 +2792,18 @@ def prepare_build_dirs(myroot, mysettings, cleanup):
                        writemsg("!!! Disabling logging.\n", noiselevel=-1)
                        while "PORT_LOGDIR" in mysettings:
                                del mysettings["PORT_LOGDIR"]
+       if "PORT_LOGDIR" in mysettings:
+               logid_path = os.path.join(mysettings["PORTAGE_BUILDDIR"], ".logid")
+               if not os.path.exists(logid_path):
+                       f = open(logid_path, "w")
+                       f.close()
+                       del f
+               logid_time = time.strftime("%Y%m%d-%H%M%S",
+                       time.gmtime(os.stat(logid_path).st_mtime))
+               mysettings["PORTAGE_LOG_FILE"] = os.path.join(
+                       mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \
+                       (mysettings["CATEGORY"], mysettings["PF"], logid_time))
+               del logid_path, logid_time
 
 def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
        fetchonly=0, cleanup=0, dbkey=None, use_cache=1, fetchall=0, tree=None,
@@ -2868,24 +2880,12 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
                        if mystatus:
                                return mystatus
+                       # PORTAGE_LOG_FILE is set above by the prepare_build_dirs() call.
+                       logfile = mysettings.get("PORTAGE_LOG_FILE", None)
                if mydo == "unmerge":
                        return unmerge(mysettings["CATEGORY"],
                                mysettings["PF"], myroot, mysettings, vartree=vartree)
 
-               if "PORT_LOGDIR" in mysettings and builddir_lock:
-                       logid_path = os.path.join(mysettings["PORTAGE_BUILDDIR"], ".logid")
-                       if not os.path.exists(logid_path):
-                               f = open(logid_path, "w")
-                               f.close()
-                               del f
-                       logid_time = time.strftime("%Y%m%d-%H%M%S",
-                               time.gmtime(os.stat(logid_path).st_mtime))
-                       logfile = os.path.join(
-                               mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \
-                               (mysettings["CATEGORY"], mysettings["PF"], logid_time))
-                       mysettings["PORTAGE_LOG_FILE"] = logfile
-                       del logid_path, logid_time
-
                # if any of these are being called, handle them -- running them out of
                # the sandbox -- and stop now.
                if mydo in ["clean","cleanrm"]: