]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - pakfire/patches/0003-ccache-optimizations-Use-tmp-and-enable-compression.patch
python: Update to 2.7.5.
[people/ms/ipfire-3.x.git] / pakfire / patches / 0003-ccache-optimizations-Use-tmp-and-enable-compression.patch
CommitLineData
eac44f69
MT
1From 27f559296e5301c16e2be42acfde3bcf7e374290 Mon Sep 17 00:00:00 2001
2From: Michael Tremer <michael.tremer@ipfire.org>
3Date: Tue, 5 Mar 2013 01:20:54 +0100
4Subject: [PATCH 03/19] ccache optimizations: Use /tmp and enable compression.
5
6When the cache is on an NFS share, a lot of preprocessed files
7will be transferred to that share, because ccache usually uses
8$CCACHE_DIR/tmp as directory for its temporary files.
9/tmp is always local and only the final data has to be live in
10the cache is transferred over the wire.
11
12To decrease the size of the cache, we enable compression. That
13will cost a bit of CPU performance, but processors are usually
14very fast nowadays and the bottleneck when compiling code is IO.
15---
16 examples/builder.conf | 5 +++++
17 python/pakfire/builder.py | 15 +++++++++++++++
18 2 files changed, 20 insertions(+)
19
20diff --git a/examples/builder.conf b/examples/builder.conf
21index ff42733..128a118 100644
22--- a/examples/builder.conf
23+++ b/examples/builder.conf
24@@ -9,6 +9,7 @@ file = /var/log/pakfire-builder.log
25 #distro = ipfire3
26
27 # Use ccache in order to build rebuilds in less time.
28+# See also the [ccache] section.
29 #use_ccache = true
30
31 # Use icecream in order to speed up builds.
32@@ -21,3 +22,7 @@ file = /var/log/pakfire-builder.log
33
34 # Create loop devices in build environment.
35 #use_loop_devices = true
36+
37+[ccache]
38+# Turn on compression to get more files into the cache.
39+#compress = true
40diff --git a/python/pakfire/builder.py b/python/pakfire/builder.py
41index 1cf1e8e..250a659 100644
42--- a/python/pakfire/builder.py
43+++ b/python/pakfire/builder.py
44@@ -119,6 +119,12 @@ class BuildEnviron(object):
45 "buildroot_tmpfs" : self.config.get_bool("builder", "use_tmpfs", False),
46 }
47
48+ # Get ccache settings.
49+ if self.settings.get("enable_ccache", False):
50+ self.settings.update({
51+ "ccache_compress" : self.config.get_bool("ccache", "compress", True),
52+ })
53+
54 # Try to get the configured host key. If it is available,
55 # we will automatically sign all packages with it.
56 if self.keyring.get_host_key(secret=True):
57@@ -615,6 +621,15 @@ class BuildEnviron(object):
58 # Inherit environment from distro
59 env.update(self.pakfire.distro.environ)
60
61+ # ccache environment settings
62+ if self.settings.get("enable_ccache", False):
63+ compress = self.settings.get("ccache_compress", False)
64+ if compress:
65+ env["CCACHE_COMPRESS"] = "1"
66+
67+ # Let ccache create its temporary files in /tmp.
68+ env["CCACHE_TEMPDIR"] = "/tmp"
69+
70 # Icecream environment settings
71 if self.settings.get("enable_icecream", False):
72 # Set the toolchain path
73--
741.8.1.4
75