build: Replace which with command -v

The `which` command is not standard, may not exist on the build host,
or may not behave as expected by the build system. It is recommended
to use `command -v` to find out if a command exist and have its path,
and it's part of a POSIX shell standard (at least, it seems to be
mandatory since IEEE Std 1003.1-2008, but was optional before).

Fixes: c8a8645f1e ("xen/build: Automatically locate a suitable python interpreter")
Fixes: 3b47bcdb6d ("xen/build: Use a distro version of figlet")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: f93629b18b
master date: 2024-02-19 12:45:48 +0100
This commit is contained in:
Anthony PERARD authored and Jan Beulich committed 2024-02-27 14:08:50 +01:00
1 parent b3ae0e6201
commit 1330a5fe44
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -25,8 +25,8 @@ export XEN_BUILD_HOST := $(shell hostname)
endif
# Best effort attempt to find a python interpreter, defaulting to Python 3 if
# available. Fall back to just `python` if `which` is nowhere to be found.
PYTHON_INTERPRETER := $(word 1,$(shell which python3 python python2 2>/dev/null) python)
# available. Fall back to just `python`.
PYTHON_INTERPRETER := $(word 1,$(shell command -v python3 || command -v python || command -v python2) python)
export PYTHON ?= $(PYTHON_INTERPRETER)
export CHECKPOLICY ?= checkpolicy
+1 -1
View File
@@ -1,6 +1,6 @@
quiet_cmd_banner = BANNER $@
define cmd_banner
if which figlet >/dev/null 2>&1 ; then \
if command -v figlet >/dev/null 2>&1 ; then \
echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
else \
echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.