keep logs outside of chroot
authorRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
Mon, 29 Oct 2012 19:40:45 +0000 (15:40 -0400)
committerRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
Mon, 29 Oct 2012 19:40:45 +0000 (15:40 -0400)
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
files/catalyst.conf
modules/generic_stage_target.py
targets/support/chroot-functions.sh

index 483a6e53a3c5c1ea966b270911bdc58366969166..ed3fbd5cc56f3039f39c371dffd5572af3e4faa8 100755 (executable)
--- 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={}
index 49d2a15f5375709e2cec6021ccf19be2a8d5ee9a..ea74eb16098361a79c9c38d7690bddd581adc31d 100644 (file)
@@ -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.
index ae7d97cd3818ec85b14c672310939d6477ffe707..b5efe05ea2d44659d1d456d745298291669e65d4 100644 (file)
@@ -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"]
index fecbad42b429dca1663a627c5738a8b5554ebd84..35ffbaa558b96971719648827cb6b76807d8d58b 100644 (file)
@@ -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"