feat(edef/depot-scan): init
A small script that parses `nix-instantiate -vv` output to track the files read while instantiating a depot build. Change-Id: I5acf31d55f39c1d1acf9cdead03d33e2c8abab6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1646 Reviewed-by: edef <edef@edef.eu> Tested-by: BuildkiteCI
This commit is contained in:
parent
58e3608e25
commit
48e47d9280
2 changed files with 23 additions and 0 deletions
12
users/edef/depot-scan.nix
Normal file
12
users/edef/depot-scan.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellScriptBin "depot-scan" ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
path=$(git rev-parse --show-prefix)
|
||||||
|
path="''${path%%/}"
|
||||||
|
attr="''${path//\//.}"
|
||||||
|
root="$(git rev-parse --show-toplevel)"
|
||||||
|
echo "scanning //$path" >&2
|
||||||
|
nix-instantiate "$root" -A "$attr" -vv 2> >(${pkgs.perl}/bin/perl sources.pl) >&2
|
||||||
|
''
|
11
users/edef/sources.pl
Executable file
11
users/edef/sources.pl
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#! /usr/bin/env -S perl -ln
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
if (/^evaluating file '(.*)'$/ or
|
||||||
|
/^copied source '(.*)' -> '.*'$/ or
|
||||||
|
/^trace: lorri read: '(.*)'$/) {
|
||||||
|
print $1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR unless /^instantiated '.*' -> '.*'$/;
|
Loading…
Reference in a new issue