[riot-commits] [RIOT-OS/RIOT] 6b5003: makefiles: Replace `which` with `command -v`

chrysn noreply at github.com
Fri Sep 3 09:04:12 CEST 2021


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 6b50033766b7701b2e20bc8646085e5edf4a27c0
      https://github.com/RIOT-OS/RIOT/commit/6b50033766b7701b2e20bc8646085e5edf4a27c0
  Author: chrysn <chrysn at fsfe.org>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M .github/workflows/release-test.yml
    M Makefile.include
    M dist/testbed-support/makefile.iotlab.single.inc.mk
    M dist/tools/openvisualizer/makefile.openvisualizer.inc.mk
    M makefiles/arch/riscv.inc.mk
    M makefiles/boards/sam0.inc.mk
    M pkg/flatbuffers/Makefile.include

  Log Message:
  -----------
  makefiles: Replace `which` with `command -v`

As the POSIX documentation[1] of `command -v` guarantees that on error
there will be no output (and there will be output in the other cases),
the tests in Makefiles were simplified to test for output equality to
the empty string.

Redirects swallowing error outputs were removed, as the command produces
no error output there (as recommended at [2]).

Existing uses of `command` are simplified as well.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
[2]: https://salsa.debian.org/debian/debianutils/-/blob/master/debian/NEWS


  Commit: 6bcc68b9ccf510f29fd0a1304e09adb969c16a6b
      https://github.com/RIOT-OS/RIOT/commit/6bcc68b9ccf510f29fd0a1304e09adb969c16a6b
  Author: chrysn <chrysn at fsfe.org>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M dist/tools/buildsystem_sanity_check/check.sh

  Log Message:
  -----------
  makefiles: Reject `shell which` in new code

... as that command is deprecated at least on Debian, and a good
replacement is available in the form of `command -v`.


  Commit: 1c6b675d9f7687bb78cc79b72d8673b195de5d06
      https://github.com/RIOT-OS/RIOT/commit/1c6b675d9f7687bb78cc79b72d8673b195de5d06
  Author: chrysn <chrysn at fsfe.org>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M dist/tools/buildsystem_sanity_check/check.sh

  Log Message:
  -----------
  makefiles: Reject `2>&1 > /dev/null`

While this could theoretically be desired, it's usually just a mishap.
It is unlikely that legitimate cases will be needed in the build system;
if so, they can exclude themselves.

See-Also: https://github.com/RIOT-OS/RIOT/pull/16775


  Commit: 8664eb8ffcfac544ea2aa5aa0e7259ba8239c952
      https://github.com/RIOT-OS/RIOT/commit/8664eb8ffcfac544ea2aa5aa0e7259ba8239c952
  Author: chrysn <chrysn at fsfe.org>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M .github/workflows/release-test.yml

  Log Message:
  -----------
  github workflows: Stick with `which` instead of `command -v`

... because even though it looks like a subshell, it apparently is not
evaluated through a shell but passed right into exec.


  Commit: d4ed42ad8f9049b99824122b8cdf530bff287edd
      https://github.com/RIOT-OS/RIOT/commit/d4ed42ad8f9049b99824122b8cdf530bff287edd
  Author: chrysn <chrysn at fsfe.org>
  Date:   2021-09-03 (Fri, 03 Sep 2021)

  Changed paths:
    M Makefile.include
    M dist/testbed-support/makefile.iotlab.single.inc.mk
    M dist/tools/buildsystem_sanity_check/check.sh
    M dist/tools/openvisualizer/makefile.openvisualizer.inc.mk
    M makefiles/arch/riscv.inc.mk
    M makefiles/boards/sam0.inc.mk
    M pkg/flatbuffers/Makefile.include

  Log Message:
  -----------
  Merge pull request #16776 from chrysn-pull-requests/shell-make-fixes-2

Remove `which` from shell invocations


Compare: https://github.com/RIOT-OS/RIOT/compare/2bf1202fb981...d4ed42ad8f90


More information about the commits mailing list