From: Stephen Champion Date: Tue, 6 Oct 2015 10:16:25 +0000 (+0530) Subject: LU-5614 build: use %kernel_module_package in rpm spec X-Git-Tag: 2.8.56~115 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3b7d27ea22faf1c6d0a37afa724fd9b5c3240322 LU-5614 build: use %kernel_module_package in rpm spec Replace module packages definitions with calls to the vendor defined %kernel_module_package macro. This results in many of the rpm packages changing names from what we are used to in the past. Each Linux distribution may name the modules packages slightly differently, most notably RHEL and SLES choose different naming schemes. The %kernel_module_package macro handles these details for us. For instance, on RHEL7 the packages that contain lustre's kernel modules become: kmod-lustre (previously in "lustre-modules" package) kmod-lustre-osd-ldiskfs (previously in "lustre-osd-ldiskfs" package) kmod-lustre-osd-zfs (previously in "lustre-osd-zfs" package) kmod-lustre-tests (previously in "lustre-tests" package) On SLES12, the same packages are instead named: lustre-kmp-default lustre-osd-ldiskfs-kmp-default lustre-osd-zfs-kmp-default lustre-tests-kmp-default These kernel module packages give us what is known as "weak-updates". Instead of compiling Lustre for every minor kernel that is installed, the weak-updates will automatically symlink the Lustre modules into and kernel's modules subdirectories if that kernel offers the required kernel symbols with exactly the same symbol versions. In addition to changing the package names for all of the Lustre packages containing kernel modules, the location of the modules in /lib/modules changes as well. Each package will put its modules in a subdirectory matching part of the package name itself (required by the macros on RHEL systems). The path name is also different on RHEL and SLES systems (e.g. "extra" vs. "updates"). Some further path examples are: RHEL7, kmod-lustre package: /lib/modules/3.10.0-327.18.2.el7_lustre.x86_64/extra/lustre/fs/ost.ko SLES12, lustre-kmp-default package: /lib/modules/3.12.57-60.35_lustre-default/updates/lustre/fs/ost.ko RHEL7, kmod-lustre-osd-ldiskfs package: /lib/modules/3.10.0-327.18.2.el7_lustre.x86_64/extra/lustre-osd-ldiskfs/fs/osd_ldiskfs.ko SLES12, lustre-osd-ldiskfs-kmp-default package: /lib/modules/3.12.57-60.35_lustre-default/updates/lustre-osd-ldiskfs/fs/osd_ldiskfs.ko Test-Parameters: trivial clientdistro=el6.7 mdsdistro=el6.7 ossdistro=el6.7 Signed-off-by: Stephen Champion Signed-off-by: Alexander Boyko Change-Id: Ic5351f4bda94eae80eaf349c8490a2c758b15c80 Signed-off-by: Minh Diep Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/12063 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/autoMakefile.am b/autoMakefile.am index 1b04013..13a00de 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -95,16 +95,17 @@ EXTRA_DIST = @PACKAGE_TARNAME@.spec \ build/Makefile \ build/Rules.in \ config.h.in \ - undef.h \ lustre-dkms_pre-build.sh \ lustre-dkms_post-build.sh \ LUSTRE-VERSION-GEN \ - LUSTRE-VERSION-FILE + LUSTRE-VERSION-FILE \ + undef.h # contrib is a directory. Putting a directory in EXTRA_DIST # recursively includes the entire directory contents in the # distribution tarball (the tarball created with "make dist"). EXTRA_DIST += contrib +EXTRA_DIST += rpm rpm-local: @(if test -z "$(RPMBUILD)"; then \ @@ -170,6 +171,7 @@ srpm: @PACKAGE_TARNAME@.spec dist Makefile rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ $(MAKE) $(AM_MAKEFLAGS) \ rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \ + cp $(top_srcdir)/rpm/* $(top_srcdir); \ $(RPMBUILD) \ --define "_tmppath $$rpmbuilddir/TMP" \ --define "_topdir $$rpmbuilddir" \ diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index a780455..cde8aaf 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -107,19 +107,19 @@ AC_MSG_CHECKING([for Linux kernel module package directory]) AC_ARG_WITH([kmp-moddir], AC_HELP_STRING([--with-kmp-moddir=string], [set the kmod updates or extra directory]), - [KMP_MODDIR=$withval],[ - AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra"], - [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates"])]) + [KMP_MODDIR=$withval + IN_KERNEL=''],[ + AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra/kernel"], + [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates/kernel"]) + IN_KERNEL="${PACKAGE}"]) AC_MSG_RESULT($KMP_MODDIR) -AC_SUBST(KMP_MODDIR) -moduledir='/lib/modules/$(LINUXRELEASE)/$(KMP_MODDIR)/kernel' -AC_SUBST(moduledir) +moduledir="/lib/modules/${LINUXRELEASE}/${KMP_MODDIR}" -modulefsdir='$(moduledir)/fs/$(PACKAGE)' +modulefsdir="${moduledir}/fs/${IN_KERNEL}" AC_SUBST(modulefsdir) -modulenetdir='$(moduledir)/net/$(PACKAGE)' +modulenetdir="${moduledir}/net/${IN_KERNEL}" AC_SUBST(modulenetdir) ]) diff --git a/config/lustre-build.m4 b/config/lustre-build.m4 index 765c021..eb454a1 100644 --- a/config/lustre-build.m4 +++ b/config/lustre-build.m4 @@ -488,9 +488,6 @@ if test -n "$LINUX" ; then RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\"" fi fi -if test -n "$KMP_MODDIR" ; then - RPMBINARGS="$RPMBINARGS --define \"kmoddir $KMP_MODDIR\"" -fi if test x$enable_modules != xyes ; then RPMBINARGS="$RPMBINARGS --without lustre_modules" fi diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 725cdf1..83a40e5 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -838,7 +838,7 @@ build_lustre() { # move RPMs into place where they are expected to be for arch in $BUILD_ARCHS; do - mv -f lustre-*.${arch}.rpm $TOPDIR/RPMS/${arch}/ + mv -f *lustre*.${arch}.rpm $TOPDIR/RPMS/${arch}/ done mv -f lustre-*.src.rpm $TOPDIR/SRPMS/ @@ -957,6 +957,7 @@ build_spl_zfs() { echo "Building RPMs from $pkg/$specdir/$spec" if ! rpmbuild $rpmb $pkg/$specdir/$spec \ --nodeps -v \ + --define "_use_internal_dependency_generator 0" \ --define "require_kdir ${LINUX}" \ ${LINUXOBJ:+--define "require_kobj ${LINUXOBJ}"} \ ${spldir:+--define "require_spldir ${spldir}"} \ @@ -1602,6 +1603,7 @@ EOF set -x . g/\/.*\/\(symset-table\)/s//$tmp\/\1/g +g/\(\/usr\/src\/kernels\/\)/s//$tmp\/reused\1/g wq EOF ed symset-table < /dev/null || echo '%dist .el7' >> $RMAC +# We modify the RHEL7 kmodtool script, because it expects +# the kernel source to be in the correct packaged RHEL location. +# lbuild does not put the source in correct packaged RHEL location. +RHEL_KMODTOOL=/usr/lib/rpm/redhat/kmodtool +LBUILD_KMODTOOL="${LBUILD_DIR}/rhel7/kmodtool" +cp $RHEL_KMODTOOL $LBUILD_KMODTOOL +pushd ${LBUILD_DIR}/rhel7 +patch -p1 < kmodtool.patch +chmod 755 kmodtool +popd +# Next we replace %kernel_module_package with one that is nearly +# identical, but calls lbuild's modified kmodtool script. +sed -e "s|REPLACE_ME|$LBUILD_KMODTOOL|" \ + ${LBUILD_DIR}/rhel7/rpmmacros.template > ${LBUILD_DIR}/rhel7/rpmmacros +cat ${LBUILD_DIR}/rhel7/rpmmacros >> $RMAC + patch_spec() { local buildid="$1" diff --git a/contrib/lbuild/rhel7/.gitignore b/contrib/lbuild/rhel7/.gitignore new file mode 100644 index 0000000..a4c26d4 --- /dev/null +++ b/contrib/lbuild/rhel7/.gitignore @@ -0,0 +1,2 @@ +kmodtool +rpmmacros diff --git a/contrib/lbuild/rhel7/kmodtool.patch b/contrib/lbuild/rhel7/kmodtool.patch new file mode 100644 index 0000000..52ce2c1 --- /dev/null +++ b/contrib/lbuild/rhel7/kmodtool.patch @@ -0,0 +1,17 @@ +lbuild does not install the kernel source in the standard RHEL7 location. +RHEL's kmodtool (starting in RHEL7) expects the source to be in the standard +location, and when it fails to find it it adds an extra $arch onto the end +of verrel. With lbuild, verrel already contains the arch, so we change the +kmodtool script so that it does not add another. + +--- old/kmodtool 2016-06-07 14:36:20.810907740 -0700 ++++ new/kmodtool 2016-06-07 14:37:55.335652424 -0700 +@@ -62,7 +62,7 @@ get_kernel_release () + local versuffix=${verrel#$verprefix} + verrel=$(ls -Ud /usr/src/kernels/$verprefix*$versuffix.$arch | sort -V | tail -n 1) + verrel=${verrel##*/} +- [[ -z $verrel ]] && verrel=$1.$arch ++ [[ -z $verrel ]] && verrel=$1 + echo "$verrel" + } + diff --git a/contrib/lbuild/rhel7/rpmmacros.template b/contrib/lbuild/rhel7/rpmmacros.template new file mode 100644 index 0000000..e34f609 --- /dev/null +++ b/contrib/lbuild/rhel7/rpmmacros.template @@ -0,0 +1,36 @@ +%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ + %global kmodtool %{-s*}%{!-s:REPLACE_ME} \ + %global kmod_version %{-v*}%{!-v:%{version}} \ + %global kmod_release %{-r*}%{!-r:%{release}} \ + %global latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \ + %{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \ + %global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \ + flavors="default" \ + if [ -z "%*" ]; then \ + flavors_to_build=$flavors \ + elif [ -z "%{-x}" ]; then \ + flavors_to_build="%*" \ + else \ + flavors_to_build=" $flavors "\ + for i in %* \ + do \ + flavors_to_build=${flavors_to_build//$i /} + done \ + fi \ + echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \ + echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo ".%%%%{1}")" \ + echo "%%global kernel_module_package_moddir() extra" \ + if [ ! -z "%{-f*}" ] \ + then \ + filelist="%{-f*}" \ + fi \ + if [ ! -z "%{-p*}" ] \ + then \ + preamble="%{-p*}" \ + fi \ + if [ -z "%{kmodtool_generate_buildreqs}" ] \ + then \ + nobuildreqs="yes" \ + fi \ + override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \ +)} diff --git a/lustre.spec.in b/lustre.spec.in index ce40332..e12170f 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -28,6 +28,13 @@ # as an alternative to this implementation we could simply "make -C $kdir kernelversion" %{!?kversion: %global kversion %(files="include/generated/utsrelease.h include/linux/utsrelease.h include/linux/version.h"; for f in $files; do if test -r %{kobjdir}/$f && grep UTS_RELEASE %{kobjdir}/$f >/dev/null; then sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' %{kobjdir}/$f; break; fi; done)} +# We set this because kernel_module_package has its own method of identifying +# which kernel to build against, and it is unlikely that its decision will +# match with Lustre's method of selecting which kernel to build against. +# By setting this variable, we override kernel_module_package's kernel +# selection with our selection. +%{!?kernel_version: %global kernel_version %kversion} + %if 0%{?build_src_rpm} %{!?myrelease: %global myrelease 1} %else @@ -80,6 +87,16 @@ %endif %endif +%global modules_fs_path /lib/modules/%{kversion}/%{kmoddir} + +%if %{_vendor}=="redhat" || %{_vendor}=="fedora" + %global requires_kmod_name kmod-%{lustre_name} + %global requires_kmod_version %{version} +%else #for Suse + %global requires_kmod_name %{lustre_name}-kmp + %global requires_kmod_version %{version}_%(echo %{krequires} | sed -r 'y/-/_/; s/^(2\.6\.[0-9]+)_/\\1.0_/;') +%endif + Summary: Lustre File System Name: %{lustre_name} Version: %{version} @@ -87,11 +104,18 @@ Release: %{fullrelease} License: GPL Group: Utilities/System Source: lustre-%{version}.tar.gz +Source1: kmp-lustre.preamble +Source2: kmp-lustre.files +Source3: kmp-lustre-osd-ldiskfs.preamble +Source4: kmp-lustre-osd-ldiskfs.files +Source5: kmp-lustre-osd-zfs.preamble +Source6: kmp-lustre-osd-zfs.files +Source7: kmp-lustre-tests.files URL: https://wiki.hpdd.intel.com/ BuildRoot: %{_tmppath}/lustre-%{version}-root Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre Provides: lustre-lite = %{version}, lustre-lite-utils = %{version} -Requires: %{name}-modules = %{version} +Requires: %{requires_kmod_name} = %{requires_kmod_version} BuildRequires: libtool %if %{with servers} Requires: lustre-osd @@ -104,48 +128,23 @@ Provides: lustre-client = %{version}-%{fullrelease} BuildRequires: libselinux-devel Requires: libselinux %endif +%if %{with lustre_modules} +%if %{_vendor}=="redhat" +BuildRequires: redhat-rpm-config +%endif +%endif %description Userspace tools and files for the Lustre file system. %if %{with lustre_modules} -%package modules -Summary: Kernel Lustre modules for Linux %{kversion} -# for SLES11, we need nothing here -%if %{_vendor}=="redhat" || %{_vendor}=="fedora" -%if %{defined krequires} -# for RHEL we need to require the specific kernel still since weak-modules -# support on RH is, well, weak, to be punny about it -Requires: kernel = %{krequires} -%endif -%if %{with lnet_dlc} -Requires: libyaml -BuildRequires: libyaml-devel -%endif -%endif -Group: Development/Kernel +%kernel_module_package_buildreqs -%description modules -Lustre file system, server and network drivers for Linux %{kversion}. +# Lustre modules +%kernel_module_package -n %{name} -p %SOURCE1 -f %SOURCE2 default %if %{with ldiskfs} -%package osd-ldiskfs -Summary: osd-ldiskfs contains both ldiskfs and its osd interface in Lustre. -Requires: lustre-modules = %{version} -Requires: module-init-tools >= 3.9 -Requires: ldiskfsprogs >= 1.42.7.wc1 -Requires: lustre-osd-ldiskfs-mount = %{version} -Provides: lustre-osd -Obsoletes: lustre-ldiskfs -Group: Development/Kernel - -%description osd-ldiskfs -The Lustre Object Storage Device (OSD) API is the interface to access and -modify data that is supposed to be stored persistently. This API is the interface -to code that bridges individual file systems. This specific package provides an -implementation of the OSD API for using the Ldiskfs filesystem as the underlying -backing store of a Lustre server. - +%kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 default %if %{with lustre_utils} %package osd-ldiskfs-mount Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso. @@ -155,24 +154,11 @@ Group: Development/Kernel %description osd-ldiskfs-mount LDISKFS hooks for mount/mkfs into a dynamic library. -%endif -%endif +%endif # with lustre_utils +%endif # with ldiskfs %if %{with zfs} -%package osd-zfs -Summary: osd-zfs is the mandatory glue for ZFS support in Lustre. -Requires: lustre-modules = %{version}, zfs-kmod -Requires: lustre-osd-zfs-mount = %{version} -Provides: lustre-osd -Group: Development/Kernel - -%description osd-zfs -The Lustre Object Storage Device (OSD) API is the interface to access and -modify data that is supposed to be stored persistently. This API is the interface -to code that bridges individual file systems. This specific package provides an -implementation of the OSD API for using the ZFS filesystem as the underlying -backing store of a Lustre server. - +%kernel_module_package -n %{name}-osd-zfs -p %SOURCE5 -f %SOURCE6 default %if %{with lustre_utils} %package osd-zfs-mount Summary: osd-zfs-mount contains mount's zfs specific dso. @@ -182,8 +168,9 @@ Group: Development/Kernel %description osd-zfs-mount ZFS hooks for mount/mkfs into a dynamic library. -%endif -%endif +%endif # with lustre_utils +%endif # with zfs + %endif # with lustre_modules # Since the RPMs we ship are to be used on both SLES and RHEL, we @@ -225,13 +212,17 @@ systems. Summary: Lustre testing framework Group: Development/Kernel Provides: %{name}-tests = %{version} -Requires: %{name} = %{version}, %{name}-modules = %{version}, lustre-iokit +Requires: %{name} = %{version}, %{requires_kmod_name} = %{requires_kmod_version}, lustre-iokit Requires: attr, rsync, perl, lsof, /usr/bin/getconf %description tests This package contains a set of test binaries and scripts that are intended to be used by the Lustre testing framework. +%if %{with lustre_modules} +%kernel_module_package -n %{name}-tests -f %SOURCE7 default +%endif + %if %{with lustre_iokit} %package -n lustre-iokit Summary: The Lustre IO-Kit is a collection of benchmark tools for a cluster with the Lustre file system. @@ -298,6 +289,7 @@ fi # string in it which we don't want word splitted by the shell # also remove (build|host|target) options because they will be specified # inside $CONFIGURE_ARGS +# kmod tools/scripts require %{name} directory with kernel modules %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g') %eval_configure $CONFIGURE_ARGS \ @@ -315,13 +307,35 @@ fi --with-release=%{release} \ --with-linux=%{kdir} \ --with-linux-obj=%{kobjdir} \ - --with-kmp-moddir=%{kmoddir} + --with-kmp-moddir=%{kmoddir}/%{name} make %{?_smp_mflags} -s %{?make_args} %install make install DESTDIR=$RPM_BUILD_ROOT +# RHEL's kernel_module_path macro expects that all the modules +# in a kmod package will be in modules_fs_path/ +# but Lustre installs all of the modules in a single pass into +# a shared location. Since this is a restriction imposed by +# RHEL, we handle this here in the spec file rather than in +# Lustre's build system. This is not expected to bother SLES's +# kernel_module_path macro. +basemodpath=$RPM_BUILD_ROOT%{modules_fs_path}/%{lustre_name} +%if %{with ldiskfs} +mkdir -p $basemodpath-osd-ldiskfs/fs +mv $basemodpath/fs/osd_ldiskfs.ko $basemodpath-osd-ldiskfs/fs/osd_ldiskfs.ko +mv $basemodpath/fs/ldiskfs.ko $basemodpath-osd-ldiskfs/fs/ldiskfs.ko +%endif +%if %{with zfs} +mkdir -p $basemodpath-osd-zfs/fs +mv $basemodpath/fs/osd_zfs.ko $basemodpath-osd-zfs/fs/osd_zfs.ko +%endif +%if %{with lustre_tests} +mkdir -p $basemodpath-tests/fs +mv $basemodpath/fs/llog_test.ko $basemodpath-tests/fs/llog_test.ko +%endif + :> lustre.files %if %{with servers} && %{with lustre_utils} @@ -381,9 +395,6 @@ echo '%{_bindir}/munlink' >>lustre-tests.files echo '%{_bindir}/req_layout' >>lustre-tests.files echo '%{_sbindir}/wirecheck' >>lustre-tests.files echo '%{_sbindir}/wiretest' >>lustre-tests.files -%if %{with lustre_modules} -echo '/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files -%endif %endif %files -f lustre.files @@ -424,28 +435,8 @@ echo '/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lu %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf %if %{with lustre_modules} -%files modules -%defattr(-,root,root) -/lib/modules/%{kversion}/%{kmoddir}/* -%if %{with lustre_tests} -%exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko -%endif -%if %{with ldiskfs} -%exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko -%exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko -%endif -%if %{with zfs} -%exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko -%endif -%doc COPYING -%doc ChangeLog-lustre -%doc ChangeLog-lnet %if %{with ldiskfs} -%files osd-ldiskfs -%defattr(-,root,root) -/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko -/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko %if %{with lustre_utils} %files osd-ldiskfs-mount %defattr(-,root,root) @@ -454,16 +445,13 @@ echo '/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lu %endif %if %{with zfs} -%files osd-zfs -%defattr(-,root,root) -/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko -%{_sbindir}/zfsobj2fid %if %{with lustre_utils} %files osd-zfs-mount %defattr(-,root,root) %{_libdir}/@PACKAGE@/mount_osd_zfs.so %endif %endif + %endif # with lustre_modules # uncomment these lines to enable deps packages @@ -499,214 +487,6 @@ echo '/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lu %doc lustre-iokit/stats-collect/README.iokit-lstats %endif -%if %{with lustre_modules} -%post modules -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}") -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - rpm -ql $MODULES_RPM_NAME | grep '\.ko$' | - /usr/lib/module-init-tools/weak-modules --add-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - rpm -ql $MODULES_RPM_NAME | grep '\.ko$' | - /sbin/weak-modules --add-modules -fi - -# If the kernel was built to reject unsupported modules (e.g. not a Lustre -# kernel), and this hasn't been overridden in /etc/modprobe.d yet, then -# print a warning so that users are aware of this issue. -if sysctl kernel.unsupported >/dev/null 2>&1 && - [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] && - ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then - echo " - warning: the Lustre modules are not supported by Novell. To use Lustre - on this system, you should put - - allow_unsupported_modules 1 - - into /etc/modprobe.d/unsupported_modules" -fi - -%if %{with ldiskfs} -%post osd-ldiskfs -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}") -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' | - /usr/lib/module-init-tools/weak-modules --add-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' | - /sbin/weak-modules --add-modules -fi - -# If the kernel was built to reject unsupported modules (e.g. not a Lustre -# kernel), and this hasn't been overridden in /etc/modprobe.d yet, then -# print a warning so that users are aware of this issue. -if sysctl kernel.unsupported >/dev/null 2>&1 && - [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] && - ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then - echo " - warning: the Lustre modules are not supported by Novell. To use Lustre - on this system, you should put - - allow_unsupported_modules 1 - - into /etc/modprobe.d/unsupported_modules" -fi -%endif - -%if %{with zfs} -%post osd-zfs -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}") -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' | - /usr/lib/module-init-tools/weak-modules --add-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' | - /sbin/weak-modules --add-modules -fi - -# If the kernel was built to reject unsupported modules (e.g. not a Lustre -# kernel), and this hasn't been overridden in /etc/modprobe.d yet, then -# print a warning so that users are aware of this issue. -if sysctl kernel.unsupported >/dev/null 2>&1 && - [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] && - ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then - echo " - warning: the Lustre modules are not supported by Novell. To use Lustre - on this system, you should put - - allow_unsupported_modules 1 - - into /etc/modprobe.d/unsupported_modules" -fi -%endif - -%preun modules -MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}") -rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true - -%if %{with ldiskfs} -%preun osd-ldiskfs -OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}") -rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true -%endif - -%if %{with zfs} -%preun osd-zfs -OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}") -rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true -%endif - -%postun modules -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - cat /var/run/%{name}-modules | - /usr/lib/module-init-tools/weak-modules --remove-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - cat /var/run/%{name}-modules | - /sbin/weak-modules --remove-modules -fi -rm /var/run/%{name}-modules - -%if %{with ldiskfs} -%postun osd-ldiskfs -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - cat /var/run/%{name}-osd-ldiskfs | - /usr/lib/module-init-tools/weak-modules --remove-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - cat /var/run/%{name}-osd-ldiskfs | - /sbin/weak-modules --remove-modules -fi -rm /var/run/%{name}-osd-ldiskfs -%endif - -%if %{with zfs} -%postun osd-zfs -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -# "weak modules" support -# Suse -if [ -x /usr/lib/module-init-tools/weak-modules ]; then - cat /var/run/%{name}-osd-zfs | - /usr/lib/module-init-tools/weak-modules --remove-modules -fi -# RedHat -if [ -x /sbin/weak-modules ]; then - cat /var/run/%{name}-osd-zfs | - /sbin/weak-modules --remove-modules -fi -rm /var/run/%{name}-osd-zfs -%endif -%endif # with lustre_modules - -%if %{with lustre_tests} -%if %{with lustre_modules} -%post tests -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi - -%postun tests -if [ -f /boot/System.map-%{kversion} ]; then - depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 -else - depmod -ae %{kversion} || exit 0 -fi -%endif -%endif - %clean rm -rf $RPM_BUILD_ROOT +rm -rf %{_tmppath}/kmp diff --git a/rpm/kmp-lustre-osd-ldiskfs.files b/rpm/kmp-lustre-osd-ldiskfs.files new file mode 100644 index 0000000..47bcee1 --- /dev/null +++ b/rpm/kmp-lustre-osd-ldiskfs.files @@ -0,0 +1,3 @@ +%defattr(-,root,root) +%{modules_fs_path}/%{lustre_name}-osd-ldiskfs/fs/ldiskfs.ko +%{modules_fs_path}/%{lustre_name}-osd-ldiskfs/fs/osd_ldiskfs.ko diff --git a/rpm/kmp-lustre-osd-ldiskfs.preamble b/rpm/kmp-lustre-osd-ldiskfs.preamble new file mode 100644 index 0000000..9d28965 --- /dev/null +++ b/rpm/kmp-lustre-osd-ldiskfs.preamble @@ -0,0 +1,6 @@ +Requires: %{requires_kmod_name} = %{requires_kmod_version} +Requires: ldiskfsprogs >= 1.42.7.wc1 +Requires: %{name}-osd-ldiskfs-mount = %{version} +Provides: %{name}-osd = %{version} +Obsoletes: %{name}-ldiskfs < %{version} +Obsoletes: %{name}-osd-ldiskfs < %{version} diff --git a/rpm/kmp-lustre-osd-zfs.files b/rpm/kmp-lustre-osd-zfs.files new file mode 100644 index 0000000..0ac2677 --- /dev/null +++ b/rpm/kmp-lustre-osd-zfs.files @@ -0,0 +1,2 @@ +%defattr(-,root,root) +%{modules_fs_path}/%{lustre_name}-osd-zfs/fs/osd_zfs.ko diff --git a/rpm/kmp-lustre-osd-zfs.preamble b/rpm/kmp-lustre-osd-zfs.preamble new file mode 100644 index 0000000..c8db093 --- /dev/null +++ b/rpm/kmp-lustre-osd-zfs.preamble @@ -0,0 +1,4 @@ +Requires: zfs-kmod +Requires: %{name}-osd-zfs-mount = %{version} +Provides: %{name}-osd = %{version} +Obsoletes: %{name}-osd-zfs < %{version} diff --git a/rpm/kmp-lustre-tests.files b/rpm/kmp-lustre-tests.files new file mode 100644 index 0000000..f62b46f --- /dev/null +++ b/rpm/kmp-lustre-tests.files @@ -0,0 +1 @@ +%{modules_fs_path}/%{lustre_name}-tests/fs/llog_test.ko diff --git a/rpm/kmp-lustre.files b/rpm/kmp-lustre.files new file mode 100644 index 0000000..62e39d0 --- /dev/null +++ b/rpm/kmp-lustre.files @@ -0,0 +1,5 @@ +%defattr(-,root,root) +%{modules_fs_path}/%{lustre_name}/* +%doc COPYING +%doc ChangeLog-lustre +%doc ChangeLog-lnet diff --git a/rpm/kmp-lustre.preamble b/rpm/kmp-lustre.preamble new file mode 100644 index 0000000..47ae87e --- /dev/null +++ b/rpm/kmp-lustre.preamble @@ -0,0 +1 @@ +Obsoletes: %{name}-modules < %{version}