diff --git a/metadata/fields/custom/license.py b/metadata/fields/custom/license.py index bd3e2d131..bf1e161fd 100644 --- a/metadata/fields/custom/license.py +++ b/metadata/fields/custom/license.py @@ -18,7 +18,7 @@ sys.path.insert(0, _ROOT_DIR) import metadata.fields.field_types as field_types import metadata.fields.util as util import metadata.validation_result as vr -from metadata.fields.custom.license_allowlist import ALLOWED_SPDX_LICENSES +from metadata.fields.custom.license_allowlist import ALLOWED_LICENSES def process_license_value(value: str, @@ -57,7 +57,7 @@ def is_license_allowlisted(value: str) -> bool: """Returns whether the value is in the allowlist for license types. """ - return value in ALLOWED_SPDX_LICENSES + return value in ALLOWED_LICENSES class LicenseField(field_types.SingleLineTextField): diff --git a/metadata/fields/custom/license_allowlist.py b/metadata/fields/custom/license_allowlist.py index 0a43995ed..4fb6e1a1e 100644 --- a/metadata/fields/custom/license_allowlist.py +++ b/metadata/fields/custom/license_allowlist.py @@ -65,3 +65,48 @@ ALLOWED_SPDX_LICENSES = frozenset([ "MPL-1.1", "MPL-2.0", ]) + +# These are licenses that are not in the SPDX license list, but are identified +# by the license classifier. +EXTENDED_LICENSE_CLASSIFIERS = frozenset([ + # unencumbered. + "AhemFont", + "Android-SDK", + "LZMA", + "SPL-SQRT-FLOOR", + "public-domain-md5", + # permissive. + "LicenseRef-AMSFonts-2.2", + "test_fonts", + # notice. + "Apache-with-LLVM-Exception", + "Apache-with-Runtime-Exception", + "BSD-2-Clause-Flex", + "BSD-3-Clause-OpenMPI", + "BSD-4-Clause-Wasabi", + "Bitstream", + "CERN", + "Caffe", + "Entenssa", + "FFT2D", + "GIF-Encoder", + "GNU-All-permissive-Copying-License", + "IBM-DHCP", + "JsonCPP", + "Khronos", + "Libpng-2.0", + "LicenseRef-OpenGLUT", + "LicenseRef-base64", + "LicenseRef-takuya-ooura", + "Punycode", + "SSLeay", + "WebM-Project-Patent", + "X11-Lucent", + "cURL", + "dso", + "getopt", + "pffft", + "zxing", +]) + +ALLOWED_LICENSES = ALLOWED_SPDX_LICENSES | EXTENDED_LICENSE_CLASSIFIERS