Skip to content
Snippets Groups Projects
Commit 39ec1e80 authored by Nicolas Noble's avatar Nicolas Noble
Browse files

Merge pull request #3638 from soltanmm/pip-so-cash

Enable `pip` caching
parents d1da978a 60e5f91a
Branches
Tags
No related merge requests found
...@@ -37,8 +37,13 @@ cd `dirname $0`/../.. ...@@ -37,8 +37,13 @@ cd `dirname $0`/../..
git_root=`pwd` git_root=`pwd`
cd - cd -
# Ensure existence of ccache directory
mkdir -p /tmp/ccache mkdir -p /tmp/ccache
# Ensure existence of the home directory for XDG caches (e.g. what pip uses for
# its cache location now that --download-cache is deprecated).
mkdir -p /tmp/xdg-cache-home
# Create a local branch so the child Docker script won't complain # Create a local branch so the child Docker script won't complain
git branch -f jenkins-docker git branch -f jenkins-docker
...@@ -57,9 +62,11 @@ docker run \ ...@@ -57,9 +62,11 @@ docker run \
-e "config=$config" \ -e "config=$config" \
-e "arch=$arch" \ -e "arch=$arch" \
-e CCACHE_DIR=/tmp/ccache \ -e CCACHE_DIR=/tmp/ccache \
-e XDG_CACHE_HOME=/tmp/xdg-cache-home \
-i $TTY_FLAG \ -i $TTY_FLAG \
-v "$git_root:/var/local/jenkins/grpc" \ -v "$git_root:/var/local/jenkins/grpc" \
-v /tmp/ccache:/tmp/ccache \ -v /tmp/ccache:/tmp/ccache \
-v /tmp/xdg-cache-home:/tmp/xdg-cache-home \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/bin/docker \ -v $(which docker):/bin/docker \
-w /var/local/git/grpc \ -w /var/local/git/grpc \
......
...@@ -36,6 +36,10 @@ set -e ...@@ -36,6 +36,10 @@ set -e
export CONFIG=$config export CONFIG=$config
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5 export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5
# Ensure that programs depending on current-user-ownership of cache directories
# are satisfied (it's being mounted from outside the image).
chown `whoami` $XDG_CACHE_HOME
mkdir -p /var/local/git mkdir -p /var/local/git
git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
......
...@@ -126,10 +126,11 @@ RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" ...@@ -126,10 +126,11 @@ RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
python-all-dev \ python-all-dev \
python3-all-dev \ python3-all-dev \
python-pip \ python-pip
python-virtualenv
# Install Python packages from PyPI # Install Python packages from PyPI
RUN pip install pip --upgrade
RUN pip install virtualenv
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2
# For sanity test # For sanity test
......
...@@ -39,6 +39,33 @@ GRPCIO=$ROOT/src/python/grpcio ...@@ -39,6 +39,33 @@ GRPCIO=$ROOT/src/python/grpcio
GRPCIO_TEST=$ROOT/src/python/grpcio_test GRPCIO_TEST=$ROOT/src/python/grpcio_test
GRPCIO_HEALTH_CHECKING=$ROOT/src/python/grpcio_health_checking GRPCIO_HEALTH_CHECKING=$ROOT/src/python/grpcio_health_checking
install_grpcio_deps() {
cd $GRPCIO
pip install -r requirements.txt
}
install_grpcio_test_deps() {
cd $GRPCIO_TEST
pip install -r requirements.txt
}
install_grpcio() {
CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO
}
install_grpcio_test() {
pip install $GRPCIO_TEST
}
install_grpcio_health_checking() {
pip install $GRPCIO_HEALTH_CHECKING
}
# Cleans the environment of previous installations
clean_grpcio_all() {
(yes | pip uninstall grpcio) || true
(yes | pip uninstall grpcio_test) || true
(yes | pip uninstall grpcio_health_checking) || true
}
# Builds the testing environment.
make_virtualenv() { make_virtualenv() {
virtualenv_name="python"$1"_virtual_environment" virtualenv_name="python"$1"_virtual_environment"
if [ ! -d $virtualenv_name ] if [ ! -d $virtualenv_name ]
...@@ -48,33 +75,29 @@ make_virtualenv() { ...@@ -48,33 +75,29 @@ make_virtualenv() {
source $virtualenv_name/bin/activate source $virtualenv_name/bin/activate
# Install grpcio # Install grpcio
cd $GRPCIO install_grpcio_deps
pip install -r requirements.txt install_grpcio
CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO
# Install grpcio_test # Install grpcio_test
cd $GRPCIO_TEST install_grpcio_test_deps
pip install -r requirements.txt install_grpcio_test
pip install $GRPCIO_TEST
# Install grpcio_health_checking # Install grpcio_health_checking
pip install $GRPCIO_HEALTH_CHECKING install_grpcio_health_checking
else else
source $virtualenv_name/bin/activate source $virtualenv_name/bin/activate
# Uninstall and re-install the packages we care about. Don't use # Uninstall and re-install the packages we care about. Don't use
# --force-reinstall or --ignore-installed to avoid propagating this # --force-reinstall or --ignore-installed to avoid propagating this
# unnecessarily to dependencies. Don't use --no-deps to avoid missing # unnecessarily to dependencies. Don't use --no-deps to avoid missing
# dependency upgrades. # dependency upgrades.
(yes | pip uninstall grpcio) || true clean_grpcio_all
(yes | pip uninstall grpcio_test) || true install_grpcio || (
(yes | pip uninstall grpcio_health_checking) || true
(CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO) || (
# Fall back to rebuilding the entire environment # Fall back to rebuilding the entire environment
rm -rf $virtualenv_name rm -rf $virtualenv_name
make_virtualenv $1 make_virtualenv $1
) )
pip install $GRPCIO_TEST install_grpcio_test
pip install $GRPCIO_HEALTH_CHECKING install_grpcio_health_checking
fi fi
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment