From: Nathan Cutler Date: Thu, 5 Jul 2018 08:16:59 +0000 (+0200) Subject: run-make-check.sh: ccache goodness for everyone X-Git-Tag: v14.0.1~911^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2315928acdd0e367b6a7d85ee16a15f820432d22;p=ceph.git run-make-check.sh: ccache goodness for everyone Since run-make-check.sh already ensures that ccache is installed, it makes sense to let everyone benefit from the ccache tweaks introduced by 4cb5a590537a9caaf61db42ce8ea123d2ab961f3 Note 1: The previous solution using "date" would cause build tools to reset their timestamps after 24 hours, on subsequent runs of run-make-check.sh. In order to maximize ccache effectiveness, this commit sets SOURCE_DATE_EPOCH to a fixed value: the number of seconds elapsed since the Unix epoch as at January 1, 2000 (chosen to commemorate Y2K armageddon). Note 2: this commit introduces "set -e". This was actually in effect before, via "source install-deps.sh". Better to make it explicit. Fixes: http://tracker.ceph.com/issues/24777 Signed-off-by: Nathan Cutler --- diff --git a/run-make-check.sh b/run-make-check.sh index 643906a64e0..364b4e58ca0 100755 --- a/run-make-check.sh +++ b/run-make-check.sh @@ -12,9 +12,26 @@ # version 2.1 of the License, or (at your option) any later version. # -# -# Return MAX(1, (number of processors / 2)) by default or NPROC -# +set -e + +trap clean_up_after_myself EXIT + +ORIGINAL_CCACHE_CONF="$HOME/.ccache/ccache.conf" +SAVED_CCACHE_CONF="$HOME/.run-make-check-saved-ccache-conf" + +function save_ccache_conf() { + test -f $ORIGINAL_CCACHE_CONF && cp $ORIGINAL_CCACHE_CONF $SAVED_CCACHE_CONF || true +} + +function restore_ccache_conf() { + test -f $SAVED_CCACHE_CONF && mv $SAVED_CCACHE_CONF $ORIGINAL_CCACHE_CONF || true +} + +function clean_up_after_myself() { + rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv* + restore_ccache_conf +} + function get_processors() { if test -n "$NPROC" ; then echo $NPROC @@ -60,6 +77,11 @@ function run() { echo "This probably means distribution $ID is not supported by run-make-check.sh" >&2 fi + if ! type ccache > /dev/null 2>&1 ; then + echo "ERROR: ccache could not be installed" + exit 1 + fi + if test -f ./install-deps.sh ; then $DRY_RUN source ./install-deps.sh || return 1 fi @@ -76,28 +98,34 @@ function run() { CMAKE_BUILD_OPTS="-DWITH_FIO=ON -DWITH_GTEST_PARALLEL=ON" - # Are we in the CI ? + cat <