Skip to content

scripts: mandate use of SPDX-License-Identifier tags in new files

Daniel P. Berrangé qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 1 replyIn review
  2. v23 patches 3 repliesSuperseded
  3. v13 patches 6 repliesSuperseded

Changes in v3 from the cover letter

* Add missing accepted license LGPL-2.1-only
* Drop LGPL-2.0-only & LGPL-2.0-or-later as acceptable
* Fix typo in commit message

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3scripts: mandate that new files have SPDX-License-Identifierscripts/checkpatch.pl+30 -00 replies
2/3scripts: validate SPDX license choicesscripts/checkpatch.pl+69 -01 reply
3/3scripts: forbid use of arbitrary SPDX tags besides license identifiersscripts/checkpatch.pl+12 -00 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchBrian CainPhilippe Mathieu-DaudéPeter Maydell
1/3R-b R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] scripts: mandate use of SPDX-License-Identifier tags in new files

One of the items raised at the QEMU maintainers meeting at KVM Forum 2024 was adoption of SPDX-License-Identifier for licensing of newly contributed source files, for which there were no dissenting voices.

Thus, this series proposes a way to put this into action by extending checkpatch.pl to mandate SPDX-License-Identifier in all new files.

Furthermore, anytime it sees SPDX-License-Identifier in any patch, whether a new file or pre-existing, it validates the declared license name. If it is not one of the commonly used QEMU licenses (the GPL variants, MIT, & a few BSD variants), it will report an error. To encourage sticking with GPL-2.0-or-later by default, it will issue a warning even if it is one of the common licenses, encouraging the contributor to double check their choice. This will reduce accidental license proliferation.

Finally, I've seen a few other random SPDX tags such as:

* SPDX-FileCopyrightText - replacing "Copyright ..."
* SPDX-FileContributor - replacing "Authors: ..."
* SPDX-URL - a link to the link license text
* SPDX-sourceInfo - arbitrary free form text about the file

These may or may not be worth considering in QEMU, but this series discourages their usage by raising an error in checkpatch for now.

If we feel we want to adopt any of these, I think it should be through a concious decision applied universally. Inconsistent & adhoc usage of other SPDX tags by a subset of contributors feels like it doesn't seem to give a clear win, and could even be a net loss through making practices inconsistent across the code.

Changed in v3:

* Add missing accepted license LGPL-2.1-only
* Drop LGPL-2.0-only & LGPL-2.0-or-later as acceptable
* Fix typo in commit message

Changed in v2:

* Tweaks to the commit messages
* Expand the message warning about non GPL-2.0-or-later usage, to request an explanation in the commit message for the unusual choice.

Daniel P. Berrangé (3):
scripts: mandate that new files have SPDX-License-Identifier
scripts: validate SPDX license choices
scripts: forbid use of arbitrary SPDX tags besides license identifiers

 scripts/checkpatch.pl | 111 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
Signature · 1 line
2.47.1