common.mk: Set WHICH to command -v #151

Merged
Jan Lindemann merged 1 commit from jan/feature/20261020-common-mk-set-which-to-command-v into master 2026-10-20 09:14:37 +02:00 AGit
Owner

common.mk: Set WHICH to command -v

defs.mk derives WHICH from the external which binary, first from a hardcoded /usr/bin/which path and then with a which which fallback, while the probes for time, ruff, pyright, and python3 call which directly. Systems that do not ship the which package, such as minimal containers, are left to the shell's PATH search.

Define WHICH once in common.mk as the POSIX command -v builtin and drop the old definition from defs.mk. Route the remaining direct which calls through $(WHICH):

  • projects-dir.mk: TIME probe
  • py-check.mk: PY_CHECK_RUFF and PY_CHECK_PYRIGHT probes
  • py-version.mk: PYTHON lookup

command -v runs in the /bin/sh that $(shell) already uses, so the build no longer depends on the which package. The builtin names that command -v reports for echo, test, pwd, and printf are safe, because every use of those variables runs through the shell, and the bash time keyword keeps the -p output format identical to the GNU time binary.

#### common.mk: Set WHICH to command -v defs.mk derives WHICH from the external which binary, first from a hardcoded /usr/bin/which path and then with a `which which` fallback, while the probes for time, ruff, pyright, and python3 call which directly. Systems that do not ship the which package, such as minimal containers, are left to the shell's PATH search. Define `WHICH` once in `common.mk` as the `POSIX` command -v builtin and drop the old definition from `defs.mk`. Route the remaining direct which calls through `$(WHICH)`: - `projects-dir.mk`: `TIME` probe - `py-check.mk`: `PY_CHECK_RUFF` and `PY_CHECK_PYRIGHT` probes - `py-version.mk`: `PYTHON` lookup command -v runs in the /bin/sh that `$(shell)` already uses, so the build no longer depends on the which package. The builtin names that command -v reports for echo, test, pwd, and printf are safe, because every use of those variables runs through the shell, and the bash time keyword keeps the -p output format identical to the GNU time binary.
common.mk: Set WHICH to command -v
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m32s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m49s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m13s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m28s
CI / Packaging test (push) Successful in 0s
f5249a58ef
defs.mk derives WHICH from the external which binary, first from a
hardcoded /usr/bin/which path and then with a `which which` fallback, while
the probes for time, ruff, pyright, and python3 call which directly.
Systems that do not ship the which package, such as minimal containers, are
left to the shell's PATH search.

Define WHICH once in common.mk as the POSIX command -v builtin and drop the
old definition from defs.mk. Route the remaining direct which calls through
$(WHICH):

- projects-dir.mk: TIME probe
- py-check.mk: PY_CHECK_RUFF and PY_CHECK_PYRIGHT probes
- py-version.mk: PYTHON lookup

command -v runs in the /bin/sh that $(shell) already uses, so the build no
longer depends on the which package. The builtin names that command -v
reports for echo, test, pwd, and printf are safe, because every use of
those variables runs through the shell, and the bash time keyword keeps the
-p output format identical to the GNU time binary.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.3.0
Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-10-20 09:03:10 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!151
No description provided.