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

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