Skip to content

Commit

Permalink
Add bundle support.
Browse files Browse the repository at this point in the history
Add scripts to build and copy bundle files.
Tell tarball script how to use tox.

Change-Id: Ia9547bffb9274bf67a9cf2be169d6630de8e374e
  • Loading branch information
emonty committed Mar 5, 2012
1 parent 66c4198 commit 27ab7c6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 12 deletions.
23 changes: 23 additions & 0 deletions slave_scripts/build-bundle.sh
@@ -0,0 +1,23 @@
#!/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
if [ -f tools/test-requires ] ; then
pip bundle jenkins_venvs/$branch/.cache.bundle -r tools/pip-requires -r tools/test-requires
else
pip bundle jenkins_venvs/$branch/.cache.bundle -r tools/pip-requires
fi
done
git checkout master
15 changes: 15 additions & 0 deletions slave_scripts/copy-bundle.sh
@@ -0,0 +1,15 @@
#!/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/.cache.bundle .
rm -fr jenkins_venvs

if [ -f tools/test-requires -a \
`git diff HEAD^1 tools/test-requires 2>/dev/null | wc -l` -gt 0 -o \
`git diff HEAD^1 tools/pip-requires 2>/dev/null | wc -l` -gt 0 ]
then
rm .cache.bundle
fi
31 changes: 19 additions & 12 deletions tarball_script.sh
Expand Up @@ -79,16 +79,6 @@ then
exit 1
fi

# If there is a bundle file, build a virtualenv from the
# bundle we use for tox
if [ -e ".cache.bundle" ]
then
mv .cache.bundle .cache.pybundle
virtualenv --no-site-packages .venv
.venv/bin/pip install .cache.pybundle
rm .cache.pybundle
fi

VERSIONDIR="$HOME/versions"
RECORDFILE="$VERSIONDIR/tarballversions"

Expand All @@ -109,9 +99,26 @@ SEPARATOR=${SEPARATOR:-'~'}

rm -f dist/*.tar.gz
if [ -f setup.py ] ; then
# swift has no virtualenv information in its tree.
if [ -d .venv -o -f tools/with_venv.sh ] ; then
# Try tox and cached bundles first
if [ -e ".cache.bundle" ] ; then
if [ -f tox.ini -a -f /usr/bin/tox ] ; then
if tox --showconfig | grep testenv | grep jenkinsvenv >/dev/null 2>&1
then
tox -ejenkinsvenv python setup.py sdist
else
tox -evenv python setup.py sdist
fi
else
rm -rf .venv
mv .cache.bundle .cache.pybundle
virtualenv --no-site-packages .venv
.venv/bin/pip install .cache.pybundle
rm .cache.pybundle
fi
# Try old style venv's second
elif [ -d .venv -a -f tools/with_venv.sh ] ; then
tools/with_venv.sh python setup.py sdist
# Last but not least, just make a tarball
else
python setup.py sdist
fi
Expand Down

0 comments on commit 27ab7c6

Please sign in to comment.