EXTENDED_LICENSE_CLASSIFIERS for non-SPDX license validation

Add support for validating licenses that aren't in the official SPDX license list but are commonly used in our codebase. These are the values output by the license classifier. This introduces a new EXTENDED_LICENSE_CLASSIFIERS set that contains these custom license identifiers, organized by restrictiveness level similar to ALLOWED_SPDX_LICENSES.


Bug: 379977497
Change-Id: I18e0b38572ee4df783573ea338b55ac237d8134d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6107859
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Jordan Brown <rop@google.com>
changes/59/6107859/8
Jordan Brown 6 months ago committed by LUCI CQ
parent 6cbd7a8243
commit ec23ea2c79

@ -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):

@ -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

Loading…
Cancel
Save