diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-12-01 20:59:16 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-12-01 21:00:05 +0900 |
| commit | ec52a96f2b479be8b880349ddfb0819382666962 (patch) | |
| tree | 551168ec43b125ab17c2868b7e240d50441e5b44 | |
| parent | 1d73ffe341b4ec3e3dc636b8a14227ce28a4c410 (diff) | |
internal/rosa: net helper
This is mostly useful for fetching dependencies before a build.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/rosa/rosa.go | 36 | ||||
| -rw-r--r-- | internal/rosa/state.go | 8 |
2 files changed, 44 insertions, 0 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index ac6648ab..83bf316b 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -60,6 +60,8 @@ var ( AbsSource = fhs.AbsRoot.Append("source") // AbsExtra holds extra files provided to a packaging container. AbsExtra = fhs.AbsRoot.Append("extra") + // AbsNet holds the output of [PackageAttr.Net]. + AbsNet = fhs.AbsRoot.Append("net") ) // TargetError is an unsupported target architecture name. @@ -375,6 +377,11 @@ type PackageAttr struct { // Whether to create [pkg.KindExecNet] instead of [pkg.KindExec]. HostNet bool + // Runs in a [pkg.KindExecNet] artifact if non-empty. + Net string + // Outcome of Net. + NetChecksum pkg.Checksum + // Whether cross-compilation is broken. RejectCross bool // Whether the [Helper] behaves identically across all architectures. @@ -719,6 +726,35 @@ export \ srn += "-cross-" + _arch } + if attr.Net != "" { + paths = append(paths, pkg.Path(AbsNet, true, t.New( + name+"-net", version, source, &PackageAttr{ + KnownChecksum: &attr.NetChecksum, + Writable: true, + Chmod: true, + EnterSource: true, + Env: attr.Env, + Patches: attr.Patches, + Bin: attr.Bin, + NoToolchain: attr.NoToolchain, + HostNet: true, + NoArch: true, + Extra: attr.Extra, + + Paths: slices.Concat(attr.Paths, []pkg.ExecPath{ + resolvconf(), + }), + Tools: slices.Concat(attr.Tools, P{ + _nssCACert, + }), + }, &GenericHelper{ + InPlace: true, + Install: "chmod +w /etc && ln -s .." + Prefix + "/etc/ssl /etc\n" + + attr.Net, + }, + ))) + } + return pkg.NewExec( srn, arch, attr.KnownChecksum, pkg.ExecTimeoutMax, attr.HostNet, diff --git a/internal/rosa/state.go b/internal/rosa/state.go index e55202c4..8426c8a6 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -1157,6 +1157,7 @@ func (ctx *evalContext) pf( anitya int64 kc any + kcn string output any source any helper Helper @@ -1192,6 +1193,9 @@ func (ctx *evalContext) pf( k("bootstrap"): &bootstrap, k("libc"): &libc, + k("net"): &attr.Net, + k("checksumN"): &kcn, + k("checksum"): &kc, k("output"): &output, k("source"): &source, @@ -1225,6 +1229,10 @@ func (ctx *evalContext) pf( return } + if attr.Net != "" { + attr.NetChecksum = mustDecode(kcn) + } + if join || (runtimes != nil && len(runtimes) == 0 && helper != nil) { hi := helper.inputs() meta.Runtimes = make(P, 0, len(hi)+len(inputsH)+len(runtimes)) |
