Remove dependency from 'which' utility

Debian declared the 'which' utility as deprecated.

Fixes #4319
This commit is contained in:
Norman Feske 2021-11-08 21:15:54 +01:00 committed by Christian Helmuth
parent 293d545b97
commit 4cfd954e1e
4 changed files with 6 additions and 9 deletions

View File

@ -3,7 +3,7 @@
#
GENODE_ROOT_DIR = $(BASE_DIR)/../..
GENODE_VERSION := $(shell \
which git > /dev/null \
command -v git > /dev/null \
&& git -C $(GENODE_ROOT_DIR) describe --dirty=" <local changes>" 2> /dev/null \
&& exit 0 \
|| \

View File

@ -81,7 +81,7 @@ BASE_DIR := $(realpath $(shell echo $(BASE_DIR)))
# standard shell is dash, which breaks colored output via its built-in echo
# command.
#
export SHELL := $(shell which bash)
export SHELL := $(shell sh -c "command -v bash")
#
# Discharge variables evaluated by ccache mechanism that may be inherited when
@ -137,7 +137,7 @@ endif
#
# Helper function to check if a needed tool is installed
#
check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.))
check_tool = $(if $(shell command -v $(1)),,$(error Need to have '$(1)' installed.))
#
# Tool chain version check
@ -363,7 +363,7 @@ gen_deps_and_build_targets: $(CCACHED_CUSTOM_CC) $(CCACHED_CUSTOM_CXX)
# create ccache symlinks at var/tool/ccache/
$(CCACHED_CUSTOM_CC) $(CCACHED_CUSTOM_CXX):
$(VERBOSE_MK)mkdir -p $(dir $@)
$(VERBOSE_MK)ln -sf `which ccache` $@
$(VERBOSE_MK)ln -sf `command -v ccache` $@
# supplement tool-chain directory to the search-path variable used by ccache
ifneq ($(filter /%,$(CUSTOM_CXX)),)

View File

@ -31,4 +31,4 @@ MSG_GIT := $(MSG_PREFIX_TXT)git
#
# Utility to check if a tool is installed
#
check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.))
check_tool = $(if $(shell command -v $(1)),,$(error Need to have '$(1)' installed.))

View File

@ -533,11 +533,8 @@ proc have_spec {spec} { global specs; return [expr [lsearch $specs $spec] != -1]
# Return true if specified program is installed
#
proc have_installed {program} {
if {[catch { exec which $program }] == 0} { return true; }
if {[catch { exec which "/sbin/$program" }] == 0} { return true; }
if {[catch { exec which "/usr/sbin/$program" }] == 0} { return true; }
if {[catch { exec which "/usr/local/bin/$program" }] == 0} { return true; }
if {[auto_execok "$program"] != ""} { return true; }
return false;
}