[ssci] Return relative license filepath instead of absolute

This CL updates the third party metadata field License File, so that
missing license filepaths are reported as relative to the repo root,
instead of the absolute filepath.


Bug: b:277147404
Change-Id: I16ac23d86b0ef12ab6020d8e81525965489888ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4876394
Auto-Submit: Anne Redulla <aredulla@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
changes/94/4876394/2
Anne Redulla 2 years ago committed by LUCI CQ
parent 0fd098edd6
commit 4dac5d6b4b

@ -110,7 +110,8 @@ class LicenseFileField(field_types.MetadataField):
source_file_dir, os.path.normpath(license_filename))
if not os.path.exists(license_filepath):
invalid_values.append(license_filepath)
rel_filepath = os.path.relpath(license_filepath, repo_root_dir)
invalid_values.append(rel_filepath)
if invalid_values:
missing = ", ".join(invalid_values)
@ -118,7 +119,7 @@ class LicenseFileField(field_types.MetadataField):
reason=f"{self._name} is invalid.",
additional=[
"Failed to find all license files on local disk.",
f"Missing files:{missing}.",
f"Missing files: {missing}.",
])
return None

Loading…
Cancel
Save