From 658ca2b0d79022edbc6cb1e488b243844e87bfbe Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 7 Apr 2019 08:43:59 +0800 Subject: [PATCH] rpm: use python 3.6 as the default python3 some of our centos7 jenkins builders are failing to build ceph master and nautilus branches. because EPEL7 recently switched from python3.4 to python3.6 as the native python3. see https://lists.fedoraproject.org/archives/list/epel-announce@lists.fedoraproject.org/message/EGUMKAIMPK2UD5VSHXM53BH2MBDGDWMO/ and one of our BuildRequires, cmake3, was offered by EPEL7. it also followed the python3.6 switch-over to rebuild against python3.6. as a result, the cmake3-data-3.13.4-2.el7 started to depend on /usr/bin/python3.6, which is in turn offered by python36 package. after installing python36 as a dependency of the updated cmake3. but in cmake, we originally checks for the latest python3 interpreter if WITH_PYTHON3 is enabled, that's why these builders which happen to install these updated packages started to fail when detecting the existence of python3.6 related build dependencies. as a fix, in d1e83082, python%{python3_pkgversion}-{devel,setuptools,Cython} are listed as BuildRequires to reflect this change in EPEL7. before d1e83082, we hardwired them to python34-*. but as following analysis puts, there are cases where `yum-builddep` is inconsistent with `rpmbuild`. as `yum-builddep` changes the how `python3_pkgversion` and `python3_version` macros are expanded: - none of the packages installed by `yum-builddep` installs the python3 related rpm macros, so the system stays with whatever python3 it was using. in this case, `rpmbuild` won't complain, as the `python3_pkgversion` and `python_version` are consistent before and after `yum-builddep`. - system has python3.4 installed before `yum-builddep`. but `yum-builddep` installed python3.6 and also the updated `python-rpm-macros` packages, which points `python3_version` and `python3_pkgversion` to 3.6 and 36 respectively. in this case, `rpmbuild` will complain, because when we run `yum-builddep`, `python3_version` was still "3.4". - system does not have python3 installed before `yum-builddep`. so it was using python34 for preparing the "BuildRequires". but some of the packages installed by `yum-builddep` installs python36, and also the updated `python-rpm-macros` packages, which points `python3_version` and `python3_pkgversion` to 3.6 and 36 respectively. in this case, `rpmbuild` will complain, because the python36 related dependencies are missing. what the system has is python34 dependencies. - system does not have python3 installed before `yum-builddep`. so it was using python34 for preparing the "BuildRequires". but some of the packages installed by `yum-builddep` installs python34, and also the updated `python-rpm-macros` packages, which points `python3_version` and `python3_pkgversion` to 3.4 and 34 respectively. in this case, `rpmbuild` won't complain, as the `python3_pkgversion` and `python_version` are also consistent before and after `yum-builddep`. as we cannot tell if the system has python3 or what the python3 version the system has before `yum-builddep`, so what we can do is to ensure `rpmbuild` has what it needs to build Ceph. so let's just stick with python3.6. Signed-off-by: Kefu Chai --- ceph.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ceph.spec.in b/ceph.spec.in index f374c4a5949..afbe2b695b8 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -88,8 +88,8 @@ %{!?_udevrulesdir: %global _udevrulesdir /lib/udev/rules.d} %{!?tmpfiles_create: %global tmpfiles_create systemd-tmpfiles --create} %if 0%{?rhel} == 7 -%{!?python3_pkgversion: %global python3_pkgversion 34} -%{!?python3_version: %global python3_version 3.4} +%{!?python3_pkgversion: %global python3_pkgversion 36} +%{!?python3_version: %global python3_version 3.6} %else %{!?python3_pkgversion: %global python3_pkgversion 3} %{!?python3_version: %global python3_version 3} -- 2.39.5