From a9650041bb73366d9be73bcbe34faf8694f9aa2c Mon Sep 17 00:00:00 2001 From: Kane York Date: Thu, 20 Aug 2020 18:15:33 -0700 Subject: feat(tools/tvlc): pass list of derivations to depot-scanner You can now provide a list of Nix derivations to tvlc to get a git worktree + sparse-checkout containing only the paths needed to build the specified derivations. Known bugs: even though //third_party is only passed to readdir(), git doesn't know this and includes all of //third_party/*. Change-Id: I9dccebd3fbff4bb04ebd568175cf0a7e37d71ab3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1826 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tools/depot-scanner/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools/depot-scanner') diff --git a/tools/depot-scanner/main.go b/tools/depot-scanner/main.go index 8d69981c0d..2731902589 100644 --- a/tools/depot-scanner/main.go +++ b/tools/depot-scanner/main.go @@ -18,6 +18,7 @@ var nixStoreRoot = flag.String("store-path", "/nix/store/", "prefix for all vali var modeFlag = flag.String("mode", modeArchive, "operation mode. valid values: tar, print") var onlyFlag = flag.String("only", "", "only enable the listed output types, comma separated. valid values: DEPOT, STORE, CORE, UNKNOWN") +var relativeFlag = flag.Bool("relpath", false, "when printing paths, print them relative to the root of their path type") const ( modeArchive = "tar" @@ -164,16 +165,25 @@ func main() { if *modeFlag == "print" { if enabledPathTypes[pb.PathType_STORE] { for k, _ := range results[nixStorePath] { + if *relativePath { + k = strings.TrimPrefix(k, *nixStoreRoot) + k = strings.TrimPrefix(k, "/") + } fmt.Println(k) } } if enabledPathTypes[pb.PathType_DEPOT] { for k, _ := range results[depotPath] { + if *relativeFlag { + k = strings.TrimPrefix(k, *depotRoot) + k = strings.TrimPrefix(k, "/") + } fmt.Println(k) } } if enabledPathTypes[pb.PathType_CORE] { for k, _ := range results[corePkgsPath] { + // TODO relativeFlag fmt.Println(k) } } -- cgit 1.4.1