Whamcloud - gitweb
LU-18233 build: check %kernel_module_package_buildreqs 03/56403/2
authorJian Yu <yujian@whamcloud.com>
Wed, 18 Sep 2024 23:57:50 +0000 (16:57 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 27 Sep 2024 23:54:46 +0000 (23:54 +0000)
If rpm macro %kernel_module_package_buildreqs is undefined,
building Lustre codes will report the following error:

  Dependency tokens must begin with alpha-numeric, '_' or '/':
  BuildRequires: %kernel_module_package_buildreqs

However, the real issue is that kernel-rpm-macros or
rpm-build rpm is not installed. And the error should be like:

  error: Failed build dependencies:
    kernel-rpm-macros is needed by ...

This patch fixes the above issue by checking if the macro
%kernel_module_package_buildreqs is defined before adding it
to BuildRequires so as to avoid the misleading error.

The patch also replaces suse_version with sle_version to get
the correct version value for SLES15 SP3.

Test-Parameters: trivial clientdistro=el9.4 testlist=sanity
Test-Parameters: trivial clientdistro=el8.10 testlist=sanity
Test-Parameters: trivial clientdistro=sles15sp6 \
  env=SANITY_EXCEPT="103a 120e" testlist=sanity

Fixes: 037840fb6b ("LU-12899 build: rhel8 not install kernel-rpm-macros")
Fixes: c39d269f9d ("LU-12214 build: add right kernel detect")
Fixes: 78c681d9f4 ("LU-16207 build: add rpm-build BuildRequires for SLES15 SP3")

Change-Id: I151d93c0c74ab98e6589393a914acf18b5471289
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56403
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre.spec.in

index 0e7a891..fdfef7f 100644 (file)
@@ -315,13 +315,16 @@ Requires: mlnx-ofa_kernel-kmp
 %endif
 %endif
 %endif
+%if %{defined kernel_module_package_buildreqs}
+BuildRequires: %kernel_module_package_buildreqs
+%else
 %if 0%{?rhel} >= 8 || 0%{?openEuler}
 BuildRequires: kernel-rpm-macros
 %endif
-%if 0%{?suse_version} >= 1530
+%if 0%{?sle_version} >= 150300
 BuildRequires: rpm-build >= 4.14.3
 %endif
-BuildRequires: %kernel_module_package_buildreqs
+%endif
 # need to provide a /usr/lib/${uname -r)/build dir
 BuildRequires: kernel >= 3.10
 %if "%{_vendor}" == "redhat"