aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/state.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-21 14:17:30 +0900
committerOphestra <cat@gensokyo.uk>2026-05-21 14:48:16 +0900
commit40b33f9fc7d171124ac5369312fb8b6a956161ca (patch)
treea89d517420bd330d224442b0e425606d390b1b40 /internal/rosa/state.go
parent443a7a30f618c32fea6e564f0fcf0822a0d43538 (diff)
internal/rosa: enforce exclusions
This restores unexported artifact behaviour. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/state.go')
-rw-r--r--internal/rosa/state.go28
1 files changed, 23 insertions, 5 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index 6ff6f1cf..7cdf7cb5 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -384,14 +384,14 @@ func (s *S) mustRegister(
})
}
-// Count returns the number of [Artifact] registered to s.
-func (s *S) Count() int {
+// count returns the number of [Artifact] registered to s.
+func (s *S) count() int {
return int(s.artifactCount.Load())
}
-// Collect returns all [ArtifactH] registered to s.
-func (s *S) Collect() (handles P) {
- handles = make(P, 0, s.Count())
+// CollectAll returns all [ArtifactH] registered to s.
+func (s *S) CollectAll() (handles P) {
+ handles = make(P, 0, s.count())
s.artifacts.Range(func(key, _ any) bool {
handles = append(handles, key.(ArtifactH))
return true
@@ -402,6 +402,23 @@ func (s *S) Collect() (handles P) {
return
}
+// Collect returns all non-excluded [ArtifactH] registered to s.
+func (s *S) Collect() (handles P) {
+ handles = make(P, 0, s.count())
+ s.artifacts.Range(func(key, _ any) bool {
+ h := key.(ArtifactH)
+ meta, _ := s.Std().MustLoad(h)
+ if !meta.Exclude {
+ handles = append(handles, h)
+ }
+ return true
+ })
+ slices.SortFunc(handles, func(a, b ArtifactH) int {
+ return strings.Compare(a.String(), b.String())
+ })
+ return
+}
+
// deferredGit is a call to Toolchain.newTagRemote from azalea.
type deferredGit struct {
url string
@@ -915,6 +932,7 @@ func (ctx *evalContext) pf(
k("description"): &meta.Description,
k("website"): &meta.Website,
k("version"): &meta.Version,
+ k("exclude"): &meta.Exclude,
k("anitya"): &anitya,
k("latest"): &meta.latest,