From a0f2e428799b306f8e2f969f839b9fc1fd3ebbdb Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 28 Jun 2025 10:24:45 -0600 Subject: [PATCH] util/lint: Improve final newline check - Change .inc to .mk. This was missed when renaming the makefiles. - Verify that dirs/files exist before checking. - Use $FINDOPTS to control search when not in a git repo. Change-Id: If0d80403a3e799b8103164cc075601a50c33a8d9 Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/c/coreboot/+/88238 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- util/lint/lint-extended-015-final-newlines | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/util/lint/lint-extended-015-final-newlines b/util/lint/lint-extended-015-final-newlines index 7324213034..e67943e133 100755 --- a/util/lint/lint-extended-015-final-newlines +++ b/util/lint/lint-extended-015-final-newlines @@ -13,7 +13,7 @@ LINTDIR="$( . "${LINTDIR}/helper_functions.sh" PIDS="" -INCLUDED_DIRS_AND_FILES='util/* src/* payloads/* configs/* Makefile *.inc' +INCLUDED_DIRS_AND_FILES='util/* src/* payloads/* configs/* Makefile *.mk' EXCLUDED_DIRS="\ src/vendorcode/\|\ cbfstool/lzma/\|\ @@ -64,12 +64,14 @@ test_for_final_newline() { done } -for directory in $INCLUDED_DIRS_AND_FILES ; do - ${FIND_FILES} "${directory}" | sed 's|^\./||' | sort | \ - grep -v "$EXCLUDED_DIRS" | \ - grep -v "$EXCLUDED_FILES" | \ - test_for_final_newline & - PIDS="$PIDS $!" +for dir_or_file in $INCLUDED_DIRS_AND_FILES; do + if [ -e "${dir_or_file}" ] || [ -d "${dir_or_file}" ]; then + ${FIND_FILES} "${dir_or_file}" ${FINDOPTS} | sed 's|^\./||' | sort | \ + grep -v "$EXCLUDED_DIRS" | \ + grep -v "$EXCLUDED_FILES" | \ + test_for_final_newline & + PIDS="$PIDS $!" + fi done # wait for tests to finish.