|
| 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)`` |
0 commit comments