Commit bbd44f6b authored by Markus Frosch's avatar Markus Frosch
Browse files

Avoid ccache dir being created when not used

Also clean an empty ccache dir.
parent 65038999
Pipeline #5171 passed with stage
in 30 seconds
......@@ -17,7 +17,9 @@ fi
# reset ccache statistics
# so we now the statistics of the new build
ccache -z # (--zero-stats)
if [ -d "${CCACHE_DIR}" ]; then
ccache -z # (--zero-stats)
fi
# use eatmydata if present
eatmydata=
......@@ -70,9 +72,17 @@ echo "[ Building binary package ]"
dpkg-buildpackage -rfakeroot -uc -us $binopts
)
echo "[ ccache stats ]"
ccache -s | tee build/ccache-stats.txt # (--show-stats)
echo
if [ -d "${CCACHE_DIR}" ]; then
cached_files="$(find "${CCACHE_DIR}" -type f ! -name ccache.conf ! -name stats | wc -l)"
if [ "$cached_files" -eq 0 ]; then
echo "Removing empty ccache dir: ${CCACHE_DIR}"
rm -rf "${CCACHE_DIR}"
else
echo "[ ccache stats ]"
ccache -s | tee build/ccache-stats.txt # (--show-stats)
echo
fi
fi
echo "[ Running Lintian ]"
(
......
......@@ -63,12 +63,13 @@ if command -v ccache &>/dev/null; then
echo "[ Preparing ccache for our environment ]"
export CCACHE_DIR="${WORKDIR}/ccache"
rm -f ccache.stats
test -d "${CCACHE_DIR}" || mkdir "${CCACHE_DIR}"
preconfigure_ccache
# reset ccache statistics
# so we now the statistics of the new build
ccache -z # (--zero-stats)
if [ -d "${CCACHE_DIR}" ]; then
ccache -z # (--zero-stats)
fi
fi
echo "[ Building binary package ]"
......@@ -88,10 +89,16 @@ eval "$(get_rpmbuild --rebuild "${source_rpm}")"
fi
)
if command -v ccache &>/dev/null; then
echo "[ ccache stats ]"
ccache -s | tee build/ccache-stats.txt # (--show-stats)
echo
if command -v ccache &>/dev/null && [ -d "${CCACHE_DIR}" ]; then
cached_files="$(find "${CCACHE_DIR}" -type f ! -name ccache.conf ! -name stats | wc -l)"
if [ "$cached_files" -eq 0 ]; then
echo "Removing empty ccache dir: ${CCACHE_DIR}"
rm -rf "${CCACHE_DIR}"
else
echo "[ ccache stats ]"
ccache -s | tee build/ccache-stats.txt # (--show-stats)
echo
fi
fi
echo "[ Running rpmlint ]"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment