[suse] Handle pip-and-virtualenv install for opensuse

Similarly to Fedora we need to register the virtualenv package
with the rpm database to avoid things becoming messy later on
when package dependencies are conflicting with the from-source
install.

Change-Id: I67654fe5533e6086a17b38e2ae79a630a609ff92
This commit is contained in:
Dirk Mueller 2017-02-22 19:59:44 +01:00
parent 2d919e7ca0
commit 65c6da58c3

View File

@ -6,7 +6,7 @@ fi
set -eu set -eu
set -o pipefail set -o pipefail
if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then if [[ $DISTRO_NAME =~ (opensuse}fedora|centos|centos7|rhel|rhel7) ]]; then
# GENERAL WARNING : mixing packaged python libraries with # GENERAL WARNING : mixing packaged python libraries with
# pip-installed versions always creates issues. Upstream # pip-installed versions always creates issues. Upstream
# openstack-infra uses this a lot (especially devstack) but be # openstack-infra uses this a lot (especially devstack) but be
@ -16,7 +16,11 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then
# on somebody does a "yum install python-virtualenv" and goes and # on somebody does a "yum install python-virtualenv" and goes and
# overwrites the pip installed version with the packaged version, # overwrites the pip installed version with the packaged version,
# leading to all sorts of weird version issues. # leading to all sorts of weird version issues.
if [[ $DISTRO_NAME = opensuse ]]; then
zypper -n install python-virtualenv python-pip python-setuptools
else
${YUM:-yum} install -y python-virtualenv python-pip python-setuptools ${YUM:-yum} install -y python-virtualenv python-pip python-setuptools
fi
# install pip; this overwrites packaged pip # install pip; this overwrites packaged pip
/usr/local/bin/dib-python /tmp/get-pip.py /usr/local/bin/dib-python /tmp/get-pip.py
@ -38,6 +42,16 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then
# doesn't have issues with other system packages. # doesn't have issues with other system packages.
pip install -U virtualenv pip install -U virtualenv
if [[ $DISTRO_NAME = opensuse ]]; then
for pkg in virtualenv pip setuptools; do
cat - >> /etc/zypp/locks <<EOF
type: package
match_type: glob
case_sensitive: on
solvable_name: python-$pkg
EOF
done
else
# Add this to exclude so that we don't install a later package # Add this to exclude so that we don't install a later package
# over it if it updates. Note that fedora-minimal, bootstrapped # over it if it updates. Note that fedora-minimal, bootstrapped
# via yum, can have an old yum.conf around, so look for dnf first. # via yum, can have an old yum.conf around, so look for dnf first.
@ -49,6 +63,7 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then
die "No conf to modify?" die "No conf to modify?"
fi fi
echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf} echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf}
fi
else else
/usr/local/bin/dib-python /tmp/get-pip.py /usr/local/bin/dib-python /tmp/get-pip.py
pip install virtualenv pip install virtualenv