From 6bcc68b9ccf510f29fd0a1304e09adb969c16a6b Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 24 Aug 2021 15:22:42 +0200 Subject: [PATCH] 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`. --- dist/tools/buildsystem_sanity_check/check.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 99fb11f786..a7f8100ff0 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -334,6 +334,19 @@ check_no_pkg_source_local() { | error_with_message "Don't push PKG_SOURCE_LOCAL definitions upstream" } +check_shell_which() { + local patterns=() + local pathspec=() + + patterns+=(-e '(shell[[:blank:]]\+which') + + pathspec+=('Makefile*') + pathspec+=('**/Makefile*') + pathspec+=('**/*.mk') + git -C "${RIOTBASE}" grep -n "${patterns[@]}" -- "${pathspec[@]}" \ + | error_with_message "Don't use \`which\` in makefiles, use \`command -v\` instead." +} + error_on_input() { ! grep '' } @@ -353,6 +366,7 @@ all_checks() { check_no_pseudomodules_in_makefile_dep check_no_usemodules_in_makefile_include check_no_pkg_source_local + check_shell_which } main() {