1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
8 # spec file template for RHEL dkms package builds
11 %bcond_without servers
15 # LUTF Turn off brp-python-precompile script as we don't want the python files
16 # to be compiled on installation
17 %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
19 # Set the package name prefix
23 %define module @PACKAGE@-all
25 %define module @PACKAGE@-zfs
28 %if %{without ldiskfs}
29 %define module @PACKAGE@-BADSTATE
31 %define module @PACKAGE@-ldiskfs
34 %define lustre_name @PACKAGE@
37 %define module @PACKAGE@-client
38 %define lustre_name @PACKAGE@-client
41 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora"
42 %global kmod_name kmod-%{lustre_name}
43 %define mkconf_options %{nil}
46 %global kmod_name %{lustre_name}-kmp
47 %define mkconf_options -k updates
51 %define mkconf lustre/scripts/dkms.mkconf
53 # There should be a better (non-arch dependent) way to require ext4
55 %define ext4_source_rpm kernel-debuginfo-common-x86_64
60 Release: %{buildid}%{?dist}
61 Summary: Kernel module(s) (dkms)
64 URL: http://lustre.opensfs.org/
65 Source0: @PACKAGE@-%{version}.tar.gz
66 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
69 # DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps
70 # (ie, "BUILD_DEPENDS[#]=<pkg>"), and have latest DKMS fixes integrated
71 # for bugs that prevented our module to build/install.
72 Requires: dkms >= 2.2.0.3-28.git.7c3e7c5
73 Requires: flex bison libmount-devel libmount
75 Requires: libyaml-devel
78 Requires: libnl3-devel
80 # If client package is installed when installing server, remove it since
81 # the server package also includes the client. This can be removed if/when
82 # the packages are split into independent client/server/common packages.
83 Obsoletes: @PACKAGE@-client < %{version}
85 Requires: zfs-dkms >= 0.6.5
86 Conflicts: @PACKAGE@-ldiskfs-dkms
87 Conflicts: @PACKAGE@-client-dkms
88 # lustre-zfs-dkms replicates the functionality old lustre-dkms package
89 Provides: @PACKAGE@-dkms
90 Obsoletes: @PACKAGE@-dkms
94 Requires: %{ext4_source_rpm}
95 Conflicts: @PACKAGE@-zfs-dkms
96 Conflicts: @PACKAGE@-client-dkms
97 %if "%{module}" != "@PACKAGE@-all"
98 Conflicts: @PACKAGE@-dkms
101 %if "%{module}" != "@PACKAGE@-all"
102 Conflicts: @PACKAGE@-all-dkms
106 Requires: kernel-devel >= 3.10
107 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
109 Suggests: bash-completion
113 Provides: %{kmod_name} = %{version}
114 Provides: @PACKAGE@-modules = %{version}
117 Provides: @PACKAGE@-osd-zfs = %{version}
118 Provides: kmod-@PACKAGE@-osd-zfs = %{version}
119 Provides: @PACKAGE@-osd-zfs-mount = %{version}
122 Provides: @PACKAGE@-osd-ldiskfs = %{version}
123 Provides: kmod-@PACKAGE@-osd-ldiskfs = %{version}
124 Provides: @PACKAGE@-osd-ldiskfs-mount = %{version}
126 Provides: @PACKAGE@-osd
128 Provides: @PACKAGE@-client
132 This package contains the dkms Lustre kernel modules.
135 The required %{ext4_source_rpm} package is available from
136 the repository with other debuginfo rpms.
140 %setup -q -n @PACKAGE@-%{version}
143 %{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options}
146 if [ "$RPM_BUILD_ROOT" != "/" ]; then
147 rm -rf $RPM_BUILD_ROOT
149 mkdir -p $RPM_BUILD_ROOT/usr/src/
150 cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
151 mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
154 if [ "$RPM_BUILD_ROOT" != "/" ]; then
155 rm -rf $RPM_BUILD_ROOT
159 %defattr(-,root,root)
160 /usr/src/%{module}-%{version}
163 for POSTINST in /usr/lib/dkms/common.postinst; do
164 if [ -f $POSTINST ]; then
165 $POSTINST %{module} %{version}
168 echo "WARNING: $POSTINST does not exist."
170 echo -e "ERROR: DKMS version is too old and %{module} was not"
171 echo -e "built with legacy DKMS support."
172 echo -e "You must either rebuild %{module} with legacy postinst"
173 echo -e "support or upgrade DKMS to a more current version."
177 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
181 * Wed May 16 2018 Joe Grund <joe.grund@intel.com>
182 - Add patch requirement
183 * Mon Aug 1 2016 Nathaniel Clark <nathaniel.l.clark@intel.com>
184 - Add option to build either ldiskfs or zfs flavour of server version
185 * Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
186 - detect and handle cases where [spl,zfs]-dkms packages are not built
187 - also handle on-target configure issues
188 * Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
189 - adapted for Lustre Client DKMS creation
190 - allow for on-target reconfig to prevent static deps requires
191 * Mon Apr 8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
192 - First DKMS packages.