forked from uyuni-project/uyuni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspacecmd.spec
173 lines (149 loc) · 4.9 KB
/
spacecmd.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#
# spec file for package spacecmd
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2008-2018 Red Hat, Inc.
# Copyright (c) 2011 Aron Parsons <[email protected]>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if ! (0%{?fedora} || 0%{?rhel} > 5)
%if %{_vendor} == "debbuild"
%global __python /usr/bin/python3
%endif
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
%{!?pylint_check: %global pylint_check 0}
%endif
%if 0%{?fedora} || 0%{?suse_version} > 1320 || 0%{?rhel} >= 8 || %{_vendor} == "debbuild"
%global build_py3 1
%if %{_vendor} != "debbuild"
%global python_sitelib %{python3_sitelib}
%endif
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
%global python2prefix python2
%else
%global python2prefix python
%endif
Name: spacecmd
Version: 4.2.1
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Red Hat Satellite servers
%if %{_vendor} == "debbuild"
Packager: Uyuni packagers <[email protected]>
Group: admin
%else
Group: Applications/System
%endif
License: GPL-3.0-or-later
Url: https://github.com/uyuni-project/uyuni
Source: https://github.com/spacewalkproject/spacewalk/archive/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} >= 1210 || %{_vendor} == "debbuild"
BuildArch: noarch
%endif
%if 0%{?pylint_check}
%if 0%{?build_py3}
BuildRequires: spacewalk-python3-pylint
%else
BuildRequires: spacewalk-python2-pylint
%endif
%endif
%if 0%{?build_py3}
BuildRequires: python3
%if %{_vendor} == "debbuild"
BuildRequires: python3-dev
%else
BuildRequires: python3-devel
%endif
Requires: python3-rpm
Requires: python3-simplejson
Requires: python3
%else
BuildRequires: %{python2prefix}
%if %{_vendor} == "debbuild"
BuildRequires: %{python2prefix}-dev
%else
BuildRequires: %{python2prefix}-devel
%endif
Requires: %{python2prefix}-simplejson
%if %{_vendor} == "debbuild"
Requires: python-rpm
%else
Requires: rpm-python
%endif
Requires: %{python2prefix}
%if 0%{?suse_version}
BuildRequires: python-xml
Requires: python-xml
%endif
%endif
%if 0%{?rhel} == 5
BuildRequires: python-json
%endif
%if 0%{?rhel} == 5
Requires: python-simplejson
%endif
Requires: file
%description
spacecmd is a command-line interface to Spacewalk and Red Hat Satellite servers
%prep
%setup -q
%build
# nothing to build
%install
%{__mkdir_p} %{buildroot}/%{_bindir}
%if 0%{?build_py3}
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' ./src/bin/spacecmd
%endif
%{__install} -p -m0755 src/bin/spacecmd %{buildroot}/%{_bindir}/
%{__mkdir_p} %{buildroot}/%{_sysconfdir}
touch %{buildroot}/%{_sysconfdir}/spacecmd.conf
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/bash_completion.d
%{__install} -p -m0644 src/misc/spacecmd-bash-completion %{buildroot}/%{_sysconfdir}/bash_completion.d/spacecmd
%{__mkdir_p} %{buildroot}/%{python_sitelib}/spacecmd
%{__install} -p -m0644 src/spacecmd/*.py %{buildroot}/%{python_sitelib}/spacecmd/
%{__mkdir_p} %{buildroot}/%{_mandir}/man1
%{__gzip} -c src/doc/spacecmd.1 > %{buildroot}/%{_mandir}/man1/spacecmd.1.gz
touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%{__chmod} 0644 %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%if 0%{?suse_version}
%if 0%{?build_py3}
%py3_compile -O %{buildroot}/%{python_sitelib}
%else
%py_compile -O %{buildroot}/%{python_sitelib}
%endif
%endif
make -C po install PREFIX=$RPM_BUILD_ROOT
%find_lang spacecmd
%check
%if 0%{?pylint_check}
%if 0%{?build_py3}
PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib} \
spacewalk-python3-pylint $RPM_BUILD_ROOT%{python_sitelib}/spacecmd
%else
PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib} \
spacewalk-python2-pylint $RPM_BUILD_ROOT%{python_sitelib}/spacecmd
%endif
%endif
%files -f spacecmd.lang
%defattr(-,root,root)
%{_bindir}/spacecmd
%{python_sitelib}/spacecmd/
%ghost %config %{_sysconfdir}/spacecmd.conf
%dir %{_sysconfdir}/bash_completion.d
%{_sysconfdir}/bash_completion.d/spacecmd
%doc src/doc/README src/doc/COPYING
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog