pip-and-virtualenv: fix install-pip when centos-release-openstack is enabled

When RDO projects repository is installed, the python-setuptools
package is obsoleted by python2-setuptools, this makes the install-pip
script failed:

  Package python-setuptools-0.9.8-7.el7.noarch is obsoleted by
  python2-setuptools-22.0.5-1.el7.noarch which is already installed

Then the "rpm -ql python-setuptools | xargs rm -rf" exit 1.  Check if
we have a record of the updated package obsoleting then old one; if
so, use it.

Change-Id: I2b0051bd9e81908c187098a7b82e120b999b111d
This commit is contained in:
Tristan Cacqueray 2018-04-20 05:16:24 +00:00 committed by Ian Wienand
parent 99eb9a2d7d
commit abd63b01aa

View File

@ -15,7 +15,14 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then
centos*|rhel7) centos*|rhel7)
# note python2-pip in epel # note python2-pip in epel
_extra_repo="--enablerepo=epel" _extra_repo="--enablerepo=epel"
packages="python-virtualenv python2-pip python-setuptools" packages="python-virtualenv python2-pip"
if [[ "$(rpm -q --qf '[%{obsoletes}\n]' python2-setuptools)" == "python-setuptools" ]]; then
# If OpenStack release is installed, then python-setuptools is
# obsoleted by python2-setuptools
packages+=" python2-setuptools"
else
packages+=" python-setuptools"
fi
;; ;;
fedora) fedora)
_do_py3=1 _do_py3=1