What is the precise syntax of the // SPDX-License-Identifier: GPL-2.0-only comments in source files, and which organization, project or specification defines it? If there is no such definition, what syntax would be interoperable with the current crop of tools reading those comments?

In particular, how to determine where the SPDX license expression starts and ends -- has anyone defined a programming-language-independent rule for that?

  • 1
    SPDX has an extensive specification (spdx.org/spdx-specification-21-web-version, which covers much more than only license identifiers) and a very current list of identifiers at spdx.org/licenses. I know SPDX supports multi-license expressions but I don't know where they are in the SPDX grammar specification.
    – apsillers
    Mar 15 '20 at 0:34
  • 1
    The relevant part of that spec is Appendix V: Using SPDX short identifiers in Source Files. It just says "The tag should appear on its own line in the source file, generally as part of a comment." That sounds intentionally vague; maybe they are postponing detailed design. Nevertheless, the tags are already in the wild so there must be some convention.
    – Lassi
    Mar 15 '20 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.