Whamcloud - gitweb
LU-9850 patchless client should conflict patched kernel
[fs/lustre-release.git] / contrib / lbuild / lbuild-rhel7
index ea339a0..6045984 100644 (file)
@@ -8,14 +8,14 @@ BUILD_GEN+=".0"
 
 SPEC_NAME="kernel.spec"
 DEVEL_PATH_ARCH_DELIMETER="."
-USE_KABI=true
+USE_KABI=false
 
 # force local definition of %dist into ~/.rpmmacros
 # to avoid verbose extended strings like ".el7.centos"
 # in kernel version and rpm names
 #
 RMAC=$HOME/.rpmmacros
-grep '%dist' $RMAC &> /dev/null || echo '%dist .el7' >> $RMAC
+grep '^%dist' $RMAC &> /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.
@@ -29,6 +29,8 @@ chmod 755 kmodtool
 popd
 # Next we replace %kernel_module_package with one that is nearly
 # identical, but calls lbuild's modified kmodtool script.
+# We need to cleanout the previous entry
+sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
 sed -e "s|REPLACE_ME|$LBUILD_KMODTOOL|" \
     ${LBUILD_DIR}/rhel7/rpmmacros.template > ${LBUILD_DIR}/rhel7/rpmmacros
 cat ${LBUILD_DIR}/rhel7/rpmmacros >> $RMAC
@@ -102,3 +104,25 @@ kernel_srpm_location() {
     echo "http://vault.centos.org/centos/7/updates/Source/SPackages/"
 
 }
+
+cleanup_rpmmacros() {
+       sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
+}
+
+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
+        echo "Conflicts:      kernel-lustre" >> rpm/kmp-lustre.preamble
+    fi
+}