diff --git a/check_docker_clean.sh b/check_docker_clean.sh index 3bd90f8c..4349e1d3 100755 --- a/check_docker_clean.sh +++ b/check_docker_clean.sh @@ -19,27 +19,53 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$srcdir/docker.sh" +# Caches we want to check have been removed: +# +# .cache => Python pip +# +# .cpan => Perl +# .cpanm +# +# .gem => Ruby +# +# Java / Scala / Groovy: +# +# .gradle => Gradle +# .groovy => Groovy +# .ivy => Ivy (Sbt / Gradle) +# .ivy2 +# .m2 => Maven +# .sbt => SBT + +cache_list=" +.cache +.cpan +.cpanm +.gem +.gradle +.groovy +.ivy +.ivy2 +.m2 +.sbt +" + if is_inside_docker; then - # Python pip => .cache - # Perl => .cpan / .cpanm - # Ruby => .gem - # Java / Scala / Groovy: - # Maven => .m2 - # Ivy => .ivy .ivy2 - # (Sbt / Gradle) for x in \ - .cache \ - .cpan \ - .cpanm \ - .m2 \ - .ivy \ - .ivy2 \ ; do for y in /root ~; do + # This might fail if we're not running as root :-/ + # consider sudo'ing and find / -type d -name $x but that might find .cache under some app or something, although we should probably remove that too + # for now this is good enough as most dockers are built as root + # should test for sudo availability as well if [ -e "$y/$x" ]; then echo "$y/$x detected, should have been removed from docker build" exit 1 fi done done + if [ -n "$(find / -type f -name pytools_checks)" ]; then + echo "pytools_checks detected, should have been removed from docker build" + exit 1 + fi fi diff --git a/check_pytools.sh b/check_pytools.sh index 4bbda39c..30378ff9 100755 --- a/check_pytools.sh +++ b/check_pytools.sh @@ -18,6 +18,7 @@ set -euo pipefail srcdir2="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$srcdir2/utils.sh" +. "$srcdir2/docker.sh" srcdir="$srcdir2" @@ -34,6 +35,9 @@ if [ "$PROJECT" = "pytools" ]; then elif [ "$PROJECT" = "Dockerfiles" ]; then echo "detected running in Dockerfiles repo, skipping checks here as will be called in bash-tools/all.sh..." skip_checks=1 +elif is_inside_docker; then + echo "detected running inside Docker, skipping pytools checks" + skip_checks=1 fi if [ $skip_checks = 1 ]; then