Skip to content

Commit b7bb1c9

Browse files
committed
west: spdx: allow to generate for different SPDX versions
When support for SPDX 2.3 was added, it effectively dropped support for SPDX 2.2, which in retrospect was a bad idea since SPDX 2.2 is the version that is the current ISO/IEC standard. This commit adds a `--spdx-version` option to the `west spdx` command so that users can generate SPDX 2.2 documents if they want. Default is 2.3 given that's effectively what shipped for a few releases now, including latest LTS. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent af53eee commit b7bb1c9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/develop/west/zephyr-cmds.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ See :zephyr_file:`share/zephyr-package/cmake` for details.
7575
Software bill of materials: ``west spdx``
7676
*****************************************
7777

78-
This command generates SPDX 2.3 tag-value documents, creating relationships
78+
This command generates SPDX 2.2 or 2.3 tag-value documents, creating relationships
7979
from source files to the corresponding generated build files.
8080
``SPDX-License-Identifier`` comments in source files are scanned and filled
8181
into the SPDX documents.
@@ -105,6 +105,12 @@ To use this command:
105105
106106
west spdx -d BUILD_DIR
107107
108+
By default, this generates SPDX 2.3 documents. To generate SPDX 2.2 documents instead:
109+
110+
.. code-block:: bash
111+
112+
west spdx -d BUILD_DIR --spdx-version 2.2
113+
108114
.. note::
109115

110116
When building with :ref:`sysbuild`, make sure you target the actual application
@@ -144,6 +150,10 @@ source files that are compiled to generate the built library files.
144150
- ``-s SPDX_DIR``: specifies an alternate directory where the SPDX documents
145151
should be written instead of :file:`BUILD_DIR/spdx/`.
146152

153+
- ``--spdx-version {2.2,2.3}``: specifies which SPDX specification version to use.
154+
Defaults to ``2.3``. SPDX 2.3 includes additional fields like ``PrimaryPackagePurpose``
155+
that are not available in SPDX 2.2.
156+
147157
- ``--analyze-includes``: in addition to recording the compiled source code
148158
files (e.g. ``.c``, ``.S``) in the bills-of-materials, also attempt to
149159
determine the specific header files that are included for each ``.c`` file.

0 commit comments

Comments
 (0)