From f53b148a56de44b097ff6aaf2e93532904603ed5 Mon Sep 17 00:00:00 2001 From: Christoph Ostarek Date: Mon, 9 Sep 2024 11:23:24 +0200 Subject: [PATCH] tools: spdx-check file parameter also allow to use this tool directly with a path as a parameter Signed-off-by: Christoph Ostarek --- tools/spdx-check.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/spdx-check.sh b/tools/spdx-check.sh index 9d70fc0206..7a1e55fbdd 100755 --- a/tools/spdx-check.sh +++ b/tools/spdx-check.sh @@ -3,11 +3,17 @@ # Copyright (c) 2024 Zededa, Inc. # SPDX-License-Identifier: Apache-2.0 -BASE_COMMIT=$1 IGNORE_FILE=".spdxignore" +if [ -f "$1" ]; +then + files="$1" +else + BASE_COMMIT=$1 + + # List of files to check, excluding vendor directories + files=$(git diff --name-only --diff-filter=A "${BASE_COMMIT}"..HEAD) +fi -# List of files to check, excluding vendor directories -files=$(git diff --name-only --diff-filter=A "${BASE_COMMIT}"..HEAD) # SPDX License Identifier to check for license_identifiers=(