Makefile: only run rpmspec if it exists
Subsystems (2)
PATCH 1/1 Makefile: only run rpmspec if it exists
keyutils is built on many distros which do not use rpm like Gentoo, ChromeOS or Arch. Older versions of bash silently ignored the fact that rpmspec was missing, but newer bash like v5.1 issue a new error:
/bin/sh: line 1: rpmspec: command not found
This happens every time the Makefile is parsed, including for a simple "make" invocation or "make install" even if a rpm package is not desired.
Arch Linux simply ignores this new error but Gentoo and ChromeOS fail because portage actively monitors the build log for errors like this. See bug report [1].
Fix this by calling rpmspec only if it exists.
[1] https://bugs.gentoo.org/760633
Signed-off-by Adrian Ratiu <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -285,7 +285,7 @@ SRCBALL := rpmbuild/SOURCES/$(TARBALL) ZSRCBALL := rpmbuild/SOURCES/$(ZTARBALL) BUILDID := .local -rpmver0 := $(shell rpmspec -q ./keyutils.spec --define "buildid $(BUILDID)") +rpmver0 := $(shell if which rpmspec >/dev/null 2>&1; then rpmspec -q ./keyutils.spec --define "buildid $(BUILDID)"; fi) rpmver1 := $(word 1,$(rpmver0)) rpmver2 := $(subst ., ,$(rpmver1)) rpmver3 := $(lastword $(rpmver2))
Signature · 1 line
2.34.1