devtools: add spdx license check tool
RFC 1/1 devtools: add spdx license check tool
This is a simple script to print files that have missing SPDX license tag and list of files with redundant boilerplate.
--- devtools/spdx-check.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 devtools/spdx-check.sh
devtools/spdx-check.sh new file +19 -0
@@ -0,0 +1,19 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2019 Microsoft Corporation +# +# Produce a list of files without SPDX license identifiers + +echo "Files without SPDX License" +echo "--------------------------" + +git grep -L SPDX-License-Identifier | \ + grep -v '^\.' |grep -v '^license/' |\ + grep -v '\.map$' | grep -v '\.png$' | grep -v '\.svg$' + +echo +echo "Files with redundant BSD boilerplate" +echo "------------------------------------" + +git grep -l SPDX-License-Identifier | \ + xargs grep -l 'Redistribution and use'
Signature · 1 line
2.20.1
PATCH 1/1 devtools: add SPDX license tag check script
Simple script to look for missing SPDX license tags with exceptions for certain directories and file types.
--- devtools/spdx-check.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 devtools/spdx-check.sh
devtools/spdx-check.sh new file +22 -0
@@ -0,0 +1,22 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2019 Microsoft Corporation +# +# Produce a list of files without SPDX license identifiers + +echo "Files without SPDX License" +echo "--------------------------" + +git grep -L SPDX-License-Identifier -- \ + ':^.git*' ':^.ci/*' ':^.travis.yml' \ + ':^README' ':^MAINTAINERS' ':^VERSION' \ + ':^*/Kbuild' ':^*/README' \ + ':^license/' ':^doc/' ':^config/' ':^buildtools/' \ + ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt' + +echo +echo "Files with redundant BSD boilerplate" +echo "------------------------------------" + +git grep -l SPDX-License-Identifier | \ + xargs grep -l 'Redistribution'
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH] devtools: add SPDX license tag check script
Re: [dpdk-dev] [PATCH] devtools: add SPDX license tag check script
In reply to Stephen HemmingerHI Stephen,
Will you please enhance it to also provide number of files in each category?
We also need to think about how to handle the scripts "*.sh", as many of these are without SPDX.
- we can either leave them as it is.
Or , we can put the SPDX header without a copyright?
Regards,
Hemant
Quoted 44 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Friday, November 8, 2019 10:54 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>
Subject: [dpdk-dev] [PATCH] devtools: add SPDX license tag check scriptSimple script to look for missing SPDX license tags with exceptions for certain directories and file types.
Signed-off-by Stephen Hemminger <[email protected]>--- devtools/spdx-check.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 devtools/spdx-check.shdevtools/spdx-check.sh new file mode renamed from devtools/spdx-check.sh +0
-0100755 index 000000000000..4427398411f6
devtools/spdx-check.sh new file +21
-1@@ -0,0 +1,22 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2019 Microsoft +Corporation # # Produce a list of files without SPDX license +identifiers + +echo "Files without SPDX License" +echo "--------------------------" + +git grep -L SPDX-License-Identifier -- \ + ':^.git*' ':^.ci/*' ':^.travis.yml' \ + ':^README' ':^MAINTAINERS' ':^VERSION' \ + ':^*/Kbuild' ':^*/README' \ + ':^license/' ':^doc/' ':^config/' ':^buildtools/' \ + ':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt' + +echo +echo "Files with redundant BSD boilerplate" +echo "------------------------------------" + +git grep -l SPDX-License-Identifier | \ + xargs grep -l 'Redistribution' --2.20.1
Re: [dpdk-dev] [PATCH] devtools: add SPDX license tag check script
Quoted 2 lines · On Wed, 13 Nov 2019 06:59:48 +0000 Hemant Agrawal <[email protected]>…
HI Stephen,
Will you please enhance it to also provide number of files in each category?
The number of files is shrinking to zero, so may not be necessary soon.
Quoted 7 lines
We also need to think about how to handle the scripts "*.sh", as many of these are without SPDX.
- we can either leave them as it is.
Or , we can put the SPDX header without a copyright?Regards,
Hemant
Patches are outstanding for all the .sh files.
There are precedents for files without Copyright that have SPDX tag.
Re: [dpdk-dev] [PATCH] devtools: add SPDX license tag check script
In reply to Hemant AgrawalQuoted 9 lines · On Wed, 13 Nov 2019 06:59:48 +0000 Hemant Agrawal <[email protected]>…
HI Stephen,
Will you please enhance it to also provide number of files in each category?We also need to think about how to handle the scripts "*.sh", as many of these are without SPDX.
- we can either leave them as it is.
Or , we can put the SPDX header without a copyright?Regards,
Hemant
The shell files are covered and only a 3 files had missing headers. Patches are in patchwork for these.
The copyright is better if present, but without it we can infer the copyright from the original author in git.
The goal is to get this to 0, so that they output is nothing... Then add it to CI.