From 17b4c63900a461ef5ae3c5cdaed7e8d255847fde Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 22 Jan 2017 15:23:13 +0100 Subject: [PATCH] phase1, phase2: add unified ccache handling Signed-off-by: Jo-Philipp Wich --- phase1/ccache.sh | 21 +++++++++++++++++++++ phase1/master.cfg | 14 ++++++++++++++ phase2/master.cfg | 11 +++++++++++ 3 files changed, 46 insertions(+) create mode 100755 phase1/ccache.sh diff --git a/phase1/ccache.sh b/phase1/ccache.sh new file mode 100755 index 0000000..61590f2 --- /dev/null +++ b/phase1/ccache.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +export LC_ALL=C + +mkdir -p "$HOME/.ccache" + +grep -sq max_size "$HOME/.ccache/ccache.conf" || \ + echo "max_size = 10.0G" >> "$HOME/.ccache/ccache.conf" + +grep -sq compiler_check "$HOME/.ccache/ccache.conf" || \ + echo "compiler_check = %compiler% -dumpmachine; %compiler% -dumpversion" >> "$HOME/.ccache/ccache.conf" + +for dir in $(make --no-print-directory val.TOOLCHAIN_DIR val.STAGING_DIR val.STAGING_DIR_HOST V=s | grep staging_dir/); do + mkdir -p "$dir" + test -L "$dir/ccache" || rm -rf "$dir/ccache" + ln -s "$HOME/.ccache" "$dir/ccache" +done + +./staging_dir/host/bin/ccache -s 2>/dev/null + +exit 0 diff --git a/phase1/master.cfg b/phase1/master.cfg index ae69309..bc21f80 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -454,6 +454,20 @@ for target in targets: command=["./scripts/feeds", "install", "-a"], env = MakeEnv())) + # ccache helper + factory.addStep(FileDownload( + mastersrc = "ccache.sh", + slavedest = "ccache.sh", + mode = 0755 + )) + + # ccache prepare + factory.addStep(ShellCommand( + name = "prepccache", + description = "Preparing ccache", + command = ["./ccache.sh"] + )) + # seed config factory.addStep(FileDownload( mastersrc = "config.seed", diff --git a/phase2/master.cfg b/phase2/master.cfg index 08b5387..d6d2e22 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -287,6 +287,17 @@ for arch in arches: workdir = "build/sdk", command = ["sh", "-c", "rm -f .config && make defconfig"])) + factory.addStep(FileDownload( + mastersrc = home_dir+'/ccache.sh', + slavedest = 'sdk/ccache.sh', + mode = 0755)) + + factory.addStep(ShellCommand( + name = "prepccache", + description = "Preparing ccache", + workdir = "build/sdk", + command = ["./ccache.sh"])) + factory.addStep(ShellCommand( name = "updatefeeds", description = "Updating feeds", -- 2.30.2