From ac7fba7040239383049d02fcc866cc25a63b8c32 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 22 Apr 2020 11:08:19 +1000 Subject: [PATCH] pip-and-virtualenv: drop f31 & tumbleweed, rework suse 15 install This is an alternative approach to commit 68bb43535e8f032890687be6a253c3505cb319e5. I think this proposes a better overall solution that the prior change which had the Python 3 packages being installed, but did not specify the _do_py3 flag to do the installation steps that redirect the various tool installations. Fedora 31+ doesn't have python2, and Tumbleweed does have some Python 2 support but there seems to be no reason to bother updating this element for either with infra very close to removing this completely [1]. Error out on these platforms, and add a release note. The 15 path should include the python2 and python3 packages, along with the flags to do the "cleanup"; i.e. forced removal of distutils packages that pip 10+ won't touch. As mentioned in the original change, the six package causes problems here, but we can clear that too by explicitly listing it instead of letting it come in via dependencies. Again, this element will be removed from the infra 15 builds ASAP; but we can release with this to provide a roll-back point if we need to revert the removal to fix things temporarily. Add it to the testing path as well. [1] https://docs.opendev.org/opendev/infra-specs/latest/specs/cleanup-test-node-python.html Change-Id: I7a6a342461d6001c25e55638ba9b7438c28f2519 --- .zuul.d/jobs.yaml | 4 ++++ .../install-bin/pre-install.d/01-install-bin | 4 +--- .../04-install-pip | 23 +++++++++++++------ ...env-platform-removal-52e0d6a22829a3b2.yaml | 4 ++++ 4 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/pip-and-virtualenv-platform-removal-52e0d6a22829a3b2.yaml diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index 7aee56009..5360b6a98 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -132,6 +132,10 @@ Run the default tests on a Xenial build host with Python 3 parent: dib-functests-default nodeset: ubuntu-xenial + vars: + dib_functests_extra: + # Only builds on xenial; should work on focal in future + - pip-and-virtualenv/source-install-opensuse - job: name: dib-functests-xenial-python3-image diff --git a/diskimage_builder/elements/install-bin/pre-install.d/01-install-bin b/diskimage_builder/elements/install-bin/pre-install.d/01-install-bin index 12cd62946..59b38a01e 100755 --- a/diskimage_builder/elements/install-bin/pre-install.d/01-install-bin +++ b/diskimage_builder/elements/install-bin/pre-install.d/01-install-bin @@ -6,6 +6,4 @@ fi set -eu set -o pipefail -for f in $(find $(dirname $0)/../bin/ -type f -executable -print); do - install -m 0755 -o root -g root $f /usr/local/bin -done +install -m 0755 -o root -g root $(dirname $0)/../bin/* /usr/local/bin 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 bec0f624a..c98dd649b 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 @@ -29,6 +29,10 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then _clear_old_files=1 ;; fedora) + if [[ ${DIB_RELEASE} -gt 30 ]]; then + echo "This element is not supported for this version of Fedora" + exit 1 + fi _do_py3=1 packages="python2-virtualenv python2-pip python2-setuptools" packages=" python3-virtualenv python3-pip python3-setuptools" @@ -60,14 +64,17 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then _clear_old_files=1 ;; 15*) - # XXX: python3? - packages="python-xml python" - packages+=" python3-virtualenv python3-pip python3-setuptools" + _do_py3=1 + _clear_old_files=1 + # python*-six gets dragged in, and then is a + # distutils package and won't uninstall. put it + # here so it gets cleaned. + packages="python2-virtualenv python2-pip python2-setuptools python2-six" + packages+=" python3-virtualenv python3-pip python3-setuptools python3-six" ;; tumbleweed) - ### _do_py3=1 - packages="python-xml python" - packages+=" python3-virtualenv python3-pip python3-setuptools" + echo "This element is not supported for this platform" + exit 1 ;; esac ;; @@ -157,7 +164,9 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then # # Thus we need to *reinstall* the RPM version now, so those # files come back and system tools continue to work - dnf reinstall -y python3-setuptools + if [[ $DISTRO_NAME != opensuse ]]; then + dnf reinstall -y python3-setuptools + fi fi # now install latest virtualenv. it vendors stuff it needs so diff --git a/releasenotes/notes/pip-and-virtualenv-platform-removal-52e0d6a22829a3b2.yaml b/releasenotes/notes/pip-and-virtualenv-platform-removal-52e0d6a22829a3b2.yaml new file mode 100644 index 000000000..a9f459d40 --- /dev/null +++ b/releasenotes/notes/pip-and-virtualenv-platform-removal-52e0d6a22829a3b2.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - The ``pip-and-virtualenv`` element does not support Fedora 31 (and + greater) or Tumbleweed distributions.