internal/rosa: bind anitya functions
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m46s
Test / ShareFS (push) Successful in 3m47s
Test / Hakurei (push) Successful in 3m54s
Test / Sandbox (race detector) (push) Successful in 5m26s
Test / Hakurei (race detector) (push) Successful in 6m27s
Test / Flake checks (push) Successful in 1m20s

This is far more scalable than individual fields.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-19 23:34:21 +09:00
parent 98d915af3d
commit f638c73933
2 changed files with 18 additions and 26 deletions

View File

@@ -3,7 +3,7 @@ package perl {
website = "https://www.perl.org";
anitya = 13599;
// odd-even versioning
anityaFallback = true;
latest = anityaFallback;
version* = "5.42.2";
source = remoteTar {
@@ -86,7 +86,7 @@ package perl-SGMLS {
description = "class for postprocessing the output from the sgmls and nsgmls parsers";
website = "https://metacpan.org/release/RAAB/SGMLSpm-1.1";
anitya = 389576;
anityaLegacyCPAN = true;
latest = anityaLegacyCPAN;
version* = "1.1";
source = remoteCPAN {

View File

@@ -439,6 +439,21 @@ func (s *S) getFrame() azalea.Frame {
k("jobsFlagE"): jobsFlagE,
k("jobsLE"): jobsLE,
k("jobsLFlagE"): jobsLFlagE,
k("anityaFallback"): (*Versions).getStable,
k("anityaLegacyCPAN"): func(v *Versions) string {
for _, e := range v.Stable {
_, m, ok := strings.Cut(e, ".")
if !ok {
continue
}
if len(m) > 1 && m[0] == '0' {
continue
}
return e
}
return v.Latest
},
}
s.frame.Func = map[unique.Handle[azalea.Ident]]azalea.F{
@@ -795,15 +810,13 @@ func (ctx *evalContext) pf(
helper Helper
inputs, runtimes azalea.Array
anityaFallback bool
anityaLegacyCPAN bool
)
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("description"): &meta.Description,
k("website"): &meta.Website,
k("version"): &meta.Version,
k("anitya"): &anitya,
k("latest"): &meta.latest,
k("writable"): &attr.Writable,
k("chmod"): &attr.Chmod,
@@ -821,9 +834,6 @@ func (ctx *evalContext) pf(
k("exec"): &helper,
k("inputs"): &inputs,
k("runtime"): &runtimes,
k("anityaFallback"): &anityaFallback,
k("anityaLegacyCPAN"): &anityaLegacyCPAN,
}); err != nil {
return
}
@@ -835,24 +845,6 @@ func (ctx *evalContext) pf(
}
meta.ID = int(anitya)
if anityaFallback {
meta.latest = (*Versions).getStable
} else if anityaLegacyCPAN {
meta.latest = func(v *Versions) string {
for _, s := range v.Stable {
_, m, ok := strings.Cut(s, ".")
if !ok {
continue
}
if len(m) > 1 && m[0] == '0' {
continue
}
return s
}
return v.Latest
}
}
if output != nil {
v = cachedArtifact{&meta, output}
set = true