Whamcloud - gitweb
LU-11720 spec: srpm should be free of kernel requiements 71/33771/2
authorNathaniel Clark <nclark@whamcloud.com>
Mon, 3 Dec 2018 19:04:37 +0000 (14:04 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 6 Feb 2019 06:34:42 +0000 (06:34 +0000)
This moves the fix for LU-9731 into spec file and out of lbuild.
This lets "make rpms" benefit from the fix.
This also prevents the srpm from being incorrectly locked to the
kernel present when lbuild was used to create it (via
kmp-lustre.preamble).

Test-Parameters: trivial
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Change-Id: I15f61c0e37182c0efbea3566d43b1e89f180d3e5
Reviewed-on: https://review.whamcloud.com/33771
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/lbuild/lbuild-rhel7
lustre.spec.in

index a66eba4..721d56b 100644 (file)
@@ -120,16 +120,6 @@ cleanup_rpmmacros() {
 }
 
 apply_kmod_requires_conflicts() {
-    # until we have achieved full kABI compatibility we need to
-    # restrict the kernel range that can be used to the kernel
-    # version from the RHEL minor release
-    # this is supposed to be done for kmods automatically but
-    # RHBZ#1467319 seems to be getting in the way
-    local kver=$(find_linux_release)
-    local linuxversion=${kver%%-*}
-    local linuxrelease=${kver##*-}
-    local kabiminor=${linuxrelease%%.*}
-    echo "Requires:       kernel < $linuxversion-$((kabiminor+1)), kernel >= $linuxversion-$((kabiminor))" >> rpm/kmp-lustre.preamble
     if $PATCHLESS; then
         # don't allow the patched kernel to be considered as a valid kernel
         # for the patchless client
index 7fe7e9f..8ab88ce 100644 (file)
@@ -176,7 +176,27 @@ BuildRequires: systemd
 Userspace tools and files for the Lustre file system.
 
 %if %{with lustre_modules}
-%kernel_module_package -n %{name} -p %SOURCE1 -f %SOURCE2 default
+%if 0%{?rhel} == 7
+# until we have achieved full kABI compatibility we need to
+# restrict the kernel range that can be used to the kernel
+# version from the RHEL minor release
+# this is supposed to be done for kmods automatically but
+# RHBZ#1467319 seems to be getting in the way
+# this is true for el7.0 through el7.4
+%define preamble %{expand:%(
+TMPFILE=`mktemp`
+cat %{SOURCE1} > $TMPFILE
+kver=%{kver}
+linuxversion=${kver%%%%-*}
+linuxrelease=${kver##*-}
+kabiminor=${linuxrelease%%%%.*}
+echo "Requires:       kernel < $linuxversion-$((kabiminor+1)), kernel >= $linuxversion-$((kabiminor))" >> $TMPFILE
+echo $TMPFILE
+)}
+%else
+%define preamble %{SOURCE1}
+%endif
+%kernel_module_package -n %{name} -p %preamble -f %SOURCE2 default
 
 %if %{with ldiskfs}
 %kernel_module_package -n %{name}-osd-ldiskfs -p %SOURCE3 -f %SOURCE4 default