Whamcloud - gitweb
LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier()
[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 # 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')
18
19 # Set the package name prefix
20 %if %{with servers}
21     %if %{with zfs}
22         %if %{with ldiskfs}
23             %define module @PACKAGE@-all
24         %else
25             %define module @PACKAGE@-zfs
26         %endif
27     %else
28         %if %{without ldiskfs}
29             %define module @PACKAGE@-BADSTATE
30         %else
31             %define module @PACKAGE@-ldiskfs
32         %endif
33     %endif
34     %define lustre_name @PACKAGE@
35
36 %else
37     %define module @PACKAGE@-client
38     %define lustre_name @PACKAGE@-client
39 %endif
40
41 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "fedora"
42         %global kmod_name kmod-%{lustre_name}
43         %define mkconf_options %{nil}
44 #for Suse / Ubuntu
45 %else
46         %global kmod_name %{lustre_name}-kmp
47         %define mkconf_options -k updates
48 %endif
49
50 %define buildid 1
51 %define mkconf  lustre/scripts/dkms.mkconf
52
53 # There should be a better (non-arch dependent) way to require ext4
54 # sources
55 %define ext4_source_rpm kernel-debuginfo-common-x86_64
56
57 Name:           %{module}-dkms
58
59 Version:        @VERSION@
60 Release:        %{buildid}%{?dist}
61 Summary:        Kernel module(s) (dkms)
62
63 License:        GPL-2.0-only
64 URL:            http://lustre.opensfs.org/
65 Source0:        @PACKAGE@-%{version}.tar.gz
66 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
67 BuildArch:      noarch
68
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
74 # for lnetctl
75 Requires:       libyaml-devel
76 Requires:       zlib-devel
77 # for netlink support
78 Requires:       libnl3-devel
79 %if %{with servers}
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}
84 %if %{with zfs}
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
91 %endif
92 %if %{with ldiskfs}
93 Requires:       patch
94 Requires:       %{ext4_source_rpm}
95 Conflicts:      @PACKAGE@-zfs-dkms
96 Conflicts:      @PACKAGE@-client-dkms
97 %if "%{module}" != "@PACKAGE@-all"
98 Conflicts:      @PACKAGE@-dkms
99 %endif
100 %endif
101 %if "%{module}" != "@PACKAGE@-all"
102 Conflicts:      @PACKAGE@-all-dkms
103 %endif
104 %endif
105 Requires:       gcc, make
106 Requires:       kernel-devel >= 3.10
107 %if 0%{?rhel} > 7 || 0%{?fedora} > 33 || 0%{?rhel} < 1
108 Recommends:     perl
109 Suggests:       bash-completion
110 %else
111 Requires:       perl
112 %endif
113 Provides:       %{kmod_name} = %{version}
114 Provides:       @PACKAGE@-modules = %{version}
115 %if %{with servers}
116 %if %{with zfs}
117 Provides:       @PACKAGE@-osd-zfs = %{version}
118 Provides:       kmod-@PACKAGE@-osd-zfs = %{version}
119 Provides:       @PACKAGE@-osd-zfs-mount = %{version}
120 %endif
121 %if %{with ldiskfs}
122 Provides:       @PACKAGE@-osd-ldiskfs = %{version}
123 Provides:       kmod-@PACKAGE@-osd-ldiskfs = %{version}
124 Provides:       @PACKAGE@-osd-ldiskfs-mount = %{version}
125 %endif
126 Provides:       @PACKAGE@-osd
127 %else
128 Provides:       @PACKAGE@-client
129 %endif
130
131 %description
132 This package contains the dkms Lustre kernel modules.
133 %if %{with ldiskfs}
134
135 The required %{ext4_source_rpm} package is available from
136 the repository with other debuginfo rpms.
137 %endif
138
139 %prep
140 %setup -q -n @PACKAGE@-%{version}
141
142 %build
143 %{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options}
144
145 %install
146 if [ "$RPM_BUILD_ROOT" != "/" ]; then
147     rm -rf $RPM_BUILD_ROOT
148 fi
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}
152
153 %clean
154 if [ "$RPM_BUILD_ROOT" != "/" ]; then
155     rm -rf $RPM_BUILD_ROOT
156 fi
157
158 %files
159 %defattr(-,root,root)
160 /usr/src/%{module}-%{version}
161
162 %post
163 for POSTINST in /usr/lib/dkms/common.postinst; do
164     if [ -f $POSTINST ]; then
165         $POSTINST %{module} %{version}
166         exit $?
167     fi
168     echo "WARNING: $POSTINST does not exist."
169 done
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."
174 exit 1
175
176 %preun
177 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
178 exit 0
179
180 %changelog
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.