FrankChen021 commented on code in PR #20764:
URL: https://github.com/apache/druid/pull/20764#discussion_r4400539097


##########
distribution/bin/check-licenses.py:
##########
@@ -422,23 +432,36 @@ 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
+    )
+
+    if unsupported_licenses:

Review Comment:
   [P1] Excluded modules are not honored for unknown-license failures
   
   **Finding:** `read_dependency_reports` collects unsupported licenses for 
every generated report, but this branch exits before `exclude_module_prefixes` 
is consulted. The release and CI commands explicitly exclude 
`extensions/druid-testcontainers` even though report generation still scans 
extensions-core; adding a dependency with an unrecognized license to that 
intentionally unshipped module therefore fails the license check.
   
   **Suggestion:** Filter unsupported report entries by the excluded module 
prefixes before failing, and add a regression case for an excluded module.



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

Reply via email to