license metadata text notice files
Introduce the below command-line tool:
textnotice outputs a NOTICE text file constructed from the license
texts of the transitive closure of dependencies.
Bug: 68860345
Bug: 151177513
Bug: 151953481
Bug: 213388645
Bug: 210912771
Test: m all
Test: m systemlicense
Test: m textnotice; out/soong/host/linux-x85/textnotice ...
where ... is the path to the .meta_lic file for the system image. In my
case if
$ export PRODUCT=$(realpath $ANDROID_PRODUCT_OUT --relative-to=$PWD)
... can be expressed as:
${PRODUCT}/gen/META/lic_intermediates/${PRODUCT}/system.img.meta_lic
Change-Id: Ia691869fd8e58ef008024f48c23b1a4b4435677a
diff --git a/tools/compliance/policy/policy.go b/tools/compliance/policy/policy.go
index 581912a..4261ed0 100644
--- a/tools/compliance/policy/policy.go
+++ b/tools/compliance/policy/policy.go
@@ -29,6 +29,31 @@
"toolchain": "toolchain",
}
+ // SafePathPrefixes maps the path prefixes presumed not to contain any
+ // proprietary or confidential pathnames to whether to strip the prefix
+ // from the path when used as the library name for notices.
+ SafePathPrefixes = map[string]bool{
+ "external/": true,
+ "art/": false,
+ "build/": false,
+ "cts/": false,
+ "dalvik/": false,
+ "developers/": false,
+ "development/": false,
+ "frameworks/": false,
+ "packages/": true,
+ "prebuilts/": false,
+ "sdk/": false,
+ "system/": false,
+ "test/": false,
+ "toolchain/": false,
+ "tools/": false,
+ }
+
+ // SafePrebuiltPrefixes maps the regular expression to match a prebuilt
+ // containing the path of a safe prefix to the safe prefix.
+ SafePrebuiltPrefixes = make(map[*regexp.Regexp]string)
+
// ImpliesUnencumbered lists the condition names representing an author attempt to disclaim copyright.
ImpliesUnencumbered = LicenseConditionSet(UnencumberedCondition)
@@ -66,6 +91,15 @@
ccBySa = regexp.MustCompile(`^SPDX-license-identifier-CC-BY.*-SA.*`)
)
+func init() {
+ for prefix := range SafePathPrefixes {
+ if prefix == "prebuilts/" {
+ continue
+ }
+ r := regexp.MustCompile("^prebuilts/[^ ]*/" + prefix)
+ SafePrebuiltPrefixes[r] = prefix
+ }
+}
// LicenseConditionSetFromNames returns a set containing the recognized `names` and
// silently ignoring or discarding the unrecognized `names`.