Skip to content

Commit

Permalink
Merge pull request #560 from sjamgade/ccache_compression
Browse files Browse the repository at this point in the history
enable compression on ccache
  • Loading branch information
mlschroe committed May 6, 2020
2 parents 3692d82 + ac938b2 commit 2f83e3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,18 @@ setupccache() {
chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/.ccache"
echo "export CCACHE_DIR=/.ccache" > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
echo 'export PATH=/var/lib/build/ccache/bin:$PATH' >> "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
local ccachetar="$BUILD_ROOT/.build.oldpackages/_ccache.tar.gz"
test -e $ccachetar && tar -zxf $ccachetar -C "$BUILD_ROOT/.ccache/"

local cconf="$BUILD_ROOT"/etc/ccache.conf
if test -e $cconf; then
# setting compression value
# if grep returns false, change it using sed(create backup), else append setting
(grep "^compression\s*=\s*true\s*$" $cconf || sed -i`date +%s` "s:compression\s*=\s*.*$:compression = true:g" $cconf ) \
|| echo "compression = true" >> $cconf
else
echo "compression = true" >> $cconf
fi
local ccachetar="$BUILD_ROOT/.build.oldpackages/_ccache.tar"
test -e $ccachetar && tar -xf $ccachetar -C "$BUILD_ROOT/.ccache/"
else
rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++,clang,clang++}
fi
Expand Down Expand Up @@ -1319,7 +1329,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
copy_oldpackages
# chroot based builds
# rsync as source and dest could be same
test -n "$PKG_CCACHE" -a -e "$PKG_CCACHE" && rsync -v "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar.gz"
test -n "$PKG_CCACHE" -a -e "$PKG_CCACHE" && rsync -v "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar"
fi

mount_stuff
Expand Down Expand Up @@ -1591,7 +1601,7 @@ fi

if test -n "$CCACHE" ; then
echo "... saving ccache"
tar -zcf "$BUILD_ROOT/$TOPDIR/OTHER/_ccache.tar.gz" -C "$BUILD_ROOT/.ccache/" .
tar -cf "$BUILD_ROOT/$TOPDIR/OTHER/_ccache.tar" -C "$BUILD_ROOT/.ccache/" .
fi

if test \( -n "$RPMS" -o -n "$DEBS" \) -a -n "$CREATE_BASELIBS"; then
Expand Down
2 changes: 1 addition & 1 deletion build-vm
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ vm_first_stage() {
fi

# rsync as source and dest could be same
test -n "$PKG_CCACHE" && rsync -av "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar.gz"
test -n "$PKG_CCACHE" && rsync -av "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar"

if test -n "$VM_ROOT" ; then
# copy out kernel & initrd (if they exist) during unmounting VM image
Expand Down

0 comments on commit 2f83e3a

Please sign in to comment.