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