diff options
Diffstat (limited to 'rpm/generic/zfs.spec.in')
-rw-r--r-- | rpm/generic/zfs.spec.in | 79 |
1 files changed, 56 insertions, 23 deletions
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 55edbc83f..533792989 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -53,16 +53,6 @@ %bcond_with asan %bcond_with systemd -# Python permits the !/usr/bin/python shebang for scripts that are cross -# compatible between python2 and python3, but Fedora 28 does not. Fedora -# wants us to choose python3 for cross-compatible scripts. Since we want -# to support python2 and python3 users, exclude our scripts from Fedora 28's -# RPM build check, so that we don't get a bunch of build warnings. -# -# Details: https://github.com/zfsonlinux/zfs/issues/7360 -# -%global __brp_mangle_shebangs_exclude_from arc_summary.py|arcstat.py|dbufstat.py|test-runner.py|zts-report.py - # Generic enable switch for systemd %if %{with systemd} %define _systemd 1 @@ -85,6 +75,32 @@ %define _systemd 1 %endif +# When not specified default to distribution provided version. This +# is normally Python 3, but for RHEL <= 7 only Python 2 is provided. +%if %{undefined __use_python} +%if 0%{?rhel} && 0%{?rhel} <= 7 +%define __python /usr/bin/python2 +%define __python_pkg_version 2 +%define __python_cffi_pkg python-cffi +%else +%define __python /usr/bin/python3 +%define __python_pkg_version 3 +%define __python_cffi_pkg python3-cffi +%endif +%else +%define __python %{__use_python} +%define __python_pkg_version %{__use_python_pkg_version} +%define __python_cffi_pkg python%{__python_pkg_version}-cffi +%endif + +# By default python-pyzfs is enabled, with the exception of +# RHEL 6 which by default uses Python 2.6 which is too old. +%if 0%{?rhel} == 6 +%bcond_with pyzfs +%else +%bcond_without pyzfs +%endif + Name: @PACKAGE@ Version: @VERSION@ Release: @RELEASE@%{?dist} @@ -135,7 +151,7 @@ Requires: util-linux Requires: sysstat %description -This package contains the ZFS command line utilities. +This package contains the core ZFS command line utilities. %package -n libzpool2 Summary: Native ZFS pool library for Linux @@ -219,6 +235,7 @@ Requires: acl Requires: sudo Requires: sysstat Requires: libaio +Requires: python%{__python_pkg_version} %if 0%{?rhel}%{?fedora}%{?suse_version} BuildRequires: libaio-devel %endif @@ -240,23 +257,23 @@ Requires: grep This package contains a dracut module used to construct an initramfs image which is ZFS aware. -%if 0%{?_pyzfs} -%package -n pyzfs -Summary: Python wrapper for libzfs_core +%if %{with pyzfs} +%package -n python%{__python_pkg_version}-pyzfs +Summary: Python %{python_version} wrapper for libzfs_core Group: Development/Languages/Python License: Apache-2.0 BuildArch: noarch Requires: libzfs2 = %{version} Requires: libnvpair1 = %{version} Requires: libffi -Requires: python >= 2.7 -Requires: python-cffi +Requires: python%{__python_pkg_version} +Requires: %{__python_cffi_pkg} %if 0%{?rhel}%{?fedora}%{?suse_version} -BuildRequires: python-devel +BuildRequires: python%{__python_pkg_version}-devel BuildRequires: libffi-devel %endif -%description -n pyzfs +%description -n python%{__python_pkg_version}-pyzfs This package provides a python wrapper for the libzfs_core C library. %endif @@ -299,6 +316,12 @@ image which is ZFS aware. %define systemd --enable-sysvinit --disable-systemd %endif +%if %{with pyzfs} + %define pyzfs --enable-pyzfs +%else + %define pyzfs --disable-pyzfs +%endif + %setup -q %build @@ -307,11 +330,13 @@ image which is ZFS aware. --with-udevdir=%{_udevdir} \ --with-udevruledir=%{_udevruledir} \ --with-dracutdir=%{_dracutdir} \ + --with-python=%{__python} \ --disable-static \ %{debug} \ %{debuginfo} \ %{asan} \ - %{systemd} + %{systemd}\ + %{pyzfs} make %{?_smp_mflags} %install @@ -379,12 +404,20 @@ systemctl --system daemon-reload >/dev/null || true %endif %files +# Core utilities %{_sbindir}/* -%{_bindir}/* -%{_libexecdir}/%{name} +%{_bindir}/raidz_test +%{_bindir}/zgenhostid +# Optional Python 2/3 scripts +%{_bindir}/arc_summary +%{_bindir}/arcstat +%{_bindir}/dbufstat +# Man pages %{_mandir}/man1/* %{_mandir}/man5/* %{_mandir}/man8/* +# Configuration files and scripts +%{_libexecdir}/%{name} %{_udevdir}/vdev_id %{_udevdir}/zvol_id %{_udevdir}/rules.d/* @@ -426,8 +459,8 @@ systemctl --system daemon-reload >/dev/null || true %doc contrib/dracut/README.dracut.markdown %{_dracutdir}/modules.d/* -%if 0%{?_pyzfs} -%files -n pyzfs +%if %{with pyzfs} +%files -n python%{__python_pkg_version}-pyzfs %doc contrib/pyzfs/README %doc contrib/pyzfs/LICENSE %defattr(-,root,root,-) |