[PATCH v2] devtools: fix SPDX tag check
Marat Khalili
marat.khalili at huawei.com
Thu Apr 30 15:30:50 CEST 2026
> diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh
> index 2390941c74..41fc1fe01d 100755
> --- a/devtools/check-spdx-tag.sh
> +++ b/devtools/check-spdx-tag.sh
> @@ -39,10 +39,8 @@ check_spdx() {
> fi
>
> files_without_spdx=$(cat $tmpfile)
> - git grep -LE '(/\*|#|;|\.\.) *SPDX-License-Identifier: [A-Z(]' -- $no_license_list > $tmpfile
> - for file in $files_without_spdx ; do
> - sed -i "/^$file$/d" $tmpfile
> - done
> + git grep -LE '(/\*|#|;|\.\.) *SPDX-License-Identifier: [A-Z(]' -- $no_license_list |
> + grep -vF "$files_without_spdx" > $tmpfile
>
> warnings=$(($warnings + $(wc -l < $tmpfile)))
> $quiet || cat $tmpfile
> --
> 2.53.0
Sorry for forgetting to mention it right away, some kind of sentinel or if
condition is needed if $files_without_spdx can be empty, don't know how
realistic it is in practice and whether other parts are ready to handle this
case. E.g. `files_without_spdx=$(echo //sentinel; cat $tmpfile)`. I hope it
won't make the whole thing too complicated and not worth it.
Otherwise,
Acked-by: Marat Khalili <marat.khalili at huawei.com>
More information about the stable
mailing list