[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.
${YUM:-yum} install -y python-virtualenv python-pip python-setuptools 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
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,17 +42,28 @@ 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
# Add this to exclude so that we don't install a later package if [[ $DISTRO_NAME = opensuse ]]; then
# over it if it updates. Note that fedora-minimal, bootstrapped for pkg in virtualenv pip setuptools; do
# via yum, can have an old yum.conf around, so look for dnf first. cat - >> /etc/zypp/locks <<EOF
if [[ -f /etc/dnf/dnf.conf ]]; then type: package
conf=/etc/dnf/dnf.conf match_type: glob
elif [[ -f /etc/yum.conf ]]; then case_sensitive: on
conf=/etc/yum.conf solvable_name: python-$pkg
EOF
done
else else
die "No conf to modify?" # Add this to exclude so that we don't install a later package
# over it if it updates. Note that fedora-minimal, bootstrapped
# via yum, can have an old yum.conf around, so look for dnf first.
if [[ -f /etc/dnf/dnf.conf ]]; then
conf=/etc/dnf/dnf.conf
elif [[ -f /etc/yum.conf ]]; then
conf=/etc/yum.conf
else
die "No conf to modify?"
fi
echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf}
fi fi
echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf}
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