From 8ca52570aa2d0e14b848692ddf759212d81168e3 Mon Sep 17 00:00:00 2001 From: "Rick Farina (Zero_Chaos)" Date: Mon, 29 Oct 2012 15:40:45 -0400 Subject: [PATCH] keep logs outside of chroot Every time stage build is restarted, the build logs of the previous run are lost. This new feature allows the logs to be kept outside the chroot and thus protected from purging. This new feature forces portage to use FEATURES="clean-logs" no matter what, but it should have no effect on users not using the new functionality added by this patch. This new function is DISABLED per default due to a lack of feedback, however, it is highly suggested that this is made default for the next release cycle. --- catalyst | 3 +++ files/catalyst.conf | 5 +++++ modules/generic_stage_target.py | 6 ++++++ targets/support/chroot-functions.sh | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/catalyst b/catalyst index 483a6e53..ed3fbd5c 100755 --- a/catalyst +++ b/catalyst @@ -168,6 +168,9 @@ def parse_config(myconfig): if myconf.has_key("var_tmpfs_portage"): conf_values["var_tmpfs_portage"]=myconf["var_tmpfs_portage"]; + if myconf.has_key("port_logdir"): + conf_values["port_logdir"]=myconf["port_logdir"]; + def import_modules(): # import catalyst's own modules (i.e. catalyst_support and the arch modules) targetmap={} diff --git a/files/catalyst.conf b/files/catalyst.conf index 49d2a15f..ea74eb16 100644 --- a/files/catalyst.conf +++ b/files/catalyst.conf @@ -81,6 +81,11 @@ snapshot_cache="/var/tmp/catalyst/snapshot_cache" # also where it will put its temporary files and caches. storedir="/var/tmp/catalyst" +# port_logdir is where all build logs will be kept. This dir will be automatically cleaned +# of all logs over 30 days old. If left undefined the logs will remain in the build directory +# as usual and get cleaned every time a stage build is restarted. +# port_logdir="/var/tmp/catalyst/tmp" + # var_tmpfs_portage will mount a tmpfs for /var/tmp/portage so building takes place in RAM # this feature requires a pretty large tmpfs ({open,libre}office needs ~8GB to build) # WARNING: If you use too much RAM everything will fail horribly and it is not our fault. diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index ae7d97cd..b5efe05e 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -226,6 +226,12 @@ class generic_stage_target(generic_target): self.mountmap["/var/cache/icecream"]="/var/cache/icecream" self.env["PATH"]="/usr/lib/icecc/bin:"+self.env["PATH"] + if self.settings.has_key("port_logdir"): + self.mounts.append("/var/log/portage") + self.mountmap["/var/log/portage"]=self.settings["port_logdir"] + self.env["PORT_LOGDIR"]="/var/log/portage" + self.env["PORT_LOGDIR_CLEAN"]='find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete' + def override_cbuild(self): if self.makeconf.has_key("CBUILD"): self.settings["CBUILD"]=self.makeconf["CBUILD"] diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index fecbad42..35ffbaa5 100644 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -64,7 +64,7 @@ get_libdir() { setup_myfeatures(){ setup_myemergeopts - export FEATURES="-news" + export FEATURES="-news clean-logs" if [ -n "${clst_CCACHE}" ] then export clst_myfeatures="${clst_myfeatures} ccache" -- 2.26.2