Skip to content

Commit

Permalink
Add support for setting the ccache archive size
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Dec 18, 2023
1 parent b5debf6 commit 1fba940
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ RUN_SHELL_CMD=
CCACHE=
CCACHE_ARCHIVE=
CCACHE_CREATE_ARCHIVE=
CCACHE_MAXSIZE=
CCACHE_TYPE=
CCACHE_CLEAN=
DLNOSIGNATURE=
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions build-vm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fba940

Please sign in to comment.