-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathlustre-dkms.spec.in
193 lines (170 loc) · 5.51 KB
/
lustre-dkms.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# SPDX-License-Identifier: GPL-2.0
#
# This file is part of Lustre, http://www.lustre.org/
#
# lustre-dkms.spec.in
#
# spec file template for RHEL dkms package builds
#
%bcond_without servers
%bcond_without zfs
%bcond_with ldiskfs
%if ! 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler}
%define not_rpm 1
%endif
# LUTF Turn off brp-python-precompile script as we don't want the python files
# to be compiled on installation
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# Set the package name prefix
%if %{undefined lustre_name}
%global lustre_name @PACKAGE@
%endif
# Set the package name prefix
%if %{with servers}
%if %{with zfs}
%if %{with ldiskfs}
%define module %{lustre_name}-all
%else
%define module %{lustre_name}-zfs
%endif
%else
%if %{without ldiskfs}
%define module %{lustre_name}-BADSTATE
%else
%define module %{lustre_name}-ldiskfs
%endif
%endif
%define lustre_kmp_name %{lustre_name}
%else
%define module %{lustre_name}-client
%define lustre_kmp_name %{lustre_name}-client
%endif
%if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora"
%global kmod_name kmod-%{lustre_kmp_name}
%define mkconf_options %{nil}
#for Suse / Ubuntu
%else
%global kmod_name %{lustre_kmp_name}-kmp
%define mkconf_options -k updates
%endif
%define buildid 1
%define mkconf lustre/scripts/dkms.mkconf
# There should be a better (non-arch dependent) way to require ext4
# sources
%define ext4_source_rpm kernel-debuginfo-common-x86_64
Name: %{module}-dkms
Version: @VERSION@
Release: %{buildid}%{?dist}
Summary: Kernel module(s) (dkms)
License: GPL-2.0-only
URL: http://lustre.opensfs.org/
Source0: @PACKAGE@-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps
# (ie, "BUILD_DEPENDS[#]=<pkg>"), and have latest DKMS fixes integrated
# for bugs that prevented our module to build/install.
Requires: dkms >= 2.2.0.3-28.git.7c3e7c5
Requires: flex bison libmount-devel
# for lnetctl
Requires: libyaml-devel
Requires: zlib-devel
# for netlink support
Requires: libnl3-devel
%if %{with servers}
# If client package is installed when installing server, remove it since
# the server package also includes the client. This can be removed if/when
# the packages are split into independent client/server/common packages.
Obsoletes: %{lustre_name}-client < %{version}
%if %{with zfs}
Requires: zfs-dkms >= 0.6.5
Conflicts: %{lustre_name}-ldiskfs-dkms
Conflicts: %{lustre_name}-client-dkms
# lustre-zfs-dkms replicates the functionality old lustre-dkms package
Provides: %{lustre_name}-dkms
Obsoletes: %{lustre_name}-dkms
%endif
%if %{with ldiskfs}
Requires: patch
Requires: %{ext4_source_rpm}
Conflicts: %{lustre_name}-zfs-dkms
Conflicts: %{lustre_name}-client-dkms
%if "%{module}" != "%{lustre_name}-all"
Conflicts: %{lustre_name}-dkms
%endif
%endif
%if "%{module}" != "%{lustre_name}-all"
Conflicts: %{lustre_name}-all-dkms
%endif
%endif
Requires: gcc, make
Requires: kernel-devel >= 3.10
%if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
Recommends: perl
Suggests: bash-completion
%else
Requires: perl
%endif
Provides: %{kmod_name} = %{version}
Provides: %{lustre_name}-modules = %{version}
%if %{with servers}
%if %{with zfs}
Provides: %{lustre_name}-osd-zfs = %{version}
Provides: kmod-%{lustre_name}-osd-zfs = %{version}
Provides: %{lustre_name}-osd-zfs-mount = %{version}
%endif
%if %{with ldiskfs}
Provides: %{lustre_name}-osd-ldiskfs = %{version}
Provides: kmod-%{lustre_name}-osd-ldiskfs = %{version}
Provides: %{lustre_name}-osd-ldiskfs-mount = %{version}
%endif
Provides: %{lustre_name}-osd
%else
Provides: %{lustre_name}-client
%endif
%description
This package contains the dkms Lustre kernel modules.
%if %{with ldiskfs}
The required %{ext4_source_rpm} package is available from
the repository with other debuginfo rpms.
%endif
%prep
%setup -q -n @PACKAGE@-%{version}
%build
%{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options}
%install
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
mkdir -p $RPM_BUILD_ROOT/usr/src/
cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
%files
%defattr(-,root,root)
/usr/src/%{module}-%{version}
%post
dkms add -m %{module} -v %{version} %{!?not_rpm:--rpm_safe_upgrade} ||:
dkms build -m %{module} -v %{version} || :
dkms install --force -m %{module} -v %{version} ||:
%preun
dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
exit 0
%changelog
* Wed Dec 11 2024 Jian Yu <yujian@whamcloud.com>
- Fix the /usr/lib/dkms/common.postinst does not exist warning.
* Wed May 16 2018 Joe Grund <joe.grund@intel.com>
- Add patch requirement
* Mon Aug 1 2016 Nathaniel Clark <nathaniel.l.clark@intel.com>
- Add option to build either ldiskfs or zfs flavour of server version
* Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
- detect and handle cases where [spl,zfs]-dkms packages are not built
- also handle on-target configure issues
* Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
- adapted for Lustre Client DKMS creation
- allow for on-target reconfig to prevent static deps requires
* Mon Apr 8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
- First DKMS packages.