From 05a3e073d018e7ac218e2890aad51c303f04cc0a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 29 Nov 2017 18:08:30 +0000 Subject: [PATCH] Fix Python 3 builds / RHEL macros (RHBZ#1404631). --- nbdkit.spec | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/nbdkit.spec b/nbdkit.spec index 3a197ce..1a77fa5 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -4,9 +4,14 @@ %global have_libguestfs 1 %endif +# Currently everything has Python 2. RHEL 7 doesn't have Python 3. +%if 0%{?rhel} != 7 +%global have_python3 1 +%endif + Name: nbdkit Version: 1.1.18 -Release: 3%{?dist} +Release: 4%{?dist} Summary: NBD server License: BSD @@ -40,7 +45,7 @@ BuildRequires: libcurl-devel BuildRequires: perl-devel BuildRequires: perl(ExtUtils::Embed) BuildRequires: python2-devel -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} BuildRequires: python3-devel %endif %ifarch %{ocaml_native_compiler} @@ -230,7 +235,7 @@ Obsoletes: %{name}-plugin-python <= %{version}-%{release} This package lets you write Python 2 plugins for %{name}. -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} %package plugin-python3 Summary: Python 3 plugin for %{name} License: BSD @@ -309,7 +314,7 @@ mv "$copy" python3 %configure --disable-static --with-tls-priority=@NBDKIT,SYSTEM make %{?_smp_mflags} -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} pushd python3 export PYTHON=%{_bindir}/python3 %configure --disable-static --disable-perl --disable-ocaml --disable-ruby @@ -326,7 +331,7 @@ popd # Install for Python 2 and Python 3 separately. # We do the Python 3 install first since that build is # incomplete. -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} pushd python3 %make_install popd @@ -370,7 +375,7 @@ make check || { exit 1 } -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} pushd python3 make check || { cat tests/test-suite.log @@ -469,7 +474,7 @@ popd %{_libdir}/%{name}/plugins/nbdkit-python2-plugin.so -%if 0%{?rhel} >= 8 +%if 0%{?have_python3} %files plugin-python3 %{_libdir}/%{name}/plugins/nbdkit-python3-plugin.so %endif @@ -505,6 +510,9 @@ popd %changelog +* Wed Nov 29 2017 Richard W.M. Jones - 1.1.18-4 +- Fix Python 3 builds / RHEL macros (RHBZ#1404631). + * Tue Nov 21 2017 Richard W.M. Jones - 1.1.18-3 - New upstream version 1.1.18. - Add NBD forwarding plugin.