internal/pkg: optionally measure exec artifact

Useful for verifying deterministic output without enabling network access.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-12 15:10:43 +09:00
parent dcde38f2e9
commit 6643cfbeee
9 changed files with 77 additions and 38 deletions

View File

@@ -220,6 +220,8 @@ const (
TEarly
// TNoToolchain excludes the LLVM toolchain.
TNoToolchain
// THostNet arranges for a [pkg.KindExecNet] to be created.
THostNet
)
var (
@@ -325,7 +327,9 @@ mkdir -vp /work/system/bin
}
return pkg.NewExec(
name, arch, knownChecksum, pkg.ExecTimeoutMax, flag&TExclusive != 0,
name, arch, knownChecksum, pkg.ExecTimeoutMax,
flag&THostNet != 0,
flag&TExclusive != 0,
fhs.AbsRoot, env,
AbsSystem.Append("bin", "sh"),
[]string{"sh", absCureScript.String()},
@@ -408,6 +412,9 @@ type Helper interface {
// PackageAttr holds build-system-agnostic attributes.
type PackageAttr struct {
// Measure output if populated. Required by [THostNet].
KnownChecksum *pkg.Checksum
// Mount the source tree writable.
Writable bool
// Do not pass through [Toolchain.NewPatchedSource].
@@ -545,7 +552,7 @@ cd '/usr/src/` + name + `/'
name+"-"+version,
attr.Flag,
extraRes,
nil,
attr.KnownChecksum,
attr.Env,
scriptEarly+helper.script(name),
slices.Concat(attr.Paths, []pkg.ExecPath{