From 32e368d37cc330d90313b2017740a73f5eedab92 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 16 Nov 2013 04:27:25 -0500 Subject: Serve local mirror using apache There are enough behavioral differences between http and file urls for pypi mirrors that we should do the local mirror via apache. That way we're testing what we care about - consumption of changes in the mirror context - and not what we don't - how well pip deals with file urls. Change-Id: Icb16e8bbe77c03f224d06010eeb6bd0877b0d6ca --- tools/integration.sh | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/tools/integration.sh b/tools/integration.sh index 6fa9f10..49e9aa0 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -31,8 +31,9 @@ whoami=$(whoami) tmpdownload=$tmpdir/download mkdir -p $tmpdownload -pypidir=$tmpdir/pypi -mkdir -p $pypidir +pypidir=/var/www/pypi +sudo mkdir -p $pypidir +sudo chown $USER $pypidir pypimirrorvenv=$tmpdir/pypi-mirror @@ -66,6 +67,25 @@ EOF # because the wheel format itself does not distinguish distro=`lsb_release -i -r -s | xargs | tr ' ' '-'` +# set up local apache to serve the mirror we're about to create +if [ ! -d /etc/apache2/sites-enabled/ ] ; then + echo "Apache does not seem to be installed!!!" + exit 1 +fi + +sudo rm /etc/apache2/sites-enabled/* +cat < $tmpdir/pypi.conf + + ServerAdmin webmaster@localhost + DocumentRoot /var/www + Options Indexes FollowSymLinks + +EOF +sudo mv $tmpdir/pypi.conf /etc/apache2/sites-available/pypi +sudo chown root:root /etc/apache2/sites-available/pypi +sudo a2ensite pypi +sudo service apache2 reload + # PROJECTS is a list of projects that we're testing PROJECTS=$* @@ -82,10 +102,13 @@ $pypimirrorvenv/bin/python setup.py sdist -d $tmpdownload/pip/openstack $pypimirrorvenv/bin/run-mirror -b remotes/origin/master --verbose -c $tmpdir/mirror.yaml --no-download +find $pypidir -type f -name '*.html' -delete find $pypidir + # Make pypi thing -pypiurl=file://$pypidir +pypiurl=http://localhost/pypi +export no_proxy=$no_proxy${no_proxy:+,}localhost cat < ~/.pydistutils.cfg [easy_install] @@ -175,7 +198,11 @@ for PROJECT in $PROJECTS ; do # Test that we can make a tarball from scratch mkvenv $sdistvenv distribute + (cd $REPODIR/requirements && python update.py $shortprojectdir) cd $shortprojectdir + if ! git diff --quiet ; then + git commit -a -m"Update requirements" + fi $sdistvenv/bin/python setup.py sdist # Test that the tarball installs @@ -197,6 +224,9 @@ for PROJECT in $PROJECTS ; do installprojectdir=$projectdir/install$SHORT_PROJECT git clone $REPODIR/$SHORT_PROJECT $installprojectdir cd $installprojectdir + if ! git diff --quiet ; then + git commit -a -m"Update requirements" + fi $installvenv/bin/python setup.py install # Ensure the install_package_data is doing the thing it should do -- cgit v1.2.1