Skip to content

Commit f476138

Browse files
authored
Merge pull request #591 from Nikokrock/add_valid_xref
Add list of valid SPDX ref types when category is not OTHER.
2 parents 9d992d7 + 9f6c47c commit f476138

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/e3/spdx.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,30 @@ class ExternalRefCategory(Enum):
420420
other = "OTHER"
421421

422422

423+
# Create some constants to make writing easier
424+
SECURITY = ExternalRefCategory.security
425+
PACKAGE_MANAGER = ExternalRefCategory.package_manager
426+
PERSISTENT_ID = ExternalRefCategory.persistent_id
427+
OTHER = ExternalRefCategory.other
428+
429+
# List of valid external reference types when Category is not OTHER
430+
SPDX_EXTERNAL_REF_TYPES = (
431+
(SECURITY, "cpe22Type"),
432+
(SECURITY, "cpe23Type"),
433+
(SECURITY, "advisory"),
434+
(SECURITY, "fix"),
435+
(SECURITY, "url"),
436+
(SECURITY, "swid"),
437+
(PACKAGE_MANAGER, "maven-central"),
438+
(PACKAGE_MANAGER, "npm"),
439+
(PACKAGE_MANAGER, "nuget"),
440+
(PACKAGE_MANAGER, "bower"),
441+
(PACKAGE_MANAGER, "purl"),
442+
(PERSISTENT_ID, "swh"),
443+
(PERSISTENT_ID, "gitoid"),
444+
)
445+
446+
423447
class ExternalRef(SPDXEntry):
424448
"""Reference an external source of information relevant to the package.
425449

0 commit comments

Comments
 (0)