summaryrefslogtreecommitdiff
path: root/Toolchain/BuildIt.sh
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-05-11 06:11:26 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-11 10:27:19 +0200
commit29a44bc3256e595013b7b0df17e0409d1ac93733 (patch)
tree57e07dfc79d952bb455ad3dfa8c4d28ad1c7f2a5 /Toolchain/BuildIt.sh
parentc377e6af2989c4d583fa0e0d3a1e171347535a90 (diff)
downloadserenity-29a44bc3256e595013b7b0df17e0409d1ac93733.zip
Travis: Fix Cache spam
Back in 36ba0a35eecec73c3347c43aeb18f3ea4849117d I thought that Travis would automagically delete theoldest files. Apparently it does not. Note that no dummy changes are needed, because BuildIt.sh lists itself as a dependency for the Toolchain. Hooray for something that works!
Diffstat (limited to 'Toolchain/BuildIt.sh')
-rwxr-xr-xToolchain/BuildIt.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh
index c54e1cd1b1..17d4f34484 100755
--- a/Toolchain/BuildIt.sh
+++ b/Toolchain/BuildIt.sh
@@ -18,6 +18,10 @@ MAKE="make"
MD5SUM="md5sum"
NPROC="nproc"
+# Each cache entry is 260 MB. 8 entries are 4 GiB.
+# It seems that Travis starts having trouble at 35 entries, so I think this is a good amount.
+KEEP_CACHE_COUNT=8
+
if [ "$(uname -s)" = "OpenBSD" ]; then
MAKE=gmake
MD5SUM="md5 -q"
@@ -88,6 +92,16 @@ pushd "$DIR"
else
echo "Cache at Cache/ToolchainLocal_${DEPS_HASH}.tar.gz does not exist."
echo "Will rebuild toolchain from scratch, and save the result."
+ echo "But first, getting rid of old, outdated caches. Current caches:"
+ pushd "Cache/"
+ ls -l
+ # Travis preserves timestamps. Don't ask me why, but it does.
+ # We can exploit this to get an easy approximation of recent-ness.
+ # Our purging algorithm is simple: keep only the newest X entries.
+ ls -t | tail "-n+${KEEP_CACHE_COUNT}" | xargs -r rm -v
+ echo "After deletion:"
+ ls -l
+ popd
fi
fi