You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/07/29 10:52:16 UTC
(tooling-trusted-releases) 01/01: #1463 - add public domain to license handling
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit ec764fe435ee050c11b2354c232f71bc48c3f5c1
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Jul 29 11:51:52 2026 +0100
#1463 - add public domain to license handling
---
atr/sbom/constants/licenses.py | 2 ++
tests/unit/test_sbom_licenses.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/atr/sbom/constants/licenses.py b/atr/sbom/constants/licenses.py
index 7ce34b19..d580dcfb 100644
--- a/atr/sbom/constants/licenses.py
+++ b/atr/sbom/constants/licenses.py
@@ -50,6 +50,7 @@ LICENSES: Final[dict[str, list[str]]] = {
"LicenseRef-MX4J",
"LicenseRef-Open-Grid-Forum",
"LicenseRef-PIL",
+ "LicenseRef-Public-Domain",
"LicenseRef-Romantic-WTFPL",
"LicenseRef-SCA-Spec",
"LicenseRef-W3C-CCLA",
@@ -208,6 +209,7 @@ LICENSE_NAMES: Final[dict[str, str]] = {
"LGPL-3.0-only": "GNU Lesser General Public License v3.0 only",
"LGPL-3.0-or-later": "GNU Lesser General Public License v3.0 or later",
"Libpng": "libpng License",
+ "LicenseRef-Public-Domain": "Public Domain",
"MIT": "MIT License",
"MIT-0": "MIT No Attribution",
"MPL-1.0": "Mozilla Public License 1.0",
diff --git a/tests/unit/test_sbom_licenses.py b/tests/unit/test_sbom_licenses.py
index bb83d2a9..8b96dc73 100644
--- a/tests/unit/test_sbom_licenses.py
+++ b/tests/unit/test_sbom_licenses.py
@@ -79,6 +79,24 @@ def test_check_categorises_a_licence_named_in_full() -> None:
assert errors == []
+def test_check_categorises_a_public_domain_declaration_as_category_a() -> None:
+ # ASF policy lets us include works in the public domain, and components declaring one tend to
+ # name it rather than reach for an SPDX identifier
+ good, warnings, errors = licenses.check(
+ sboms.with_components(
+ {"type": "library", "name": "named", "licenses": [{"license": {"name": "Public Domain"}}]},
+ {"type": "library", "name": "hyphenated", "licenses": [{"license": {"name": "public-domain"}}]},
+ {"type": "library", "name": "definite", "licenses": [{"license": {"name": "The Public Domain"}}]},
+ {"type": "library", "name": "dedicated", "licenses": [{"license": {"id": "CC0-1.0"}}]},
+ ),
+ include_all=True,
+ )
+
+ assert sorted(issue.component_name for issue in good) == ["dedicated", "definite", "hyphenated", "named"]
+ assert warnings == []
+ assert errors == []
+
+
def test_check_a_disjunction_settles_on_the_friendliest_category() -> None:
# A component offered under "A OR B" may be taken under whichever half is easier to live with
good, warnings, errors = licenses.check(
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org