From bebfcbf008e6b1bc566c3abebf46fefbe6c8b5e8 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 9 Aug 2017 11:09:44 -0400 Subject: [PATCH] LU-9850 patchless client should conflict patched kernel Due to how dependencies work in RPM (and a bug in how kmod RPMs generate their dependency lists), on a node where the server and client repos are both configured, YUM could allow the patched kernel to satisfy the patchless-client RPM's requirements. Add Conflicts: and Provides: to the kernel RPM and lustre-client RPM to prevent this from happening. This change also allows one to force the installation of the patched kernel RPM (yum install kernel-lustre) if one desires. Test-Parameters: trivial Signed-off-by: Brian J. Murrell Change-Id: If9c44a93937cd7603b0246676ebc9c8260a43b11 Reviewed-on: https://review.whamcloud.com/28557 Tested-by: Jenkins Reviewed-by: Minh Diep Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- contrib/lbuild/lbuild | 4 ++-- contrib/lbuild/lbuild-rhel | 9 +++++++-- contrib/lbuild/lbuild-rhel7 | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 99dd601..bf9e754 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -934,8 +934,8 @@ build_lustre() { ./configure $configure_args $CONFIGURE_FLAGS 2>&1 || fatal 1 "Error in configure." - if type -p apply_kmod_requires; then - apply_kmod_requires + if type -p apply_kmod_requires_conflicts; then + apply_kmod_requires_conflicts fi make rpms 2>&1 || diff --git a/contrib/lbuild/lbuild-rhel b/contrib/lbuild/lbuild-rhel index 8f20270..a2b0475 100644 --- a/contrib/lbuild/lbuild-rhel +++ b/contrib/lbuild/lbuild-rhel @@ -6,7 +6,8 @@ # in build/lbuild) #BUILD_GEN+=".0" #BUILD_GEN+=".1" # refactor both rhel5 and rhel6 -BUILD_GEN+=".0" # TT-107: don't cache the BUILD dir (reset major to 5) +#BUILD_GEN+=".0" # TT-107: don't cache the BUILD dir (reset major to 5) +BUILD_GEN+=".2" # LU-9850 DEVEL_KERNEL_TYPE="devel" RPM_HELPERS_DIR="/usr/lib/rpm/redhat" @@ -21,7 +22,11 @@ get_rpmbuildopts() { # patching common to all releases patch_spec_common() { - sed -i -e '/find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\ + sed -i -e '/Provides: kernel-uname-r =/a\ +Provides: kernel-lustre = %{KVRA}%{?1:.%{1}}\\' \ + -e '/Provides: kernel-devel-uname-r =/a\ +Provides: kernel-devel-lustre = %{KVRA}%{?1:.%{1}}\\' \ + -e '/find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\ cp -a fs/ext3/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext3 \ cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4' \ SPECS/$SPEC_NAME 2>&1 || \ diff --git a/contrib/lbuild/lbuild-rhel7 b/contrib/lbuild/lbuild-rhel7 index d824b5b..6045984 100644 --- a/contrib/lbuild/lbuild-rhel7 +++ b/contrib/lbuild/lbuild-rhel7 @@ -109,7 +109,7 @@ cleanup_rpmmacros() { sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC } -apply_kmod_requires() { +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 @@ -120,4 +120,9 @@ apply_kmod_requires() { 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 } -- 1.8.3.1