[build] Use virtualenv to create tarballs

Use virtualenv to deal with different pbr requirements

   Closes-Bug: #1650049

Change-Id: I814c76208ba569263bb0bc0a5082705f230dc882
This commit is contained in:
Dmitry Burmistrov 2016-12-15 17:11:21 +04:00
parent b3fc883f83
commit 1a9697c30f
2 changed files with 12 additions and 0 deletions

View File

@ -99,8 +99,14 @@ main () {
# Do not perform `setup.py sdist` for rally packages
tar -czf ${BUILDDIR}/$TAR_NAME $EXCLUDES .
else
# Use virtualenv to deal with different pbr requirements
local venv=$(mktemp -d)
virtualenv "$venv"
source "${venv}/bin/activate"
python setup.py --version # this will download pbr if it's not available
PBR_VERSION=$release_tag python setup.py sdist -d ${BUILDDIR}/
deactivate
[ -d "$venv" ] && rm -rf "$venv"
# Fix source folder name at sdist tarball
local sdist_tarball=$(find ${BUILDDIR}/ -maxdepth 1 -name "*.gz")
if [ "$(tar -tf $sdist_tarball | head -n 1 | cut -d'/' -f1)" != "${srcpackagename}-${version}" ] ; then

View File

@ -78,8 +78,14 @@ This package provides the %{-n*} kernel modules
# Do not perform `setup.py sdist` for openstack-macros package
tar -czf ${BUILDDIR}/$TAR_NAME $EXCLUDES .
else
# Use virtualenv to deal with different pbr requirements
local venv=$(mktemp -d)
virtualenv "$venv"
source "${venv}/bin/activate"
python setup.py --version # this will download pbr if it's not available
PBR_VERSION=$release_tag python setup.py sdist -d ${BUILDDIR}/
deactivate
[ -d "$venv" ] && rm -rf "$venv"
# Fix source folder name at sdist tarball
local sdist_tarball=$(find ${BUILDDIR}/ -maxdepth 1 -name "*.gz")
if [ "$(tar -tf $sdist_tarball | head -n 1 | cut -d'/' -f1)" != "${PACKAGENAME}-${version}" ] ; then