diff --git a/docker/Dockerfile b/docker/Dockerfile --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,8 @@ memcached \ postgresql-client \ wait-for-it \ - ngrep && \ + ngrep \ + rsync && \ apt-get install -y --no-install-recommends \ r-base-core \ r-cran-jsonlite && \ diff --git a/docker/README.md b/docker/README.md --- a/docker/README.md +++ b/docker/README.md @@ -433,21 +433,6 @@ code). If the application you play with has autoreload support, there is no need to restart the impacted container.) -Note: if the docker fails to start when using local sources for one or more swh -package, it's most probably due to permission problems on cache files. For -example, if you have executed tests locally (using pytest or tox), you have -cache files (__pycache__ etc.) that will prevent `pip install` from working -within the docker. - -The solution is to clean these files and directories before trying to spawn the -docker. - -``` -~/swh-environment$ find . -type d -name __pycache__ -exec rm -rf {} \; -~/swh-environment$ find . -type d -name .tox -exec rm -rf {} \; -~/swh-environment$ find . -type d -name .hypothesis -exec rm -rf {} \; -``` - ### Using locally installed swh tools with docker @@ -518,11 +503,6 @@ export COMPOSE_FILE=~/swh-environment/docker/docker-compose.yml:~/swh-environment/docker/docker-compose.override.yml alias doco=docker-compose -function swhclean { - find ~/swh-environment -type d -name __pycache__ -exec rm -rf {} \; - find ~/swh-environment -type d -name .tox -exec rm -rf {} \; - find ~/swh-environment -type d -name .hypothesis -exec rm -rf {} \; -} EOF ``` @@ -543,11 +523,6 @@ - create an alias `doco` for `docker-compose` because this is way too long to type, -- add a `swhclean` shell function to clean your source directories so that - there is no conflict with docker containers using local swh repositories (see - below). This will delete any `.tox`, `__pycache__` and `.hypothesis` - directory found in your swh-environment directory. - So now you can easily: * Start the SWH platform: diff --git a/docker/utils/pyutils.sh b/docker/utils/pyutils.sh --- a/docker/utils/pyutils.sh +++ b/docker/utils/pyutils.sh @@ -4,9 +4,13 @@ echo Using pip from $(which pip) if [[ -d /src ]] ; then - for srcrepo in /src/swh-* ; do + tmpdir=`mktemp -d` + cp -R /src/* $tmpdir/ + rsync -a /src/ $tmpdir/ --exclude "*/__pycache__/" --exclude "*/.tox/" --exclude "*/.hypothesis/" + for srcrepo in $tmpdir/swh-* ; do pip install $srcrepo done + rm -rf $tmpdir fi echo Installed Python packages: