Bug #273099 - Add split-log and split-elog FEATURES for splitting build logs
authorZac Medico <zmedico@gentoo.org>
Fri, 9 Oct 2009 22:50:56 +0000 (22:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 9 Oct 2009 22:50:56 +0000 (22:50 -0000)
and elog mod_save logs into category subdirectories. Thanks to Sebastian
Mingramm (few) for this patch.

svn path=/main/trunk/; revision=14532

man/make.conf.5
pym/portage/__init__.py
pym/portage/elog/mod_save.py

index a2d41ef9034c0397af2b5a4bb9332b159f96426e..0e7ebf888379aff1aba5b0adfe8adfd7ccf9faef 100644 (file)
@@ -367,6 +367,15 @@ a read-only NFS share. A read-only \fBDISTDIR\fR is not compatible with the
 \fBFEATURES\fR in order to avoid warning messages that are triggered by this
 incompatibility.
 .TP
+split\-elog
+Store logs created by \fBPORTAGE_ELOG_SYSTEM="save"\fR in category
+subdirectories of \fBPORT_LOGDIR/elog\fR, instead of using
+\fBPORT_LOGDIR/elog\fR directly.
+.TP 
+.B split\-log
+Store build logs in category subdirectories of \fBPORT_LOGDIR/build\fR,
+instead of using \fBPORT_LOGDIR\fR directly.
+.TP
 .B splitdebug
 Prior to stripping ELF etdyn and etexec files, the debugging info is 
 stored for later use by various debuggers.  This feature is disabled by
index 9224b7138cb3f86f7cb8f3aa9f793e5fa6cc9809..94c698cc5a3498c84e58a52fa74df9ac1a84b1ed 100644 (file)
@@ -6476,10 +6476,18 @@ def _prepare_workdir(mysettings):
                logid_time = _unicode_decode(time.strftime("%Y%m%d-%H%M%S",
                        time.gmtime(os.stat(logid_path).st_mtime)),
                        encoding=_encodings['content'], errors='replace')
-               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
+
+               if "split-log" in mysettings.features:
+                       mysettings["PORTAGE_LOG_FILE"] = os.path.join(
+                               mysettings["PORT_LOGDIR"], "build", "%s/%s:%s.log" % \
+                               (mysettings["CATEGORY"], mysettings["PF"], logid_time))
+               else:
+                       mysettings["PORTAGE_LOG_FILE"] = os.path.join(
+                               mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \
+                               (mysettings["CATEGORY"], mysettings["PF"], logid_time))
+
+               util.ensure_dirs(os.path.dirname(mysettings["PORTAGE_LOG_FILE"]))
+
        else:
                # NOTE: When sesandbox is enabled, the local SELinux security policies
                # may not allow output to be piped out of the sesandbox domain. The
index 9547879949fd0a67e2a244167dbae1722204fe6d..b1c38061d38705ccb9006f248c7aadf57f451174 100644 (file)
@@ -21,9 +21,20 @@ def process(mysettings, key, logentries, fulltext):
                elogdir = os.path.join(os.sep, "var", "log", "portage", "elog")
        ensure_dirs(elogdir, uid=portage_uid, gid=portage_gid, mode=0o2770)
 
-       elogfilename = os.path.join(elogdir, path + ":" + _unicode_decode(
+       cat = mysettings['CATEGORY']
+       pf = mysettings['PF']
+
+       elogfilename = pf + ":" + _unicode_decode(
                time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())),
-               encoding=_encodings['content'], errors='replace') + ".log")
+               encoding=_encodings['content'], errors='replace') + ".log"
+
+       if "split-elog" in mysettings.features:
+               elogfilename = os.path.join(elogdir, cat, elogfilename)
+       else:
+               elogfilename = os.path.join(elogdir, cat + ':' + elogfilename)
+       ensure_dirs(os.path.dirname(elogfilename),
+               uid=portage_uid, gid=portage_gid, mode=0o2770)
+
        elogfile = codecs.open(_unicode_encode(elogfilename,
                encoding=_encodings['fs'], errors='strict'),
                mode='w', encoding=_encodings['content'], errors='backslashreplace')