Whamcloud - gitweb
LU-16382 spec: SUSE OBS requires kernel-source requirement. 65/49365/9
authorMr NeilBrown <neilb@suse.de>
Mon, 12 Dec 2022 04:31:16 +0000 (15:31 +1100)
committerOleg Drokin <green@whamcloud.com>
Sat, 22 Apr 2023 17:29:39 +0000 (17:29 +0000)
The SUSE OBS creates a virtual environment containing
ONLY the stated BuildRequires requirements, and some defaults.
To be able to build ldiskfs we need the kernel source, so we
need "BuildRequires: kernel-source".

However when contrib/lbuild it is used to build lustre, it finds the
source by other means and fails on that BuildRequires.  So it must be
conditional on running under abuild. (the OBS build tool).

When abuild extracts these BuildRequires, it cannot parse %() so
conditions using that all appear to be "false".  But %() is the only
way to detect abuild - but looking in environment.

So a dance is needed to fit with all these odd requirements.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I2fe9ecaf857ecbd5fda7e857b661b5b756501190
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49365
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre.spec.in

index 870b0e7..696aeca 100644 (file)
@@ -232,6 +232,18 @@ BuildRequires: pkg-config
 %if %{with gss}
 BuildRequires: krb5-devel openssl-devel
 %endif
+%if %{with lustre_modules}
+# abuild (auto-build) used by SUSE Open Build Service
+# need kernel-source as a build requirement, but the code
+# which extracts these requirements don't understand %()
+# and treats all such as failures.  So the following dance
+# Allows the requirements to be seen by abuild, but ignored
+# by lbuild.
+%if "%(echo $USER)" != "abuild"
+%else
+BuildRequires: kernel-source
+%endif
+%endif
 %if %{with servers}
 Requires: %{name}-osd
 Requires: %{name}-osd-mount