Skip to content

Commit f346068

Browse files
committed
Fixed license reported by openapi docs to spdx
1 parent fd31145 commit f346068

6 files changed

Lines changed: 20 additions & 3 deletions

File tree

CHANGES/+spdx-license.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use a proper spdx license identifier in the openapi docs.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Using Pulp you can:
1111
- Promote content through different repos in an organized way
1212

1313
Pulp is completely free and open-source!
14-
- License: GPLv2+
14+
- License: GPL-2.0-or-later
1515
- Documentation: https://pulpproject.org/
1616
- Source: https://github.com/pulp/pulpcore/
1717
- Bugs: https://github.com/pulp/pulpcore/issues

pulpcore/app/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@
350350
"url": "https://pulpproject.org",
351351
},
352352
"LICENSE": {
353-
"name": "GPLv2+",
354353
"url": "https://raw.githubusercontent.com/pulp/pulpcore/master/LICENSE",
354+
"name": "GNU General Public License v2.0 or later",
355+
"identifier": "GPL-2.0-or-later",
355356
},
356357
}
357358

pulpcore/openapi/hooks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ def add_info_hook(result, generator, request, **kwargs):
77
"url": "https://pulpproject.org/pulp-docs/docs/assets/pulp_logo_icon.svg"
88
}
99

10+
if result["openapi"].split(".", maxsplit=2)[:-1] == ["3", "0"]:
11+
result["info"]["license"].pop("identifier", None)
12+
else:
13+
result["info"]["license"].pop("url", None)
14+
1015
# Adding plugin version config
1116
result["info"]["x-pulp-app-versions"] = {app.label: app.version for app in request.apps}
1217

pulpcore/tests/functional/api/test_openapi_schema.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,13 @@ def test_content_in_filter_is_array(pulp_openapi_schema):
119119
else:
120120
assert False, "Couldn't find the content__in filter!"
121121
assert len(tested) == 2, "Couldn't test both the Publication and RepositoryVersion endpoints"
122+
123+
124+
@pytest.mark.parallel
125+
def test_license_version_is_valid_spdx_specifier(pulp_openapi_schema):
126+
assert (
127+
pulp_openapi_schema["info"]["license"]["name"] == "GNU General Public License v2.0 or later"
128+
)
129+
schema_version = pulp_openapi_schema["openapi"]
130+
if schema_version.startswith("3.1"):
131+
assert pulp_openapi_schema["info"]["license"]["identifier"] == "GPL-2.0-or-later"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ readme = "README.md"
1313
authors = [
1414
{name="Pulp Team", email="pulp-list@redhat.com"},
1515
]
16+
license = "GPL-2.0-or-later"
1617
classifiers=[
17-
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
1818
"Operating System :: POSIX :: Linux",
1919
"Development Status :: 5 - Production/Stable",
2020
"Framework :: Django",

0 commit comments

Comments
 (0)