]> git.proxmox.com Git - mirror_zfs.git/blob - rpm/generic/zfs.spec.in
Add zts-report.py to python shebang exclusion
[mirror_zfs.git] / rpm / generic / zfs.spec.in
1 %global _sbindir /sbin
2 %global _libdir /%{_lib}
3
4 # Set the default udev directory based on distribution.
5 %if %{undefined _udevdir}
6 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
7 %global _udevdir %{_prefix}/lib/udev
8 %else
9 %global _udevdir /lib/udev
10 %endif
11 %endif
12
13 # Set the default udevrule directory based on distribution.
14 %if %{undefined _udevruledir}
15 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
16 %global _udevruledir %{_prefix}/lib/udev/rules.d
17 %else
18 %global _udevruledir /lib/udev/rules.d
19 %endif
20 %endif
21
22 # Set the default dracut directory based on distribution.
23 %if %{undefined _dracutdir}
24 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
25 %global _dracutdir %{_prefix}/lib/dracut
26 %else
27 %global _dracutdir %{_prefix}/share/dracut
28 %endif
29 %endif
30
31 # Set the default _initconfdir when undefined.
32 %if %{undefined _initconfdir}
33 %global _initconfdir /etc/sysconfig
34 %endif
35
36 %bcond_with debug
37 %bcond_with debuginfo
38 %bcond_with asan
39 %bcond_with systemd
40
41 # Python permits the !/usr/bin/python shebang for scripts that are cross
42 # compatible between python2 and python3, but Fedora 28 does not. Fedora
43 # wants us to choose python3 for cross-compatible scripts. Since we want
44 # to support python2 and python3 users, exclude our scripts from Fedora 28's
45 # RPM build check, so that we don't get a bunch of build warnings.
46 #
47 # Details: https://github.com/zfsonlinux/zfs/issues/7360
48 #
49 %global __brp_mangle_shebangs_exclude_from arc_summary.py|arcstat.py|dbufstat.py|test-runner.py|zts-report.py
50
51 # Generic enable switch for systemd
52 %if %{with systemd}
53 %define _systemd 1
54 %endif
55
56 # RHEL >= 7 comes with systemd
57 %if 0%{?rhel} >= 7
58 %define _systemd 1
59 %endif
60
61 # Fedora >= 15 comes with systemd, but only >= 18 has
62 # the proper macros
63 %if 0%{?fedora} >= 18
64 %define _systemd 1
65 %endif
66
67 # opensuse >= 12.1 comes with systemd, but only >= 13.1
68 # has the proper macros
69 %if 0%{?suse_version} >= 1310
70 %define _systemd 1
71 %endif
72
73 Name: @PACKAGE@
74 Version: @VERSION@
75 Release: @RELEASE@%{?dist}
76 Summary: Commands to control the kernel modules and libraries
77
78 Group: System Environment/Kernel
79 License: @ZFS_META_LICENSE@
80 URL: http://zfsonlinux.org/
81 Source0: %{name}-%{version}.tar.gz
82 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
83 Requires: libzpool2 = %{version}
84 Requires: libnvpair1 = %{version}
85 Requires: libuutil1 = %{version}
86 Requires: libzfs2 = %{version}
87 Requires: %{name}-kmod = %{version}
88 Provides: %{name}-kmod-common = %{version}
89 Obsoletes: spl
90
91 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
92 # those on either side would conflict with all available documentation.
93 Conflicts: zfs-fuse
94
95 %if 0%{?rhel}%{?fedora}%{?suse_version}
96 BuildRequires: zlib-devel
97 BuildRequires: libuuid-devel
98 BuildRequires: libblkid-devel
99 BuildRequires: libudev-devel
100 BuildRequires: libattr-devel
101 BuildRequires: openssl-devel
102 %if 0%{?fedora} >= 28
103 BuildRequires: libtirpc-devel
104 %endif
105 Requires: openssl
106 %if 0%{?_systemd}
107 BuildRequires: systemd
108 %endif
109 %endif
110
111 %if 0%{?_systemd}
112 Requires(post): systemd
113 Requires(preun): systemd
114 Requires(postun): systemd
115 %endif
116
117 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
118 Requires: util-linux
119 Requires: sysstat
120
121 %description
122 This package contains the ZFS command line utilities.
123
124 %package -n libzpool2
125 Summary: Native ZFS pool library for Linux
126 Group: System Environment/Kernel
127
128 %description -n libzpool2
129 This package contains the zpool library, which provides support
130 for managing zpools
131
132 %post -n libzpool2 -p /sbin/ldconfig
133 %postun -n libzpool2 -p /sbin/ldconfig
134
135 %package -n libnvpair1
136 Summary: Solaris name-value library for Linux
137 Group: System Environment/Kernel
138
139 %description -n libnvpair1
140 This package contains routines for packing and unpacking name-value
141 pairs. This functionality is used to portably transport data across
142 process boundaries, between kernel and user space, and can be used
143 to write self describing data structures on disk.
144
145 %post -n libnvpair1 -p /sbin/ldconfig
146 %postun -n libnvpair1 -p /sbin/ldconfig
147
148 %package -n libuutil1
149 Summary: Solaris userland utility library for Linux
150 Group: System Environment/Kernel
151
152 %description -n libuutil1
153 This library provides a variety of compatibility functions for ZFS on Linux:
154 * libspl: The Solaris Porting Layer userland library, which provides APIs
155 that make it possible to run Solaris user code in a Linux environment
156 with relatively minimal modification.
157 * libavl: The Adelson-Velskii Landis balanced binary tree manipulation
158 library.
159 * libefi: The Extensible Firmware Interface library for GUID disk
160 partitioning.
161 * libshare: NFS, SMB, and iSCSI service integration for ZFS.
162
163 %post -n libuutil1 -p /sbin/ldconfig
164 %postun -n libuutil1 -p /sbin/ldconfig
165
166 %package -n libzfs2
167 Summary: Native ZFS filesystem library for Linux
168 Group: System Environment/Kernel
169
170 %description -n libzfs2
171 This package provides support for managing ZFS filesystems
172
173 %post -n libzfs2 -p /sbin/ldconfig
174 %postun -n libzfs2 -p /sbin/ldconfig
175
176 %package -n libzfs2-devel
177 Summary: Development headers
178 Group: System Environment/Kernel
179 Requires: libzfs2 = %{version}
180 Requires: libzpool2 = %{version}
181 Requires: libnvpair1 = %{version}
182 Requires: libuutil1 = %{version}
183 Provides: libzpool2-devel
184 Provides: libnvpair1-devel
185 Provides: libuutil1-devel
186 Obsoletes: zfs-devel
187
188 %description -n libzfs2-devel
189 This package contains the header files needed for building additional
190 applications against the ZFS libraries.
191
192 %package test
193 Summary: Test infrastructure
194 Group: System Environment/Kernel
195 Requires: %{name}%{?_isa} = %{version}-%{release}
196 Requires: parted
197 Requires: lsscsi
198 Requires: mdadm
199 Requires: bc
200 Requires: ksh
201 Requires: fio
202 Requires: acl
203 Requires: sudo
204 Requires: sysstat
205 Requires: libaio
206 %if 0%{?rhel}%{?fedora}%{?suse_version}
207 BuildRequires: libaio-devel
208 %endif
209 AutoReqProv: no
210
211 %description test
212 This package contains test infrastructure and support scripts for
213 validating the file system.
214
215 %package dracut
216 Summary: Dracut module
217 Group: System Environment/Kernel
218 Requires: %{name}%{?_isa} = %{version}-%{release}
219 Requires: dracut
220 Requires: /usr/bin/awk
221 Requires: grep
222
223 %description dracut
224 This package contains a dracut module used to construct an initramfs
225 image which is ZFS aware.
226
227 %if 0%{?_pyzfs}
228 %package -n pyzfs
229 Summary: Python wrapper for libzfs_core
230 Group: Development/Languages/Python
231 License: Apache-2.0
232 BuildArch: noarch
233 Requires: libzfs2 = %{version}
234 Requires: libnvpair1 = %{version}
235 Requires: libffi
236 Requires: python >= 2.7
237 Requires: python-cffi
238 %if 0%{?rhel}%{?fedora}%{?suse_version}
239 BuildRequires: python-devel
240 BuildRequires: libffi-devel
241 %endif
242
243 %description -n pyzfs
244 This package provides a python wrapper for the libzfs_core C library.
245 %endif
246
247 %if 0%{?_initramfs}
248 %package initramfs
249 Summary: Initramfs module
250 Group: System Environment/Kernel
251 Requires: %{name}%{?_isa} = %{version}-%{release}
252 Requires: %{name} = %{version}-%{release}
253 Requires: initramfs-tools
254
255 %description initramfs
256 This package contains a initramfs module used to construct an initramfs
257 image which is ZFS aware.
258 %endif
259
260 %prep
261 %if %{with debug}
262 %define debug --enable-debug
263 %else
264 %define debug --disable-debug
265 %endif
266
267 %if %{with debuginfo}
268 %define debuginfo --enable-debuginfo
269 %else
270 %define debuginfo --disable-debuginfo
271 %endif
272
273 %if %{with asan}
274 %define asan --enable-asan
275 %else
276 %define asan --disable-asan
277 %endif
278
279 %if 0%{?_systemd}
280 %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit
281 %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target zfs-import.target
282 %else
283 %define systemd --enable-sysvinit --disable-systemd
284 %endif
285
286 %setup -q
287
288 %build
289 %configure \
290 --with-config=user \
291 --with-udevdir=%{_udevdir} \
292 --with-udevruledir=%{_udevruledir} \
293 --with-dracutdir=%{_dracutdir} \
294 --disable-static \
295 %{debug} \
296 %{debuginfo} \
297 %{asan} \
298 %{systemd}
299 make %{?_smp_mflags}
300
301 %install
302 %{__rm} -rf $RPM_BUILD_ROOT
303 make install DESTDIR=%{?buildroot}
304 find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
305
306 %post
307 %if 0%{?_systemd}
308 %if 0%{?systemd_post:1}
309 %systemd_post %{systemd_svcs}
310 %else
311 if [ "$1" = "1" -o "$1" = "install" ] ; then
312 # Initial installation
313 systemctl preset %{systemd_svcs} >/dev/null || true
314 fi
315 %endif
316 %else
317 if [ -x /sbin/chkconfig ]; then
318 /sbin/chkconfig --add zfs-import
319 /sbin/chkconfig --add zfs-mount
320 /sbin/chkconfig --add zfs-share
321 /sbin/chkconfig --add zfs-zed
322 fi
323 %endif
324 exit 0
325
326 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
327 # installing a package. This is the default behavior for Fedora.
328 %posttrans
329 %if 0%{?rhel} == 7 || 0%{?centos} == 7
330 systemctl restart kmod-static-nodes
331 systemctl restart systemd-tmpfiles-setup-dev
332 udevadm trigger
333 %endif
334
335 %preun
336 %if 0%{?_systemd}
337 %if 0%{?systemd_preun:1}
338 %systemd_preun %{systemd_svcs}
339 %else
340 if [ "$1" = "0" -o "$1" = "remove" ] ; then
341 # Package removal, not upgrade
342 systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
343 systemctl stop %{systemd_svcs} >/dev/null || true
344 fi
345 %endif
346 %else
347 if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
348 /sbin/chkconfig --del zfs-import
349 /sbin/chkconfig --del zfs-mount
350 /sbin/chkconfig --del zfs-share
351 /sbin/chkconfig --del zfs-zed
352 fi
353 %endif
354 exit 0
355
356 %postun
357 %if 0%{?_systemd}
358 %if 0%{?systemd_postun:1}
359 %systemd_postun %{systemd_svcs}
360 %else
361 systemctl --system daemon-reload >/dev/null || true
362 %endif
363 %endif
364
365 %files
366 %{_sbindir}/*
367 %{_bindir}/*
368 %{_libexecdir}/%{name}
369 %{_mandir}/man1/*
370 %{_mandir}/man5/*
371 %{_mandir}/man8/*
372 %{_udevdir}/vdev_id
373 %{_udevdir}/zvol_id
374 %{_udevdir}/rules.d/*
375 %if 0%{?_systemd}
376 /usr/lib/modules-load.d/*
377 %{_unitdir}/*
378 %{_presetdir}/*
379 %{_generatordir}/*
380 %else
381 %config(noreplace) %{_sysconfdir}/init.d/*
382 %config(noreplace) %{_initconfdir}/zfs
383 %endif
384 %config(noreplace) %{_sysconfdir}/%{name}
385 %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/*
386
387 %files -n libzpool2
388 %{_libdir}/libzpool.so.*
389
390 %files -n libnvpair1
391 %{_libdir}/libnvpair.so.*
392
393 %files -n libuutil1
394 %{_libdir}/libuutil.so.*
395
396 %files -n libzfs2
397 %{_libdir}/libzfs*.so.*
398
399 %files -n libzfs2-devel
400 %{_datadir}/pkgconfig/libzfs.pc
401 %{_datadir}/pkgconfig/libzfs_core.pc
402 %{_libdir}/*.so
403 %{_includedir}/*
404 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
405
406 %files test
407 %{_datadir}/%{name}
408
409 %files dracut
410 %doc contrib/dracut/README.dracut.markdown
411 %{_dracutdir}/modules.d/*
412
413 %if 0%{?_pyzfs}
414 %files -n pyzfs
415 %doc contrib/pyzfs/README
416 %doc contrib/pyzfs/LICENSE
417 %defattr(-,root,root,-)
418 %{python_sitelib}/libzfs_core/*
419 %{python_sitelib}/pyzfs*
420 %endif
421
422 %if 0%{?_initramfs}
423 %files initramfs
424 %doc contrib/initramfs/README.initramfs.markdown
425 /usr/share/initramfs-tools/*
426 %else
427 # Since we're not building the initramfs package,
428 # ignore those files.
429 %exclude /usr/share/initramfs-tools
430 %endif