diff --git a/slave_scripts/build-venv.sh b/slave_scripts/build-venv.sh new file mode 100755 index 00000000..d8344510 --- /dev/null +++ b/slave_scripts/build-venv.sh @@ -0,0 +1,22 @@ +#!/bin/bash -xe + +# Make sure there is a location on this builder to cache pip downloads +mkdir -p ~/cache/pip +export PIP_DOWNLOAD_CACHE=~/cache/pip + +# Start with a clean slate +rm -fr jenkins_venvs +mkdir -p jenkins_venvs + +# Build a venv for every known branch +for branch in `git branch -r |grep "origin/"|grep -v HEAD|sed "s/origin\///"` +do + echo "Building venv for $branch" + git checkout $branch + mkdir -p jenkins_venvs/$branch + python tools/install_venv.py + virtualenv --relocatable .venv + tar cvfz jenkins_venvs/$branch/venv.tgz .venv + rm -fr .venv +done +git checkout master diff --git a/slave_scripts/copy-venv.sh b/slave_scripts/copy-venv.sh new file mode 100755 index 00000000..cfb63b48 --- /dev/null +++ b/slave_scripts/copy-venv.sh @@ -0,0 +1,19 @@ +#!/bin/bash -xe + +# Support jobs, such as nova-docs, which are not yet triggered by gerrit +if [ "x$GERRIT_BRANCH" = "x" ] ; then + GERRIT_BRANCH=master +fi +mv jenkins_venvs/$GERRIT_BRANCH/venv.tgz . +rm -fr jenkins_venvs +tar xfz venv.tgz +rm venv.tgz +perl -MCwd -ple '$CWD=Cwd::abs_path();s,^VIRTUAL_ENV=.*,VIRTUAL_ENV="$CWD/.venv",' -i .venv/bin/activate +# This gets easy-install.pth as well as $PROJECT.pth. Examples for glance: +# easy-install.pth looks like: /home/jenkins/workspace/glance-venv/.venv/src/keystone +# $PROJECT.pth looks like: /home/jenkins/workspace/glance-venv +perl -MCwd -ple '$CWD=Cwd::abs_path();s,^/.*/workspace/[^/]+(/.*)$,$CWD$1,' -i .venv/lib/python2.7/site-packages/*.pth +# This is needed for the keystone install for glance +perl -MCwd -ple '$CWD=Cwd::abs_path();s,^/.*/.venv/src/(.*),$CWD/.venv/src/$1,' -i .venv/lib/python2.7/site-packages/*.egg-link +# This is needed for the keystone install for glance +perl -MCwd -ple '$CWD=Cwd::abs_path();s,/.*/.venv/src/(.*),$CWD/.venv/src/$1,' -i .venv/bin/*