summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-10-09 22:50:56 +0000
committerZac Medico <zmedico@gentoo.org>2009-10-09 22:50:56 +0000
commit9ca46474139b131a2c2e416880f65ae9e3f99fc5 (patch)
tree6a38d7e1c7b808235ebab38bde189f524649ae04
parent6430efa0bcf9379b50ccaea0e1c2b2ea347ea212 (diff)
downloadportage-9ca46474139b131a2c2e416880f65ae9e3f99fc5.tar.gz
portage-9ca46474139b131a2c2e416880f65ae9e3f99fc5.tar.bz2
portage-9ca46474139b131a2c2e416880f65ae9e3f99fc5.zip
Bug #273099 - Add split-log and split-elog FEATURES for splitting build logs
and elog mod_save logs into category subdirectories. Thanks to Sebastian Mingramm (few) for this patch. svn path=/main/trunk/; revision=14532
-rw-r--r--man/make.conf.59
-rw-r--r--pym/portage/__init__.py16
-rw-r--r--pym/portage/elog/mod_save.py15
3 files changed, 34 insertions, 6 deletions
diff --git a/man/make.conf.5 b/man/make.conf.5
index a2d41ef90..0e7ebf888 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -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
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 9224b7138..94c698cc5 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -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
diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py
index 954787994..b1c38061d 100644
--- a/pym/portage/elog/mod_save.py
+++ b/pym/portage/elog/mod_save.py
@@ -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')