qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts: Add exception to license check
@ 2025-04-23 18:37 Nabih Estefan
  2025-04-24  8:38 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: Nabih Estefan @ 2025-04-23 18:37 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, philmd, mjt, berrange, thuth, alex.bennee,
	peter.maydell, Nabih Estefan

The documentation for trace events says that every subdirectory which
has trace events should have a trace.h header, whose only content is
an include of the trace/trace-<subdir>.h file.

Due to that, we should skip it in the checkpatch license check.
I'm adding it as an exception to the check instead of its own if so it
still throws the warning on all new files instead of ignoring it.

Change-Id: Ic2dae14f8cded0dd02d5b231588bd38d8a00e40d
Signed-off-by: Nabih Estefan <nabihestefan@google.com>
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 365892de04..b2c6ac2477 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1685,7 +1685,9 @@ sub process {
 		if ($line =~ /^new file mode\s*\d+\s*$/) {
 		    if ($expect_spdx) {
 			if ($expect_spdx_file =~
-			    /\.(c|h|py|pl|sh|json|inc|Makefile)$/) {
+			    /\.(c|h|py|pl|sh|json|inc|Makefile)$/
+				and not $expect_spdx_file =~ /(trace\.h)$/) {
+				# Files to include auto-generated files don't require a license
 			    # source code files MUST have SPDX license declared
 			    ERROR("New file '$expect_spdx_file' requires " .
 				  "'SPDX-License-Identifier'");
-- 
2.49.0.805.g082f7c87e0-goog



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts: Add exception to license check
  2025-04-23 18:37 [PATCH] scripts: Add exception to license check Nabih Estefan
@ 2025-04-24  8:38 ` Daniel P. Berrangé
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2025-04-24  8:38 UTC (permalink / raw)
  To: Nabih Estefan
  Cc: qemu-devel, qemu-arm, philmd, mjt, thuth, alex.bennee,
	peter.maydell

On Wed, Apr 23, 2025 at 06:37:27PM +0000, Nabih Estefan wrote:
> The documentation for trace events says that every subdirectory which
> has trace events should have a trace.h header, whose only content is
> an include of the trace/trace-<subdir>.h file.

Historically we have not bothered to add the license header to the trace.h
files, primarily because its size would dwarf the actual content, and
secondly because. the content can probably be sad to be not copyrightable.

With SPDX-License-Identifier being so concise though, the main reason for
omitting it goes away. So my feeling is that we should not exempt the
trace.h files, and stick with our default rule that *ALL* source files
must have SPDX-License-Identifier.

> Due to that, we should skip it in the checkpatch license check.
> I'm adding it as an exception to the check instead of its own if so it
> still throws the warning on all new files instead of ignoring it.
> 
> Change-Id: Ic2dae14f8cded0dd02d5b231588bd38d8a00e40d
> Signed-off-by: Nabih Estefan <nabihestefan@google.com>
> ---
>  scripts/checkpatch.pl | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 365892de04..b2c6ac2477 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1685,7 +1685,9 @@ sub process {
>  		if ($line =~ /^new file mode\s*\d+\s*$/) {
>  		    if ($expect_spdx) {
>  			if ($expect_spdx_file =~
> -			    /\.(c|h|py|pl|sh|json|inc|Makefile)$/) {
> +			    /\.(c|h|py|pl|sh|json|inc|Makefile)$/
> +				and not $expect_spdx_file =~ /(trace\.h)$/) {
> +				# Files to include auto-generated files don't require a license
>  			    # source code files MUST have SPDX license declared
>  			    ERROR("New file '$expect_spdx_file' requires " .
>  				  "'SPDX-License-Identifier'");
> -- 
> 2.49.0.805.g082f7c87e0-goog
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-24  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 18:37 [PATCH] scripts: Add exception to license check Nabih Estefan
2025-04-24  8:38 ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).