]>
Commit | Line | Data |
---|---|---|
dedb394b JK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
d53b44d6 | 6 | %define module rtslib_fb |
dedb394b JK |
7 | Summary: Python library for configuring the Linux kernel-based multiprotocol SCSI target (LIO) |
8 | Name: python-rtslib-fb | |
d53b44d6 AG |
9 | Version: 2.1.fb63 |
10 | Release: 1 | |
dedb394b JK |
11 | License: Apache v2.0 |
12 | Group: Libraries/Python | |
c56cf611 | 13 | Source0: https://codeload.github.com/open-iscsi/rtslib-fb/tar.gz/v%{version} |
d53b44d6 | 14 | # Source0-md5: 7fb48bee32a4ed961a4cd885184a9bb3 |
c56cf611 | 15 | URL: https://github.com/open-iscsi/rtslib-fb |
dedb394b JK |
16 | BuildRequires: python-distribute |
17 | BuildRequires: rpm-pythonprov | |
a65c9ac5 | 18 | BuildRequires: rpmbuild(macros) >= 1.710 |
dedb394b JK |
19 | BuildRequires: sed >= 4.0 |
20 | %if %{with python3} | |
21 | BuildRequires: python3-distribute | |
22 | BuildRequires: python3-modules | |
23 | %endif | |
24 | Requires: python-modules | |
d53b44d6 | 25 | Requires: python-pyudev >= 0.16.1 |
dedb394b JK |
26 | BuildArch: noarch |
27 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
28 | ||
29 | %description | |
30 | rtslib-fb is an object-based Python library for configuring the LIO | |
31 | generic SCSI target, present in 3.x Linux kernel versions. | |
32 | ||
33 | %package -n python3-rtslib-fb | |
34 | Summary: Python library for configuring the Linux kernel-based multiprotocol SCSI target (LIO) | |
35 | Group: Libraries/Python | |
d53b44d6 | 36 | Requires: python3-pyudev >= 0.16.1 |
dedb394b JK |
37 | |
38 | %description -n python3-rtslib-fb | |
39 | rtslib-fb is an object-based Python library for configuring the LIO | |
40 | generic SCSI target, present in 3.x Linux kernel versions. | |
41 | ||
42 | %prep | |
43 | %setup -q -n rtslib-fb-%{version} | |
44 | ||
45 | %build | |
46 | %if %{with python2} | |
32d3e8a0 | 47 | %py_build %{?with_tests:test} |
dedb394b JK |
48 | %endif |
49 | ||
50 | %if %{with python3} | |
32d3e8a0 | 51 | %py3_build %{?with_tests:test} |
dedb394b JK |
52 | %endif |
53 | ||
54 | %install | |
55 | rm -rf $RPM_BUILD_ROOT | |
56 | install -d $RPM_BUILD_ROOT%{_mandir}/man{5,8} | |
57 | ||
58 | %if %{with python2} | |
32d3e8a0 | 59 | %py_install |
dedb394b | 60 | |
d53b44d6 AG |
61 | # symlink for old module name |
62 | rm -rf $RPM_BUILD_ROOT%{py_sitescriptdir}/rtslib | |
63 | ln -sf %{py_sitescriptdir}/%{module} $RPM_BUILD_ROOT%{py_sitescriptdir}/rtslib | |
64 | ||
dedb394b JK |
65 | %py_postclean |
66 | %endif | |
67 | ||
68 | %if %{with python3} | |
32d3e8a0 | 69 | %py3_install |
d53b44d6 AG |
70 | |
71 | # symlink for old module name | |
72 | rm -rf $RPM_BUILD_ROOT%{py3_sitescriptdir}/rtslib | |
73 | ln -sf %{py3_sitescriptdir}/%{module} $RPM_BUILD_ROOT%{py3_sitescriptdir}/rtslib | |
dedb394b JK |
74 | %endif |
75 | ||
76 | cp doc/*.5 $RPM_BUILD_ROOT%{_mandir}/man5/ | |
77 | cp doc/*.8 $RPM_BUILD_ROOT%{_mandir}/man8/ | |
78 | ||
79 | %clean | |
80 | rm -rf $RPM_BUILD_ROOT | |
81 | ||
82 | %if %{with python2} | |
83 | %files | |
84 | %defattr(644,root,root,755) | |
85 | %attr(755,root,root) %{_bindir}/targetctl | |
86 | %doc README.md | |
87 | %dir %{py_sitescriptdir}/%{module} | |
d53b44d6 | 88 | %ghost %{py_sitescriptdir}/rtslib |
dedb394b JK |
89 | %{py_sitescriptdir}/%{module}/*.py[co] |
90 | %if "%{py_ver}" > "2.4" | |
91 | %{py_sitescriptdir}/rtslib_fb-*.egg-info | |
92 | %endif | |
93 | %endif | |
94 | %{_mandir}/man5/saveconfig.json.5* | |
95 | %{_mandir}/man8/targetctl.8* | |
96 | ||
97 | %if %{with python3} | |
98 | %files -n python3-rtslib-fb | |
99 | %defattr(644,root,root,755) | |
100 | %doc README.md | |
101 | %{py3_sitescriptdir}/%{module} | |
d53b44d6 | 102 | %{py3_sitescriptdir}/rtslib |
dedb394b JK |
103 | %{py3_sitescriptdir}/rtslib_fb-*-py*.egg-info |
104 | %endif |