yifengyou / rpms / spacewalk-usix

Forked from rpms/spacewalk-usix 3 years ago
Clone

Blame SOURCES/spacewalk-usix-2.8.1-2-el8-to-spacewalk-usix-2.8.1-3-el8.patch

463904
diff --git a/spacewalk-usix.spec b/spacewalk-usix.spec
463904
index 0266659..ce9df24 100644
463904
--- a/spacewalk-usix.spec
463904
+++ b/spacewalk-usix.spec
463904
@@ -2,16 +2,23 @@
463904
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
463904
 %endif
463904
 
463904
-%if 0%{?fedora} >= 23
463904
+%if 0%{?fedora} >= 23 || 0%{?rhel} >= 8
463904
 %{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
463904
 %global python3rhnroot %{python3_sitelib}/spacewalk
463904
 %endif
463904
 
463904
+%if 0%{?fedora} || 0%{?rhel} >= 8
463904
+%global build_py3   1
463904
+%global default_py3 1
463904
+%endif
463904
+
463904
+%define pythonX %{?default_py3: python3}%{!?default_py3: python2}
463904
+
463904
 %global pythonrhnroot %{python_sitelib}/spacewalk
463904
 
463904
 Name:	    spacewalk-usix
463904
 Version:	2.8.1
463904
-Release:	2%{?dist}
463904
+Release:	3%{?dist}
463904
 Summary:	Spacewalk server and client nano six library
463904
 
463904
 License:	GPLv2
463904
@@ -20,14 +27,22 @@ Source0: https://github.com/spacewalkproject/spacewalk/archive/%{name}-%{version
463904
 BuildArch: noarch
463904
 
463904
 Provides:	spacewalk-backend-usix = %{version}-%{release}
463904
+Requires: %{pythonX}-%{name} = %{version}-%{release}
463904
 Obsoletes: spacewalk-backend-usix < 2.8
463904
-BuildRequires: python-devel
463904
 
463904
 %description
463904
 Library for writing code that runs on Python 2 and 3
463904
 
463904
-%if 0%{?fedora} >= 23
463904
+%package -n python2-%{name}
463904
+Summary: Spacewalk client micro six library
463904
+Provides: python2-spacewalk-backend-usix = %{version}-%{release}
463904
+Obsoletes: python2-spacewalk-backend-usix < 2.8
463904
+BuildRequires: python-devel
463904
+
463904
+%description -n python2-%{name}
463904
+Library for writing code that runs on Python 2 and 3
463904
 
463904
+%if 0%{?build_py3}
463904
 %package -n python3-%{name}
463904
 Summary: Spacewalk client micro six library
463904
 Provides: python3-spacewalk-backend-usix = %{version}-%{release}
463904
@@ -52,7 +67,7 @@ install -m 0644 __init__.py $RPM_BUILD_ROOT%{pythonrhnroot}/__init__.py
463904
 install -m 0644 common/__init__.py $RPM_BUILD_ROOT%{pythonrhnroot}/common/__init__.py
463904
 install -m 0644 common/usix.py* $RPM_BUILD_ROOT%{pythonrhnroot}/common/usix.py
463904
 
463904
-%if 0%{?fedora} && 0%{?fedora} >= 23
463904
+%if 0%{?build_py3}
463904
 install -d $RPM_BUILD_ROOT%{python3rhnroot}/common
463904
 cp $RPM_BUILD_ROOT%{pythonrhnroot}/__init__.py $RPM_BUILD_ROOT%{python3rhnroot}
463904
 cp $RPM_BUILD_ROOT%{pythonrhnroot}/common/__init__.py $RPM_BUILD_ROOT%{python3rhnroot}/common
463904
@@ -61,7 +76,7 @@ cp $RPM_BUILD_ROOT%{pythonrhnroot}/common/usix.py $RPM_BUILD_ROOT%{python3rhnroo
463904
 
463904
 %clean
463904
 
463904
-%files
463904
+%files -n python2-%{name}
463904
 %dir %{pythonrhnroot}
463904
 %dir %{pythonrhnroot}/common
463904
 %{pythonrhnroot}/__init__.py
463904
@@ -72,7 +87,7 @@ cp $RPM_BUILD_ROOT%{pythonrhnroot}/common/usix.py $RPM_BUILD_ROOT%{python3rhnroo
463904
 %exclude %{pythonrhnroot}/common/__init__.pyc
463904
 %exclude %{pythonrhnroot}/common/__init__.pyo
463904
 
463904
-%if 0%{?fedora} && 0%{?fedora} >= 23
463904
+%if 0%{?build_py3}
463904
 
463904
 %files -n python3-%{name}
463904
 %dir %{python3rhnroot}
463904
@@ -86,6 +101,10 @@ cp $RPM_BUILD_ROOT%{pythonrhnroot}/common/usix.py $RPM_BUILD_ROOT%{python3rhnroo
463904
 %endif
463904
 
463904
 %changelog
463904
+* Wed Feb 28 2018 Tomas Kasparek <tkasparek@redhat.com> 2.8.1-3
463904
+- split spacewalk-usix into python2 and python3 variants (tkasparek@redhat.com)
463904
+- build python3-spacewalk-usix also on rhel8 (tkasparek@redhat.com)
463904
+
463904
 * Wed Feb 28 2018 Tomas Kasparek <tkasparek@redhat.com> 2.8.1-2
463904
 - rebuild for rhel8
463904