[OE-core] [PATCH v2 1/3] ccache.bbclass: enable max size setup for ccache dir

Yannick Gicquel yannick.gicquel at iot.bzh
Thu Jan 19 15:01:29 UTC 2017


ccache directories are limited to 1G by default.
This patch enables the configuration of their limits, and as default
location is TMPDIR, it proposes a size limit to "0" (unlimited).

The setup can be overloaded in local.conf by setting
CCACHE_MAX_SIZE to a custom value if needed.

Signed-off-by: Yannick Gicquel <yannick.gicquel at iot.bzh>
---
 meta/classes/ccache.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 93fcaca..b6643a1 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -1,6 +1,14 @@
 CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
 export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_HOST_SYS}/${PN}"
 CCACHE_DISABLE[unexport] = "1"
+CCACHE_MAX_SIZE ?= "0"
 
 do_configure[dirs] =+ "${CCACHE_DIR}"
 do_kernel_configme[dirs] =+ "${CCACHE_DIR}"
+
+ccache_init() {
+    if [ -n "${CCACHE}" ]; then
+        ${CCACHE} -M ${CCACHE_MAX_SIZE}
+    fi
+}
+do_configure[postfuncs] += "ccache_init"
-- 
1.9.1




More information about the Openembedded-core mailing list