configure.ac | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-)
New commits: commit 70fd835b4cf75e386ee115c705241a4059fb68a8 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Tue May 30 12:25:22 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Thu Jun 1 01:57:07 2023 +0200 Fix ccache cache size detection I have ccache 4.8.1 and it reports: (/home/khaled/.config/ccache/ccache.conf) max_size = 30.0 GB With a space between the number and the unit and the configure check with then see a unit-less 30 and will warn: ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection Instead of relying on the human readable output, use --print-stats which prints machine-readable output and is available since 3.7 (thanks to Cloph for the suggestion). Change-Id: I69f994a07cfbf08b66a2010f9c99401881d4acf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152382 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Tested-by: Jenkins diff --git a/configure.ac b/configure.ac index e86e3c30141d..06a60ebf8d8d 100644 --- a/configure.ac +++ b/configure.ac @@ -3316,31 +3316,15 @@ AC_SUBST(CCACHE_DEPEND_MODE) # sccache defaults are good enough if test "$CCACHE" != "" -a -z "$SCCACHE"; then - # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G - # -p works with both 4.2 and 4.4 - ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//']) - ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//') - if test "$ccache_size" = ""; then - ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//') - if test "$ccache_size" = ""; then - ccache_size=0 - fi - # we could not determine the size or it was less than 1GB -> disable auto-ccache - if test $ccache_size -lt 1024; then - CCACHE="" - AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection]) - add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled" - else - # warn that ccache may be too small for debug build - AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build]) - add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build" - fi - else - if test $ccache_size -lt 5; then - #warn that ccache may be too small for debug build - AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build]) - add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build" - fi + ccache_size=$($CCACHE --print-stats | $AWK /cache_size_kibibyte/'{ print $2 }') + if test $ccache_size -lt 976563; then + CCACHE="" + AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection]) + add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled" + elif test $ccache_size -lt 4883000; then + # warn that ccache may be too small for debug build + AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build]) + add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build" fi fi