From abd63b01aac585d12eefcc5506065652a26243bb Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 20 Apr 2018 05:16:24 +0000 Subject: [PATCH] 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 --- .../pip-and-virtualenv-source-install/04-install-pip | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index 82d2dac6..746b78ef 100755 --- a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -15,7 +15,14 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then centos*|rhel7) # note python2-pip in 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) _do_py3=1