Whamcloud - gitweb
b=21452 support for weak-modules
authorBrian J. Murrell <brian@sun.com>
Mon, 17 May 2010 20:52:05 +0000 (16:52 -0400)
committerJohann Lombardi <johann@sun.com>
Tue, 18 May 2010 12:41:49 +0000 (14:41 +0200)
Add support to our RPM SPEC for the weak-modules script.

This requires that we install our modules under
/lib/modules/$(uname -r)/updates/kernel.  I think this is the correct
location for us in any case given that we are a kernel "addon" package.
Relax the kernel Requires: to work better with weak-modules.
Use the external dependency generator as the internal one cannot deal
with kernel modules.

i=mjmac
i=wangyb

build/autoconf/lustre-build-linux.m4
ldiskfs/lustre-ldiskfs.spec.in
lustre.spec.in
lustre/ChangeLog

index 8e1025f..c6583d2 100644 (file)
@@ -84,7 +84,7 @@ fi
 AC_MSG_RESULT([$LINUXRELEASE])
 AC_SUBST(LINUXRELEASE)
 
-moduledir='/lib/modules/'$LINUXRELEASE/kernel
+moduledir='/lib/modules/'$LINUXRELEASE/updates/kernel
 AC_SUBST(moduledir)
 
 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
index b76f6d6..35a7c24 100644 (file)
@@ -45,7 +45,7 @@ make -j $RPM_BUILD_NCPUS -s
 make install DESTDIR=$RPM_BUILD_ROOT
 
 %files
-%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
+%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
 
 %post
 if [ -f /boot/System.map-%{kversion} ]; then
index 5b022b9..6e12b63 100644 (file)
@@ -5,10 +5,23 @@
 %{!?lustre_name: %define lustre_name lustre}
 %{!?build_lustre_tests: %define build_lustre_tests 1}
 
+# on RHEL5, we need to disable the internal dependency generator and let
+# the external one be used as it can deal with providing Provides: tags
+# for kernel modules
+# on SLES10, /usr/lib/rpm/macros already sets this, so no harm (until Suse
+# changes their mind)
+%global _use_internal_dependency_generator 0
+
 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
 # for those uses that don't want the -smp/-bigsmp on the end of %kversion
 %define krequires %(bash -c "echo %{kversion} | sed -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//'")
 
+%define sles10 %(bash -c "if [ "%sles_version" = "10" ]; then echo -n '1'; else echo -n '0'; fi")
+
+%if %sles10
+%define flavor %(bash -c "echo %{kversion} | sed -e 's/^.*-//'")
+%endif
+
 Summary: Lustre File System
 Name: %{lustre_name}
 Version: %{version}
@@ -28,7 +41,11 @@ Userspace tools and files for the Lustre file system.
 
 %package modules
 Summary: Kernel Lustre modules for Linux %{kversion}
-Requires: modutils >= 2.4.10, kernel = %{krequires}
+# for RHEL5 and SLES11, we need nothing here
+# for SLES10, we need (where %{flavor} is, i.e. smp):
+%if %sles10
+Requires: kernel-%{flavor}
+%endif
 Group: Development/Kernel
 
 %description modules
@@ -124,14 +141,14 @@ make install DESTDIR=$RPM_BUILD_ROOT
 # hack to avoid changing the libsysio code for "make install"
 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
-rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre-ldiskfs
+rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
 
 # hack to include the llog_test module in lustre-tests
 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
 if [ -e ${llog_base}.ko ]; then
-  cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
+  cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
 elif [ -e ${llog_base}.o ]; then
-  cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/fs/lustre
+  cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
 fi
 
 # Create the pristine source directory.
@@ -191,7 +208,7 @@ fi
 
 %if %{build_lustre_tests}
 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
-echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
+echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
 modules_excludes="|llog_test"
 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
@@ -199,7 +216,7 @@ fi
 %endif
 
 pushd $RPM_BUILD_ROOT >/dev/null
-find lib/modules/%{kversion}/kernel -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
+find lib/modules/%{kversion}/updates -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
 popd >/dev/null
 
 %files -f lustre.files
@@ -226,9 +243,22 @@ if [ -f /boot/System.map-%{kversion} ]; then
 else
        depmod -ae %{kversion} || exit 0
 fi
+
+# "weak modules" support
+# Suse
+if [ -x /usr/lib/module-init-tools/weak-modules ]; then
+    rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' |
+        /usr/lib/module-init-tools/weak-modules --add-modules
+fi
+# RedHat
+if [ -x /sbin/weak-modules ]; then
+    rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' |
+        /sbin/weak-modules --add-modules
+fi
+
 cat <<EOF
-Congratulations on finishing your Lustre installation!  To register  
-your copy of Lustre and find out more about Lustre Support, Service,  
+Congratulations on finishing your Lustre installation!  To register
+your copy of Lustre and find out more about Lustre Support, Service,
 and Training offerings please visit
 
 http://www.sun.com/software/products/lustre/lustre_reg.jsp
@@ -271,6 +301,9 @@ if sysctl kernel.unsupported >/dev/null 2>&1 &&
      into /etc/modprobe.d/unsupported_modules"
 fi
 
+%preun modules
+rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' > /var/run/%{name}-modules
+
 %postun modules
 if [ -f /boot/System.map-%{kversion} ]; then
        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
@@ -278,6 +311,19 @@ 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 | grep '\.ko$' |
+        /usr/lib/module-init-tools/weak-modules --remove-modules
+fi
+# RedHat
+if [ -x /sbin/weak-modules ]; then
+    cat /var/run/%{name}-modules | grep '\.ko$' |
+        /sbin/weak-modules --remove-modules
+fi
+rm /var/run/%{name}-modules
+
 %if %{build_lustre_tests}
 %post tests
 if [ -f /boot/System.map-%{kversion} ]; then
index 7a55837..9edc0e0 100644 (file)
@@ -278,6 +278,14 @@ Severity   : normal
 Bugzilla   : 21966
 Description: avoid divide-by-zero in lprocfs_rd_import()
 
+Severity   : enhancement
+Bugzilla   : 21452
+Description: "weak-modules" support
+Details    : Implement "weak-modules" support which enables kernel modules
+            to be used with any kernel that implements the same kABI.  In
+            order to achieve this modules are now installed in
+            /lib/modules/$(uname -r)/updates/kernel on all distributions.
+
 Severity   : normal
 Bugzilla   : 21816
 Description: lfs quota failed when OSTs are down