Support OUT_DIR for license graph.
Bug: 226066987 Test: OUT_DIR=/tmp/outdir m all listshare checkshare htmlnotice rtrace dumpgraph dumpresolutions compliancenotice_bom compliancenotice_shippedlibs Test: OUT_DIR=/tmp/outdir m /tmp/outdir/target/product/bonito/obj/NOTICE.xml.gz Test: m all listshare checkshare htmlnotice rtrace dumpgraph dumpresolutions compliancenotice_bom compliancenotice_shippedlibs Test: m out/target/product/bonito/obj/NOTICE.xml.gz Change-Id: I6282c647a389c5935d5ce7c79193f86d32c76365
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@@ -107,7 +108,7 @@ func main() {
|
||||
sources: *sources,
|
||||
stripPrefix: *stripPrefix,
|
||||
}
|
||||
_, err := traceRestricted(ctx, os.Stdout, os.Stderr, flag.Args()...)
|
||||
_, err := traceRestricted(ctx, os.Stdout, os.Stderr, compliance.FS, flag.Args()...)
|
||||
if err != nil {
|
||||
if err == failNoneRequested {
|
||||
flag.Usage()
|
||||
@@ -119,7 +120,7 @@ func main() {
|
||||
}
|
||||
|
||||
// traceRestricted implements the rtrace utility.
|
||||
func traceRestricted(ctx *context, stdout, stderr io.Writer, files ...string) (*compliance.LicenseGraph, error) {
|
||||
func traceRestricted(ctx *context, stdout, stderr io.Writer, rootFS fs.FS, files ...string) (*compliance.LicenseGraph, error) {
|
||||
if len(files) < 1 {
|
||||
return nil, failNoneRequested
|
||||
}
|
||||
@@ -129,7 +130,7 @@ func traceRestricted(ctx *context, stdout, stderr io.Writer, files ...string) (*
|
||||
}
|
||||
|
||||
// Read the license graph from the license metadata files (*.meta_lic).
|
||||
licenseGraph, err := compliance.ReadLicenseGraph(os.DirFS("."), stderr, files)
|
||||
licenseGraph, err := compliance.ReadLicenseGraph(rootFS, stderr, files)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to read license metadata file(s) %q: %v\n", files, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user