[OE-core] [PATCH v2 2/3] ccache.bbclass: add trimming tasks

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


These can be use to trim ccache directories to default cache size (1G)
without deleting the whole dirs.

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

diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index b6643a1..0bad4d4 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -12,3 +12,20 @@ ccache_init() {
     fi
 }
 do_configure[postfuncs] += "ccache_init"
+
+addtask ccache_trim
+do_ccache_trim[nostamp] = "1"
+do_ccache_trim() {
+    if [ -n "${CCACHE}" -a -d "${CCACHE_DIR}" ]; then
+        ${CCACHE} -M 1G
+        ${CCACHE} -c
+    fi
+}
+
+addtask ccache_trimall after do_ccache_trim
+do_ccache_trimall[recrdeptask] = "do_ccache_trimall do_ccache_trim"
+do_ccache_trimall[recideptask] = "do_${BB_DEFAULT_TASK}"
+do_ccache_trimall[nostamp] = "1"
+do_ccache_trimall() {
+        :
+}
-- 
1.9.1




More information about the Openembedded-core mailing list