From 37dff9738afd245772cf029995476f29e68fb0f0 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 22 Feb 2019 18:03:50 +1100 Subject: [PATCH] Fix opensuse 42.3 pip-and-virtualenv Related to I041a141366099093805e6052b1bbf64efd277e1e, we also need to remove this on opensuse. The files for gate testing are added, but the test is not added to any jobs at this point in the interests of gate time. Change-Id: I1af9e84d76bedcb2607717edc6d2abe2920b0584 --- .../04-install-pip | 21 ++++++++++++------- .../source-install-opensuse/element-deps | 3 +++ .../10-source-installtype-pip-and-virtualenv | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-deps create mode 100644 diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenv 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 457e2848..19c7ea41 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 @@ -11,6 +11,8 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then # Default packages _do_py3=0 _extra_repo='' + # see notes below on this var... + _clear_old_files=0 case "$DISTRO_NAME" in centos*|rhel7) # note python2-pip in epel @@ -23,6 +25,8 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then else packages+=" python-setuptools" fi + # see notes below + _clear_old_files=1 ;; fedora) _do_py3=1 @@ -33,6 +37,7 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then case "$DIB_RELEASE" in 42*) packages="python-virtualenv python-pip python-setuptools" + _clear_old_files=1 ;; tumbleweed|15*) # XXX: python3? @@ -68,15 +73,15 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then # about to re-install so pip doesn't think anything is installed. # See: https://github.com/pypa/pip/issues/4805 # - # This is only necessary on CentOS -- for complicated reasons of - # course. On Fedora, the Python2 virtualenv packages are *not* - # distutils based and pip overwrites them correctly. For python3, - # pip has changed to not overwrite system packages (a long - # standing difference between Debuntu and Fedora), but a number of - # tools run with "python3 -Es" to isolate themselves to the - # package installed versions. So we definitely don't want to + # This is only necessary on old CentOS and suse -- for complicated + # reasons of course. On Fedora, the Python2 virtualenv packages + # are *not* distutils based and pip overwrites them correctly. + # For python3, pip has changed to not overwrite system packages (a + # long standing difference between Debuntu and Fedora), but a + # number of tools run with "python3 -Es" to isolate themselves to + # the package installed versions. So we definitely don't want to # clear the packaged versions out in that case. - if [[ $DISTRO_NAME =~ (centos|centos7|rhel7) ]]; then + if [[ ${_clear_old_files} == 1 ]]; then for pkg in $packages; do rpm -ql $pkg | xargs rm -rf done diff --git a/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-deps b/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-deps new file mode 100644 index 00000000..0575b7a8 --- /dev/null +++ b/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-deps @@ -0,0 +1,3 @@ +openstack-ci-mirrors +opensuse-minimal + diff --git a/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenv b/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenv new file mode 100644 index 00000000..0f27f00c --- /dev/null +++ b/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenv @@ -0,0 +1 @@ +export DIB_INSTALLTYPE_pip_and_virtualenv=source