Skip to content

Commit 0ac84d7

Browse files
authored
docs: migrate to v8.0.0 (#684)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 96386cc commit 0ac84d7

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ If you're looking for a CycloneDX tool to run to generate (SBOM) software bill-o
4747
contributing
4848
support
4949
changelog
50+
upgrading

docs/upgrading.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Upgrading to v8
2+
===============
3+
4+
Version 8 is not backwards compatible. Some behaviours and integrations changed.
5+
This document covers all breaking changes and should give guidance how to migrate from previous versions.
6+
7+
This document is not a full :doc:`change log <changelog>`, but a migration path.
8+
9+
Add this library to Metadata Tools
10+
----------------------------------
11+
12+
This library no longer adds itself to the metadata.
13+
14+
Downstream users SHOULD add the following to their BOM build processes,
15+
to keep track of used libraries during the build process.
16+
17+
.. code-block:: python
18+
19+
from cyclonedx.builder.this import this_component as cdx_lib_component
20+
from cyclonedx.model.bom import Bom
21+
22+
bom = Bom()
23+
bom.metadata.tools.components.add(cdx_lib_component())
24+
25+
Import model Tool
26+
-----------------
27+
28+
Class `cyclonedx.model.Tool` was moved to :class:`cyclonedx.model.tool.Tool`.
29+
Therefore, the imports need to be migrated:
30+
31+
Old: ``from cyclonedx.model import Tool``
32+
33+
New: ``from cyclonedx.model.tool import Tool``
34+
35+
Alter Metadata Tools
36+
--------------------
37+
38+
Property :attr:`cyclonedx.model.bom.BomMetaData.tools` is an instance of :class:`cyclonedx.model.tool.ToolsRepository`, now.
39+
Therefore, the process of adding new tools needs to be migrated changed.
40+
41+
Old: ``my_bom.metadata.tools.add(my_tool)``
42+
43+
New: ``my_bom.metadata.tools.tools.add(my_tool)``
44+
45+
Alter Vulnerability Tools
46+
-------------------------
47+
48+
Property :attr:`cyclonedx.model.vulnerability.Vulnerability.tools` is an instance of :class:`cyclonedx.model.tool.ToolsRepository`, now.
49+
Therefore, the process of adding new tools needs to be migrated changed.
50+
51+
Old: ``my_vulnerability.tools.add(my_tool)``
52+
53+
New: ``my_vulnerability.tools.tools.add(my_tool)``
54+
55+
Set LicenseExpression Acknowledgement
56+
-------------------------------------
57+
58+
:class:`cyclonedx.model.license.LicenseExpression()` no longer accepts optional arguments in a positional way, but in a key-word way.
59+
60+
Old: ``LicenseExpression(my_exp, my_acknowledgement)``
61+
62+
New: ``LicenseExpression(my_exp, acknowledgement=my_acknowledgement)``

examples/complex_serialize.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from packageurl import PackageURL
2222

23+
from cyclonedx.builder.this import this_component as cdx_lib_component
2324
from cyclonedx.exception import MissingOptionalDependencyException
2425
from cyclonedx.factory.license import LicenseFactory
2526
from cyclonedx.model import XsUri
@@ -43,6 +44,8 @@
4344
# region build the BOM
4445

4546
bom = Bom()
47+
bom.metadata.tools.components.add(cdx_lib_component())
48+
4649
bom.metadata.component = root_component = Component(
4750
name='myApp',
4851
type=ComponentType.APPLICATION,

0 commit comments

Comments
 (0)