From e5a40942982cae870f52a3d254feba70c0e46136 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 23 May 2026 13:55:17 +0900 Subject: [PATCH] internal/rosa: remove unused helpers These are no longer needed after migration. Signed-off-by: Ophestra --- internal/rosa/busybox.go | 2 +- internal/rosa/cmake.go | 4 ++-- internal/rosa/git.go | 5 ----- internal/rosa/make.go | 2 +- internal/rosa/meson.go | 2 +- internal/rosa/perl.go | 22 +--------------------- internal/rosa/python.go | 32 +------------------------------- internal/rosa/state.go | 8 +++++--- 8 files changed, 12 insertions(+), 65 deletions(-) diff --git a/internal/rosa/busybox.go b/internal/rosa/busybox.go index 32d903a6..923f25ef 100644 --- a/internal/rosa/busybox.go +++ b/internal/rosa/busybox.go @@ -26,7 +26,7 @@ func (a busyboxBin) Params(*pkg.IContext) {} // IsExclusive returns false: Cure performs a trivial filesystem write. func (busyboxBin) IsExclusive() bool { return false } -// Dependencies returns the underlying busybox [pkg.File]. +// Dependencies returns the underlying busybox [pkg.FileArtifact]. func (a busyboxBin) Dependencies() []pkg.Artifact { return []pkg.Artifact{a.bin} } diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go index 127423d1..83acad60 100644 --- a/internal/rosa/cmake.go +++ b/internal/rosa/cmake.go @@ -11,7 +11,7 @@ var ( _ninja = H("ninja") ) -// CMakeHelper is the [CMake] build system helper. +// CMakeHelper builds and tests a CMake project with specified CACHE entries. type CMakeHelper struct { // Path elements joined with source. Append []string @@ -34,7 +34,7 @@ type CMakeHelper struct { var _ Helper = new(CMakeHelper) -// extra returns a hardcoded slice of [CMake] and [Ninja]. +// extra returns the cmake handle alongside either ninja or make. func (attr *CMakeHelper) extra(int) P { if attr != nil && attr.Make { return P{_cmake, _make} diff --git a/internal/rosa/git.go b/internal/rosa/git.go index c7f8c5b9..d4d679ba 100644 --- a/internal/rosa/git.go +++ b/internal/rosa/git.go @@ -36,8 +36,3 @@ git \ rm -rf /work/.git `, resolvconf()) } - -// newTagRemote is a helper around NewViaGit for a tag on a git remote. -func (t Toolchain) newTagRemote(url, tag, checksum string) pkg.Artifact { - return t.NewViaGit(url, "refs/tags/"+tag, mustDecode(checksum)) -} diff --git a/internal/rosa/make.go b/internal/rosa/make.go index a3e3d8e3..d6f1f0b9 100644 --- a/internal/rosa/make.go +++ b/internal/rosa/make.go @@ -7,7 +7,7 @@ import ( var _make = H("make") -// MakeHelper is the [Make] build system helper. +// MakeHelper wraps the make program and its surrounding build system. type MakeHelper struct { // Do not include default extras. OmitDefaults bool diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go index 4ee126e4..003b32cd 100644 --- a/internal/rosa/meson.go +++ b/internal/rosa/meson.go @@ -7,7 +7,7 @@ import ( var _meson = H("meson") -// MesonHelper is the [Meson] build system helper. +// MesonHelper builds and tests a meson project. type MesonHelper struct { // Runs after setup. ScriptCompileEarly string diff --git a/internal/rosa/perl.go b/internal/rosa/perl.go index aa0c817b..3a9f56ac 100644 --- a/internal/rosa/perl.go +++ b/internal/rosa/perl.go @@ -1,14 +1,8 @@ package rosa -import ( - "slices" - - "hakurei.app/internal/pkg" -) - var _perl = H("perl") -// MakeMakerHelper is the [Perl] MakeMaker helper. +// MakeMakerHelper builds projects using the included MakeMaker script. type MakeMakerHelper struct { // Whether to skip the check target. SkipCheck bool @@ -49,17 +43,3 @@ make \ script += "make DESTDIR=/work install\n" return script } - -// newViaPerlMakeMaker installs a perl module via Makefile.PL. -func (t Toolchain) newViaPerlMakeMaker( - name, version string, - source pkg.Artifact, - patches []KV, - extra ...ArtifactH, -) pkg.Artifact { - return t.NewPackage("perl-"+name, version, source, &PackageAttr{ - Patches: patches, - }, (*MakeMakerHelper)(nil), slices.Concat(extra, P{ - _perl, - })...) -} diff --git a/internal/rosa/python.go b/internal/rosa/python.go index d868efe3..3ebc1e08 100644 --- a/internal/rosa/python.go +++ b/internal/rosa/python.go @@ -1,17 +1,11 @@ package rosa -import ( - "slices" - - "hakurei.app/internal/pkg" -) - var ( _python = H("python") _pythonPyTest = H("python-pytest") ) -// PipHelper is the [Python] pip packaging helper. +// PipHelper installs python packages from source using pip. type PipHelper struct { // Path elements joined with source. Append []string @@ -94,27 +88,3 @@ pip3 install \ '` + sourcePath.String() + `' ` + script } - -// newPythonPackage registers a new [Python] package. -func (s *S) newPythonPackage( - name string, id int, description, website, version string, - source pkg.Artifact, attrP *PackageAttr, attr *PipHelper, - build P, extra ...ArtifactH, -) { - name = "python-" + name - s.MustRegister(name, func(t Toolchain) (*Metadata, pkg.Artifact) { - return &Metadata{ - Name: name, - Description: description, - Website: website, - Version: version, - - Dependencies: slices.Concat(P{_python}, extra), - - ID: id, - }, t.NewPackage(name, version, source, attrP, attr, slices.Concat( - extra, - build, - )...) - }) -} diff --git a/internal/rosa/state.go b/internal/rosa/state.go index 399e6dc9..5c822426 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -411,7 +411,7 @@ func (s *S) Collect() (handles P) { type deferredGit struct { url string tag string - checksum string + checksum pkg.Checksum } // getFrame must be called before accessing s. @@ -661,13 +661,15 @@ func (s *S) getFrame() azalea.Frame { args azalea.FArgs, ) (v any, set bool, err error) { var a deferredGit + var checksum string if err = args.Apply(map[unique.Handle[azalea.Ident]]any{ k("url"): &a.url, k("tag"): &a.tag, - k("checksum"): &a.checksum, + k("checksum"): &checksum, }); err != nil { return } + a.checksum = mustDecode(checksum) v = a set = true return @@ -1047,7 +1049,7 @@ func (ctx *evalContext) pf( source = p case deferredGit: - source = ctx.t.newTagRemote(p.url, p.tag, p.checksum) + source = ctx.t.NewViaGit(p.url, "refs/tags/"+p.tag, p.checksum) case azalea.Ident: var _meta *Metadata