From 1fba9406a227cb0b45ef3887d11636665f240b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Mon, 18 Dec 2023 14:31:17 +0100 Subject: [PATCH] Add support for setting the ccache archive size --- build | 9 +++++++++ build-vm | 1 + 2 files changed, 10 insertions(+) diff --git a/build b/build index df28d3975..71c145025 100755 --- a/build +++ b/build @@ -111,6 +111,7 @@ RUN_SHELL_CMD= CCACHE= CCACHE_ARCHIVE= CCACHE_CREATE_ARCHIVE= +CCACHE_MAXSIZE= CCACHE_TYPE= CCACHE_CLEAN= DLNOSIGNATURE= @@ -608,9 +609,11 @@ ccache_setup() { if test -e $cconf; then grep -q "^compression*" $cconf && sed -i "s:compression.*:compression = true:g" $cconf || echo "compression = true" >> $cconf grep -q "^cache_dir*" $cconf && sed -i "s:cache_dir.*:cache_dir = /.ccache:g" $cconf || echo "cache_dir = /.ccache" >> $cconf + grep -q "^max_size*" $cconf && sed -i "s:max_size.*:max_size = ${CCACHE_MAXSIZE:-5G}:g" $cconf || echo "max_size = ${CCACHE_MAXSIZE:-5G}" >> $cconf else echo "compression = true" >> $cconf echo "cache_dir = /.ccache" >> $cconf + echo "max_size = ${CCACHE_MAXSIZE:-5G}" >> $cconf fi test -n "$CCACHE_ARCHIVE" -a -e "$CCACHE_ARCHIVE" && ccache_unpack "$BUILD_ROOT/.ccache" ccache chown -hR "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/.ccache" @@ -1215,6 +1218,12 @@ while test -n "$1"; do -ccache-create-archive) CCACHE_CREATE_ARCHIVE=true ;; + -ccache-maxsize) + CCACHE_MAXSIZE=$ARG + shift + CCACHE=true + CCACHE_TYPE=ccache + ;; -sccache) CCACHE=true CCACHE_TYPE=sccache diff --git a/build-vm b/build-vm index 4c083251a..3e20ce84b 100644 --- a/build-vm +++ b/build-vm @@ -1047,6 +1047,7 @@ vm_first_stage() { echo "CCACHE_ARCHIVE='$CCACHE_ARCHIVE'" >> $BUILD_ROOT/.build/build.data echo "CCACHE_CREATE_ARCHIVE='$CCACHE_CREATE_ARCHIVE'" >> $BUILD_ROOT/.build/build.data echo "CCACHE_CLEAN='$CCACHE_CLEAN'" >> $BUILD_ROOT/.build/build.data + echo "CCACHE_MAXSIZE='$CCACHE_MAXSIZE'" >> $BUILD_ROOT/.build/build.data echo "ABUILD_TARGET='$ABUILD_TARGET'" >> $BUILD_ROOT/.build/build.data echo "BUILD_FLAVOR='$BUILD_FLAVOR'" >> $BUILD_ROOT/.build/build.data echo "OBS_PACKAGE='$OBS_PACKAGE'" >> $BUILD_ROOT/.build/build.data