]> git.ipfire.org Git - pakfire.git/commitdiff
ccache optimizations: Use /tmp and enable compression.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Mar 2013 00:20:54 +0000 (01:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 Mar 2013 00:20:54 +0000 (01:20 +0100)
When the cache is on an NFS share, a lot of preprocessed files
will be transferred to that share, because ccache usually uses
$CCACHE_DIR/tmp as directory for its temporary files.
/tmp is always local and only the final data has to be live in
the cache is transferred over the wire.

To decrease the size of the cache, we enable compression. That
will cost a bit of CPU performance, but processors are usually
very fast nowadays and the bottleneck when compiling code is IO.

examples/builder.conf
python/pakfire/builder.py

index ff427330ac0386dd78e7ca7e2287373dfa96dd2a..128a118c831c0e524bcad4651e6180b74063d8a0 100644 (file)
@@ -9,6 +9,7 @@ file = /var/log/pakfire-builder.log
 #distro = ipfire3
 
 # Use ccache in order to build rebuilds in less time.
+# See also the [ccache] section.
 #use_ccache = true
 
 # Use icecream in order to speed up builds.
@@ -21,3 +22,7 @@ file = /var/log/pakfire-builder.log
 
 # Create loop devices in build environment.
 #use_loop_devices = true
+
+[ccache]
+# Turn on compression to get more files into the cache.
+#compress = true
index 1cf1e8e168f5f854af00fde30bf752f12b103177..250a659799c4869ab9f903054b8b4213cce3cca5 100644 (file)
@@ -119,6 +119,12 @@ class BuildEnviron(object):
                        "buildroot_tmpfs"     : self.config.get_bool("builder", "use_tmpfs", False),
                }
 
+               # Get ccache settings.
+               if self.settings.get("enable_ccache", False):
+                       self.settings.update({
+                               "ccache_compress" : self.config.get_bool("ccache", "compress", True),
+                       })
+
                # Try to get the configured host key. If it is available,
                # we will automatically sign all packages with it.
                if self.keyring.get_host_key(secret=True):
@@ -615,6 +621,15 @@ class BuildEnviron(object):
                # Inherit environment from distro
                env.update(self.pakfire.distro.environ)
 
+               # ccache environment settings
+               if self.settings.get("enable_ccache", False):
+                       compress = self.settings.get("ccache_compress", False)
+                       if compress:
+                               env["CCACHE_COMPRESS"] = "1"
+
+                       # Let ccache create its temporary files in /tmp.
+                       env["CCACHE_TEMPDIR"] = "/tmp"
+
                # Icecream environment settings
                if self.settings.get("enable_icecream", False):
                        # Set the toolchain path