aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/state.go')
-rw-r--r--internal/rosa/state.go46
1 files changed, 43 insertions, 3 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index fca1aa48..f2ba2059 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -91,7 +91,9 @@ type Metadata struct {
Website string `json:"website,omitempty"`
// Runtime dependencies.
- Dependencies P `json:"dependencies"`
+ Runtimes P `json:"runtime"`
+ // Whether this package is unlike to be a runtime dependency.
+ Unlikely bool `json:"unlikely,omitempty"`
// Package version.
Version string `json:"version"`
@@ -1028,6 +1030,12 @@ func (t Toolchain) evalArtifact(v any, meta *Metadata) pkg.Artifact {
}
}
+// isUnlikely returns whether p is unlikely to be a runtime dependency.
+func (t Toolchain) isUnlikely(handle ArtifactH) bool {
+ meta, _ := t.MustLoad(handle)
+ return meta.Unlikely
+}
+
// pf implements [azalea.PF].
func (ctx *evalContext) pf(
name azalea.Ident,
@@ -1049,9 +1057,11 @@ func (ctx *evalContext) pf(
source any
helper Helper
overlay string
+ join bool
- inputs, runtimes, extra azalea.Array
+ tools, inputs, extra azalea.Array
+ runtimes = azalea.Array{}
bootstrap = true
)
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
@@ -1082,7 +1092,10 @@ func (ctx *evalContext) pf(
k("source"): &source,
k("exec"): &helper,
k("inputs"): &inputs,
+ k("tools"): &tools,
k("runtime"): &runtimes,
+ k("join"): &join,
+ k("unlikely"): &meta.Unlikely,
k("extra"): &extra,
k("overlay"): &overlay,
}); err != nil {
@@ -1092,12 +1105,39 @@ func (ctx *evalContext) pf(
var inputsH, extraH P
if inputsH, err = toHandles(inputs); err != nil {
return
- } else if meta.Dependencies, err = toHandles(runtimes); err != nil {
+ } else if attr.Tools, err = toHandles(tools); err != nil {
return
} else if extraH, err = toHandles(extra); err != nil {
return
}
+ if join || (runtimes != nil && len(runtimes) == 0 && helper != nil) {
+ hi := helper.inputs()
+ meta.Runtimes = make(P, 0, len(hi)+len(inputsH)+len(runtimes))
+ for _, h := range hi {
+ if ctx.t.isUnlikely(h) {
+ continue
+ }
+ meta.Runtimes = append(meta.Runtimes, h)
+ }
+ for _, h := range inputsH {
+ if ctx.t.isUnlikely(h) {
+ continue
+ }
+ meta.Runtimes = append(meta.Runtimes, h)
+ }
+
+ if join {
+ var extraRuntimes P
+ if extraRuntimes, err = toHandles(runtimes); err != nil {
+ return
+ }
+ meta.Runtimes = append(meta.Runtimes, extraRuntimes...)
+ }
+ } else if meta.Runtimes, err = toHandles(runtimes); err != nil {
+ return
+ }
+
meta.ID = int(anitya)
for _, pathname := range patches {
var p []byte