debian-forge/test/mod
Tomáš Hozza a3428e282d sbom/spdx: use compliant license expressions
Introduce a new class `SpdxLicenseExpressionCreator`, responsible for
converting license texts extracted from packages, into an SPDX-compliant
license expressions. If the `license_expression` Python package is
available on the system, it is used to determine the license text
extracted from a package is a valid SPDX license expression. If it is,
it's returned as is back to the caller. If it is not, or of the package
is not available on the system, the license text is wrapped in a
`ExtractedLicensingInfo` instance.

The `SpdxLicenseExpressionCreator` object keeps track of all generated
`ExtractedLicensingInfo` instances and de-duplicates them based on the
license text. This means that if two packages use the same
SPDX-non-compliant license text, they will be wrapped by an
`ExtractedLicensingInfo` instance with the same `LicenseRef-` ID.

The reason for fallback when `license_expression` package is not
available is that it is not available on RHEL and CentOS Stream. This
implementation allows us to ship the functionality in RHEL and
optionally enabling it by installing `license_expression` from a 3rd
party repository. In any case, the generated SBOM document will always
contain valid SPDX license expressions.

Extend unit tests to cover the newly added functionality.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>

FIXUP: sbom/spdx: use compliant license expressions

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-27 13:31:19 +01:00
..
__init__.py test: '{. -> ./mod}/test_util_selinux.py' 2020-04-24 15:50:44 +02:00
test_api.py pipeline,api: write metadata directly 2022-12-09 12:03:40 +01:00
test_buildroot.py Test/buildroot: fix checking /var/tmp mode 2024-05-16 09:58:38 +02:00
test_fmt_v1.py test: fix autopep8 issues 2024-01-02 19:31:31 +01:00
test_fmt_v2.py test: metadata in describe 2024-10-29 08:24:33 +01:00
test_host.py host: add support for emitting signals 2022-02-22 10:38:43 +01:00
test_inputs.py jsoncomm: transparently handle huge messages via fds 2024-09-17 19:27:03 +02:00
test_loop.py Revert "osbuild: ensure loop.Loop() has the required device node" 2024-03-13 22:16:51 +02:00
test_meta.py Fix pylint issue E0606: possibly-used-before-assignment 2024-11-25 10:09:18 +01:00
test_mixins.py osbuild: error when {Device,Mount} is modified after creation 2024-01-19 02:54:26 +01:00
test_monitor.py monitor: limit the amount of data sent in JSONSeqMontior.result() 2025-02-18 10:36:59 +01:00
test_mounts.py test: fix isort issues 2024-01-02 19:31:31 +01:00
test_objectstore.py test: fix all pylint issues 2024-01-02 19:31:31 +01:00
test_osbuild.py test: Skip check_moduleinfo for unsupported versions 2025-01-14 08:19:16 +01:00
test_testutil_dnf4.py testutil: add helper function for depsolving pkgset with DNF4 2024-09-18 12:26:36 +02:00
test_testutil_dnf5.py Testutil: add DNF5 helper function for depsolving 2024-12-02 23:24:39 +01:00
test_testutil_fake_tree.py testutil: extrace new make_fake_tree() helper 2024-01-03 11:25:48 -08:00
test_testutil_imports.py test: fix isort issues 2024-01-02 19:31:31 +01:00
test_testutil_jsonschema.py test: add new testutil.assert_jsonschema_error_contains() helper 2024-01-23 12:00:59 +01:00
test_testutil_make_container.py testutil: fix make_container() cleanup 2024-04-25 21:59:40 +02:00
test_testutil_mock_command.py testutil: tweak mock_command to write a call_log 2024-03-18 20:37:21 +01:00
test_testutil_net.py test: regenerate X509 test certs 2024-11-22 10:15:50 +01:00
test_util_bls.py util: tweak bls.options_append() support no/multiple options 2024-02-28 10:37:01 +01:00
test_util_checksum.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_chroot.py test: add integration test for Chroot.run() 2024-10-24 10:06:46 +02:00
test_util_ctx.py util/ctx: extract suppress_oserror() 2020-05-11 18:05:12 +02:00
test_util_fscache.py fscache: use remove_lru() to reclaim space when the cache is full 2024-02-06 17:16:48 +01:00
test_util_fscache_coherency.py test: fix autopep8 issues 2024-01-02 19:31:31 +01:00
test_util_jsoncomm.py jsoncomm: transparently handle huge messages via fds 2024-09-17 19:27:03 +02:00
test_util_linux.py uktil: add libc.memfd_create() wrapper 2024-09-17 19:27:03 +02:00
test_util_lorax.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
test_util_lvm2.py autopep8: Update with changes to make autopep8 -a -a -a happy 2023-08-10 13:04:14 +02:00
test_util_mnt.py test: tweak test_osbuild_mount_failure_msg() for tmt/fc40 2024-05-23 14:56:41 +02:00
test_util_osrelease.py util,test: add test for new shlex based os-release parsing 2024-12-04 14:54:00 -05:00
test_util_ostree.py ostree: add convenience function for using default OSTree deployment 2024-02-07 18:50:38 -05:00
test_util_parsing.py parsing: treat locations without scheme as belonging to 'tree://' 2024-11-14 17:49:26 +01:00
test_util_path.py test_util_path: extend test coverage of join_abs() 2025-01-06 11:53:46 -08:00
test_util_pe32p.py util: add module to parse PE32+ files 2022-11-14 20:10:59 +01:00
test_util_rhsm.py global: fix PEP-8 formatting 2022-08-05 09:41:05 +02:00
test_util_rmrf.py test: convert to shared helpers 2020-05-13 14:26:05 +02:00
test_util_sbom_dnf.py test_util_sbom_dnf: fix imported module name 2024-12-02 23:24:39 +01:00
test_util_sbom_dnf5.py util/sbom: add support for DNF5 2024-12-02 23:24:39 +01:00
test_util_sbom_model.py Add initial SBOM library implementation 2024-09-18 12:26:36 +02:00
test_util_sbom_spdx.py sbom/spdx: use compliant license expressions 2025-02-27 13:31:19 +01:00
test_util_sbom_spdx2_model.py sbom/spdx2/model: support ExtractedLicensingInfo 2025-02-27 13:31:19 +01:00
test_util_selinux.py osbuild: add support to exclude_paths to setfiles() 2024-03-20 18:05:51 +01:00
test_util_toml.py test: add read/write tests for util.toml 2024-08-21 19:26:31 +02:00
test_util_udev.py devices: add custom udev rule inhibitor mechanism 2021-12-09 00:44:21 +00:00