Skip to content

Commit cdbb5ef

Browse files
e4tthiell
authored andcommitted
Fix spec file to work with openSUSE
- openSUSE:Factory has dropped python2 - Add 'Obsoletes:' for leftover python2 package. - '%license' instead of '%doc' is required for license files - '%else if' isn't allowed for older rpm versions - fix License string - add '%fdupes' at end of %install section Signed-off-by: Egbert Eich <eich@suse.com>
1 parent 06ecc79 commit cdbb5ef

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

clustershell.spec.in

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
%{!?__python3: %global __python3 python3}
2222
%{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}
2323

24+
%if ! 0%{?rhel} >= 8 && ! 0%{?suse_version} > 1550
25+
%define py2 1
26+
%endif
27+
2428
%global srcname ClusterShell
2529

2630
Name: clustershell
@@ -29,31 +33,36 @@ Release: 1%{?dist}
2933
Summary: Python framework for efficient cluster administration
3034

3135
%if 0%{?suse_version}
32-
License: LGPL-2.1
36+
License: LGPL-2.1-or-later
3337
%else
3438
License: LGPLv2+
3539
%endif
3640
%if 0%{?suse_version}
3741
Group: Productivity/Clustering/Computing
38-
%else if 0%{?rhel}
42+
%else
43+
%if 0%{?rhel}
3944
Group: System Environment/Base
4045
%endif
46+
%endif
4147
URL: http://cea-hpc.github.io/clustershell/
4248
Source0: https://files.pythonhosted.org/packages/source/C/%{srcname}/%{srcname}-%{version}.tar.gz
4349
BuildArch: noarch
44-
%if 0%{?rhel} >= 8
45-
Requires: python3-%{name} = %{version}-%{release}
46-
%else
50+
%if 0%{?py2}
4751
Requires: python2-%{name} = %{version}-%{release}
52+
%else
53+
Requires: python3-%{name} = %{version}-%{release}
4854
%endif
4955
%if 0%{?rhel} >= 7 || 0%{?fedora}
5056
Requires: vim-filesystem
51-
%else if 0%{?suse_version}
57+
%else
58+
%if 0%{?suse_version}
5259
Requires: vim
60+
BuildRequires: fdupes
5361
BuildRequires: vim
5462
%else
5563
Requires: vim-common
5664
%endif
65+
%endif
5766
Provides: vim-clustershell = %{version}-%{release}
5867
Obsoletes: vim-clustershell < 1.7.81-4
5968

@@ -66,7 +75,7 @@ server farms. Command line utilities like clush, clubak and nodeset (or
6675
cluset) allow traditional shell scripts to take benefit of the features
6776
offered by the library.
6877

69-
%if 0%{?rhel} < 8
78+
%if 0%{?py2}
7079
%package -n python2-%{name}
7180
Summary: ClusterShell module for Python 2
7281
BuildRequires: %{python2_pkgprefix}-devel
@@ -89,6 +98,7 @@ BuildRequires: %{python3_pkgprefix}-devel
8998
BuildRequires: %{python3_pkgprefix}-setuptools
9099
Requires: %{python3_pkgprefix}-PyYAML
91100
Requires: %{python3_pkgprefix}-setuptools
101+
%{!?py2:Obsoletes: python2-%{name}}
92102
%{?python_provide:%python_provide %{python3_pkgprefix}-%{srcname}}
93103

94104
%description -n %{python3_pkgprefix}-%{name}
@@ -100,12 +110,12 @@ ClusterShell Python 3 module and related command line tools.
100110

101111
%build
102112
%{__python3} setup.py build
103-
%{__python2} setup.py build
113+
%{?py2:%{__python2} setup.py build}
104114

105115
%install
106116
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
107117

108-
%if 0%{?rhel} < 8
118+
%if 0%{?py2}
109119
pushd %{buildroot}%{_bindir}
110120
for i in clubak cluset clush nodeset; do
111121
mv $i $i-%{python3_shortver}
@@ -144,14 +154,15 @@ install -d %{buildroot}/%{vimdatadir}/{ftdetect,syntax}
144154
install -p -m 0644 doc/extras/vim/ftdetect/clustershell.vim %{buildroot}/%{vimdatadir}/ftdetect/
145155
install -p -m 0644 doc/extras/vim/syntax/clushconf.vim %{buildroot}/%{vimdatadir}/syntax/
146156
install -p -m 0644 doc/extras/vim/syntax/groupsconf.vim %{buildroot}/%{vimdatadir}/syntax/
157+
%{?suse_version:%fdupes %{buildroot}}
147158

148159
%if 0%{?rhel}
149160
%clean
150161
rm -rf %{buildroot}
151162
%endif
152163

153164
# Unversioned python3 for rhel8
154-
%if 0%{?rhel} < 8
165+
%if 0%{?py2}
155166
%files -n python2-%{name}
156167
%if 0%{?rhel}
157168
%defattr(-,root,root,-)
@@ -192,7 +203,12 @@ rm -rf %{buildroot}
192203
%if 0%{?rhel}
193204
%defattr(-,root,root,-)
194205
%endif
195-
%doc ChangeLog COPYING.LGPLv2.1 README.md
206+
%doc ChangeLog README.md
207+
%if 0%{?suse_version} >= 1500
208+
%license COPYING.LGPLv2.1
209+
%else
210+
%doc COPYING.LGPLv2.1
211+
%endif
196212
%doc doc/examples
197213
%doc doc/sphinx
198214
%{_mandir}/man1/clubak.1*

0 commit comments

Comments
 (0)