[v3] devtools: add new SPDX license compliance checker
Checks
Commit Message
Simple script to look for drivers and scripts that
are missing requires SPDX header.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v3 - pickup more places with boilerplate text
avoid false positive for cocci scripts or abignore
devtools/spdx-check.sh | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100755 devtools/spdx-check.sh
Comments
07/02/2020 18:52, Stephen Hemminger:
> Simple script to look for drivers and scripts that
> are missing requires SPDX header.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> devtools/spdx-check.sh | 24 ++++++++++++++++++++++++
For consistency with other scripts, it should be named check-spdx.sh
Please add the new file in MAINTAINERS file in the section
"Developers and Maintainers Tools".
I think it should be mentioned also in the contributors guide.
> --- /dev/null
> +++ b/devtools/spdx-check.sh
> @@ -0,0 +1,24 @@
> +#! /bin/sh
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright (c) 2019 Microsoft Corporation
While talking about license, are you sure the (c) is required?
> +#
> +# Produce a list of files with incorrect license
> +# information
In order to add this script in a CI, it should return an error code.
Based on the error code, the CI can report it as success, warning or failure
to patchwork.
> +
> +echo "Files without SPDX License"
> +echo "--------------------------"
> +
> +git grep -L SPDX-License-Identifier -- \
> + ':^.git*' ':^.ci/*' ':^.travis.yml' \
> + ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \
> + ':^*/Kbuild' ':^*/README' \
> + ':^license/' ':^doc/' ':^config/' ':^buildtools/' \
> + ':^*.cocci' ':^*.abignore' \
> + ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt'
This should be considered a critical error.
> +
> +echo
> +echo "Files with additional license text"
> +echo "----------------------------------"
> +
> +git grep -l Redistribution -- \
> + ':^license/' ':^/devtools/spdx-check.sh'
This should be considered as a warning.
07/02/2020 18:52, Stephen Hemminger:
> Simple script to look for drivers and scripts that
> are missing requires SPDX header.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[...]
> +git grep -L SPDX-License-Identifier -- \
> + ':^.git*' ':^.ci/*' ':^.travis.yml' \
> + ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \
> + ':^*/Kbuild' ':^*/README' \
> + ':^license/' ':^doc/' ':^config/' ':^buildtools/' \
> + ':^*.cocci' ':^*.abignore' \
> + ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt'
I think we should plan to add SPDX tag to the doc (rst and svg files).
new file mode 100755
@@ -0,0 +1,24 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2019 Microsoft Corporation
+#
+# Produce a list of files with incorrect license
+# information
+
+echo "Files without SPDX License"
+echo "--------------------------"
+
+git grep -L SPDX-License-Identifier -- \
+ ':^.git*' ':^.ci/*' ':^.travis.yml' \
+ ':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \
+ ':^*/Kbuild' ':^*/README' \
+ ':^license/' ':^doc/' ':^config/' ':^buildtools/' \
+ ':^*.cocci' ':^*.abignore' \
+ ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt'
+
+echo
+echo "Files with additional license text"
+echo "----------------------------------"
+
+git grep -l Redistribution -- \
+ ':^license/' ':^/devtools/spdx-check.sh'