From a5d52831dc4d357906f5514943e17ab535e9e578 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Fri, 18 Jun 2021 13:53:21 +0200 Subject: [PATCH] Fix updating setuptools in Centos In RHEL-based distributions, updating setuptools using pip removes the files from the python3-setuptools RPM. It breaks some tools such as semanage (which is used by diskimage-builder) that use the -s flag of the python interpreter (don't import modules from /usr/local). This commit reinstalls python3-setuptools to fix those applications. Change-Id: Ib44857e83f75acf37823fae912960a801c83cf7f --- tools/fixup_stuff.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh index 19219435ad..060abb1605 100755 --- a/tools/fixup_stuff.sh +++ b/tools/fixup_stuff.sh @@ -106,6 +106,16 @@ function fixup_fedora { # overwriting works. So this hacks around those packages that # have been dragged in by some other system dependency sudo rm -rf /usr/lib64/python3*/site-packages/PyYAML-*.egg-info + + # After updating setuptools based on the requirements, the files from the + # python3-setuptools RPM are deleted, it breaks some tools such as semanage + # (used in diskimage-builder) that use the -s flag of the python + # interpreter, enforcing the use of the packages from /usr/lib. + # Importing setuptools/pkg_resources in a such environment fails. + # Enforce the package re-installation to fix those applications. + if is_package_installed python3-setuptools; then + sudo dnf reinstall -y python3-setuptools + fi } function fixup_suse {