diff --git a/cmd/mbf/info.go b/cmd/mbf/info.go index 6a3de7c9..672ab44f 100644 --- a/cmd/mbf/info.go +++ b/cmd/mbf/info.go @@ -39,14 +39,13 @@ func commandInfo( t := rosa.Native().Std() for i, name := range args { handle := rosa.ArtifactH(unique.Make(name)) - if meta := rosa.Native().Get(handle); meta == nil { + if meta, a := t.Load(handle); meta == nil { return fmt.Errorf("unknown artifact %q", name) } else { var suffix string - a, version := t.MustLoad(handle) - if version != rosa.Unversioned { - suffix += "-" + version + if meta.Version != rosa.Unversioned { + suffix += "-" + meta.Version } mustPrintln("name : " + name + suffix) @@ -58,9 +57,10 @@ func commandInfo( if len(meta.Dependencies) > 0 { mustPrint("depends on :") for _, d := range meta.Dependencies { - s := rosa.Native().MustGet(d).Name - if _, _version := t.Load(d); _version != rosa.Unversioned { - s += "-" + _version + _meta, _ := rosa.Native().Std().MustLoad(d) + s := _meta.Name + if _meta.Version != rosa.Unversioned { + s += "-" + _meta.Version } mustPrint(" " + s) } diff --git a/cmd/mbf/info_test.go b/cmd/mbf/info_test.go index 87e9cdcb..30658119 100644 --- a/cmd/mbf/info_test.go +++ b/cmd/mbf/info_test.go @@ -22,12 +22,12 @@ func TestInfo(t *testing.T) { t.Parallel() _t := rosa.Native().Std() - _, qemuVersion := _t.Load(rosa.QEMU) - _, glibVersion := _t.Load(rosa.GLib) - zlib, zlibVersion := _t.Load(rosa.Zlib) - _, zstdVersion := _t.Load(rosa.Zstd) - _, hakureiVersion := _t.Load(rosa.Hakurei) - _, hakureiDistVersion := _t.Load(rosa.HakureiDist) + qemuMeta, _ := _t.Load(rosa.QEMU) + glibMeta, _ := _t.Load(rosa.GLib) + zlibMeta, zlib := _t.Load(rosa.Zlib) + zstdMeta, _ := _t.Load(rosa.Zstd) + hakureiMeta, _ := _t.Load(rosa.Hakurei) + hakureiDistMeta, _ := _t.Load(rosa.HakureiDist) testCases := []struct { name string @@ -38,24 +38,24 @@ func TestInfo(t *testing.T) { wantErr any }{ {"qemu", []string{"qemu"}, nil, "", ` -name : qemu-` + qemuVersion + ` +name : qemu-` + qemuMeta.Version + ` description : a generic and open source machine emulator and virtualizer website : https://www.qemu.org -depends on : glib-` + glibVersion + ` zstd-` + zstdVersion + ` +depends on : glib-` + glibMeta.Version + ` zstd-` + zstdMeta.Version + ` `, nil}, {"multi", []string{"hakurei", "hakurei-dist"}, nil, "", ` -name : hakurei-` + hakureiVersion + ` +name : hakurei-` + hakureiMeta.Version + ` description : low-level userspace tooling for Rosa OS website : https://hakurei.app -name : hakurei-dist-` + hakureiDistVersion + ` +name : hakurei-dist-` + hakureiDistMeta.Version + ` description : low-level userspace tooling for Rosa OS (distribution tarball) website : https://hakurei.app `, nil}, {"nonexistent", []string{"zlib", "\x00"}, nil, "", ` -name : zlib-` + zlibVersion + ` +name : zlib-` + zlibMeta.Version + ` description : lossless data-compression library website : https://zlib.net @@ -65,12 +65,12 @@ website : https://zlib.net "zstd": "internal/pkg (amd64) on satori\n", "hakurei": "internal/pkg (amd64) on satori\n\n", }, "", ` -name : zlib-` + zlibVersion + ` +name : zlib-` + zlibMeta.Version + ` description : lossless data-compression library website : https://zlib.net status : not yet cured -name : zstd-` + zstdVersion + ` +name : zstd-` + zstdMeta.Version + ` description : a fast compression algorithm website : https://facebook.github.io/zstd status : internal/pkg (amd64) on satori @@ -79,7 +79,7 @@ status : internal/pkg (amd64) on satori {"status cache perm", []string{"zlib"}, map[string]string{ "zlib": "\x00", }, "", ` -name : zlib-` + zlibVersion + ` +name : zlib-` + zlibMeta.Version + ` description : lossless data-compression library website : https://zlib.net `, func(cm *cache) error { @@ -91,7 +91,7 @@ website : https://zlib.net }}, {"status report", []string{"zlib"}, nil, strings.Repeat("\x00", len(pkg.Checksum{})+8), ` -name : zlib-` + zlibVersion + ` +name : zlib-` + zlibMeta.Version + ` description : lossless data-compression library website : https://zlib.net status : not in report @@ -140,7 +140,7 @@ status : not in report if tc.status != nil { for name, status := range tc.status { - a, _ := _t.Load(rosa.ArtifactH(unique.Make(name))) + _, a := _t.Load(rosa.ArtifactH(unique.Make(name))) if a == nil { t.Fatalf("invalid name %q", name) } diff --git a/cmd/mbf/internal/pkgserver/index.go b/cmd/mbf/internal/pkgserver/index.go index 3508a844..2cc68f9f 100644 --- a/cmd/mbf/internal/pkgserver/index.go +++ b/cmd/mbf/internal/pkgserver/index.go @@ -33,10 +33,10 @@ type packageIndex struct { // metadata holds [rosa.Metadata] extended with additional information. type metadata struct { handle rosa.ArtifactH - *rosa.Artifact + *rosa.Metadata - // Populated via [rosa.Toolchain.Version], [rosa.Unversioned] is equivalent - // to the zero value. Otherwise, the zero value is invalid. + // Copied from [rosa.Metadata], [rosa.Unversioned] is equivalent to the zero + // value. Otherwise, the zero value is invalid. Version string `json:"version,omitempty"` // Output data size, available if present in report. Size int64 `json:"size,omitempty"` @@ -61,12 +61,12 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) { index.names = make(map[string]*metadata) ir := pkg.NewIR() for i, handle := range handles { - a, version := rosa.Native().Std().MustLoad(handle) + meta, a := rosa.Native().Std().MustLoad(handle) m := metadata{ handle: handle, - Artifact: rosa.Native().MustGet(handle), - Version: version, + Metadata: meta, + Version: meta.Version, } if m.Version == "" { return errors.New("invalid version from " + m.Name) diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 526dce50..1910a100 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -118,7 +118,7 @@ func main() { rosa.Native().DropCaches("", flags) cross := flagArch != "" && flagArch != runtime.GOARCH if flagQEMU || cross { - cm.qemu, _ = rosa.Native().Std().Load(rosa.QEMU) + _, cm.qemu = rosa.Native().Std().MustLoad(rosa.QEMU) } if cross { @@ -358,7 +358,7 @@ func main() { for range max(flagJobs, 1) { wg.Go(func() { for p := range w { - meta := rosa.Native().MustGet(p) + meta, _ := rosa.Native().Std().MustLoad(p) if meta.ID == 0 { continue } @@ -371,13 +371,9 @@ func main() { continue } - _, version := rosa.Native().Std().Load(p) - if current, latest := - version, - meta.GetLatest(v); current != latest { - + if latest := meta.GetLatest(v); meta.Version != latest { n.Add(1) - log.Printf("%s %s < %s", meta.Name, current, latest) + log.Printf("%s %s < %s", meta.Name, meta.Version, latest) continue } @@ -453,7 +449,7 @@ func main() { ) if err = cm.Do(func(cache *pkg.Cache) (err error) { - llvm, _ := rosa.Native().New(s - 2).Load(rosa.LLVM) + _, llvm := rosa.Native().New(s - 2).Load(rosa.LLVM) pathname, _, err = cache.Cure(llvm) return }); err != nil { @@ -462,7 +458,7 @@ func main() { log.Println("stage1:", pathname) if err = cm.Do(func(cache *pkg.Cache) (err error) { - llvm, _ := rosa.Native().New(s - 1).Load(rosa.LLVM) + _, llvm := rosa.Native().New(s - 1).Load(rosa.LLVM) pathname, checksum[0], err = cache.Cure(llvm) return }); err != nil { @@ -470,7 +466,7 @@ func main() { } log.Println("stage2:", pathname) if err = cm.Do(func(cache *pkg.Cache) (err error) { - llvm, _ := rosa.Native().New(s).Load(rosa.LLVM) + _, llvm := rosa.Native().New(s).Load(rosa.LLVM) pathname, checksum[1], err = cache.Cure(llvm) return }); err != nil { @@ -492,7 +488,7 @@ func main() { if flagStage0 { if err = cm.Do(func(cache *pkg.Cache) (err error) { - stage0, _ := rosa.Native().New(s).Load(rosa.Stage0) + _, stage0 := rosa.Native().New(s).Load(rosa.Stage0) pathname, _, err = cache.Cure(stage0) return }); err != nil { @@ -546,7 +542,7 @@ func main() { t -= 1 } - a, _ := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0]))) + _, a := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0]))) if a == nil { return fmt.Errorf("unknown artifact %q", args[0]) } @@ -762,7 +758,7 @@ func main() { handles := make([]rosa.ArtifactH, len(args)+3) for i, arg := range args { handles[i] = rosa.ArtifactH(unique.Make(arg)) - if rosa.Native().Get(handles[i]) == nil { + if meta, _ := rosa.Native().Std().Load(handles[i]); meta == nil { return fmt.Errorf("unknown artifact %q", arg) } } diff --git a/cmd/mbf/main_test.go b/cmd/mbf/main_test.go index 4a51e3ca..83dc9a98 100644 --- a/cmd/mbf/main_test.go +++ b/cmd/mbf/main_test.go @@ -36,8 +36,8 @@ func TestCureAll(t *testing.T) { }) for _, handle := range rosa.Native().Collect() { - a, _ := rosa.Native().Std().MustLoad(handle) - t.Run(rosa.Native().MustGet(handle).Name, func(t *testing.T) { + _, a := rosa.Native().Std().MustLoad(handle) + t.Run(handle.String(), func(t *testing.T) { _, err := cureRemote(t.Context(), &addr, a, 0) if err != nil { t.Error(err) diff --git a/internal/rosa/argp-standalone.go b/internal/rosa/argp-standalone.go index e82b95e1..36281201 100644 --- a/internal/rosa/argp-standalone.go +++ b/internal/rosa/argp-standalone.go @@ -26,9 +26,7 @@ install -D -m755 libargp.a /work/system/lib/libargp.a ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newArgpStandalone, - + native.mustRegister(Toolchain.newArgpStandalone, &Metadata{ Name: "argp-standalone", Description: "hierarchical argument parsing library broken out from glibc", Website: "http://www.lysator.liu.se/~nisse/misc/", diff --git a/internal/rosa/bison.go b/internal/rosa/bison.go index b79ed9e1..4ca95093 100644 --- a/internal/rosa/bison.go +++ b/internal/rosa/bison.go @@ -66,9 +66,7 @@ func (t Toolchain) newBison() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newBison, - + native.mustRegister(Toolchain.newBison, &Metadata{ Name: "bison", Description: "a general-purpose parser generator", Website: "https://www.gnu.org/software/bison/", diff --git a/internal/rosa/bzip2.go b/internal/rosa/bzip2.go index 6cb98fa8..75f721b1 100644 --- a/internal/rosa/bzip2.go +++ b/internal/rosa/bzip2.go @@ -26,9 +26,7 @@ func (t Toolchain) newBzip2() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newBzip2, - + native.mustRegister(Toolchain.newBzip2, &Metadata{ Name: "bzip2", Description: "a freely available, patent free, high-quality data compressor", Website: "https://sourceware.org/bzip2/", diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go index 16d549c9..c169b046 100644 --- a/internal/rosa/cmake.go +++ b/internal/rosa/cmake.go @@ -106,9 +106,7 @@ index 2ead810437..f85cbb8b1c 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newCMake, - + native.mustRegister(Toolchain.newCMake, &Metadata{ Name: "cmake", Description: "cross-platform, open-source build system", Website: "https://cmake.org/", diff --git a/internal/rosa/connman.go b/internal/rosa/connman.go index 6db4020d..cb62e2b5 100644 --- a/internal/rosa/connman.go +++ b/internal/rosa/connman.go @@ -90,9 +90,7 @@ func (t Toolchain) newConnman() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newConnman, - + native.mustRegister(Toolchain.newConnman, &Metadata{ Name: "connman", Description: "a daemon for managing Internet connections", Website: "https://git.kernel.org/pub/scm/network/connman/connman.git/", diff --git a/internal/rosa/curl.go b/internal/rosa/curl.go index 33a68d4e..c05eea20 100644 --- a/internal/rosa/curl.go +++ b/internal/rosa/curl.go @@ -39,9 +39,7 @@ chmod +w tests/data && rm -f tests/data/test459 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newCurl, - + native.mustRegister(Toolchain.newCurl, &Metadata{ Name: "curl", Description: "command line tool and library for transferring data with URLs", Website: "https://curl.se/", diff --git a/internal/rosa/dbus.go b/internal/rosa/dbus.go index 9667a50b..485bc422 100644 --- a/internal/rosa/dbus.go +++ b/internal/rosa/dbus.go @@ -29,9 +29,7 @@ func (t Toolchain) newDBus() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newDBus, - + native.mustRegister(Toolchain.newDBus, &Metadata{ Name: "dbus", Description: "a message bus system", Website: "https://www.freedesktop.org/wiki/Software/dbus/", @@ -65,9 +63,7 @@ func (t Toolchain) newXDGDBusProxy() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXDGDBusProxy, - + native.mustRegister(Toolchain.newXDGDBusProxy, &Metadata{ Name: "xdg-dbus-proxy", Description: "a filtering proxy for D-Bus connections", Website: "https://github.com/flatpak/xdg-dbus-proxy", diff --git a/internal/rosa/dtc.go b/internal/rosa/dtc.go index a80b25ef..7e830a37 100644 --- a/internal/rosa/dtc.go +++ b/internal/rosa/dtc.go @@ -31,9 +31,7 @@ func (t Toolchain) newDTC() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newDTC, - + native.mustRegister(Toolchain.newDTC, &Metadata{ Name: "dtc", Description: "The Device Tree Compiler", Website: "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/", diff --git a/internal/rosa/elfutils.go b/internal/rosa/elfutils.go index bb969151..5f0987ac 100644 --- a/internal/rosa/elfutils.go +++ b/internal/rosa/elfutils.go @@ -39,9 +39,7 @@ func (t Toolchain) newElfutils() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newElfutils, - + native.mustRegister(Toolchain.newElfutils, &Metadata{ Name: "elfutils", Description: "utilities and libraries to handle ELF files and DWARF data", Website: "https://sourceware.org/elfutils/", diff --git a/internal/rosa/fakeroot.go b/internal/rosa/fakeroot.go index 4c882de0..baf3c530 100644 --- a/internal/rosa/fakeroot.go +++ b/internal/rosa/fakeroot.go @@ -46,9 +46,7 @@ index f135ad9..85c784c 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFakeroot, - + native.mustRegister(Toolchain.newFakeroot, &Metadata{ Name: "fakeroot", Description: "tool for simulating superuser privileges", Website: "https://salsa.debian.org/clint/fakeroot", diff --git a/internal/rosa/flex.go b/internal/rosa/flex.go index 1085e0d0..83719413 100644 --- a/internal/rosa/flex.go +++ b/internal/rosa/flex.go @@ -20,9 +20,7 @@ func (t Toolchain) newFlex() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFlex, - + native.mustRegister(Toolchain.newFlex, &Metadata{ Name: "flex", Description: "scanner generator for lexing in C and C++", Website: "https://github.com/westes/flex/", diff --git a/internal/rosa/freetype.go b/internal/rosa/freetype.go index ba337c99..0758bfda 100644 --- a/internal/rosa/freetype.go +++ b/internal/rosa/freetype.go @@ -15,9 +15,7 @@ func (t Toolchain) newFreetype() (pkg.Artifact, string) { ), nil, (*MakeHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFreetype, - + native.mustRegister(Toolchain.newFreetype, &Metadata{ Name: "freetype", Description: "a freely available software library to render fonts", Website: "http://www.freetype.org/", diff --git a/internal/rosa/fuse.go b/internal/rosa/fuse.go index 299e1e2e..45b3f0cf 100644 --- a/internal/rosa/fuse.go +++ b/internal/rosa/fuse.go @@ -31,9 +31,7 @@ func (t Toolchain) newFuse() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFuse, - + native.mustRegister(Toolchain.newFuse, &Metadata{ Name: "fuse", Description: "the reference implementation of the Linux FUSE interface", Website: "https://github.com/libfuse/libfuse/", diff --git a/internal/rosa/git.go b/internal/rosa/git.go index e30fc954..5815cd0a 100644 --- a/internal/rosa/git.go +++ b/internal/rosa/git.go @@ -88,9 +88,7 @@ disable_test t5515-fetch-merge-logic ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newGit, - + native.mustRegister(Toolchain.newGit, &Metadata{ Name: "git", Description: "distributed version control system", Website: "https://www.git-scm.com/", diff --git a/internal/rosa/glslang.go b/internal/rosa/glslang.go index 969cf2ad..c51c7937 100644 --- a/internal/rosa/glslang.go +++ b/internal/rosa/glslang.go @@ -22,9 +22,7 @@ func (t Toolchain) newSPIRVHeaders() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newSPIRVHeaders, - + native.mustRegister(Toolchain.newSPIRVHeaders, &Metadata{ Name: "spirv-headers", Description: "machine-readable files for the SPIR-V Registry", Website: "https://github.com/KhronosGroup/SPIRV-Headers", @@ -72,9 +70,7 @@ func (t Toolchain) newSPIRVTools() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newSPIRVTools, - + native.mustRegister(Toolchain.newSPIRVTools, &Metadata{ Name: "spirv-tools", Description: "an API and commands for processing SPIR-V modules", Website: "https://github.com/KhronosGroup/SPIRV-Tools", @@ -116,9 +112,7 @@ func (t Toolchain) newGlslang() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newGlslang, - + native.mustRegister(Toolchain.newGlslang, &Metadata{ Name: "glslang", Description: "reference front end for GLSL/ESSL", Website: "https://github.com/KhronosGroup/glslang", @@ -232,9 +226,7 @@ export LIT_OPTS=` + litArgs(true, skipChecks...) + ` ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newSPIRVLLVMTranslator, - + native.mustRegister(Toolchain.newSPIRVLLVMTranslator, &Metadata{ Name: "spirv-llvm-translator", Description: "bi-directional translation between SPIR-V and LLVM IR", Website: "https://github.com/KhronosGroup/SPIRV-LLVM-Translator", diff --git a/internal/rosa/go.go b/internal/rosa/go.go index f448d20c..2bde38c0 100644 --- a/internal/rosa/go.go +++ b/internal/rosa/go.go @@ -166,9 +166,7 @@ rm \ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newGoLatest, - + native.mustRegister(Toolchain.newGoLatest, &Metadata{ Name: "go", Description: "the Go programming language toolchain", Website: "https://go.dev/", diff --git a/internal/rosa/gtk.go b/internal/rosa/gtk.go index 02ba1786..eaa67654 100644 --- a/internal/rosa/gtk.go +++ b/internal/rosa/gtk.go @@ -42,9 +42,7 @@ func (t Toolchain) newGLib() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newGLib, - + native.mustRegister(Toolchain.newGLib, &Metadata{ Name: "glib", Description: "the GNU library of miscellaneous stuff", Website: "https://developer.gnome.org/glib/", diff --git a/internal/rosa/hakurei.go b/internal/rosa/hakurei.go index f6882474..537b6b76 100644 --- a/internal/rosa/hakurei.go +++ b/internal/rosa/hakurei.go @@ -58,9 +58,8 @@ func main() { ))) } func init() { - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newHakurei("", ` + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.newHakurei("", ` mkdir -p /work/system/libexec/hakurei/ echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)." @@ -86,26 +85,23 @@ mkdir -p /work/system/bin/ sharefs \ ../../bin/) `, true), hakureiVersion - }, - + }, &Metadata{ Name: "hakurei", Description: "low-level userspace tooling for Rosa OS", Website: "https://hakurei.app/", ID: 388834, }) - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - name := "all" - if t.opts&OptSkipCheck != 0 { - name = "make" - } - return t.newHakurei("-dist", ` + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + name := "all" + if t.opts&OptSkipCheck != 0 { + name = "make" + } + return t.newHakurei("-dist", ` export HAKUREI_VERSION DESTDIR=/work /usr/src/hakurei/`+name+`.sh `, true), hakureiVersion - }, - + }, &Metadata{ Name: "hakurei-dist", Description: "low-level userspace tooling for Rosa OS (distribution tarball)", Website: "https://hakurei.app/", diff --git a/internal/rosa/hwdata.go b/internal/rosa/hwdata.go index f021703d..454cec28 100644 --- a/internal/rosa/hwdata.go +++ b/internal/rosa/hwdata.go @@ -22,9 +22,7 @@ func (t Toolchain) newHwdata() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newHwdata, - + native.mustRegister(Toolchain.newHwdata, &Metadata{ Name: "hwdata", Description: "contains various hardware identification and configuration data", Website: "https://github.com/vcrhonek/hwdata", diff --git a/internal/rosa/images.go b/internal/rosa/images.go index 715035cc..561eee7c 100644 --- a/internal/rosa/images.go +++ b/internal/rosa/images.go @@ -6,12 +6,13 @@ import ( ) func init() { - native.MustRegister(&Artifact{ + meta := Metadata{ Name: "earlyinit", Description: "Rosa OS initramfs init program", - - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newHakurei("-early-init", ` + Version: Unversioned, + } + native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + return &meta, t.newHakurei("-early-init", ` mkdir -p /work/system/libexec/hakurei/ echo '# Building earlyinit.' @@ -22,52 +23,51 @@ go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w -X hakurei.app/internal/info.buildVersion=${HAKUREI_VERSION} " ./cmd/earlyinit echo -`, false), Unversioned - }, +`, false) }) } -func (t Toolchain) newImageSystem() (pkg.Artifact, string) { - return t.New("system.img", TNoToolchain, t.Append(nil, - SquashfsTools, - ), nil, nil, ` -mksquashfs /mnt/system /work/system.img -`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil, - Musl, - Mksh, - Toybox, - Kmod, - Kernel, - Firmware, - )...)), Unversioned -} func init() { - native.MustRegister(&Artifact{ + meta := Metadata{ Name: "system-image", Description: "Rosa OS system image", + Version: Unversioned, + } + native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + return &meta, t.New("system.img", TNoToolchain, t.Append(nil, + SquashfsTools, + ), nil, nil, ` +mksquashfs /mnt/system /work/system.img +`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil, + Musl, + Mksh, + Toybox, - f: Toolchain.newImageSystem, + Kmod, + Kernel, + Firmware, + )...)) }) } -func (t Toolchain) newImageInitramfs() (pkg.Artifact, string) { - return t.New("initramfs", TNoToolchain, t.Append(nil, - Zstd, - EarlyInit, - GenInitCPIO, - ), nil, nil, ` + +func init() { + meta := Metadata{ + Name: "initramfs-image", + Description: "Rosa OS initramfs image", + Version: Unversioned, + } + native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + return &meta, t.New("initramfs", TNoToolchain, t.Append(nil, + Zstd, + EarlyInit, + GenInitCPIO, + ), nil, nil, ` gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst `, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(` dir /dev 0755 0 0 nod /dev/null 0666 0 0 c 1 3 nod /dev/console 0600 0 0 c 5 1 file /init /system/libexec/hakurei/earlyinit 0555 0 0 -`)))), Unversioned -} -func init() { - native.MustRegister(&Artifact{ - Name: "initramfs-image", - Description: "Rosa OS initramfs image", - - f: Toolchain.newImageInitramfs, +`)))) }) } diff --git a/internal/rosa/kernel.go b/internal/rosa/kernel.go index 354e97ed..054008cd 100644 --- a/internal/rosa/kernel.go +++ b/internal/rosa/kernel.go @@ -19,9 +19,7 @@ chmod -R +w /work/usr/src/linux/ `, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newKernelSource, - + native.mustRegister(Toolchain.newKernelSource, &Metadata{ Name: "kernel-source", Description: "a writable kernel source tree installed to /usr/src/linux", Website: "https://kernel.org/", @@ -70,9 +68,7 @@ cat \ ), kernelVersion } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newKernelHeaders, - + native.mustRegister(Toolchain.newKernelHeaders, &Metadata{ Name: "kernel-headers", Description: "an installation of kernel headers", Website: "https://kernel.org/", @@ -1275,9 +1271,7 @@ rm -v /work/system/lib/modules/` + kernelVersion + `/build ), kernelVersion } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newKernel, - + native.mustRegister(Toolchain.newKernel, &Metadata{ Name: "kernel", Description: "the generic Rosa OS linux kernel", Website: "https://kernel.org/", @@ -1293,9 +1287,7 @@ cc -o /work/system/bin/gen_init_cpio /usr/src/linux/usr/gen_init_cpio.c `, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newGenInitCPIO, - + native.mustRegister(Toolchain.newGenInitCPIO, &Metadata{ Name: "gen_init_cpio", Description: "a program in the kernel source tree for creating initramfs archive", }) @@ -1340,9 +1332,7 @@ func (t Toolchain) newFirmware() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFirmware, - + native.mustRegister(Toolchain.newFirmware, &Metadata{ Name: "firmware", Description: "firmware blobs for use with the Linux kernel", Website: "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/", diff --git a/internal/rosa/kmod.go b/internal/rosa/kmod.go index 0009f3e7..7166eceb 100644 --- a/internal/rosa/kmod.go +++ b/internal/rosa/kmod.go @@ -32,9 +32,7 @@ func (t Toolchain) newKmod() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newKmod, - + native.mustRegister(Toolchain.newKmod, &Metadata{ Name: "kmod", Description: "a set of tools to handle common tasks with Linux kernel modules", Website: "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git", diff --git a/internal/rosa/libarchive.go b/internal/rosa/libarchive.go index 1cb35c6a..d79f1282 100644 --- a/internal/rosa/libarchive.go +++ b/internal/rosa/libarchive.go @@ -88,9 +88,7 @@ install -Dv /usr/src/CTestCustom.cmake /cure/ }, (*CMakeHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibarchive, - + native.mustRegister(Toolchain.newLibarchive, &Metadata{ Name: "libarchive", Description: "multi-format archive and compression library", Website: "https://www.libarchive.org/", diff --git a/internal/rosa/libbsd.go b/internal/rosa/libbsd.go index 20d74b7c..a1b1ff84 100644 --- a/internal/rosa/libbsd.go +++ b/internal/rosa/libbsd.go @@ -21,9 +21,7 @@ install -D /usr/src/libmd/src/helper.c src/helper.c ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibmd, - + native.mustRegister(Toolchain.newLibmd, &Metadata{ Name: "libmd", Description: "Message Digest functions from BSD systems", Website: "https://www.hadrons.org/software/libmd/", @@ -50,9 +48,7 @@ func (t Toolchain) newLibbsd() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibbsd, - + native.mustRegister(Toolchain.newLibbsd, &Metadata{ Name: "libbsd", Description: "provides useful functions commonly found on BSD systems", Website: "https://libbsd.freedesktop.org/", diff --git a/internal/rosa/libcap.go b/internal/rosa/libcap.go index 480b8b96..5c1a0123 100644 --- a/internal/rosa/libcap.go +++ b/internal/rosa/libcap.go @@ -42,9 +42,7 @@ ln -s ../system/bin/bash /bin/ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibcap, - + native.mustRegister(Toolchain.newLibcap, &Metadata{ Name: "libcap", Description: "a library for getting and setting POSIX.1e draft 15 capabilities", Website: "https://sites.google.com/site/fullycapable/", diff --git a/internal/rosa/libconfig.go b/internal/rosa/libconfig.go index 63e55cb7..dfe2c6fc 100644 --- a/internal/rosa/libconfig.go +++ b/internal/rosa/libconfig.go @@ -38,9 +38,7 @@ index eba7eae..f916d2e 100644 }, (*CMakeHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibconfig, - + native.mustRegister(Toolchain.newLibconfig, &Metadata{ Name: "libconfig", Description: "a simple library for processing structured configuration files", Website: "https://hyperrealm.github.io/libconfig/", diff --git a/internal/rosa/libdisplay-info.go b/internal/rosa/libdisplay-info.go index db059bc8..4a4d17bf 100644 --- a/internal/rosa/libdisplay-info.go +++ b/internal/rosa/libdisplay-info.go @@ -18,9 +18,7 @@ func (t Toolchain) newLibdisplayInfo() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibdisplayInfo, - + native.mustRegister(Toolchain.newLibdisplayInfo, &Metadata{ Name: "libdisplay-info", Description: "EDID and DisplayID library", Website: "https://gitlab.freedesktop.org/emersion/libdisplay-info", diff --git a/internal/rosa/libepoxy.go b/internal/rosa/libepoxy.go index e9fbc2b7..1704e5a4 100644 --- a/internal/rosa/libepoxy.go +++ b/internal/rosa/libepoxy.go @@ -21,9 +21,7 @@ func (t Toolchain) newLibepoxy() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibepoxy, - + native.mustRegister(Toolchain.newLibepoxy, &Metadata{ Name: "libepoxy", Description: "a library for handling OpenGL function pointer management", Website: "https://github.com/anholt/libepoxy", diff --git a/internal/rosa/libev.go b/internal/rosa/libev.go index 2d661bc9..6015382a 100644 --- a/internal/rosa/libev.go +++ b/internal/rosa/libev.go @@ -14,9 +14,7 @@ func (t Toolchain) newLibev() (pkg.Artifact, string) { ), nil, (*MakeHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibev, - + native.mustRegister(Toolchain.newLibev, &Metadata{ Name: "libev", Description: "a full-featured and high-performance event loop", Website: "http://libev.schmorp.de/", diff --git a/internal/rosa/libexpat.go b/internal/rosa/libexpat.go index 99bb626e..1f1f9225 100644 --- a/internal/rosa/libexpat.go +++ b/internal/rosa/libexpat.go @@ -22,9 +22,7 @@ func (t Toolchain) newLibexpat() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibexpat, - + native.mustRegister(Toolchain.newLibexpat, &Metadata{ Name: "libexpat", Description: "a stream-oriented XML parser library", Website: "https://libexpat.github.io/", diff --git a/internal/rosa/libffi.go b/internal/rosa/libffi.go index 21054c4b..01a70b5e 100644 --- a/internal/rosa/libffi.go +++ b/internal/rosa/libffi.go @@ -18,9 +18,7 @@ func (t Toolchain) newLibffi() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibffi, - + native.mustRegister(Toolchain.newLibffi, &Metadata{ Name: "libffi", Description: "a portable, high level programming interface to various calling conventions", Website: "https://sourceware.org/libffi/", diff --git a/internal/rosa/libgd.go b/internal/rosa/libgd.go index 575a7582..98ce0083 100644 --- a/internal/rosa/libgd.go +++ b/internal/rosa/libgd.go @@ -24,9 +24,7 @@ mkdir /dev/shm/gd ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibgd, - + native.mustRegister(Toolchain.newLibgd, &Metadata{ Name: "libgd", Description: "an open source code library for the dynamic creation of images", Website: "https://libgd.github.io/", diff --git a/internal/rosa/libpng.go b/internal/rosa/libpng.go index ab4c0033..2d0807ba 100644 --- a/internal/rosa/libpng.go +++ b/internal/rosa/libpng.go @@ -22,9 +22,7 @@ func (t Toolchain) newLibpng() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibpng, - + native.mustRegister(Toolchain.newLibpng, &Metadata{ Name: "libpng", Description: "the official PNG reference library", Website: "https://www.libpng.org/pub/png/libpng.html", diff --git a/internal/rosa/libpsl.go b/internal/rosa/libpsl.go index e5001063..69fff34b 100644 --- a/internal/rosa/libpsl.go +++ b/internal/rosa/libpsl.go @@ -25,9 +25,7 @@ test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibpsl, - + native.mustRegister(Toolchain.newLibpsl, &Metadata{ Name: "libpsl", Description: "provides functions to work with the Mozilla Public Suffix List", Website: "https://rockdaboot.github.io/libpsl/", diff --git a/internal/rosa/libseccomp.go b/internal/rosa/libseccomp.go index dac1b8e7..5cf0154a 100644 --- a/internal/rosa/libseccomp.go +++ b/internal/rosa/libseccomp.go @@ -43,9 +43,7 @@ index adccef3..65a277a 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibseccomp, - + native.mustRegister(Toolchain.newLibseccomp, &Metadata{ Name: "libseccomp", Description: "an interface to the Linux Kernel's syscall filtering mechanism", Website: "https://github.com/seccomp/libseccomp/", diff --git a/internal/rosa/libtirpc.go b/internal/rosa/libtirpc.go index 89503753..3cba7c9d 100644 --- a/internal/rosa/libtirpc.go +++ b/internal/rosa/libtirpc.go @@ -32,9 +32,7 @@ func (t Toolchain) newLibtirpc() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibtirpc, - + native.mustRegister(Toolchain.newLibtirpc, &Metadata{ Name: "libtirpc", Description: "a port of Suns Transport-Independent RPC library to Linux", Website: "https://sourceforge.net/projects/libtirpc/", diff --git a/internal/rosa/libucontext.go b/internal/rosa/libucontext.go index 83096ef8..d693cb12 100644 --- a/internal/rosa/libucontext.go +++ b/internal/rosa/libucontext.go @@ -27,9 +27,7 @@ func (t Toolchain) newLibucontext() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibucontext, - + native.mustRegister(Toolchain.newLibucontext, &Metadata{ Name: "libucontext", Description: "ucontext implementation featuring glibc-compatible ABI", Website: "https://github.com/kaniini/libucontext/", diff --git a/internal/rosa/libxml2.go b/internal/rosa/libxml2.go index 9e6b5248..80ad9430 100644 --- a/internal/rosa/libxml2.go +++ b/internal/rosa/libxml2.go @@ -20,9 +20,7 @@ func (t Toolchain) newLibxml2() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxml2, - + native.mustRegister(Toolchain.newLibxml2, &Metadata{ Name: "libxml2", Description: "an XML toolkit implemented in C", Website: "https://gitlab.gnome.org/GNOME/libxml2/", diff --git a/internal/rosa/libxslt.go b/internal/rosa/libxslt.go index f3315032..0161b2da 100644 --- a/internal/rosa/libxslt.go +++ b/internal/rosa/libxslt.go @@ -26,9 +26,7 @@ func (t Toolchain) newLibxslt() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxslt, - + native.mustRegister(Toolchain.newLibxslt, &Metadata{ Name: "libxslt", Description: "an XSLT processor based on libxml2", Website: "https://gitlab.gnome.org/GNOME/libxslt/", diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index ccc8ee8c..0758183e 100644 --- a/internal/rosa/llvm.go +++ b/internal/rosa/llvm.go @@ -29,42 +29,52 @@ func litArgs(verbose bool, skipChecks ...string) string { return "'" + strings.Join(args, " ") + "'" } -func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) { - source, version := t.Load(llvmSource) - major, _, _ := strings.Cut(version, ".") - return t.NewPackage("early-compiler-rt", version, source, &PackageAttr{ - Flag: TExclusive, - }, &CMakeHelper{ - Append: []string{"compiler-rt"}, +func init() { + native.MustRegister("early-compiler-rt", func(t Toolchain) (*Metadata, pkg.Artifact) { + meta := Metadata{ + Name: "early-compiler-rt", + Description: "early LLVM runtime: compiler-rt", - Cache: []KV{ - {"ENABLE_LINKER_BUILD_ID", "ON"}, + Dependencies: P{ + Musl, + }, + } + _meta, source := t.MustLoad(llvmSource) + meta.Version = _meta.Version + major, _, _ := strings.Cut(meta.Version, ".") + return &meta, t.NewPackage("early-compiler-rt", meta.Version, source, &PackageAttr{ + Flag: TExclusive, + }, &CMakeHelper{ + Append: []string{"compiler-rt"}, - // libc++ not yet available - {"CMAKE_CXX_COMPILER_TARGET", ""}, + Cache: []KV{ + {"ENABLE_LINKER_BUILD_ID", "ON"}, - {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, - {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, - {"LLVM_ENABLE_RTTI", "ON"}, - {"LLVM_BUILD_LLVM_DYLIB", "ON"}, - {"LLVM_LINK_LLVM_DYLIB", "ON"}, - {"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"}, + // libc++ not yet available + {"CMAKE_CXX_COMPILER_TARGET", ""}, - {"COMPILER_RT_BUILD_BUILTINS", "ON"}, - {"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"}, - {"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"}, - {"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"}, - {"COMPILER_RT_BUILD_GWP_ASAN", "OFF"}, + {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_ENABLE_RTTI", "ON"}, + {"LLVM_BUILD_LLVM_DYLIB", "ON"}, + {"LLVM_LINK_LLVM_DYLIB", "ON"}, + {"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"}, - // does not work without libunwind - {"COMPILER_RT_BUILD_CTX_PROFILE", "OFF"}, - {"COMPILER_RT_BUILD_LIBFUZZER", "OFF"}, - {"COMPILER_RT_BUILD_MEMPROF", "OFF"}, - {"COMPILER_RT_BUILD_PROFILE", "OFF"}, - {"COMPILER_RT_BUILD_XRAY", "OFF"}, - }, - SkipTest: true, - Script: ` + {"COMPILER_RT_BUILD_BUILTINS", "ON"}, + {"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"}, + {"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"}, + {"COMPILER_RT_SANITIZERS_TO_BUILD", "asan"}, + {"COMPILER_RT_BUILD_GWP_ASAN", "OFF"}, + + // does not work without libunwind + {"COMPILER_RT_BUILD_CTX_PROFILE", "OFF"}, + {"COMPILER_RT_BUILD_LIBFUZZER", "OFF"}, + {"COMPILER_RT_BUILD_MEMPROF", "OFF"}, + {"COMPILER_RT_BUILD_PROFILE", "OFF"}, + {"COMPILER_RT_BUILD_XRAY", "OFF"}, + }, + SkipTest: true, + Script: ` mkdir -p "/work/system/lib/clang/` + major + `/lib/" ln -s \ "../../../${ROSA_TRIPLE}" \ @@ -77,223 +87,242 @@ ln -s \ "clang_rt.crtend-` + t.linuxArch() + `.o" \ "/work/system/lib/${ROSA_TRIPLE}/crtendS.o" `, - }, - Python, - - muslHeaders, - KernelHeaders, - ), version -} -func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newEarlyCompilerRT, - - Name: "early-compiler-rt", - Description: "early LLVM runtime: compiler-rt", - - Dependencies: P{ - Musl, }, + Python, + + muslHeaders, + KernelHeaders, + ) }) -} -func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) { - source, version := t.Load(llvmSource) - return t.NewPackage("early-runtimes", version, source, &PackageAttr{ - Flag: TExclusive, - }, &CMakeHelper{ - Append: []string{"runtimes"}, + native.MustRegister("early-runtimes", func(t Toolchain) (*Metadata, pkg.Artifact) { + meta := Metadata{ + Name: "early-runtimes", + Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi", - Cache: []KV{ + Dependencies: P{ + earlyCompilerRT, + }, + } + _meta, source := t.MustLoad(llvmSource) + meta.Version = _meta.Version + + return &meta, t.NewPackage("early-runtimes", meta.Version, source, &PackageAttr{ + Flag: TExclusive, + }, &CMakeHelper{ + Append: []string{"runtimes"}, + + Cache: []KV{ + {"ENABLE_LINKER_BUILD_ID", "ON"}, + + // libc++ not yet available + {"CMAKE_CXX_COMPILER_WORKS", "ON"}, + + {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, + {"LLVM_ENABLE_RTTI", "ON"}, + {"LLVM_BUILD_LLVM_DYLIB", "ON"}, + {"LLVM_LINK_LLVM_DYLIB", "ON"}, + {"LLVM_ENABLE_RUNTIMES", "'libunwind;libcxx;libcxxabi'"}, + + {"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"}, + {"LIBUNWIND_USE_COMPILER_RT", "ON"}, + {"LIBCXX_HAS_MUSL_LIBC", "ON"}, + {"LIBCXX_USE_COMPILER_RT", "ON"}, + {"LIBCXX_CXX_ABI", "libcxxabi"}, + {"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"}, + {"LIBCXX_HARDENING_MODE", "fast"}, + {"LIBCXX_HAS_ATOMIC_LIB", "OFF"}, + {"LIBCXXABI_USE_COMPILER_RT", "ON"}, + {"LIBCXXABI_USE_LLVM_UNWINDER", "ON"}, + {"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"}, + {"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"}, + + {"LLVM_ENABLE_ZLIB", "FORCE_ON"}, + {"LLVM_ENABLE_ZSTD", "FORCE_ON"}, + {"LLVM_ENABLE_LIBXML2", "OFF"}, + }, + SkipTest: true, + }, + Python, + + Zlib, + Zstd, + earlyCompilerRT, + KernelHeaders, + ) + }) + + const ( + version = "22.1.5" + checksum = "32gOaLPHcUlo3hkdk5RbFumTE01XKeCAYZcpvn8IDHF95egXVfDFSl6eZL3ChMen" + ) + + native.MustRegister("llvm-project", func(t Toolchain) (*Metadata, pkg.Artifact) { + meta := Metadata{ + Name: "llvm-project", + Description: "LLVM monorepo with Rosa OS patches", + Version: version, + + ID: 1830, + } + return &meta, t.NewPatchedSource("llvm", version, newFromGitHub( + "llvm/llvm-project", + "llvmorg-"+version, + checksum, + ), true, llvmPatches...) + }) + + native.MustRegister("llvm", func(t Toolchain) (*Metadata, pkg.Artifact) { + meta := Metadata{ + Name: "llvm", + Description: "a collection of modular and reusable compiler and toolchain technologies", + Website: "https://llvm.org", + + Dependencies: P{ + Zlib, + Zstd, + Musl, + }, + } + _meta, source := t.MustLoad(llvmSource) + meta.Version = _meta.Version + + early := muslHeaders + if t.stage.isStage0() { + // The LLVM build system uses the system installation when building with + // LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using + // the just-built toolchain. This is unacceptable in stage0 due to the + // potential version difference. Later stages bootstrap off of runtimes + // of its previous stage via 3-stage determinism. + early = earlyRuntimes + } + + cache := []KV{ {"ENABLE_LINKER_BUILD_ID", "ON"}, - - // libc++ not yet available - {"CMAKE_CXX_COMPILER_WORKS", "ON"}, + {"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"}, + {"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"}, + {"COMPILER_RT_BUILD_GWP_ASAN", "OFF"}, + {"LIBCXX_CXX_ABI", "libcxxabi"}, + {"LIBCXX_USE_COMPILER_RT", "ON"}, + {"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"}, + {"LIBCXX_HAS_MUSL_LIBC", "ON"}, + {"LIBCXX_HARDENING_MODE", "fast"}, + {"LIBCXXABI_USE_LLVM_UNWINDER", "ON"}, + {"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"}, + {"LIBCXXABI_USE_COMPILER_RT", "ON"}, + {"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"}, + {"LLVM_INSTALL_UTILS", "ON"}, + {"LLVM_BUILD_LLVM_DYLIB", "ON"}, + {"LLVM_LINK_LLVM_DYLIB", "ON"}, + {"LLVM_APPEND_VC_REV", "OFF"}, + {"LLVM_ENABLE_RTTI", "ON"}, + {"LLVM_ENABLE_ZLIB", "FORCE_ON"}, + {"LLVM_ENABLE_ZSTD", "FORCE_ON"}, + {"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"}, + {"LLVM_INCLUDE_BENCHMARKS", "OFF"}, + {"CLANG_DEFAULT_RTLIB", "compiler-rt"}, + {"CLANG_DEFAULT_UNWINDLIB", "libunwind"}, + {"CLANG_DEFAULT_CXX_STDLIB", "libc++"}, + {"CLANG_CONFIG_FILE_SYSTEM_DIR", "/system/etc/clang"}, + {"LLVM_ENABLE_FFI", "OFF"}, + {"LLVM_ENABLE_LIBXML2", "OFF"}, + {"LLVM_ENABLE_LIBCXX", "ON"}, + {"LLVM_ENABLE_LLD", "ON"}, + {"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"}, + {"LIBUNWIND_USE_COMPILER_RT", "ON"}, {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, - {"LLVM_ENABLE_RTTI", "ON"}, - {"LLVM_BUILD_LLVM_DYLIB", "ON"}, - {"LLVM_LINK_LLVM_DYLIB", "ON"}, - {"LLVM_ENABLE_RUNTIMES", "'libunwind;libcxx;libcxxabi'"}, - - {"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"}, - {"LIBUNWIND_USE_COMPILER_RT", "ON"}, - {"LIBCXX_HAS_MUSL_LIBC", "ON"}, - {"LIBCXX_USE_COMPILER_RT", "ON"}, - {"LIBCXX_CXX_ABI", "libcxxabi"}, - {"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"}, - {"LIBCXX_HARDENING_MODE", "fast"}, - {"LIBCXX_HAS_ATOMIC_LIB", "OFF"}, - {"LIBCXXABI_USE_COMPILER_RT", "ON"}, - {"LIBCXXABI_USE_LLVM_UNWINDER", "ON"}, - {"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"}, - {"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"}, - - {"LLVM_ENABLE_ZLIB", "FORCE_ON"}, - {"LLVM_ENABLE_ZSTD", "FORCE_ON"}, - {"LLVM_ENABLE_LIBXML2", "OFF"}, - }, - SkipTest: true, - }, - Python, - - Zlib, - Zstd, - earlyCompilerRT, - KernelHeaders, - ), version -} -func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newEarlyRuntimes, - - Name: "early-runtimes", - Description: "early LLVM runtimes: libunwind, libcxx, libcxxabi", - - Dependencies: P{ - earlyCompilerRT, - }, - }) -} - -func (t Toolchain) newLLVM() (pkg.Artifact, string) { - early := muslHeaders - if t.stage.isStage0() { - // The LLVM build system uses the system installation when building with - // LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using - // the just-built toolchain. This is unacceptable in stage0 due to the - // potential version difference. Later stages bootstrap off of runtimes - // of its previous stage via 3-stage determinism. - early = earlyRuntimes - } - - cache := []KV{ - {"ENABLE_LINKER_BUILD_ID", "ON"}, - {"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"}, - {"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"}, - {"COMPILER_RT_BUILD_GWP_ASAN", "OFF"}, - {"LIBCXX_CXX_ABI", "libcxxabi"}, - {"LIBCXX_USE_COMPILER_RT", "ON"}, - {"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"}, - {"LIBCXX_HAS_MUSL_LIBC", "ON"}, - {"LIBCXX_HARDENING_MODE", "fast"}, - {"LIBCXXABI_USE_LLVM_UNWINDER", "ON"}, - {"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"}, - {"LIBCXXABI_USE_COMPILER_RT", "ON"}, - {"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"}, - {"LLVM_INSTALL_UTILS", "ON"}, - {"LLVM_BUILD_LLVM_DYLIB", "ON"}, - {"LLVM_LINK_LLVM_DYLIB", "ON"}, - {"LLVM_APPEND_VC_REV", "OFF"}, - {"LLVM_ENABLE_RTTI", "ON"}, - {"LLVM_ENABLE_ZLIB", "FORCE_ON"}, - {"LLVM_ENABLE_ZSTD", "FORCE_ON"}, - {"LLVM_ENABLE_PER_TARGET_RUNTIME_DIR", "ON"}, - {"LLVM_INCLUDE_BENCHMARKS", "OFF"}, - {"CLANG_DEFAULT_RTLIB", "compiler-rt"}, - {"CLANG_DEFAULT_UNWINDLIB", "libunwind"}, - {"CLANG_DEFAULT_CXX_STDLIB", "libc++"}, - {"CLANG_CONFIG_FILE_SYSTEM_DIR", "/system/etc/clang"}, - {"LLVM_ENABLE_FFI", "OFF"}, - {"LLVM_ENABLE_LIBXML2", "OFF"}, - {"LLVM_ENABLE_LIBCXX", "ON"}, - {"LLVM_ENABLE_LLD", "ON"}, - {"LIBUNWIND_ENABLE_ASSERTIONS", "OFF"}, - {"LIBUNWIND_USE_COMPILER_RT", "ON"}, - - {"LLVM_HOST_TRIPLE", `"${ROSA_TRIPLE}"`}, - {"LLVM_DEFAULT_TARGET_TRIPLE", `"${ROSA_TRIPLE}"`}, - {"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{ - "clang", - "lld", - }, ";") + "'"}, - {"LLVM_ENABLE_RUNTIMES", "'" + strings.Join([]string{ - "compiler-rt", - "libcxx", - "libcxxabi", - "libunwind", - "libclc", - }, ";") + "'"}, - } - - if !t.stage.isStage0() { - skipChecks := []string{ - // expensive, pointless to run here - "benchmarks", - // LLVM ERROR: Tried to execute an unknown external function: roundevenf - "ExecutionEngine/Interpreter/intrinsics.ll", - // clang: deadlocks with LLVM_BUILD_LLVM_DYLIB - "crash-recovery-modules", - // clang: fatal error: '__config_site' file not found - "CodeGen/PowerPC/ppc-xmmintrin.c", - "CodeGen/PowerPC/ppc-mmintrin.c", - "CodeGen/PowerPC/ppc-emmintrin.c", - "CodeGen/PowerPC/ppc-pmmintrin.c", - "CodeGen/PowerPC/ppc-tmmintrin.c", - "CodeGen/PowerPC/ppc-smmintrin.c", - "CodeGenCUDA/amdgpu-alias-undef-symbols.cu", - // cxx: fails on musl - "close.dont-get-rid-of-buffer", - "re/re.traits", - "std/time", - "localization/locales", - "localization/locale.categories", - "selftest/dsl/dsl.sh.py", - "input.output/iostream.format", - "locale-specific_form", - // cxx: deadlocks - "std/thread/thread.jthread", - // unwind: fails on musl - "eh_frame_fde_pc_range", - } - switch t.arch { - case "arm64": - skipChecks = append(skipChecks, - // LLVM: intermittently crashes - "ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll", - // unwind: unexpectedly passes - "unwind_leaffunction", - ) + {"LLVM_ENABLE_PROJECTS", "'" + strings.Join([]string{ + "clang", + "lld", + }, ";") + "'"}, + {"LLVM_ENABLE_RUNTIMES", "'" + strings.Join([]string{ + "compiler-rt", + "libcxx", + "libcxxabi", + "libunwind", + "libclc", + }, ";") + "'"}, } - if t.opts&OptLLVMNoLTO == 0 { + if !t.stage.isStage0() { + skipChecks := []string{ + // expensive, pointless to run here + "benchmarks", + // LLVM ERROR: Tried to execute an unknown external function: roundevenf + "ExecutionEngine/Interpreter/intrinsics.ll", + // clang: deadlocks with LLVM_BUILD_LLVM_DYLIB + "crash-recovery-modules", + // clang: fatal error: '__config_site' file not found + "CodeGen/PowerPC/ppc-xmmintrin.c", + "CodeGen/PowerPC/ppc-mmintrin.c", + "CodeGen/PowerPC/ppc-emmintrin.c", + "CodeGen/PowerPC/ppc-pmmintrin.c", + "CodeGen/PowerPC/ppc-tmmintrin.c", + "CodeGen/PowerPC/ppc-smmintrin.c", + "CodeGenCUDA/amdgpu-alias-undef-symbols.cu", + // cxx: fails on musl + "close.dont-get-rid-of-buffer", + "re/re.traits", + "std/time", + "localization/locales", + "localization/locale.categories", + "selftest/dsl/dsl.sh.py", + "input.output/iostream.format", + "locale-specific_form", + // cxx: deadlocks + "std/thread/thread.jthread", + // unwind: fails on musl + "eh_frame_fde_pc_range", + } + switch t.arch { + case "arm64": + skipChecks = append(skipChecks, + // LLVM: intermittently crashes + "ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll", + // unwind: unexpectedly passes + "unwind_leaffunction", + ) + } + + if t.opts&OptLLVMNoLTO == 0 { + cache = append(cache, []KV{ + // very expensive + {"LLVM_ENABLE_LTO", "Thin"}, + }...) + } + cache = append(cache, []KV{ - // very expensive - {"LLVM_ENABLE_LTO", "Thin"}, + // symbols: clock_gettime, mallopt + {"COMPILER_RT_INCLUDE_TESTS", "OFF"}, + + {"LLVM_BUILD_TESTS", "ON"}, + {"LLVM_LIT_ARGS", litArgs(true, skipChecks...)}, }...) } - cache = append(cache, []KV{ - // symbols: clock_gettime, mallopt - {"COMPILER_RT_INCLUDE_TESTS", "OFF"}, + return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{ + Flag: TExclusive, + }, &CMakeHelper{ + Append: []string{"llvm"}, - {"LLVM_BUILD_TESTS", "ON"}, - {"LLVM_LIT_ARGS", litArgs(true, skipChecks...)}, - }...) - } - - source, version := t.Load(llvmSource) - return t.NewPackage("llvm", version, source, &PackageAttr{ - Flag: TExclusive, - }, &CMakeHelper{ - Append: []string{"llvm"}, - - Cache: cache, - Script: ` + Cache: cache, + Script: ` ln -s ld.lld /work/system/bin/ld ln -s clang /work/system/bin/cc ln -s clang /work/system/bin/cpp ln -s clang++ /work/system/bin/c++ `, - // LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system - // installation into test environment, and the tests end up testing the - // system installation instead. Tests are disabled on stage0 and relies - // on 3-stage determinism to test later stages. - SkipTest: t.stage.isStage0(), + // LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system + // installation into test environment, and the tests end up testing the + // system installation instead. Tests are disabled on stage0 and relies + // on 3-stage determinism to test later stages. + SkipTest: t.stage.isStage0(), - Test: ` + Test: ` chmod +w /bin && ln -s \ ../system/bin/chmod \ ../system/bin/mkdir \ @@ -303,53 +332,20 @@ chmod +w /bin && ln -s \ /bin ninja ` + jobsFlagE + ` check-all `, - }, - Python, - Perl, - Diffutils, - Bash, - Gawk, - Coreutils, - Findutils, - - Zlib, - Zstd, - early, - KernelHeaders, - ), version -} -func init() { - const ( - version = "22.1.5" - checksum = "32gOaLPHcUlo3hkdk5RbFumTE01XKeCAYZcpvn8IDHF95egXVfDFSl6eZL3ChMen" - ) - - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.NewPatchedSource("llvm", version, newFromGitHub( - "llvm/llvm-project", - "llvmorg-"+version, - checksum, - ), true, llvmPatches...), version }, + Python, + Perl, + Diffutils, + Bash, + Gawk, + Coreutils, + Findutils, - Name: "llvm-project", - Description: "LLVM monorepo with Rosa OS patches", - - ID: 1830, - }) - - native.MustRegister(&Artifact{ - f: Toolchain.newLLVM, - - Name: "llvm", - Description: "a collection of modular and reusable compiler and toolchain technologies", - Website: "https://llvm.org", - - Dependencies: P{ Zlib, Zstd, - Musl, - }, + early, + KernelHeaders, + ) + }) } diff --git a/internal/rosa/lm-sensors.go b/internal/rosa/lm-sensors.go index 32223434..6818f9f5 100644 --- a/internal/rosa/lm-sensors.go +++ b/internal/rosa/lm-sensors.go @@ -47,9 +47,7 @@ ln -s \ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLMSensors, - + native.mustRegister(Toolchain.newLMSensors, &Metadata{ Name: "lm_sensors", Description: "user-space support for hardware monitoring drivers", Website: "https://hwmon.wiki.kernel.org/lm_sensors", diff --git a/internal/rosa/make.go b/internal/rosa/make.go index 8f5295b0..5803150e 100644 --- a/internal/rosa/make.go +++ b/internal/rosa/make.go @@ -27,9 +27,7 @@ cd "$(mktemp -d)" ))), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMake, - + native.mustRegister(Toolchain.newMake, &Metadata{ Name: "make", Description: "a tool which controls the generation of executables and other non-source files", Website: "https://www.gnu.org/software/make/", diff --git a/internal/rosa/mesa.go b/internal/rosa/mesa.go index 58ca7c86..94cb120a 100644 --- a/internal/rosa/mesa.go +++ b/internal/rosa/mesa.go @@ -35,9 +35,7 @@ trap 'kill $XVFB_PID && wait $XVFB_PID' EXIT ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibglvnd, - + native.mustRegister(Toolchain.newLibglvnd, &Metadata{ Name: "libglvnd", Description: "The GL Vendor-Neutral Dispatch library", Website: "https://gitlab.freedesktop.org/glvnd/libglvnd", @@ -72,9 +70,7 @@ func (t Toolchain) newLibdrm() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibdrm, - + native.mustRegister(Toolchain.newLibdrm, &Metadata{ Name: "libdrm", Description: "a userspace library for accessing the DRM", Website: "https://dri.freedesktop.org/", @@ -111,9 +107,7 @@ func (t Toolchain) newLibva() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibva, - + native.mustRegister(Toolchain.newLibva, &Metadata{ Name: "libva", Description: "an implementation for VA-API (Video Acceleration API)", Website: "https://01.org/vaapi", @@ -238,9 +232,7 @@ func (t Toolchain) newMesa() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMesa, - + native.mustRegister(Toolchain.newMesa, &Metadata{ Name: "mesa", Description: "open source implementations of OpenGL, OpenGL ES, Vulkan, OpenCL, and more", Website: "https://mesa3d.org", diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go index 56c2abd8..8f56ba81 100644 --- a/internal/rosa/meson.go +++ b/internal/rosa/meson.go @@ -52,9 +52,7 @@ python3 ./run_project_tests.py \ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMeson, - + native.mustRegister(Toolchain.newMeson, &Metadata{ Name: "meson", Description: "an open source build system", Website: "https://mesonbuild.com/", diff --git a/internal/rosa/mksh.go b/internal/rosa/mksh.go index 0457fd52..26392d6c 100644 --- a/internal/rosa/mksh.go +++ b/internal/rosa/mksh.go @@ -36,9 +36,7 @@ ln -vs ../system/bin/sh /work/bin/ ))), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMksh, - + native.mustRegister(Toolchain.newMksh, &Metadata{ Name: "mksh", Description: "MirBSD Korn Shell", Website: "https://www.mirbsd.org/mksh", diff --git a/internal/rosa/musl-fts.go b/internal/rosa/musl-fts.go index aa1ffaa1..a5b38a21 100644 --- a/internal/rosa/musl-fts.go +++ b/internal/rosa/musl-fts.go @@ -24,9 +24,7 @@ func (t Toolchain) newMuslFts() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMuslFts, - + native.mustRegister(Toolchain.newMuslFts, &Metadata{ Name: "musl-fts", Description: "implementation of fts(3) functions which are missing in musl libc", Website: "https://github.com/void-linux/musl-fts", diff --git a/internal/rosa/musl-obstack.go b/internal/rosa/musl-obstack.go index 4b019b6a..dfa168a8 100644 --- a/internal/rosa/musl-obstack.go +++ b/internal/rosa/musl-obstack.go @@ -24,9 +24,7 @@ func (t Toolchain) newMuslObstack() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newMuslObstack, - + native.mustRegister(Toolchain.newMuslObstack, &Metadata{ Name: "musl-obstack", Description: "obstack functions and macros separated from glibc", Website: "https://github.com/void-linux/musl-obstack", diff --git a/internal/rosa/musl.go b/internal/rosa/musl.go index b57c185c..191a63e5 100644 --- a/internal/rosa/musl.go +++ b/internal/rosa/musl.go @@ -75,11 +75,9 @@ index 715948f4..c2fece68 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newMusl(false) - }, - + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.newMusl(false) + }, &Metadata{ Name: "musl", Description: "an implementation of the C standard library", Website: "https://musl.libc.org/", @@ -87,11 +85,9 @@ func init() { ID: 11688, }) - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newMusl(true) - }, - + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.newMusl(true) + }, &Metadata{ Name: "musl-headers", Description: "system installation of musl headers", }) diff --git a/internal/rosa/ncurses.go b/internal/rosa/ncurses.go index da819c0e..be75dd14 100644 --- a/internal/rosa/ncurses.go +++ b/internal/rosa/ncurses.go @@ -26,9 +26,7 @@ func (t Toolchain) newNcurses() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNcurses, - + native.mustRegister(Toolchain.newNcurses, &Metadata{ Name: "ncurses", Description: "a free software emulation of curses in System V Release 4.0 (SVr4)", Website: "https://invisible-island.net/ncurses/", diff --git a/internal/rosa/netfilter.go b/internal/rosa/netfilter.go index f8cb68d2..4ac70878 100644 --- a/internal/rosa/netfilter.go +++ b/internal/rosa/netfilter.go @@ -39,9 +39,7 @@ index d223ac2..a7878d0 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibmnl, - + native.mustRegister(Toolchain.newLibmnl, &Metadata{ Name: "libmnl", Description: "a minimalistic user-space library oriented to Netlink developers", Website: "https://www.netfilter.org/projects/libmnl/", @@ -77,9 +75,7 @@ func (t Toolchain) newLibnftnl() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibnftnl, - + native.mustRegister(Toolchain.newLibnftnl, &Metadata{ Name: "libnftnl", Description: "a userspace library providing a low-level netlink API to the in-kernel nf_tables subsystem", Website: "https://www.netfilter.org/projects/libnftnl/", @@ -131,9 +127,7 @@ chmod +w /etc/ && ln -s ../usr/src/iptables/etc/ethertypes /etc/ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newIPTables, - + native.mustRegister(Toolchain.newIPTables, &Metadata{ Name: "iptables", Description: "the userspace command line program used to configure the Linux 2.4.x and later packet filtering ruleset", Website: "https://www.netfilter.org/projects/iptables/", diff --git a/internal/rosa/nettle.go b/internal/rosa/nettle.go index 87425884..e65942b4 100644 --- a/internal/rosa/nettle.go +++ b/internal/rosa/nettle.go @@ -19,9 +19,7 @@ func (t Toolchain) newNettle() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNettle, - + native.mustRegister(Toolchain.newNettle, &Metadata{ Name: "nettle", Description: "a low-level cryptographic library", Website: "https://www.lysator.liu.se/~nisse/nettle/", diff --git a/internal/rosa/nettle3.go b/internal/rosa/nettle3.go index 05164b2a..3a841992 100644 --- a/internal/rosa/nettle3.go +++ b/internal/rosa/nettle3.go @@ -19,9 +19,7 @@ func (t Toolchain) newNettle3() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNettle3, - + native.mustRegister(Toolchain.newNettle3, &Metadata{ Name: "nettle3", Description: "a low-level cryptographic library", Website: "https://www.lysator.liu.se/~nisse/nettle/", diff --git a/internal/rosa/ninja.go b/internal/rosa/ninja.go index d34d7841..1040219c 100644 --- a/internal/rosa/ninja.go +++ b/internal/rosa/ninja.go @@ -7,8 +7,8 @@ func (t Toolchain) newNinja() (pkg.Artifact, string) { version = "1.13.2" checksum = "ygKWMa0YV2lWKiFro5hnL-vcKbc_-RACZuPu0Io8qDvgQlZ0dxv7hPNSFkt4214v" ) - python, _ := t.Load(Python) - bash, _ := t.Load(Bash) + _, python := t.Load(Python) + _, bash := t.Load(Bash) return t.New("ninja-"+version, 0, []pkg.Artifact{ python, bash, @@ -39,9 +39,7 @@ cp ninja /work/system/bin/ ))), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNinja, - + native.mustRegister(Toolchain.newNinja, &Metadata{ Name: "ninja", Description: "a small build system with a focus on speed", Website: "https://ninja-build.org/", diff --git a/internal/rosa/nss.go b/internal/rosa/nss.go index dba39c94..5fccab7e 100644 --- a/internal/rosa/nss.go +++ b/internal/rosa/nss.go @@ -67,9 +67,7 @@ cp -r \ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNSS, - + native.mustRegister(Toolchain.newNSS, &Metadata{ Name: "nss", Description: "Network Security Services", Website: "https://firefox-source-docs.mozilla.org/security/nss/index.html", @@ -120,9 +118,7 @@ buildcatrust \ `), Unversioned } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newNSSCACert, - + native.mustRegister(Toolchain.newNSSCACert, &Metadata{ Name: "nss-cacert", Description: "bundle of X.509 certificates of public Certificate Authorities", Website: "https://curl.se/docs/caextract.html", diff --git a/internal/rosa/openssl.go b/internal/rosa/openssl.go index 5b8bb442..b0e2d01d 100644 --- a/internal/rosa/openssl.go +++ b/internal/rosa/openssl.go @@ -40,9 +40,7 @@ func (t Toolchain) newOpenSSL() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newOpenSSL, - + native.mustRegister(Toolchain.newOpenSSL, &Metadata{ Name: "openssl", Description: "TLS/SSL and crypto library", Website: "https://www.openssl.org/", diff --git a/internal/rosa/p11.go b/internal/rosa/p11.go index b0853f9d..985714a7 100644 --- a/internal/rosa/p11.go +++ b/internal/rosa/p11.go @@ -23,9 +23,7 @@ func (t Toolchain) newP11Kit() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newP11Kit, - + native.mustRegister(Toolchain.newP11Kit, &Metadata{ Name: "p11-kit", Description: "provides a way to load and enumerate PKCS#11 modules", Website: "https://p11-glue.freedesktop.org/p11-kit.html", diff --git a/internal/rosa/pcre2.go b/internal/rosa/pcre2.go index 65de62d2..c2c41ac8 100644 --- a/internal/rosa/pcre2.go +++ b/internal/rosa/pcre2.go @@ -32,9 +32,7 @@ ln -s ../system/bin/toybox /bin/echo ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPCRE2, - + native.mustRegister(Toolchain.newPCRE2, &Metadata{ Name: "pcre2", Description: "a set of C functions that implement regular expression pattern matching", Website: "https://pcre2project.github.io/pcre2/", diff --git a/internal/rosa/perl.go b/internal/rosa/perl.go index 4eb9ba1e..204022aa 100644 --- a/internal/rosa/perl.go +++ b/internal/rosa/perl.go @@ -50,9 +50,7 @@ chmod +w /system/bin && rm -f /system/bin/ps # perl does not like toybox ps }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerl, - + native.mustRegister(Toolchain.newPerl, &Metadata{ Name: "perl", Description: "The Perl Programming language", Website: "https://www.perl.org/", @@ -100,9 +98,7 @@ func (t Toolchain) newPerlModuleBuild() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlModuleBuild, - + native.mustRegister(Toolchain.newPerlModuleBuild, &Metadata{ Name: "perl-Module::Build", Description: "build and install Perl modules", Website: "https://metacpan.org/release/Module-Build", @@ -154,9 +150,7 @@ func (t Toolchain) newPerlLocaleGettext() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlLocaleGettext, - + native.mustRegister(Toolchain.newPerlLocaleGettext, &Metadata{ Name: "perl-Locale::gettext", Description: "message handling functions", Website: "https://metacpan.org/release/Locale-gettext", @@ -178,9 +172,7 @@ func (t Toolchain) newPerlPodParser() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlPodParser, - + native.mustRegister(Toolchain.newPerlPodParser, &Metadata{ Name: "perl-Pod::Parser", Description: "base class for creating POD filters and translators", Website: "https://metacpan.org/release/Pod-Parser", @@ -202,9 +194,7 @@ func (t Toolchain) newPerlSGMLS() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlSGMLS, - + native.mustRegister(Toolchain.newPerlSGMLS, &Metadata{ Name: "perl-SGMLS", Description: "class for postprocessing the output from the sgmls and nsgmls parsers", Website: "https://metacpan.org/release/RAAB/SGMLSpm-1.1", @@ -240,9 +230,7 @@ func (t Toolchain) newPerlTermReadKey() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlTermReadKey, - + native.mustRegister(Toolchain.newPerlTermReadKey, &Metadata{ Name: "perl-Term::ReadKey", Description: "a perl module for simple terminal control", Website: "https://metacpan.org/release/TermReadKey", @@ -264,9 +252,7 @@ func (t Toolchain) newPerlTextCharWidth() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlTextCharWidth, - + native.mustRegister(Toolchain.newPerlTextCharWidth, &Metadata{ Name: "perl-Text::CharWidth", Description: "get number of occupied columns of a string on terminal", Website: "https://metacpan.org/release/Text-CharWidth", @@ -290,9 +276,7 @@ func (t Toolchain) newPerlTextWrapI18N() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlTextWrapI18N, - + native.mustRegister(Toolchain.newPerlTextWrapI18N, &Metadata{ Name: "perl-Text::WrapI18N", Description: "line wrapping module", Website: "https://metacpan.org/release/Text-WrapI18N", @@ -318,9 +302,7 @@ func (t Toolchain) newPerlMIMECharset() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlMIMECharset, - + native.mustRegister(Toolchain.newPerlMIMECharset, &Metadata{ Name: "perl-MIME::Charset", Description: "Charset Information for MIME", Website: "https://metacpan.org/release/MIME-Charset", @@ -344,9 +326,7 @@ func (t Toolchain) newPerlUnicodeLineBreak() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlUnicodeLineBreak, - + native.mustRegister(Toolchain.newPerlUnicodeLineBreak, &Metadata{ Name: "perl-Unicode::LineBreak", Description: "String as Sequence of UAX #29 Grapheme Clusters", Website: "https://metacpan.org/release/Unicode-LineBreak", @@ -372,9 +352,7 @@ func (t Toolchain) newPerlYAMLTiny() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlYAMLTiny, - + native.mustRegister(Toolchain.newPerlYAMLTiny, &Metadata{ Name: "perl-YAML::Tiny", Description: "read/write YAML files with as little code as possible", Website: "https://metacpan.org/release/YAML-Tiny", @@ -396,9 +374,7 @@ func (t Toolchain) newPerlTestCmd() (pkg.Artifact, string) { ), nil), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPerlTestCmd, - + native.mustRegister(Toolchain.newPerlTestCmd, &Metadata{ Name: "perl-Test::Cmd", Description: "portable testing of commands and scripts", Website: "https://metacpan.org/release/Test-Cmd", diff --git a/internal/rosa/pixman.go b/internal/rosa/pixman.go index e1f792a1..4fe6d5df 100644 --- a/internal/rosa/pixman.go +++ b/internal/rosa/pixman.go @@ -19,9 +19,7 @@ func (t Toolchain) newPixman() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPixman, - + native.mustRegister(Toolchain.newPixman, &Metadata{ Name: "pixman", Description: "a low-level software library for pixel manipulation", Website: "https://pixman.org/", diff --git a/internal/rosa/pkg-config.go b/internal/rosa/pkg-config.go index e362715e..fec4b3cd 100644 --- a/internal/rosa/pkg-config.go +++ b/internal/rosa/pkg-config.go @@ -24,9 +24,7 @@ func (t Toolchain) newPkgConfig() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPkgConfig, - + native.mustRegister(Toolchain.newPkgConfig, &Metadata{ Name: "pkg-config", Description: "a helper tool used when compiling applications and libraries", Website: "https://pkgconfig.freedesktop.org/", diff --git a/internal/rosa/procps.go b/internal/rosa/procps.go index 73a2db8a..f4ad141a 100644 --- a/internal/rosa/procps.go +++ b/internal/rosa/procps.go @@ -27,9 +27,7 @@ func (t Toolchain) newProcps() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newProcps, - + native.mustRegister(Toolchain.newProcps, &Metadata{ Name: "procps", Description: "command line and full screen utilities for browsing procfs", Website: "https://gitlab.com/procps-ng/procps", diff --git a/internal/rosa/python.go b/internal/rosa/python.go index 93fe0d70..a9ec642a 100644 --- a/internal/rosa/python.go +++ b/internal/rosa/python.go @@ -88,9 +88,7 @@ index 19aea290b58..51603ba9510 100644 ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newPython, - + native.mustRegister(Toolchain.newPython, &Metadata{ Name: "python", Description: "the Python programming language interpreter", Website: "https://www.python.org/", @@ -200,15 +198,13 @@ func (s *S) newPythonPackage( build P, extra ...ArtifactH, ) { name = "python-" + name - s.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.NewPackage(name, version, source, attrP, attr, slices.Concat( - P{Python}, - extra, - build, - )...), version - }, - + s.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.NewPackage(name, version, source, attrP, attr, slices.Concat( + P{Python}, + extra, + build, + )...), version + }, &Metadata{ Name: name, Description: description, Website: website, @@ -352,18 +348,16 @@ func init() { } func init() { - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - source, version := t.Load(llvmSource) - return t.NewPackage("lit", version, source, nil, &PipHelper{ - Append: []string{"llvm", "utils", "lit"}, - // already checked during llvm - SkipCheck: true, - }, - PythonSetuptools, - ), version + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + meta, source := t.Load(llvmSource) + return t.NewPackage("lit", meta.Version, source, nil, &PipHelper{ + Append: []string{"llvm", "utils", "lit"}, + // already checked during llvm + SkipCheck: true, }, - + PythonSetuptools, + ), meta.Version + }, &Metadata{ Name: "lit", Description: "a portable tool for executing LLVM and Clang style test suites", Website: "https://llvm.org/docs/CommandGuide/lit.html", diff --git a/internal/rosa/qemu.go b/internal/rosa/qemu.go index 23b24087..fa7bac02 100644 --- a/internal/rosa/qemu.go +++ b/internal/rosa/qemu.go @@ -94,9 +94,7 @@ EOF ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newQEMU, - + native.mustRegister(Toolchain.newQEMU, &Metadata{ Name: "qemu", Description: "a generic and open source machine emulator and virtualizer", Website: "https://www.qemu.org/", diff --git a/internal/rosa/rdfind.go b/internal/rosa/rdfind.go index c4e51685..f77a9164 100644 --- a/internal/rosa/rdfind.go +++ b/internal/rosa/rdfind.go @@ -21,9 +21,7 @@ ln -s ../system/bin/toybox /bin/echo ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newRdfind, - + native.mustRegister(Toolchain.newRdfind, &Metadata{ Name: "rdfind", Description: "a program that finds duplicate files", Website: "https://rdfind.pauldreik.se/", diff --git a/internal/rosa/report.go b/internal/rosa/report.go index 1fbd0e43..29a74233 100644 --- a/internal/rosa/report.go +++ b/internal/rosa/report.go @@ -34,11 +34,10 @@ func WriteReport(msg message.Msg, w io.Writer, c *pkg.Cache) error { ) t := native.Std() for _, p := range native.Collect() { - meta := native.Get(p) + meta, a := t.MustLoad(p) if meta == nil { return errors.New("artifact " + p.String() + " in inconsistent state") } - a, _ := t.MustLoad(p) if _, ok := a.(pkg.FileArtifact); ok { msg.Verbosef("skipping file artifact %s", meta.Name) continue diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index b29fd605..dde85e00 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -249,7 +249,7 @@ func (t Toolchain) New( support = append(support, extra...) support = append(support, cureEtc{}) if t.stage == stageEarly { - a, _ := t.Load(stage0Dist) + _, a := t.MustLoad(stage0Dist) support = append(support, a) } else { support = append(support, t.S.New(_stageBusybox).New("gentoo", 0, nil, nil, nil, ` @@ -438,10 +438,11 @@ func (t Toolchain) appendHandle(a []pkg.Artifact, pv pa, p ArtifactH) []pkg.Arti } pv[p] = struct{}{} - for _, d := range t.MustGet(p).Dependencies { + meta, _ := t.MustLoad(p) + for _, d := range meta.Dependencies { a = t.appendHandle(a, pv, d) } - d, _ := t.Load(p) + _, d := t.MustLoad(p) return append(a, d) } diff --git a/internal/rosa/rosa_test.go b/internal/rosa/rosa_test.go index 5a80ba32..958cd506 100644 --- a/internal/rosa/rosa_test.go +++ b/internal/rosa/rosa_test.go @@ -78,9 +78,8 @@ func TestCureAll(t *testing.T) { t.Parallel() for _, p := range rosa.Native().Collect() { - a, _ := rosa.Native().Std().MustLoad(p) - meta := rosa.Native().MustGet(p) - t.Run(meta.Name, func(t *testing.T) { + _, a := rosa.Native().Std().MustLoad(p) + t.Run(p.String(), func(t *testing.T) { t.Parallel() if pathname, _, err := cache.Cure(a); err != nil { diff --git a/internal/rosa/rsync.go b/internal/rosa/rsync.go index 1f0f2ea4..0ea1096a 100644 --- a/internal/rosa/rsync.go +++ b/internal/rosa/rsync.go @@ -27,9 +27,7 @@ func (t Toolchain) newRsync() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newRsync, - + native.mustRegister(Toolchain.newRsync, &Metadata{ Name: "rsync", Description: "an open source utility that provides fast incremental file transfer", Website: "https://rsync.samba.org/", diff --git a/internal/rosa/squashfs.go b/internal/rosa/squashfs.go index afa33a2d..267dd3d3 100644 --- a/internal/rosa/squashfs.go +++ b/internal/rosa/squashfs.go @@ -42,9 +42,7 @@ func (t Toolchain) newSquashfsTools() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newSquashfsTools, - + native.mustRegister(Toolchain.newSquashfsTools, &Metadata{ Name: "squashfs-tools", Description: "tools to create and extract Squashfs filesystems", Website: "https://github.com/plougher/squashfs-tools", diff --git a/internal/rosa/stage0.go b/internal/rosa/stage0.go index 4197ffac..05335ab5 100644 --- a/internal/rosa/stage0.go +++ b/internal/rosa/stage0.go @@ -5,10 +5,16 @@ import ( "hakurei.app/internal/pkg" ) -func (t Toolchain) newStage0() (pkg.Artifact, string) { - return t.New("rosa-stage0", 0, t.Append(nil, - Bzip2, - ), nil, nil, ` +func init() { + meta := Metadata{ + Name: "rosa-stage0", + Description: "Rosa OS stage0 toolchain tarball for bootstrap", + Version: Unversioned, + } + native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + return &meta, t.New("rosa-stage0", 0, t.Append(nil, + Bzip2, + ), nil, nil, ` umask 377 tar \ -vjc \ @@ -16,38 +22,30 @@ tar \ -f /work/stage0-`+t.triple()+`.tar.bz2 \ . `, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.Append(nil, - LLVM, - Mksh, - toyboxEarly, - )...)), Unversioned -} -func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newStage0, - - Name: "rosa-stage0", - Description: "Rosa OS stage0 toolchain tarball for bootstrap", + LLVM, + Mksh, + toyboxEarly, + )...)) }) } func init() { - const version = "20260504" - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return newTar( - "https://hakurei.app/seed/"+version+"/"+ - "stage0-"+t.triple()+".tar.bz2", - perArch[string]{ - "amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk", - "arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH", - "riscv64": "Z2ODV0rIoo9iQRUIu35bsaOBeXc_9qQfGcyb2aGneatzNUJlXh5emSpEV2bOklUL", - }.unwrap(t.S), - pkg.TarBzip2, - ), version - }, - + meta := Metadata{ Name: "stage0-dist", Description: "Rosa OS stage0 bootstrap seed", + Version: "20260504", + } + native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + return &meta, newTar( + "https://hakurei.app/seed/"+meta.Version+"/"+ + "stage0-"+t.triple()+".tar.bz2", + perArch[string]{ + "amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk", + "arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH", + "riscv64": "Z2ODV0rIoo9iQRUIu35bsaOBeXc_9qQfGcyb2aGneatzNUJlXh5emSpEV2bOklUL", + }.unwrap(t.S), + pkg.TarBzip2, + ) }) } diff --git a/internal/rosa/state.go b/internal/rosa/state.go index efb51d96..c2f0650b 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -70,11 +70,9 @@ type ( // P represents multiple [ArtifactH]. type P []ArtifactH -// Artifact is stage-agnostic immutable data with a deterministic resulting -// [pkg.Artifact]. It can be created natively or through evaluation. -type Artifact struct { - f func(t Toolchain) (a pkg.Artifact, version string) - +// Metadata is stage-agnostic immutable data around [Artifact] not directly +// representable in the resulting [pkg.Artifact]. +type Metadata struct { // Unique package name. Name string `json:"name"` // Short user-facing description. @@ -85,6 +83,8 @@ type Artifact struct { // Runtime dependencies. Dependencies P `json:"dependencies"` + // Package version. + Version string `json:"version"` // Project identifier on [Anitya]. // // [Anitya]: https://release-monitoring.org/ @@ -98,7 +98,7 @@ type Artifact struct { } // GetLatest returns the latest version described by v. -func (meta *Artifact) GetLatest(v *Versions) string { +func (meta *Metadata) GetLatest(v *Versions) string { if meta.latest != nil { return meta.latest(v) } @@ -134,7 +134,7 @@ func (v *Versions) getStable() string { } // GetVersions returns versions fetched from Anitya. -func (meta *Artifact) GetVersions(ctx context.Context) (*Versions, error) { +func (meta *Metadata) GetVersions(ctx context.Context) (*Versions, error) { if meta.ID == 0 { return nil, UnpopulatedIDError{} } @@ -160,10 +160,13 @@ func (meta *Artifact) GetVersions(ctx context.Context) (*Versions, error) { return &v, errors.Join(err, resp.Body.Close()) } -// A cachedArtifact holds [pkg.Artifact] and its corresponding version string. +// Artifact is a lazily initialised [pkg.Artifact] with associated [Metadata]. +type Artifact func(t Toolchain) (meta *Metadata, a pkg.Artifact) + +// A cachedArtifact caches satisfied [Artifact]. type cachedArtifact struct { - a pkg.Artifact - v string + meta *Metadata + a pkg.Artifact } const ( @@ -242,20 +245,20 @@ func (s *S) DropCaches(targetArch string, flags int) { } } -// Get returns the address of the named [Artifact]. -func (s *S) Get(handle ArtifactH) (meta *Artifact) { +// get returns the named [Artifact]. +func (s *S) get(handle ArtifactH) (f Artifact) { s.wantsArch() v, ok := s.artifacts.Load(handle) if ok { - meta = v.(*Artifact) + f = v.(Artifact) } return } -// MustGet is like Get, but panics if the named [Artifact] is not registered. -func (s *S) MustGet(handle ArtifactH) (meta *Artifact) { - meta = s.Get(handle) - if meta == nil { +// mustGet is like get, but panics if the named [Artifact] is not registered. +func (s *S) mustGet(handle ArtifactH) (f Artifact) { + f = s.get(handle) + if f == nil { panic(HandleError(handle)) } return @@ -282,8 +285,8 @@ func (e LoadError) Error() string { return "cannot load " + strconv.Quote(e.Handle.String()) + ": " + e.Err.Error() } -// Load returns the resulting [pkg.Artifact] of [ArtifactH]. -func (t Toolchain) Load(handle ArtifactH) (pkg.Artifact, string) { +// Load satisfies an [Artifact] referred to by an [ArtifactH]. +func (t Toolchain) Load(handle ArtifactH) (*Metadata, pkg.Artifact) { defer func() { r := recover() if r == nil { @@ -305,36 +308,36 @@ func (t Toolchain) Load(handle ArtifactH) (pkg.Artifact, string) { e, ok := t.c[t.stage].Load(handle) if ok { r := e.(cachedArtifact) - return r.a, r.v + return r.meta, r.a } - meta := t.Get(handle) - if meta == nil { - return nil, "" + f := t.get(handle) + if f == nil { + return nil, nil } var r cachedArtifact - r.a, r.v = meta.f(t) + r.meta, r.a = f(t) t.c[t.stage].Store(handle, r) - return r.a, r.v + return r.meta, r.a } // MustLoad is like Load, but panics if the named [Artifact] is not registered. -func (t Toolchain) MustLoad(handle ArtifactH) (pkg.Artifact, string) { - a, version := t.Load(handle) - if a == nil { +func (t Toolchain) MustLoad(handle ArtifactH) (*Metadata, pkg.Artifact) { + meta, a := t.Load(handle) + if meta == nil { panic(HandleError(handle)) } - return a, version + return meta, a } // Register arranges for a new [Artifact] to be cured under s. It returns false // if another [Artifact] is already registered under the same name. -func (s *S) Register(meta *Artifact) bool { - if meta.Name == "" { +func (s *S) Register(name string, f Artifact) bool { + if name == "" { return false } - p := ArtifactH(unique.Make(meta.Name)) - _, ok := s.artifacts.LoadOrStore(p, meta) + p := ArtifactH(unique.Make(name)) + _, ok := s.artifacts.LoadOrStore(p, f) if !ok { s.artifactCount.Add(1) } @@ -346,16 +349,34 @@ func (s *S) Register(meta *Artifact) bool { type RegisterError ArtifactH func (e RegisterError) Error() string { + if ArtifactH(e).String() == "" { + return "attempting to register invalid name" + } return "attempting to register " + strconv.Quote(ArtifactH(e).String()) + " twice" } // MustRegister is like Register, but panics if registration fails. -func (s *S) MustRegister(meta *Artifact) { - if !s.Register(meta) { - panic(RegisterError(H(meta.Name))) +func (s *S) MustRegister(name string, f Artifact) { + if !s.Register(name, f) { + panic(RegisterError(H(name))) } } +// mustRegister registers an [Artifact] with the old function signature. +// +// Deprecated: Artifacts should be migrated to Register. +func (s *S) mustRegister( + f func(t Toolchain) (pkg.Artifact, string), + meta *Metadata, +) { + s.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) { + v := *meta + a, version := f(t) + v.Version = version + return &v, a + }) +} + // Count returns the number of [Artifact] registered to s. func (s *S) Count() int { return int(s.artifactCount.Load()) @@ -567,7 +588,7 @@ func (ctx *evalContext) f( return unique.Make(azalea.Ident(name)) } - meta := Artifact{Name: string(name)} + meta := Metadata{Name: string(name)} var ( attr PackageAttr patches []string @@ -575,7 +596,6 @@ func (ctx *evalContext) f( early bool anitya int64 - version string sourceA any helper Helper @@ -584,11 +604,9 @@ func (ctx *evalContext) f( 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("version"): &version, - k("source"): &sourceA, - k("writable"): &attr.Writable, k("chmod"): &attr.Chmod, k("enterSource"): &attr.EnterSource, @@ -598,6 +616,7 @@ func (ctx *evalContext) f( k("exclusive"): &excl, k("toyboxEarly"): &early, + k("source"): &sourceA, k("exec"): &helper, k("inputs"): &inputs, k("runtime"): &runtimes, @@ -630,7 +649,7 @@ func (ctx *evalContext) f( } meta.ID = int(anitya) - meta.f = func(t Toolchain) (pkg.Artifact, string) { + v = Artifact(func(t Toolchain) (*Metadata, pkg.Artifact) { var source pkg.Artifact switch p := sourceA.(type) { case pkg.Artifact: @@ -646,17 +665,15 @@ func (ctx *evalContext) f( }) } - return t.NewPackage( + return &meta, t.NewPackage( meta.Name, - version, + meta.Version, source, &attr, helper, inputsH..., - ), version - } - - v = meta + ) + }) set = true return } @@ -686,13 +703,13 @@ func (s *S) Evaluate(r io.Reader, b fs.FS) error { ctx := evalContext{b} for _, f := range pending { - meta, set, err := azalea.Evaluate[Artifact](ctx.f, s.getS(), *f) + lf, set, err := azalea.Evaluate[Artifact](ctx.f, s.getS(), *f) if err != nil { return err } else if !set { return errors.New("unexpected unset") } - if !s.Register(&meta) { + if !s.Register(string(f.Ident), lf) { return RegisterError(H(string(f.Ident))) } } diff --git a/internal/rosa/state_test.go b/internal/rosa/state_test.go index 8b01f7d3..ea4b7bf8 100644 --- a/internal/rosa/state_test.go +++ b/internal/rosa/state_test.go @@ -10,7 +10,7 @@ func TestLoad(t *testing.T) { t.Parallel() for _, p := range rosa.Native().Collect() { - t.Run(rosa.Native().MustGet(p).Name, func(t *testing.T) { + t.Run(p.String(), func(t *testing.T) { t.Parallel() rosa.Native().Std().MustLoad(p) diff --git a/internal/rosa/strace.go b/internal/rosa/strace.go index d4d99fcf..69851765 100644 --- a/internal/rosa/strace.go +++ b/internal/rosa/strace.go @@ -37,9 +37,7 @@ sed -i 's/unsigned int msg_len;$/uint32_t msg_len;/g' \ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newStrace, - + native.mustRegister(Toolchain.newStrace, &Metadata{ Name: "strace", Description: "a diagnostic, debugging and instructional userspace utility", Website: "https://strace.io/", diff --git a/internal/rosa/tamago.go b/internal/rosa/tamago.go index 4a5b5859..36818114 100644 --- a/internal/rosa/tamago.go +++ b/internal/rosa/tamago.go @@ -40,9 +40,7 @@ rm \ ))), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newTamaGo, - + native.mustRegister(Toolchain.newTamaGo, &Metadata{ Name: "tamago", Description: "a Go toolchain extended with support for bare metal execution", Website: "https://github.com/usbarmory/tamago-go", diff --git a/internal/rosa/toybox.go b/internal/rosa/toybox.go index cb97e8dc..a0e439f1 100644 --- a/internal/rosa/toybox.go +++ b/internal/rosa/toybox.go @@ -59,11 +59,9 @@ ln -s ../../system/bin/env /work/usr/bin ), version } func init() { - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newToybox("", "") - }, - + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.newToybox("", "") + }, &Metadata{ Name: "toybox", Description: "many common Linux command line utilities", Website: "https://landley.net/toybox/", @@ -71,9 +69,8 @@ func init() { ID: 13818, }) - native.MustRegister(&Artifact{ - f: func(t Toolchain) (pkg.Artifact, string) { - return t.newToybox("-early", ` + native.mustRegister(func(t Toolchain) (pkg.Artifact, string) { + return t.newToybox("-early", ` echo ' CONFIG_EXPR=y CONFIG_TR=y @@ -81,8 +78,7 @@ CONFIG_AWK=y CONFIG_DIFF=y ' >> .config `) - }, - + }, &Metadata{ Name: "toybox-early", Description: "a build of toybox with unfinished tools enabled to break dependency loops", Website: "https://landley.net/toybox/", diff --git a/internal/rosa/unzip.go b/internal/rosa/unzip.go index 888a36f5..f2e62028 100644 --- a/internal/rosa/unzip.go +++ b/internal/rosa/unzip.go @@ -32,9 +32,7 @@ mv unzip /work/system/bin/ ))), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newUnzip, - + native.mustRegister(Toolchain.newUnzip, &Metadata{ Name: "unzip", Description: "portable compression/archiver utilities", Website: "https://infozip.sourceforge.net/", diff --git a/internal/rosa/util-linux.go b/internal/rosa/util-linux.go index 54dff381..80ec9f7e 100644 --- a/internal/rosa/util-linux.go +++ b/internal/rosa/util-linux.go @@ -47,9 +47,7 @@ ln -s ../system/bin/bash /bin/ ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newUtilLinux, - + native.mustRegister(Toolchain.newUtilLinux, &Metadata{ Name: "util-linux", Description: "a random collection of Linux utilities", Website: "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git", diff --git a/internal/rosa/vim.go b/internal/rosa/vim.go index e29b8cc3..7c67ca81 100644 --- a/internal/rosa/vim.go +++ b/internal/rosa/vim.go @@ -29,9 +29,7 @@ func (t Toolchain) newVIM() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newVIM, - + native.mustRegister(Toolchain.newVIM, &Metadata{ Name: "vim", Description: "a greatly improved version of the good old UNIX editor Vi", Website: "https://www.vim.org", diff --git a/internal/rosa/wayland.go b/internal/rosa/wayland.go index c1207695..5b33214b 100644 --- a/internal/rosa/wayland.go +++ b/internal/rosa/wayland.go @@ -35,9 +35,7 @@ echo 'int main(){}' > tests/sanity-test.c ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newWayland, - + native.mustRegister(Toolchain.newWayland, &Metadata{ Name: "wayland", Description: "core Wayland window system code and protocol", Website: "https://wayland.freedesktop.org/", @@ -121,9 +119,7 @@ GitLab ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newWaylandProtocols, - + native.mustRegister(Toolchain.newWaylandProtocols, &Metadata{ Name: "wayland-protocols", Description: "Additional standard Wayland protocols", Website: "https://wayland.freedesktop.org/", diff --git a/internal/rosa/x.go b/internal/rosa/x.go index 89ef7e46..116e2131 100644 --- a/internal/rosa/x.go +++ b/internal/rosa/x.go @@ -15,9 +15,7 @@ func (t Toolchain) newUtilMacros() (pkg.Artifact, string) { ), nil, (*MakeHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newUtilMacros, - + native.mustRegister(Toolchain.newUtilMacros, &Metadata{ Name: "util-macros", Description: "X.Org Autotools macros", Website: "https://xorg.freedesktop.org/", @@ -47,9 +45,7 @@ func (t Toolchain) newLibxtrans() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxtrans, - + native.mustRegister(Toolchain.newLibxtrans, &Metadata{ Name: "libxtrans", Description: "X Window System Protocols Transport layer shared code", Website: "https://gitlab.freedesktop.org/xorg/lib/libxtrans", @@ -78,9 +74,7 @@ func (t Toolchain) newXorgProto() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXorgProto, - + native.mustRegister(Toolchain.newXorgProto, &Metadata{ Name: "xorgproto", Description: "X Window System unified protocol definitions", Website: "https://gitlab.freedesktop.org/xorg/proto/xorgproto", @@ -112,9 +106,7 @@ func (t Toolchain) newLibXau() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXau, - + native.mustRegister(Toolchain.newLibXau, &Metadata{ Name: "libXau", Description: "functions for handling Xauthority files and entries", Website: "https://gitlab.freedesktop.org/xorg/lib/libxau", @@ -141,9 +133,7 @@ func (t Toolchain) newXCBProto() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXCBProto, - + native.mustRegister(Toolchain.newXCBProto, &Metadata{ Name: "xcb-proto", Description: "XML-XCB protocol descriptions used by libxcb for the X11 protocol & extensions", Website: "https://gitlab.freedesktop.org/xorg/proto/xcbproto", @@ -170,9 +160,7 @@ func (t Toolchain) newXCB() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXCB, - + native.mustRegister(Toolchain.newXCB, &Metadata{ Name: "xcb", Description: "The X protocol C-language Binding", Website: "https://xcb.freedesktop.org/", @@ -202,9 +190,7 @@ func (t Toolchain) newLibxcbUtilKeysyms() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcbUtilKeysyms, - + native.mustRegister(Toolchain.newLibxcbUtilKeysyms, &Metadata{ Name: "libxcb-util-keysyms", Description: "standard X key constants and conversion to/from keycodes", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms", @@ -233,9 +219,7 @@ func (t Toolchain) newLibxcbUtilImage() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcbUtilImage, - + native.mustRegister(Toolchain.newLibxcbUtilImage, &Metadata{ Name: "libxcb-util-image", Description: "XCB port of Xlib's XImage and XShmImage functions", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcb-image", @@ -265,9 +249,7 @@ func (t Toolchain) newLibxcbUtilWM() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcbUtilWM, - + native.mustRegister(Toolchain.newLibxcbUtilWM, &Metadata{ Name: "libxcb-util-wm", Description: "XCB client and window-manager helpers for ICCCM & EWMH", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcb-wm", @@ -298,9 +280,7 @@ func (t Toolchain) newLibxcbUtil() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcbUtil, - + native.mustRegister(Toolchain.newLibxcbUtil, &Metadata{ Name: "libxcb-util", Description: "XCB utility libraries", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcb-util", @@ -331,9 +311,7 @@ func (t Toolchain) newLibxcbRenderUtil() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcbRenderUtil, - + native.mustRegister(Toolchain.newLibxcbRenderUtil, &Metadata{ Name: "libxcb-render-util", Description: "XCB convenience functions for the Render extension", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util", @@ -375,9 +353,7 @@ func (t Toolchain) newLibX11() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibX11, - + native.mustRegister(Toolchain.newLibX11, &Metadata{ Name: "libX11", Description: `Core X11 protocol client library (aka "Xlib")`, Website: "https://gitlab.freedesktop.org/xorg/lib/libx11", @@ -412,9 +388,7 @@ func (t Toolchain) newLibXext() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXext, - + native.mustRegister(Toolchain.newLibXext, &Metadata{ Name: "libXext", Description: "Xlib-based library for common extensions to the X11 protocol", Website: "https://gitlab.freedesktop.org/xorg/lib/libxext", @@ -450,9 +424,7 @@ func (t Toolchain) newLibXfixes() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXfixes, - + native.mustRegister(Toolchain.newLibXfixes, &Metadata{ Name: "libXfixes", Description: "Xlib-based library for the XFIXES Extension", Website: "https://www.freedesktop.org/wiki/Software/FixesExt/", @@ -487,9 +459,7 @@ func (t Toolchain) newLibXrender() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXrender, - + native.mustRegister(Toolchain.newLibXrender, &Metadata{ Name: "libXrender", Description: "Xlib library for the Render Extension to the X11 protocol", Website: "https://gitlab.freedesktop.org/xorg/lib/libxrender", @@ -524,9 +494,7 @@ func (t Toolchain) newLibxshmfence() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxshmfence, - + native.mustRegister(Toolchain.newLibxshmfence, &Metadata{ Name: "libxshmfence", Description: "shared memory 'SyncFence' synchronization primitive", Website: "https://gitlab.freedesktop.org/xorg/lib/libxshmfence", @@ -558,9 +526,7 @@ func (t Toolchain) newLibXxf86vm() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXxf86vm, - + native.mustRegister(Toolchain.newLibXxf86vm, &Metadata{ Name: "libXxf86vm", Description: "Xlib-based library for the XFree86-VidMode X extension", Website: "https://gitlab.freedesktop.org/xorg/lib/libxxf86vm", @@ -597,9 +563,7 @@ func (t Toolchain) newLibXrandr() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXrandr, - + native.mustRegister(Toolchain.newLibXrandr, &Metadata{ Name: "libXrandr", Description: "Xlib Resize, Rotate and Reflection (RandR) extension library", Website: "https://gitlab.freedesktop.org/xorg/lib/libxrandr", @@ -634,9 +598,7 @@ func (t Toolchain) newFontUtil() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newFontUtil, - + native.mustRegister(Toolchain.newFontUtil, &Metadata{ Name: "font-util", Description: "X.Org font package creation/installation utilities", Website: "https://gitlab.freedesktop.org/xorg/font/util", @@ -668,9 +630,7 @@ func (t Toolchain) newLibfontenc() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibfontenc, - + native.mustRegister(Toolchain.newLibfontenc, &Metadata{ Name: "libfontenc", Description: "X font encoding library", Website: "https://gitlab.freedesktop.org/xorg/lib/libfontenc", @@ -694,9 +654,7 @@ func (t Toolchain) newLibxkbfile() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxkbfile, - + native.mustRegister(Toolchain.newLibxkbfile, &Metadata{ Name: "libxkbfile", Description: "XKB file handling routines", Website: "http://www.x.org/wiki/XKB", @@ -732,9 +690,7 @@ func (t Toolchain) newXkbcomp() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXkbcomp, - + native.mustRegister(Toolchain.newXkbcomp, &Metadata{ Name: "xkbcomp", Description: "XKB keyboard description compiler", Website: "http://www.x.org/wiki/XKB", @@ -772,9 +728,7 @@ func (t Toolchain) newLibXfont2() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXfont2, - + native.mustRegister(Toolchain.newLibXfont2, &Metadata{ Name: "libXfont2", Description: "X font handling library for server & utilities", Website: "https://gitlab.freedesktop.org/xorg/lib/libxfont", @@ -801,9 +755,7 @@ func (t Toolchain) newLibxcvt() (pkg.Artifact, string) { ), nil, (*MesonHelper)(nil)), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibxcvt, - + native.mustRegister(Toolchain.newLibxcvt, &Metadata{ Name: "libxcvt", Description: "VESA CVT standard timing modeline generation library & utility", Website: "https://gitlab.freedesktop.org/xorg/lib/libxcvt", @@ -834,9 +786,7 @@ func (t Toolchain) newLibXdmcp() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibXdmcp, - + native.mustRegister(Toolchain.newLibXdmcp, &Metadata{ Name: "libXdmcp", Description: "X Display Manager Control Protocol library", Website: "https://gitlab.freedesktop.org/xorg/lib/libxdmcp", @@ -860,9 +810,7 @@ func (t Toolchain) newXkeyboardConfig() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXkeyboardConfig, - + native.mustRegister(Toolchain.newXkeyboardConfig, &Metadata{ Name: "xkeyboard-config", Description: "the non-arch keyboard configuration database for X Window", Website: "https://www.freedesktop.org/wiki/Software/XKeyboardConfig/", @@ -888,9 +836,7 @@ func (t Toolchain) newLibpciaccess() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newLibpciaccess, - + native.mustRegister(Toolchain.newLibpciaccess, &Metadata{ Name: "libpciaccess", Description: "generic PCI access library", Website: "https://gitlab.freedesktop.org/xorg/lib/libpciaccess", @@ -955,9 +901,7 @@ func (t Toolchain) newXserver() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXserver, - + native.mustRegister(Toolchain.newXserver, &Metadata{ Name: "xserver", Description: "X server", Website: "https://gitlab.freedesktop.org/xorg/xserver", diff --git a/internal/rosa/xz.go b/internal/rosa/xz.go index e524dcab..27696ae9 100644 --- a/internal/rosa/xz.go +++ b/internal/rosa/xz.go @@ -18,9 +18,7 @@ func (t Toolchain) newXZ() (pkg.Artifact, string) { ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newXZ, - + native.mustRegister(Toolchain.newXZ, &Metadata{ Name: "xz", Description: "XZ Utils", Website: "https://tukaani.org/xz/", diff --git a/internal/rosa/zlib.go b/internal/rosa/zlib.go index 3b276371..7af8efbb 100644 --- a/internal/rosa/zlib.go +++ b/internal/rosa/zlib.go @@ -28,9 +28,7 @@ func (t Toolchain) newZlib() (pkg.Artifact, string) { }), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newZlib, - + native.mustRegister(Toolchain.newZlib, &Metadata{ Name: "zlib", Description: "lossless data-compression library", Website: "https://zlib.net/", diff --git a/internal/rosa/zstd.go b/internal/rosa/zstd.go index adb82cbd..15de3154 100644 --- a/internal/rosa/zstd.go +++ b/internal/rosa/zstd.go @@ -29,9 +29,7 @@ ZSTD_BIN=/cure/programs/zstd /usr/src/zstd/tests/playTests.sh ), version } func init() { - native.MustRegister(&Artifact{ - f: Toolchain.newZstd, - + native.mustRegister(Toolchain.newZstd, &Metadata{ Name: "zstd", Description: "a fast compression algorithm", Website: "https://facebook.github.io/zstd/",