FrankChen021 commented on code in PR #20764:
URL: https://github.com/apache/druid/pull/20764#discussion_r4402835562
##########
distribution/bin/check-licenses.py:
##########
@@ -222,8 +228,7 @@ def set_license(self, data):
try:
self.license = self.compatible_license_names[data]
except KeyError:
- print("Unsupported license: " + data)
- print("For:" + self.group_id + " " + self.artifact_id +
" in: "+ self.druid_module_name)
+ self.unsupported_license_names.append(data)
Review Comment:
Fixed in d180bc6892: names are now looked up first, so the CDDL + GPLv2
mappings match. An unknown GPL name leaves the license unset like any other
unknown name, and the first compatible license still wins for dual-licensed
deps.
##########
distribution/bin/check-licenses.py:
##########
@@ -163,6 +164,10 @@ def handle_endtag(self, tag):
# print(json.dumps({"groupId": self.group_id, "artifactId":
self.artifact_id, "version": self.version, "classifier": self.classifier,
"type": self.dep_type, "license": self.license}))
if self.group_id.find("org.apache.druid") < 0:
self.dep_to_license[get_dep_key(self.group_id,
self.artifact_id, self.version)] = (self.license, self.druid_module_name)
+ # A license name missing from compatible_license_names
would otherwise leave the license unset,
+ # which silently skips the comparison against
licenses.yaml.
+ if self.license is None and self.unsupported_license_names:
Review Comment:
Done in d180bc6892: `find_unknown_licenses()` now fails on any dependency
from a released module whose license is unset, skipping `-` and
`skip_dependency_report_check` entries. One note: a POM without a license shows
up as `-` in the report, so that case is still skipped.
##########
distribution/bin/check-licenses.py:
##########
@@ -422,23 +436,37 @@ def read_dependency_reports(dependency_reports_root,
compatible_license_names):
parser = DependencyReportParser(druid_module_name,
compatible_license_names)
dep_to_license = parser.parse(report_file)
reported_dep_to_licenses.update(dep_to_license)
+ unsupported_licenses.extend(parser.unsupported_licenses)
for key in dep_to_license:
reported_modules.setdefault(key,
set()).add(druid_module_name)
if len(reported_dep_to_licenses) == 0:
raise Exception("No dependency reports are found")
- return reported_dep_to_licenses, reported_modules
+ return reported_dep_to_licenses, reported_modules, unsupported_licenses
def check_licenses(license_yaml, dependency_reports_root,
exclude_module_prefixes):
# Build a dictionary to facilitate comparing reported licenses and
registered ones.
# These dictionaries are the mapping of (group_id, artifact_id, version)
to license_name.
with open(license_yaml, encoding='utf-8') as registry_file:
- licenses_list = list(yaml.load_all(registry_file,
Loader=yaml.FullLoader))
+ licenses_list = licenses_yaml.load_all(registry_file)
check_license_files(license_yaml, licenses_list)
# Build reported license dictionary.
compatible_license_names = build_compatible_license_names()
- reported_dep_to_licenses, reported_modules =
read_dependency_reports(dependency_reports_root, compatible_license_names)
+ reported_dep_to_licenses, reported_modules, unsupported_licenses =
read_dependency_reports(
+ dependency_reports_root, compatible_license_names
+ )
+
+ unsupported_licenses = find_unsupported_licenses(unsupported_licenses,
exclude_module_prefixes)
Review Comment:
Done in d180bc6892: unknown licenses are now reported together with the
mismatched and missing ones, with a single exit at the end.
##########
distribution/bin/check-licenses.py:
##########
@@ -331,6 +336,9 @@ def build_compatible_license_names():
compatible_licenses['MIT-0'] = 'MIT No Attribution'
+ compatible_licenses['Zero-Clause BSD'] = 'Zero-Clause BSD'
+ compatible_licenses['0BSD'] = 'Zero-Clause BSD'
Review Comment:
Done in d180bc6892: added both identity keys, and `set_license` now keeps
the first compatible license. A new test checks that every normalized name is
also a key.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]