[v3] devtools: add new SPDX license compliance checker
diff mbox series

Message ID 20200207175217.14974-1-stephen@networkplumber.org
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • [v3] devtools: add new SPDX license compliance checker
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 7, 2020, 5:52 p.m. UTC
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

Thomas Monjalon Feb. 22, 2020, 3:43 p.m. UTC | #1
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.
Thomas Monjalon Feb. 22, 2020, 3:45 p.m. UTC | #2
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).

Patch
diff mbox series

diff --git a/devtools/spdx-check.sh b/devtools/spdx-check.sh
new file mode 100755
index 000000000000..a5be10b26f44
--- /dev/null
+++ b/devtools/spdx-check.sh
@@ -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'