build: replace which with command -v

PR-URL: https://github.com/nodejs/node/pull/36118
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
raisinten 2020-11-14 20:50:03 +05:30 committed by Antoine du Hamel
parent 3e0194e88e
commit 2d167f0dc7
5 changed files with 12 additions and 12 deletions

View File

@ -24,7 +24,7 @@ jobs:
- name: Environment Information - name: Environment Information
run: npx envinfo run: npx envinfo
- name: Lint addon docs - name: Lint addon docs
run: NODE=$(which node) make lint-addon-docs run: NODE=$(command -v node) make lint-addon-docs
lint-cpp: lint-cpp:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -50,7 +50,7 @@ jobs:
- name: Lint docs - name: Lint docs
run: | run: |
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
NODE=$(which node) make lint-md NODE=$(command -v node) make lint-md
lint-js: lint-js:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -62,7 +62,7 @@ jobs:
- name: Environment Information - name: Environment Information
run: npx envinfo run: npx envinfo
- name: Lint JavaScript files - name: Lint JavaScript files
run: NODE=$(which node) make lint-js run: NODE=$(command -v node) make lint-js
lint-py: lint-py:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -76,7 +76,7 @@ jobs:
- name: Lint Python - name: Lint Python
run: | run: |
make lint-py-build || true make lint-py-build || true
NODE=$(which node) make lint-py NODE=$(command -v node) make lint-py
lint-codeowners: lint-codeowners:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -23,7 +23,7 @@ jobs:
- name: Environment Information - name: Environment Information
run: npx envinfo run: npx envinfo
- name: Build - name: Build
run: NODE=$(which node) make doc-only run: NODE=$(command -v node) make doc-only
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: docs name: docs

View File

@ -3,7 +3,7 @@ FLAGS=${.MAKEFLAGS:C/\-J ([0-9]+,?)+//W}
all: .DEFAULT all: .DEFAULT
.DEFAULT: .DEFAULT:
@which gmake > /dev/null 2>&1 ||\ @command -v gmake > /dev/null 2>&1 ||\
(echo "GMake is required for node.js to build.\ (echo "GMake is required for node.js to build.\
Install and try again" && exit 1) Install and try again" && exit 1)
@gmake ${.FLAGS} ${.TARGETS} @gmake ${.FLAGS} ${.TARGETS}

View File

@ -65,8 +65,8 @@ V ?= 0
available-node = \ available-node = \
if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \ if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \
$(PWD)/$(NODE) $(1); \ $(PWD)/$(NODE) $(1); \
elif [ -x `which node` ] && [ -e `which node` ] && [ `which node` ]; then \ elif [ -x `command -v node` ] && [ -e `command -v node` ] && [ `command -v node` ]; then \
`which node` $(1); \ `command -v node` $(1); \
else \ else \
echo "No available node, cannot run \"node $(1)\""; \ echo "No available node, cannot run \"node $(1)\""; \
exit 1; \ exit 1; \
@ -898,7 +898,7 @@ BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
endif endif
BINARYTAR=$(BINARYNAME).tar BINARYTAR=$(BINARYNAME).tar
# OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/ # OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/
HAS_XZ ?= $(shell which xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0) HAS_XZ ?= $(shell command -v xz > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
# Supply SKIP_XZ=1 to explicitly skip .tar.xz creation # Supply SKIP_XZ=1 to explicitly skip .tar.xz creation
SKIP_XZ ?= 0 SKIP_XZ ?= 0
XZ = $(shell [ $(HAS_XZ) -eq 1 -a $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0) XZ = $(shell [ $(HAS_XZ) -eq 1 -a $(SKIP_XZ) -eq 0 ] && echo 1 || echo 0)
@ -1383,7 +1383,7 @@ lint-clean:
$(RM) tools/.*lintstamp $(RM) tools/.*lintstamp
$(RM) .eslintcache $(RM) .eslintcache
HAS_DOCKER ?= $(shell which docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0) HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0)
ifeq ($(HAS_DOCKER), 1) ifeq ($(HAS_DOCKER), 1)
DOCKER_COMMAND ?= docker run -it -v $(PWD):/node DOCKER_COMMAND ?= docker run -it -v $(PWD):/node

View File

@ -50,8 +50,8 @@ esac
HOST_OS="linux" HOST_OS="linux"
HOST_ARCH="x86_64" HOST_ARCH="x86_64"
export CC_host=$(which gcc) export CC_host=$(command -v gcc)
export CXX_host=$(which g++) export CXX_host=$(command -v g++)
host_gcc_version=$($CC_host --version | grep gcc | awk '{print $NF}') host_gcc_version=$($CC_host --version | grep gcc | awk '{print $NF}')
major=$(echo $host_gcc_version | awk -F . '{print $1}') major=$(echo $host_gcc_version | awk -F . '{print $1}')