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