Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contrib][linux-kernel] Generate SPDX license identifiers #3294

Merged
merged 1 commit into from
Oct 18, 2022
Merged

[contrib][linux-kernel] Generate SPDX license identifiers #3294

merged 1 commit into from
Oct 18, 2022

Conversation

ojeda
Copy link
Contributor

@ojeda ojeda commented Oct 18, 2022

Add a --spdx option to the freestanding script (and use it from the linux-kernel Makefile) to prefix files with a line like (for .c files):

// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

or (for .h and .S files):

/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */

Given the style of the line to be used depends on the extension, a simple sed insert command would not work.

It also skips the file if an existing SPDX line is there, as well as raising an error if an unexpected SPDX-License-Identifier string appears anywhere else in the file, as well as for unexpected file extensions.

I double-checked that all currently generated files appear to be licensed as expected with:

grep -LRF 'This source code is licensed under both the BSD-style license (found in the'  linux/lib/zstd
grep -LRF 'LICENSE file in the root directory of this source tree) and the GPLv2 (found' linux/lib/zstd

but somebody knowledgeable on the licensing of the project should double-check this is the intended case.

Fixes: #3293
Signed-off-by: Miguel Ojeda ojeda@kernel.org

Add a `--spdx` option to the freestanding script to prefix
files with a line like (for `.c` files):

    // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

or (for `.h` and `.S` files):

    /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */

Given the style of the line to be used depends on the extension,
a simple `sed` insert command would not work.

It also skips the file if an existing SPDX line is there,
as well as raising an error if an unexpected SPDX line appears
anywhere else in the file, as well as for unexpected
file extensions.

I double-checked that all currently generated files appear
to be license as expected with:

    grep -LRF 'This source code is licensed under both the BSD-style license (found in the'  linux/lib/zstd
    grep -LRF 'LICENSE file in the root directory of this source tree) and the GPLv2 (found' linux/lib/zstd

but somebody knowledgable on the licensing of the project should
double-check this is the intended case.

Fixes: #3293
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
@terrelln
Copy link
Contributor

Yeah, all of our files share the same license. We have a test to make sure that they all have the a consistent copyright + license.

This looks great! Thanks for the PR @ojeda! I will back port it to the changes I'm making on top of the v1.5.2 release for the next kernel update.

@terrelln terrelln merged commit 5c1cdba into facebook:dev Oct 18, 2022
@ojeda ojeda deleted the spdx branch October 18, 2022 23:40
@ojeda
Copy link
Contributor Author

ojeda commented Oct 18, 2022

Yeah, all of our files share the same license. We have a test to make sure that they all have the a consistent copyright + license.

That is a nice test to have indeed.

This looks great! Thanks for the PR @ojeda! I will back port it to the changes I'm making on top of the v1.5.2 release for the next kernel update.

My pleasure! After I sent you that email, I thought I could give it a go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linux kernel: generate SPDX license identifiers
2 participants