From 40b33f9fc7d171124ac5369312fb8b6a956161ca Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 21 May 2026 14:17:30 +0900 Subject: internal/rosa: enforce exclusions This restores unexported artifact behaviour. Signed-off-by: Ophestra --- internal/rosa/state.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'internal/rosa/state.go') 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, -- cgit v1.3.1