Skip to content

Commit

Permalink
dist/tools/build_system_sanity_check: add script helper functions
Browse files Browse the repository at this point in the history
Add helper functions to better handle output and errors.
  • Loading branch information
cladmi committed Jun 13, 2019
1 parent ec2278f commit ef24df7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dist/tools/buildsystem_sanity_check/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@

SCRIPT_PATH=dist/tools/buildsystem_sanity_check/check.sh


tab_indent() {
# Ident using 'bashism' to to the tab compatible with 'bsd-sed'
sed 's/^/\'$'\t/'
}

prepend() {
# 'i' needs 'i\{newline}' and a newline after for 'bsd-sed'
sed '1i\
'"$1"'
'
}

error_with_message() {
tab_indent | prepend "${1}"
}


# Modules should not check the content of FEATURES_PROVIDED/_REQUIRED/OPTIONAL
# Handling specific behaviors/dependencies should by checking the content of:
# * `USEMODULE`
Expand Down Expand Up @@ -88,6 +106,10 @@ check_not_exporting_variables() {
}


error_on_input() {
grep '' && return 1
}

main() {
local errors=''

Expand Down

0 comments on commit ef24df7

Please sign in to comment.