1 Commits

Author SHA1 Message Date
mae
d3f5b24538 internal/pkg/ruby: ruby artifact 2026-05-16 21:53:15 -05:00
102 changed files with 1308 additions and 2774 deletions

View File

@@ -6,7 +6,6 @@ import (
"io"
"os"
"strings"
"unique"
"hakurei.app/internal/pkg"
"hakurei.app/internal/rosa"
@@ -36,20 +35,17 @@ 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 p, ok := rosa.ResolveName(name); !ok {
return fmt.Errorf("unknown artifact %q", name)
} else {
var suffix string
a, version := t.MustLoad(handle)
if version != rosa.Unversioned {
if version := rosa.Std.Version(p); version != rosa.Unversioned {
suffix += "-" + version
}
mustPrintln("name : " + name + suffix)
meta := rosa.GetMetadata(p)
mustPrintln("description : " + meta.Description)
if meta.Website != "" {
mustPrintln("website : " +
@@ -58,9 +54,9 @@ 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
s := rosa.GetMetadata(d).Name
if version := rosa.Std.Version(d); version != rosa.Unversioned {
s += "-" + version
}
mustPrint(" " + s)
}
@@ -72,7 +68,7 @@ func commandInfo(
if r == nil {
var f io.ReadSeekCloser
err = cm.Do(func(cache *pkg.Cache) (err error) {
f, err = cache.OpenStatus(a)
f, err = cache.OpenStatus(rosa.Std.Load(p))
return
})
if err != nil {
@@ -91,7 +87,7 @@ func commandInfo(
}
}
} else if err = cm.Do(func(cache *pkg.Cache) (err error) {
status, n := r.ArtifactOf(cache.Ident(a))
status, n := r.ArtifactOf(cache.Ident(rosa.Std.Load(p)))
if status == nil {
mustPrintln(
statusPrefix + "not in report",

View File

@@ -10,7 +10,6 @@ import (
"strings"
"syscall"
"testing"
"unique"
"unsafe"
"hakurei.app/internal/pkg"
@@ -21,14 +20,6 @@ import (
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)
testCases := []struct {
name string
args []string
@@ -38,24 +29,24 @@ func TestInfo(t *testing.T) {
wantErr any
}{
{"qemu", []string{"qemu"}, nil, "", `
name : qemu-` + qemuVersion + `
name : qemu-` + rosa.Std.Version(rosa.QEMU) + `
description : a generic and open source machine emulator and virtualizer
website : https://www.qemu.org
depends on : glib-` + glibVersion + ` zstd-` + zstdVersion + `
depends on : glib-` + rosa.Std.Version(rosa.GLib) + ` zstd-` + rosa.Std.Version(rosa.Zstd) + `
`, nil},
{"multi", []string{"hakurei", "hakurei-dist"}, nil, "", `
name : hakurei-` + hakureiVersion + `
name : hakurei-` + rosa.Std.Version(rosa.Hakurei) + `
description : low-level userspace tooling for Rosa OS
website : https://hakurei.app
name : hakurei-dist-` + hakureiDistVersion + `
name : hakurei-dist-` + rosa.Std.Version(rosa.HakureiDist) + `
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-` + rosa.Std.Version(rosa.Zlib) + `
description : lossless data-compression library
website : https://zlib.net
@@ -65,12 +56,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-` + rosa.Std.Version(rosa.Zlib) + `
description : lossless data-compression library
website : https://zlib.net
status : not yet cured
name : zstd-` + zstdVersion + `
name : zstd-` + rosa.Std.Version(rosa.Zstd) + `
description : a fast compression algorithm
website : https://facebook.github.io/zstd
status : internal/pkg (amd64) on satori
@@ -79,19 +70,19 @@ status : internal/pkg (amd64) on satori
{"status cache perm", []string{"zlib"}, map[string]string{
"zlib": "\x00",
}, "", `
name : zlib-` + zlibVersion + `
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
description : lossless data-compression library
website : https://zlib.net
`, func(cm *cache) error {
return &os.PathError{
Op: "open",
Path: filepath.Join(cm.base, "status", pkg.Encode(cm.c.Ident(zlib).Value())),
Path: filepath.Join(cm.base, "status", pkg.Encode(cm.c.Ident(rosa.Std.Load(rosa.Zlib)).Value())),
Err: syscall.EACCES,
}
}},
{"status report", []string{"zlib"}, nil, strings.Repeat("\x00", len(pkg.Checksum{})+8), `
name : zlib-` + zlibVersion + `
name : zlib-` + rosa.Std.Version(rosa.Zlib) + `
description : lossless data-compression library
website : https://zlib.net
status : not in report
@@ -140,8 +131,8 @@ status : not in report
if tc.status != nil {
for name, status := range tc.status {
a, _ := _t.Load(rosa.ArtifactH(unique.Make(name)))
if a == nil {
p, ok := rosa.ResolveName(name)
if !ok {
t.Fatalf("invalid name %q", name)
}
perm := os.FileMode(0400)
@@ -152,7 +143,7 @@ status : not in report
return os.WriteFile(filepath.Join(
cm.base,
"status",
pkg.Encode(cache.Ident(a).Value()),
pkg.Encode(cache.Ident(rosa.Std.Load(p)).Value()),
), unsafe.Slice(unsafe.StringData(status), len(status)), perm)
}); err != nil {
t.Fatalf("Do: error = %v", err)

View File

@@ -30,7 +30,7 @@ var (
// handleInfo writes constant system information.
func handleInfo(w http.ResponseWriter, _ *http.Request) {
infoPayloadOnce.Do(func() {
infoPayload.Count = int(rosa.Native().Count())
infoPayload.Count = int(rosa.PresetUnexportedStart)
infoPayload.HakureiVersion = info.Version()
})
// TODO(mae): cache entire response if no additional fields are planned
@@ -91,7 +91,7 @@ func (index *packageIndex) handleGet(w http.ResponseWriter, r *http.Request) {
if err != nil || i >= len(index.sorts[0]) || i < 0 {
http.Error(
w, "index must be an integer between 0 and "+
strconv.Itoa(len(index.sorts[0])-1),
strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
http.StatusBadRequest,
)
return
@@ -125,7 +125,7 @@ func (index *packageIndex) handleSearch(w http.ResponseWriter, r *http.Request)
if err != nil || i >= len(index.sorts[0]) || i < 0 {
http.Error(
w, "index must be an integer between 0 and "+
strconv.Itoa(len(index.sorts[0])-1),
strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
http.StatusBadRequest,
)
return

View File

@@ -3,6 +3,7 @@ package pkgserver
import (
"net/http"
"net/http/httptest"
"slices"
"strconv"
"testing"
@@ -31,7 +32,7 @@ func TestAPIInfo(t *testing.T) {
checkPayload(t, resp, struct {
Count int `json:"count"`
HakureiVersion string `json:"hakurei_version"`
}{rosa.Native().Count(), info.Version()})
}{int(rosa.PresetUnexportedStart), info.Version()})
}
func TestAPIGet(t *testing.T) {
@@ -95,8 +96,8 @@ func TestAPIGet(t *testing.T) {
t.Run("index", func(t *testing.T) {
t.Parallel()
checkValidate(
t, "limit=1&sort=0&index", 0, rosa.Native().Count()-1,
"index must be an integer between 0 and "+strconv.Itoa(rosa.Native().Count()-1),
t, "limit=1&sort=0&index", 0, int(rosa.PresetUnexportedStart-1),
"index must be an integer between 0 and "+strconv.Itoa(int(rosa.PresetUnexportedStart-1)),
)
})
@@ -107,4 +108,74 @@ func TestAPIGet(t *testing.T) {
"sort must be an integer between 0 and "+strconv.Itoa(int(sortOrderEnd)),
)
})
checkWithSuffix := func(name, suffix string, want []*metadata) {
t.Run(name, func(t *testing.T) {
t.Parallel()
w := newRequest(suffix)
resp := w.Result()
checkStatus(t, resp, http.StatusOK)
checkAPIHeader(t, w.Header())
checkPayloadFunc(t, resp, func(got *struct {
Values []*metadata `json:"values"`
}) bool {
return slices.EqualFunc(got.Values, want, func(a, b *metadata) bool {
return (a.Version == b.Version ||
a.Version == rosa.Unversioned ||
b.Version == rosa.Unversioned) &&
a.HasReport == b.HasReport &&
a.Name == b.Name &&
a.Description == b.Description &&
a.Website == b.Website
})
})
})
}
checkWithSuffix("declarationAscending", "?limit=2&index=1&sort=0", []*metadata{
{
Metadata: rosa.GetMetadata(1),
Version: rosa.Std.Version(1),
},
{
Metadata: rosa.GetMetadata(2),
Version: rosa.Std.Version(2),
},
})
checkWithSuffix("declarationAscending offset", "?limit=3&index=5&sort=0", []*metadata{
{
Metadata: rosa.GetMetadata(5),
Version: rosa.Std.Version(5),
},
{
Metadata: rosa.GetMetadata(6),
Version: rosa.Std.Version(6),
},
{
Metadata: rosa.GetMetadata(7),
Version: rosa.Std.Version(7),
},
})
checkWithSuffix("declarationDescending", "?limit=3&index=0&sort=1", []*metadata{
{
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 1),
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 1),
},
{
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 2),
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 2),
},
{
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 3),
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 3),
},
})
checkWithSuffix("declarationDescending offset", "?limit=1&index=37&sort=1", []*metadata{
{
Metadata: rosa.GetMetadata(rosa.PresetUnexportedStart - 38),
Version: rosa.Std.Version(rosa.PresetUnexportedStart - 38),
},
})
}

View File

@@ -23,7 +23,7 @@ const (
// packageIndex refers to metadata by name and various sort orders.
type packageIndex struct {
sorts [sortOrderEnd + 1][]*metadata
sorts [sortOrderEnd + 1][rosa.PresetUnexportedStart]*metadata
names map[string]*metadata
search searchCache
// Taken from [rosa.Report] if available.
@@ -32,8 +32,8 @@ type packageIndex struct {
// metadata holds [rosa.Metadata] extended with additional information.
type metadata struct {
handle rosa.ArtifactH
*rosa.Artifact
p rosa.PArtifact
*rosa.Metadata
// Populated via [rosa.Toolchain.Version], [rosa.Unversioned] is equivalent
// to the zero value. Otherwise, the zero value is invalid.
@@ -56,17 +56,15 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
index.handleAccess = report.HandleAccess
}
handles := rosa.Native().Collect()
work := make([]*metadata, len(handles))
var work [rosa.PresetUnexportedStart]*metadata
index.names = make(map[string]*metadata)
ir := pkg.NewIR()
for i, handle := range handles {
a, version := rosa.Native().Std().MustLoad(handle)
for p := range rosa.PresetUnexportedStart {
m := metadata{
handle: handle,
p: p,
Artifact: rosa.Native().MustGet(handle),
Version: version,
Metadata: rosa.GetMetadata(p),
Version: rosa.Std.Version(p),
}
if m.Version == "" {
return errors.New("invalid version from " + m.Name)
@@ -76,32 +74,32 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) {
}
if report != nil {
id := ir.Ident(a)
id := ir.Ident(rosa.Std.Load(p))
m.ids = pkg.Encode(id.Value())
m.status, m.Size = report.ArtifactOf(id)
m.HasReport = m.Size >= 0
}
work[i] = &m
work[p] = &m
index.names[m.Name] = &m
}
index.sorts[declarationAscending] = work
index.sorts[declarationDescending] = slices.Clone(work)
index.sorts[declarationDescending] = work
slices.Reverse(index.sorts[declarationDescending][:])
index.sorts[nameAscending] = slices.Clone(work)
index.sorts[nameAscending] = work
slices.SortFunc(index.sorts[nameAscending][:], func(a, b *metadata) int {
return strings.Compare(a.Name, b.Name)
})
index.sorts[nameDescending] = slices.Clone(index.sorts[nameAscending])
index.sorts[nameDescending] = index.sorts[nameAscending]
slices.Reverse(index.sorts[nameDescending][:])
index.sorts[sizeAscending] = slices.Clone(work)
index.sorts[sizeAscending] = work
slices.SortFunc(index.sorts[sizeAscending][:], func(a, b *metadata) int {
return cmp.Compare(a.Size, b.Size)
})
index.sorts[sizeDescending] = slices.Clone(index.sorts[sizeAscending])
index.sorts[sizeDescending] = index.sorts[sizeAscending]
slices.Reverse(index.sorts[sizeDescending][:])
return

View File

@@ -4,12 +4,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="icon" href="https://hakurei.app/favicon.ico"/>
<title>Rosa OS Packages</title>
<title>Hakurei PkgServer</title>
<script src="index.js"></script>
</head>
<body>
<h1>Rosa OS Packages</h1>
<h1>Hakurei PkgServer</h1>
<div class="top-controls" id="top-controls-regular">
<p>Showing entries <span id="entry-counter"></span>.</p>
<span id="search-bar">
@@ -55,4 +54,4 @@
</footer>
<script>main();</script>
</body>
</html>
</html>

View File

@@ -58,19 +58,6 @@ func main() {
log.Fatal("this program must not run as root")
}
defer func() {
r := recover()
if r == nil {
return
}
h, ok := r.(rosa.HandleError)
if !ok {
panic(r)
}
log.Fatal(h)
}()
ctx, stop := signal.NotifyContext(context.Background(),
syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
defer stop()
@@ -110,10 +97,10 @@ func main() {
if !flagLTO {
flags |= rosa.OptLLVMNoLTO
}
rosa.Native().DropCaches("", flags)
rosa.DropCaches("", flags)
cross := flagArch != "" && flagArch != runtime.GOARCH
if flagQEMU || cross {
cm.qemu, _ = rosa.Native().Std().Load(rosa.QEMU)
cm.qemu = rosa.Std.Load(rosa.QEMU)
}
if cross {
@@ -121,7 +108,7 @@ func main() {
flags = flagCrossOverride
}
rosa.Native().DropCaches(flagArch, flags)
rosa.DropCaches(flagArch, flags)
if !rosa.HasStage0() {
return pkg.UnsupportedArchError(flagArch)
}
@@ -344,12 +331,12 @@ func main() {
n atomic.Uint64
)
w := make(chan rosa.ArtifactH)
w := make(chan rosa.PArtifact)
var wg sync.WaitGroup
for range max(flagJobs, 1) {
wg.Go(func() {
for p := range w {
meta := rosa.Native().MustGet(p)
meta := rosa.GetMetadata(p)
if meta.ID == 0 {
continue
}
@@ -362,9 +349,8 @@ func main() {
continue
}
_, version := rosa.Native().Std().Load(p)
if current, latest :=
version,
rosa.Std.Version(p),
meta.GetLatest(v); current != latest {
n.Add(1)
@@ -378,9 +364,9 @@ func main() {
}
done:
for _, p := range rosa.Native().Collect() {
for i := range rosa.PresetEnd {
select {
case w <- p:
case w <- rosa.PArtifact(i):
break
case <-ctx.Done():
break done
@@ -425,9 +411,9 @@ func main() {
"stage3",
"Check for toolchain 3-stage non-determinism",
func(args []string) (err error) {
s := rosa.Std
t := rosa.Std
if flagGentoo != "" {
s -= 3 // magic number to discourage misuse
t -= 3 // magic number to discourage misuse
var checksum pkg.Checksum
if len(flagChecksum) != 0 {
@@ -435,7 +421,7 @@ func main() {
return
}
}
rosa.Native().SetGentooStage3(flagGentoo, checksum)
rosa.SetGentooStage3(flagGentoo, checksum)
}
var (
@@ -444,8 +430,9 @@ func main() {
)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
llvm, _ := rosa.Native().New(s - 2).Load(rosa.LLVM)
pathname, _, err = cache.Cure(llvm)
pathname, _, err = cache.Cure(
(t - 2).Load(rosa.LLVM),
)
return
}); err != nil {
return
@@ -453,16 +440,18 @@ 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)
pathname, checksum[0], err = cache.Cure(llvm)
pathname, checksum[0], err = cache.Cure(
(t - 1).Load(rosa.LLVM),
)
return
}); err != nil {
return
}
log.Println("stage2:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
llvm, _ := rosa.Native().New(s).Load(rosa.LLVM)
pathname, checksum[1], err = cache.Cure(llvm)
pathname, checksum[1], err = cache.Cure(
t.Load(rosa.LLVM),
)
return
}); err != nil {
return
@@ -483,8 +472,9 @@ func main() {
if flagStage0 {
if err = cm.Do(func(cache *pkg.Cache) (err error) {
stage0, _ := rosa.Native().New(s).Load(rosa.Stage0)
pathname, _, err = cache.Cure(stage0)
pathname, _, err = cache.Cure(
t.Load(rosa.Stage0),
)
return
}); err != nil {
return
@@ -529,6 +519,10 @@ func main() {
if len(args) != 1 {
return errors.New("cure requires 1 argument")
}
p, ok := rosa.ResolveName(args[0])
if !ok {
return fmt.Errorf("unknown artifact %q", args[0])
}
t := rosa.Std
if flagBoot {
@@ -537,16 +531,11 @@ func main() {
t -= 1
}
a, _ := rosa.Native().New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
if a == nil {
return fmt.Errorf("unknown artifact %q", args[0])
}
switch {
default:
var pathname *check.Absolute
err := cm.Do(func(cache *pkg.Cache) (err error) {
pathname, _, err = cache.Cure(a)
pathname, _, err = cache.Cure(t.Load(p))
return
})
if err != nil {
@@ -588,7 +577,7 @@ func main() {
return err
}
if err = pkg.NewIR().EncodeAll(f, a); err != nil {
if err = pkg.NewIR().EncodeAll(f, rosa.Std.Load(p)); err != nil {
_ = f.Close()
return err
}
@@ -599,7 +588,7 @@ func main() {
return cm.Do(func(cache *pkg.Cache) error {
return cache.EnterExec(
ctx,
a,
t.Load(p),
true, os.Stdin, os.Stdout, os.Stderr,
rosa.AbsSystem.Append("bin", "mksh"),
"sh",
@@ -611,6 +600,7 @@ func main() {
if flagNoReply {
flags |= remoteNoReply
}
a := t.Load(p)
pathname, err := cureRemote(ctx, &addr, a, flags)
if !flagNoReply && err == nil {
log.Println(pathname)
@@ -630,7 +620,7 @@ func main() {
case flagFaults:
var faults []pkg.Fault
if err := cm.Do(func(cache *pkg.Cache) (err error) {
faults, err = cache.ReadFaults(a)
faults, err = cache.ReadFaults(t.Load(p))
return
}); err != nil {
return err
@@ -644,7 +634,7 @@ func main() {
case flagPop:
var faults []pkg.Fault
if err := cm.Do(func(cache *pkg.Cache) (err error) {
faults, err = cache.ReadFaults(a)
faults, err = cache.ReadFaults(t.Load(p))
return
}); err != nil {
return err
@@ -750,26 +740,27 @@ func main() {
"shell",
"Interactive shell in the specified Rosa OS environment",
func(args []string) error {
handles := make([]rosa.ArtifactH, len(args)+3)
presets := make([]rosa.PArtifact, len(args)+3)
for i, arg := range args {
handles[i] = rosa.ArtifactH(unique.Make(arg))
if rosa.Native().Get(handles[i]) == nil {
p, ok := rosa.ResolveName(arg)
if !ok {
return fmt.Errorf("unknown artifact %q", arg)
}
presets[i] = p
}
base := rosa.LLVM
if !flagWithToolchain {
base = rosa.Musl
}
handles = append(handles,
presets = append(presets,
base,
rosa.Mksh,
rosa.Toybox,
)
root := make(pkg.Collect, 0, 6+len(args))
root = rosa.Native().Std().Append(root, handles...)
root = rosa.Std.AppendPresets(root, presets...)
if err := cm.Do(func(cache *pkg.Cache) error {
_, _, err := cache.Cure(&root)

View File

@@ -9,7 +9,7 @@ import (
)
func TestMain(m *testing.M) {
rosa.Native().DropCaches("", rosa.OptLLVMNoLTO)
rosa.DropCaches("", rosa.OptLLVMNoLTO)
os.Exit(m.Run())
}
@@ -35,10 +35,10 @@ 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) {
_, err := cureRemote(t.Context(), &addr, a, 0)
for i := range rosa.PresetEnd {
p := rosa.PArtifact(i)
t.Run(rosa.GetMetadata(p).Name, func(t *testing.T) {
_, err := cureRemote(t.Context(), &addr, rosa.Std.Load(p), 0)
if err != nil {
t.Error(err)
}

View File

@@ -65,7 +65,7 @@ ln -s ../../system/bin/perl /usr/bin
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Attr] = Metadata{
f: Toolchain.newAttr,
Name: "attr",
@@ -73,7 +73,7 @@ func init() {
Website: "https://savannah.nongnu.org/projects/attr/",
ID: 137,
})
}
}
func (t Toolchain) newACL() (pkg.Artifact, string) {
@@ -94,7 +94,7 @@ func (t Toolchain) newACL() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[ACL] = Metadata{
f: Toolchain.newACL,
Name: "acl",
@@ -106,5 +106,5 @@ func init() {
},
ID: 16,
})
}
}

448
internal/rosa/all.go Normal file
View File

@@ -0,0 +1,448 @@
package rosa
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"runtime"
"strconv"
"sync"
"hakurei.app/internal/pkg"
)
// PArtifact is a lazily-initialised [pkg.Artifact] preset.
type PArtifact int
const (
LLVM PArtifact = iota
// EarlyInit is the Rosa OS init program.
EarlyInit
// ImageSystem is the Rosa OS /system image.
ImageSystem
// ImageInitramfs is the Rosa OS initramfs archive.
ImageInitramfs
// Kernel is the generic Rosa OS Linux kernel.
Kernel
// KernelHeaders is an installation of kernel headers for [Kernel].
KernelHeaders
// KernelSource is a writable kernel source tree installed to [AbsUsrSrc].
KernelSource
// Firmware is firmware blobs for use with the Linux kernel.
Firmware
ACL
ArgpStandalone
Attr
Autoconf
Automake
BC
Bash
Binutils
Bison
Bzip2
CMake
Connman
Coreutils
Curl
DBus
DTC
Diffutils
Elfutils
Fakeroot
Findutils
Flex
FontUtil
Freetype
Fuse
GMP
GLib
Gawk
GenInitCPIO
Gettext
Git
Glslang
GnuTLS
Go
Gperf
Grep
Gzip
Hakurei
HakureiDist
Hwdata
IPTables
Kmod
LIT
LibX11
LibXau
LibXdmcp
LibXext
LibXfixes
LibXfont2
LibXrandr
LibXrender
LibXxf86vm
Libarchive
Libbsd
Libcap
Libconfig
LibdisplayInfo
Libdrm
Libepoxy
Libev
Libexpat
Libffi
Libfontenc
Libgd
Libglvnd
Libiconv
Libmd
Libmnl
Libnftnl
Libpciaccess
Libpng
Libpsl
Libseccomp
Libtasn1
Libtirpc
Libtool
Libucontext
Libunistring
Libva
LibxcbRenderUtil
LibxcbUtil
LibxcbUtilImage
LibxcbUtilKeysyms
LibxcbUtilWM
Libxcvt
Libxkbfile
Libxml2
Libxshmfence
Libxslt
Libxtrans
LMSensors
M4
MPC
MPFR
Make
Mesa
Meson
Mksh
MuslFts
MuslObstack
NSS
NSSCACert
Ncurses
Nettle
Ninja
OpenSSL
P11Kit
PCRE2
Parallel
Patch
Perl
PerlLocaleGettext
PerlMIMECharset
PerlModuleBuild
PerlPodParser
PerlSGMLS
PerlTermReadKey
PerlTestCmd
PerlTextCharWidth
PerlTextWrapI18N
PerlUnicodeLineBreak
PerlYAMLTiny
Pixman
PkgConfig
Procps
Python
PythonFlitCore
PythonHatchling
PythonIniConfig
PythonMako
PythonMarkupSafe
PythonPackaging
PythonPathspec
PythonPluggy
PythonPyTest
PythonPyYAML
PythonPycparser
PythonPygments
PythonSetuptools
PythonSetuptoolsSCM
PythonTroveClassifiers
PythonVCSVersioning
PythonWheel
QEMU
Rdfind
Readline
Rsync
Ruby
Sed
SPIRVHeaders
SPIRVLLVMTranslator
SPIRVTools
SquashfsTools
Strace
TamaGo
Tar
Texinfo
Toybox
toyboxEarly
Unzip
UtilLinux
VIM
Wayland
WaylandProtocols
XCB
XCBProto
XDGDBusProxy
XZ
Xkbcomp
XkeyboardConfig
XorgProto
Xserver
Zlib
Zstd
// PresetUnexportedStart is the first unexported preset.
PresetUnexportedStart
stage0Dist = iota - 1
llvmSource
// earlyCompilerRT is an early, standalone compiler-rt installation for the
// standalone runtimes build.
//
// earlyCompilerRT must only be loaded by [LLVM].
earlyCompilerRT
// earlyRuntimes is an early, standalone installation of LLVM runtimes to
// work around the cmake build system leaking the system LLVM installation
// when invoking the newly built toolchain.
//
// earlyRuntimes must only be loaded by [LLVM].
earlyRuntimes
buildcatrust
utilMacros
// Musl is a standalone libc that does not depend on the toolchain.
Musl
// muslHeaders is a system installation of [Musl] headers.
muslHeaders
// gcc is a hacked-to-pieces GCC toolchain meant for use in intermediate
// stages only. This preset and its direct output must never be exposed.
gcc
// nettle3 is an older version of [Nettle].
nettle3
// Stage0 is a tarball containing all compile-time dependencies of artifacts
// part of the [Std] toolchain.
Stage0
// PresetEnd is the total number of presets and does not denote a preset.
PresetEnd
)
// P represents multiple [PArtifact] and is stable through JSON.
type P []PArtifact
// MarshalJSON represents [PArtifact] by their [Metadata.Name].
func (s P) MarshalJSON() ([]byte, error) {
names := make([]string, len(s))
for i, p := range s {
names[i] = GetMetadata(p).Name
}
return json.Marshal(names)
}
// UnmarshalJSON resolves the value created by MarshalJSON back to [P].
func (s *P) UnmarshalJSON(data []byte) error {
var names []string
if err := json.Unmarshal(data, &names); err != nil {
return err
}
*s = make(P, len(names))
for i, name := range names {
if p, ok := ResolveName(name); !ok {
return fmt.Errorf("unknown artifact %q", name)
} else {
(*s)[i] = p
}
}
return nil
}
// Metadata is stage-agnostic information of a [PArtifact] not directly
// representable in the resulting [pkg.Artifact].
type Metadata struct {
f func(t Toolchain) (a pkg.Artifact, version string)
// Unique package name.
Name string `json:"name"`
// Short user-facing description.
Description string `json:"description"`
// Project home page.
Website string `json:"website,omitempty"`
// Runtime dependencies.
Dependencies P `json:"dependencies"`
// Project identifier on [Anitya].
//
// [Anitya]: https://release-monitoring.org/
ID int `json:"-"`
// Optional custom version checking behaviour.
latest func(v *Versions) string
}
// GetLatest returns the latest version described by v.
func (meta *Metadata) GetLatest(v *Versions) string {
if meta.latest != nil {
return meta.latest(v)
}
return v.Latest
}
// Unversioned denotes an unversioned [PArtifact].
const Unversioned = "\x00"
// UnpopulatedIDError is returned by [Metadata.GetLatest] for an instance of
// [Metadata] where ID is not populated.
type UnpopulatedIDError struct{}
func (UnpopulatedIDError) Unwrap() error { return errors.ErrUnsupported }
func (UnpopulatedIDError) Error() string { return "Anitya ID is not populated" }
// Versions are package versions returned by Anitya.
type Versions struct {
// The latest version for the project, as determined by the version sorting algorithm.
Latest string `json:"latest_version"`
// List of all versions that arent flagged as pre-release.
Stable []string `json:"stable_versions"`
// List of all versions stored, sorted from newest to oldest.
All []string `json:"versions"`
}
// getStable returns the first Stable version, or Latest if that is unavailable.
func (v *Versions) getStable() string {
if len(v.Stable) == 0 {
return v.Latest
}
return v.Stable[0]
}
// GetVersions returns versions fetched from Anitya.
func (meta *Metadata) GetVersions(ctx context.Context) (*Versions, error) {
if meta.ID == 0 {
return nil, UnpopulatedIDError{}
}
var resp *http.Response
if req, err := http.NewRequestWithContext(
ctx,
http.MethodGet,
"https://release-monitoring.org/api/v2/versions/?project_id="+
strconv.Itoa(meta.ID),
nil,
); err != nil {
return nil, err
} else {
req.Header.Set("User-Agent", "Rosa/1.1")
if resp, err = http.DefaultClient.Do(req); err != nil {
return nil, err
}
}
var v Versions
err := json.NewDecoder(resp.Body).Decode(&v)
return &v, errors.Join(err, resp.Body.Close())
}
var (
// artifactsM is an array of [PArtifact] metadata.
artifactsM [PresetEnd]Metadata
// artifacts stores the result of Metadata.f.
artifacts [_toolchainEnd][len(artifactsM)]struct {
a pkg.Artifact
v string
}
// artifactsOnce is for lazy initialisation of artifacts.
artifactsOnce [_toolchainEnd][len(artifactsM)]sync.Once
// arch is the target architecture.
arch = runtime.GOARCH
// presetOpts globally modifies behaviour of presets.
presetOpts int
)
const (
// OptSkipCheck skips running all test suites.
OptSkipCheck = 1 << iota
// OptLLVMNoLTO disables LTO in all [LLVM] stages.
OptLLVMNoLTO
)
// Arch returns the target architecture.
func Arch() string { return arch }
// Flags returns the current preset flags
func Flags() int { return presetOpts }
// zero zeros the value pointed to by p.
func zero[T any](p *T) { var v T; *p = v }
// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
// it returns. Must not be used concurrently with any other function from this
// package.
func DropCaches(targetArch string, flags int) {
if targetArch == "" {
targetArch = runtime.GOARCH
}
arch = targetArch
presetOpts = flags
zero(&artifacts)
zero(&artifactsOnce)
}
// GetMetadata returns [Metadata] of a [PArtifact].
func GetMetadata(p PArtifact) *Metadata { return &artifactsM[p] }
// construct constructs a [pkg.Artifact] corresponding to a [PArtifact] once.
func (t Toolchain) construct(p PArtifact) {
artifactsOnce[t][p].Do(func() {
artifacts[t][p].a, artifacts[t][p].v = artifactsM[p].f(t)
})
}
// Load returns the resulting [pkg.Artifact] of [PArtifact].
func (t Toolchain) Load(p PArtifact) pkg.Artifact {
t.construct(p)
return artifacts[t][p].a
}
// Version returns the version string of [PArtifact].
func (t Toolchain) Version(p PArtifact) string {
t.construct(p)
return artifacts[t][p].v
}
// ResolveName returns a [PArtifact] by name.
func ResolveName(name string) (p PArtifact, ok bool) {
for i := range PresetUnexportedStart {
if name == artifactsM[i].Name {
return i, true
}
}
return 0, false
}

81
internal/rosa/all_test.go Normal file
View File

@@ -0,0 +1,81 @@
package rosa_test
import (
"testing"
"hakurei.app/internal/rosa"
)
func TestLoad(t *testing.T) {
t.Parallel()
for i := range rosa.PresetEnd {
p := rosa.PArtifact(i)
t.Run(rosa.GetMetadata(p).Name, func(t *testing.T) {
t.Parallel()
rosa.Std.Load(p)
})
}
}
func BenchmarkAll(b *testing.B) {
arch, flags := rosa.Arch(), rosa.Flags()
b.Cleanup(func() { rosa.DropCaches(arch, flags) })
for b.Loop() {
for i := range rosa.PresetEnd {
rosa.Std.Load(rosa.PArtifact(i))
}
b.StopTimer()
rosa.DropCaches("", 0)
b.StartTimer()
}
}
func TestResolveName(t *testing.T) {
t.Parallel()
for i := range rosa.PresetUnexportedStart {
p := i
name := rosa.GetMetadata(p).Name
t.Run(name, func(t *testing.T) {
t.Parallel()
if got, ok := rosa.ResolveName(name); !ok {
t.Fatal("ResolveName: ok = false")
} else if got != p {
t.Fatalf("ResolveName: %d, want %d", got, p)
}
})
}
}
func TestResolveNameUnexported(t *testing.T) {
t.Parallel()
for i := rosa.PresetUnexportedStart; i < rosa.PresetEnd; i++ {
p := i
name := rosa.GetMetadata(p).Name
t.Run(name, func(t *testing.T) {
t.Parallel()
if got, ok := rosa.ResolveName(name); ok {
t.Fatalf("ResolveName: resolved unexported preset %d", got)
}
})
}
}
func TestUnique(t *testing.T) {
t.Parallel()
names := make(map[string]struct{})
for i := range rosa.PresetEnd {
name := rosa.GetMetadata(rosa.PArtifact(i)).Name
if _, ok := names[name]; ok {
t.Fatalf("name %s is not unique", name)
}
names[name] = struct{}{}
}
}

View File

@@ -26,11 +26,11 @@ install -D -m755 libargp.a /work/system/lib/libargp.a
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[ArgpStandalone] = Metadata{
f: Toolchain.newArgpStandalone,
Name: "argp-standalone",
Description: "hierarchical argument parsing library broken out from glibc",
Website: "http://www.lysator.liu.se/~nisse/misc/",
})
}
}

View File

@@ -1,348 +0,0 @@
// Package azalea implements a proof-of-concept, domain-specific language for
// Rosa OS software packaging.
package azalea
import (
"errors"
"io"
"strconv"
"text/scanner"
)
// idents are runes accepted in an identifier.
var idents = [...]bool{
'0': true, '1': true, '2': true, '3': true, '4': true, '5': true, '6': true,
'7': true, '8': true, '9': true,
'A': true, 'B': true, 'C': true, 'D': true, 'E': true, 'F': true, 'G': true,
'H': true, 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, 'N': true,
'O': true, 'P': true, 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true,
'V': true, 'W': true, 'X': true, 'Y': true, 'Z': true,
'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true,
'h': true, 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true,
'o': true, 'p': true, 'q': true, 'r': true, 's': true, 't': true, 'u': true,
'v': true, 'w': true, 'x': true, 'y': true, 'z': true,
'-': true, '_': true,
}
// TokenError describes an unexpected token.
type TokenError [2]rune
func (e TokenError) Error() string {
return "expected " + scanner.TokenString(e[0]) +
", found " + scanner.TokenString(e[1])
}
// ExprError is an unexpected token encountered while parsing an expression.
type ExprError rune
func (e ExprError) Error() string {
return "unexpected token " + scanner.TokenString(rune(e))
}
// must1 returns v, or panics if err is not nil.
func must1[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
// parser retains the current token.
type parser struct {
s scanner.Scanner
tok rune
}
// scan advances the underlying scanner to the next token, storing its result.
func (p *parser) scan() rune { p.tok = p.s.Scan(); return p.tok }
// expects panics with [TokenError] for an unexpected tok.
func (p *parser) expects(expects rune) {
if p.tok != expects {
panic(TokenError{expects, p.tok})
}
}
// scanAs advances the scanner for an expected token.
func (p *parser) scanAs(expects rune) { p.scan(); p.expects(expects) }
// An Int is the value represented by an integer literal.
type Int int64
func (v Int) GoString() string {
return "azalea.Int(" + strconv.FormatInt(int64(v), 10) + ")"
}
// parseInt parses the current token as a base 10 representation of a 64-bit
// signed integer.
func (p *parser) parseInt() Int {
v, err := strconv.ParseInt(p.s.TokenText(), 10, 64)
return must1(Int(v), err)
}
// A String holds the unquoted content of a string literal.
type String string
func (v String) GoString() string {
return "azalea.String(" + strconv.Quote(string(v)) + ")"
}
// parseString parses the current token as a string.
func (p *parser) parseString() String {
s, err := strconv.Unquote(p.s.TokenText())
return must1(String(s), err)
}
// An Ident holds the name of an identifier.
type Ident string
func (v Ident) GoString() string {
return "azalea.Ident(" + strconv.Quote(string(v)) + ")"
}
// A Val are statements joined by the '+' operator. Only the [String] type
// supports concatenation.
type Val []any
// parseVal parses until the end of the [Val].
func (p *parser) parseVal() (v Val) {
v = append(v, p.parseExpr())
for p.tok == '+' {
p.scan()
v = append(v, p.parseExpr())
}
return
}
// An Array holds statements in an array.
type Array []Val
// A KV holds a key/value pair.
type KV struct {
K String
V Val
}
// An Arg represents an argument of [Func].
type Arg struct {
K []Ident
V Val
R bool
}
// Func is a function call or package declaration.
type Func struct {
// Function or package identifier.
Ident Ident
// Whether this is a package declaration.
Package bool
// Key-value arguments.
Args []Arg
}
// parseExpr parses the current expression.
func (p *parser) parseExpr() any {
switch p.tok {
case scanner.Int:
v := p.parseInt()
p.scan()
return v
case scanner.String, scanner.RawString:
v := p.parseString()
p.scan()
return v
case scanner.Ident:
var v Func
v.Ident = Ident(p.s.TokenText())
if v.Package = v.Ident == "package"; v.Package {
p.scanAs(scanner.Ident)
v.Ident = Ident(p.s.TokenText())
}
p.scan()
switch p.tok {
case '{':
for {
p.scan()
switch p.tok {
case '}':
p.scan()
return v
case scanner.Ident:
break
default:
panic(TokenError{scanner.Ident, p.tok})
}
arg := Arg{K: []Ident{Ident(p.s.TokenText())}}
delim := true
arg:
for {
p.scan()
switch p.tok {
case ',':
if delim {
delim = false
continue
}
panic(ExprError(p.tok))
case scanner.Ident:
if delim {
panic(TokenError{',', p.tok})
}
delim = true
arg.K = append(arg.K, Ident(p.s.TokenText()))
default:
break arg
}
}
switch p.tok {
case '=':
break
case '*':
arg.R = true
p.scanAs('=')
default:
panic(TokenError{'=', p.tok})
}
p.scan()
arg.V = p.parseVal()
v.Args = append(v.Args, arg)
p.expects(';')
}
default:
return v.Ident
}
case '{':
var v []KV
for {
p.scan()
switch p.tok {
case '}':
p.scan()
return v
case scanner.String:
pair := KV{K: p.parseString()}
p.scan()
switch p.tok {
case ';':
break
case ':':
p.scan()
pair.V = p.parseVal()
p.expects(';')
break
default:
panic(ExprError(p.tok))
}
v = append(v, pair)
default:
panic(ExprError(p.tok))
}
}
case '[':
var (
v Array
delim bool
)
p.scan()
for {
switch p.tok {
case ',':
if delim {
p.scan()
delim = false
continue
}
panic(ExprError(','))
case ']':
p.scan()
return v
case scanner.EOF:
panic(ExprError(scanner.EOF))
default:
if delim {
panic(TokenError{',', p.tok})
}
delim = true
break
}
v = append(v, p.parseVal())
}
default:
panic(ExprError(p.tok))
}
}
// ScanError is the error count parsing all expressions.
type ScanError int
func (ScanError) Error() string {
return "aborting due to scanning errors"
}
// Parse parses expressions from r.
func Parse(r io.Reader) (e []any, err error) {
var p parser
p.s.Init(r)
p.s.Mode = scanner.ScanIdents |
scanner.ScanInts |
scanner.ScanStrings |
scanner.ScanRawStrings |
scanner.ScanComments |
scanner.SkipComments
p.s.IsIdentRune = func(ch rune, i int) bool {
if i == 0 && ch >= '0' && ch <= '9' {
return false
}
return ch > 0 && ch < rune(len(idents)) && idents[ch]
}
defer func() {
v := recover()
if v == nil {
return
}
_err, ok := v.(error)
if !ok {
panic(v)
}
if err == nil {
err = _err
return
}
err = errors.Join(err, _err)
}()
p.scan()
for p.tok != scanner.EOF {
e = append(e, p.parseExpr())
}
if p.s.ErrorCount != 0 {
err = ScanError(p.s.ErrorCount)
}
return
}

View File

@@ -1,169 +0,0 @@
package azalea_test
import (
_ "embed"
"reflect"
"strings"
"testing"
"text/scanner"
. "hakurei.app/internal/rosa/azalea"
)
//go:embed testdata/gcc.az
var sample string
func TestParse(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
data string
want []any
err error
}{
{"invalid", "}", nil, ExprError('}')},
{"bad sep", "f{v?}", nil, TokenError{'=', '?'}},
{"bad ident", "f{9}", nil, TokenError{scanner.Ident, scanner.Int}},
{"share bad sep", "f { v,,v = v; }", nil, ExprError(',')},
{"share missing sep", "f { v v }", nil, TokenError{',', scanner.Ident}},
{"ident", `v`, []any{Ident("v")}, nil},
{"concat", `f { v = v+"\xfd"+p{}+9; }`, []any{Func{
Ident: "f",
Args: []Arg{{K: []Ident{"v"}, V: Val{
Ident("v"),
String("\xfd"),
Func{Ident: "p"},
Int(9),
}}},
}}, nil},
{"truncated string concat", `f { v = v+; }`, nil,
ExprError(';')},
{"empty pairs", `{}`, []any{[]KV(nil)}, nil},
{"short kv", `{"\x00":v;}`, []any{[]KV{
{K: "\x00", V: Val{Ident("v")}},
}}, nil},
{"truncated kv", `{"\x00"`, nil, ExprError(scanner.EOF)},
{"ident kv", `{v="";}`, nil, ExprError(scanner.Ident)},
{"empty array", `[]`, []any{Array(nil)}, nil},
{"integer array", `[9]`, []any{Array{{Int(9)}}}, nil},
{"short array", `[ "\x00" ]`, []any{
Array{{String("\x00")}},
}, nil},
{"short array delim", `[ "\x00", ]`, []any{
Array{{String("\x00")}},
}, nil},
{"missing array value", `[ "\x00", , v ]`, nil, ExprError(',')},
{"missing array delimiter", `[ v0 v1 ]`, nil, TokenError{',', scanner.Ident}},
{"truncated array", `[ "\x00"`, nil,
ExprError(scanner.EOF)},
{"gcc", sample, []any{Func{
Ident: Ident("gcc"),
Package: true,
Args: []Arg{
{K: []Ident{Ident("description")}, V: Val{String("The GNU Compiler Collection")}},
{K: []Ident{Ident("website")}, V: Val{String("https://www.gnu.org/software/gcc")}},
{K: []Ident{Ident("anitya")}, V: Val{Int(6502)}},
{K: []Ident{Ident("version")}, V: Val{String("16.1.0")}, R: true},
{K: []Ident{Ident("source")}, V: Val{Func{
Ident: Ident("remoteTar"),
Args: []Arg{
{K: []Ident{Ident("url")}, V: Val{
String("https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"),
String("gcc-"),
Ident("version"),
String("/gcc-"),
Ident("version"),
String(".tar.gz"),
}},
{K: []Ident{Ident("checksum")}, V: Val{String("4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K")}},
{K: []Ident{Ident("compress")}, V: Val{Ident("gzip")}},
},
}}},
{K: []Ident{Ident("patches")}, V: Val{Array{
{String("musl-off64_t-loff_t.patch")},
{String("musl-legacy-lfs.patch")},
}}},
{K: []Ident{Ident("exclusive")}, V: Val{Ident("true")}},
{K: []Ident{Ident("exec")}, V: Val{Func{
Ident: Ident("make"),
Args: []Arg{
{K: []Ident{Ident("configure")}, V: Val{[]KV{
{K: String("disable-multilib")},
{K: String("enable-default-pie")},
{K: String("disable-nls")},
{K: String("with-gnu-as")},
{K: String("with-gnu-ld")},
{K: String("with-system-zlib")},
{K: String("enable-languages"), V: Val{String("c,c++,go")}},
{K: String("with-native-system-header-dir"), V: Val{String("/system/include")}},
{K: String("with-multilib-list"), V: Val{Func{
Ident: Ident("arch"),
Args: []Arg{
{K: []Ident{Ident("amd64"), Ident("arm64")}, V: Val{String("''")}},
{K: []Ident{Ident("default")}, V: Val{Ident("unset")}},
},
}}},
}}},
{K: []Ident{Ident("make")}, V: Val{Array{
{String("BOOT_CFLAGS='-O2 -g'")},
{
Func{Ident: Ident("noop"), Args: []Arg{{K: []Ident{Ident("key")}, V: Val{Ident("value")}}}},
String("\x00"),
},
{String("bootstrap")},
}}},
{K: []Ident{Ident("skip-check")}, V: Val{Ident("true")}},
},
}}},
{K: []Ident{Ident("inputs")}, V: Val{Array{
{Ident("binutils")},
{Ident("mpc")},
{Ident("zlib")},
{Ident("libucontext")},
{Ident("kernel-headers")},
}}},
},
}}, nil},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
p, err := Parse(strings.NewReader(tc.data))
if !reflect.DeepEqual(p, tc.want) {
t.Errorf("Parse: %#v, want %#v", p, tc.want)
}
if !reflect.DeepEqual(err, tc.err) {
t.Errorf("Parse: error = %v, want %v", err, tc.err)
}
})
}
}
func BenchmarkParse(b *testing.B) {
r := strings.NewReader(sample)
for b.Loop() {
if _, err := Parse(r); err != nil {
b.Fatal(err)
}
b.StopTimer()
r.Reset(sample)
b.StartTimer()
}
}

View File

@@ -1,361 +0,0 @@
package azalea
import (
"errors"
"fmt"
"maps"
"reflect"
"slices"
"unique"
)
// Value are types supported by the language.
type Value interface {
bool | int64 | string | []string | [][2]string
}
type (
// FArg is an argument passed to [F].
FArg struct {
K unique.Handle[Ident]
V any
R bool
}
// FArgs are arguments passed to [F].
FArgs []FArg
// PF implements the package declaration function.
PF func(name Ident, args FArgs) (v any, set bool, err error)
// F is the implementation of a [Func].
F struct {
F func(args FArgs) (v any, set bool, err error)
V map[unique.Handle[Ident]]any
}
)
// Apply applies named arguments and rejects unused arguments.
func (args FArgs) Apply(v map[unique.Handle[Ident]]any) error {
for _, arg := range args {
if arg.V == nil {
// unset
continue
}
r, ok := v[arg.K]
if !ok {
if arg.R {
continue
}
return UndefinedError(arg.K.Value())
}
err := storeE(r, arg.V)
if err != nil {
return err
}
}
return nil
}
// A Frame refers to local variables and debugging information.
type Frame struct {
// Local constants.
Val map[unique.Handle[Ident]]any
// Functions.
Func map[unique.Handle[Ident]]F
}
// UnsupportedExprError is an expression with invalid concrete type.
type UnsupportedExprError struct{ E any }
func (e UnsupportedExprError) Error() string {
return fmt.Sprintf("unsupported expression %#v", e.E)
}
// UndefinedError is an identifier not defined in any stack frame visible to the
// expression containing it.
type UndefinedError Ident
func (e UndefinedError) Error() string {
return "undefined: " + string(e)
}
// evaluate is evaluateAny with a type parameter.
func evaluate[T Value](d PF, s []Frame, expr any, rp *T) bool {
return evaluateAny(d, s, expr, rp)
}
// TypeError is an unexpected type during evaluation.
type TypeError struct {
Concrete, Asserted reflect.Type
}
func (e TypeError) Error() string {
return "expected " + e.Asserted.String() + ", got " + e.Concrete.String()
}
func (e TypeError) Is(err error) bool {
var v TypeError
return errors.As(err, &v) &&
e.Asserted == v.Asserted &&
e.Concrete == v.Concrete
}
// storeE is a convenience function to set the value of a result pointer.
func storeE(rp any, r any) error {
pv := reflect.ValueOf(rp).Elem()
v := reflect.ValueOf(r)
pt, vt := pv.Type(), v.Type()
if !vt.AssignableTo(pt) {
return TypeError{vt, pt}
}
pv.Set(v)
return nil
}
// store is like storeE, but panics if error is non-nil.
func store[T Value](rp any, r T) {
err := storeE(rp, r)
if err != nil {
panic(err)
}
}
// EvaluationError is an error and the expression it occurred in.
type EvaluationError struct {
Expr any
Err error
}
// Unwrap returns the underlying error.
func (e EvaluationError) Unwrap() error { return e.Err }
// Error returns a very long error description that should not be presented
// to the user directly.
func (e EvaluationError) Error() string {
return fmt.Sprintf("expression %#v: %v", e.Expr, e.Err)
}
var (
// IdentInputs is a special array argument in a package declaration whose
// values of [Ident] are kept as is when passed to a [PF].
IdentInputs = unique.Make(Ident("inputs"))
// IdentRuntime has the same semantics as [IdentInputs].
IdentRuntime = unique.Make(Ident("runtime"))
// ErrInvalidInputs is panicked for an [IdentInputs] argument to [PF]
// sharing its value or set for R.
ErrInvalidInputs = errors.New("inputs must not be common or bound to scope")
)
// evaluateAny implements [Evaluate].
func evaluateAny(d PF, s []Frame, expr, rp any) bool {
defer func() {
r := recover()
if r == nil {
return
}
err, ok := r.(error)
if !ok {
panic(r)
}
if _, ok = err.(EvaluationError); ok {
panic(err)
}
panic(EvaluationError{expr, err})
}()
switch e := expr.(type) {
case Int:
store(rp, int64(e))
return true
case String:
store(rp, string(e))
return true
case Ident:
var (
v any
ok bool
)
for i := range s {
v, ok = s[len(s)-1-i].Val[unique.Make(e)]
if ok {
break
}
}
if !ok {
panic(UndefinedError(e))
}
if err := storeE(rp, v); err != nil {
panic(err)
}
return true
case Val:
if len(e) == 1 {
switch v := e[0].(type) {
case Ident:
switch v {
case "unset":
return false
case "true":
store(rp, true)
return true
case "false":
store(rp, false)
return true
default:
return evaluateAny(d, s, v, rp)
}
default:
return evaluateAny(d, s, e[0], rp)
}
}
var v string
for i := range e {
var _r string
if evaluate(d, s, e[i], &_r) {
v += _r
}
}
store(rp, v)
return true
case Array:
r := make([]string, 0, len(e))
for i := range e {
var _r string
if evaluate(d, s, e[i], &_r) {
r = append(r, _r)
}
}
store(rp, r)
return true
case []KV:
r := make([][2]string, 0, len(e))
for i := range e {
var _r string
if e[i].V == nil || evaluate(d, s, e[i].V, &_r) {
r = append(r, [2]string{string(e[i].K), _r})
}
}
store(rp, r)
return true
case Func:
var (
f F
ok bool
)
if !e.Package {
for i := range s {
f, ok = s[len(s)-1-i].Func[unique.Make(e.Ident)]
if ok {
break
}
}
if !ok {
panic(UndefinedError(e.Ident))
}
}
argc := len(e.Args)
for _, arg := range e.Args {
argc += len(arg.K) - 1
}
fargs := make([]FArg, 0, len(e.Args))
s = append(s, Frame{})
fp := &s[len(s)-1]
if !e.Package {
fp.Val = maps.Clone(f.V)
}
args:
for _, arg := range e.Args {
names := make([]unique.Handle[Ident], len(arg.K))
for i, name := range arg.K {
names[i] = unique.Make(name)
}
farg := FArg{R: arg.R}
if e.Package {
for _, special := range [...]unique.Handle[Ident]{
IdentInputs,
IdentRuntime,
} {
if slices.Contains(names, special) {
if len(names) != 1 || len(arg.V) != 1 || arg.R {
panic(ErrInvalidInputs)
}
farg.K = names[0]
if err := storeE(&farg.V, arg.V[0]); err != nil {
panic(err)
}
fargs = append(fargs, farg)
continue args
}
}
}
if !evaluateAny(d, s, arg.V, &farg.V) {
farg.V = nil
}
for _, name := range names {
farg.K = name
fargs = append(fargs, farg)
if arg.R && farg.V != nil {
if fp.Val == nil {
fp.Val = make(map[unique.Handle[Ident]]any)
}
(*fp).Val[name] = farg.V
}
}
}
var (
v any
err error
)
if !e.Package {
v, ok, err = f.F(fargs)
} else {
v, ok, err = d(e.Ident, fargs)
}
if err != nil {
panic(err)
} else if v != nil {
if err = storeE(rp, v); err != nil {
panic(err)
}
}
return ok
default:
panic(UnsupportedExprError{expr})
}
}
// Evaluate evaluates a statement and returns its value.
func Evaluate[T any](d PF, s []Frame, expr any) (v T, set bool, err error) {
defer func() {
r := recover()
if r == nil {
return
}
_err, ok := r.(error)
if !ok {
panic(r)
}
err = _err
}()
set = evaluateAny(d, s, expr, &v)
return
}

View File

@@ -1,364 +0,0 @@
package azalea_test
import (
"errors"
"fmt"
"reflect"
"strings"
"testing"
"unique"
. "hakurei.app/internal/rosa/azalea"
)
// makeStackCheck creates a stack with a single frame with a single function "f"
// which calls the check function internally.
func makeStackCheck(check func(args FArgs) (any, error)) []Frame {
return []Frame{{Func: map[unique.Handle[Ident]]F{
unique.Make(Ident("f")): {F: func(
args FArgs,
) (v any, set bool, err error) {
set = true
v, err = check(args)
return
}},
}}}
}
func TestEvaluate(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
data string
s []Frame
want string
err error
}{
{"apply unset", `f { v = unset; }`, makeStackCheck(func(
args FArgs,
) (v any, err error) {
v = "\xfd"
err = args.Apply(map[unique.Handle[Ident]]any{
unique.Make(Ident("v")): &v,
})
return
}), "\xfd", nil},
{"apply bad type", `f { v = 9; }`, makeStackCheck(func(
args FArgs,
) (v any, err error) {
v = "\xfd"
err = args.Apply(map[unique.Handle[Ident]]any{
unique.Make(Ident("v")): &v,
})
return
}), "", TypeError{
Concrete: reflect.TypeFor[int64](),
Asserted: reflect.TypeFor[string](),
}},
{"apply undefined", `f { v = 9; }`, makeStackCheck(func(
args FArgs,
) (v any, err error) {
v = "\xfd"
err = args.Apply(map[unique.Handle[Ident]]any{})
return
}), "", EvaluationError{
Expr: Func{
Ident: Ident("f"),
Args: []Arg{
{K: []Ident{"v"}, V: Val{Int(9)}},
},
},
Err: UndefinedError("v"),
}},
{"apply bound undefined", `f { _v* = "\x00"; v = _v; }`, makeStackCheck(func(
args FArgs,
) (v any, err error) {
v = "\xfd"
err = args.Apply(map[unique.Handle[Ident]]any{
unique.Make(Ident("v")): &v,
})
return
}), "\x00", nil},
{"undefined function", `f {}`, nil, "", EvaluationError{
Expr: Func{Ident: "f"},
Err: UndefinedError("f"),
}},
{"error wrap deep", `f { v = nil; }`, makeStackCheck(func(
FArgs,
) (any, error) {
panic("unreachable")
}), "", EvaluationError{
Expr: Ident("nil"),
Err: UndefinedError("nil"),
}},
{"common inputs", `package name { inputs, v = []; }`, nil, "", EvaluationError{
Expr: Func{
Ident: Ident("name"),
Package: true,
Args: []Arg{
{K: []Ident{
"inputs",
"v",
}, V: Val{Array(nil)}},
},
},
Err: ErrInvalidInputs,
}},
{"bound inputs", `package name { inputs* = []; }`, nil, "", EvaluationError{
Expr: Func{
Ident: Ident("name"),
Package: true,
Args: []Arg{
{K: []Ident{"inputs"}, V: Val{Array(nil)}, R: true},
},
},
Err: ErrInvalidInputs,
}},
{"bound runtime", `package name { runtime* = []; }`, nil, "", EvaluationError{
Expr: Func{
Ident: Ident("name"),
Package: true,
Args: []Arg{
{K: []Ident{"runtime"}, V: Val{Array(nil)}, R: true},
},
},
Err: ErrInvalidInputs,
}},
{"concat inputs", `package name { inputs = ""+""; }`, nil, "", EvaluationError{
Expr: Func{
Ident: Ident("name"),
Package: true,
Args: []Arg{
{K: []Ident{"inputs"}, V: Val{String(""), String("")}},
},
},
Err: ErrInvalidInputs,
}},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
var expr Func
if e, err := Parse(strings.NewReader(tc.data)); err != nil {
t.Fatal(err)
} else if len(e) != 1 {
t.Fatalf("got expression %#v", e)
} else {
expr = e[0].(Func)
}
r, set, err := Evaluate[string](nil, tc.s, expr)
if set != (err == nil) {
t.Error("Evaluate: unexpected unset")
}
if r != tc.want {
t.Errorf("Evaluate: %q, want %q", r, tc.want)
}
var errEquals bool
if errors.As(err, new(TypeError)) {
errEquals = errors.Is(err, tc.err)
} else {
errEquals = reflect.DeepEqual(err, tc.err)
}
if !errEquals {
t.Errorf("Evaluate: error = %v, want %v", err, tc.err)
}
})
}
}
func TestEvaluateGCC(t *testing.T) {
t.Parallel()
var gcc Func
if e, err := Parse(strings.NewReader(sample)); err != nil {
t.Fatal(err)
} else {
gcc = e[0].(Func)
}
var got [3]FArgs
if r, set, err := Evaluate[string](func(
name Ident,
args FArgs,
) (v any, set bool, err error) {
v = "\x00"
set = true
got[0] = args
return
}, []Frame{{
Func: map[unique.Handle[Ident]]F{
unique.Make(Ident("remoteTar")): {F: func(
args FArgs,
) (v any, set bool, err error) {
var url, checksum string
var compress int
if err = args.Apply(map[unique.Handle[Ident]]any{
unique.Make(Ident("url")): &url,
unique.Make(Ident("checksum")): &checksum,
unique.Make(Ident("compress")): &compress,
}); err != nil {
return
}
if compress != 0xcafe {
err = fmt.Errorf("unexpected compress %#v", compress)
}
set = true
v = url + "?checksum=" + checksum
return
}, V: map[unique.Handle[Ident]]any{
unique.Make(Ident("gzip")): 0xcafe,
}},
unique.Make(Ident("make")): {F: func(
args FArgs,
) (v any, set bool, err error) {
v = args
set = true
return
}},
unique.Make(Ident("arch")): {F: func(
args FArgs,
) (v any, set bool, err error) {
set = false
got[1] = args
return
}},
unique.Make(Ident("noop")): {F: func(
args FArgs,
) (v any, set bool, err error) {
set = false
set = true
got[2] = args
return
}, V: map[unique.Handle[Ident]]any{
unique.Make(Ident("value")): "\xfd",
}},
},
}}, gcc); err != nil {
t.Fatal(err)
} else if r != "\x00" {
t.Fatalf("package: %q", r)
} else if !set {
t.Fatal("package: unset")
}
want := [...]FArgs{
{
{K: unique.Make(Ident("description")), V: "The GNU Compiler Collection"},
{K: unique.Make(Ident("website")), V: "https://www.gnu.org/software/gcc"},
{K: unique.Make(Ident("anitya")), V: int64(6502)},
{K: unique.Make(Ident("version")), V: "16.1.0", R: true},
{K: unique.Make(Ident("source")), V: "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-16.1.0/gcc-16.1.0.tar.gz?checksum=4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K"},
{K: unique.Make(Ident("patches")), V: []string{"musl-off64_t-loff_t.patch", "musl-legacy-lfs.patch"}},
{K: unique.Make(Ident("exclusive")), V: true},
{K: unique.Make(Ident("exec")), V: FArgs{
{K: unique.Make(Ident("configure")), V: [][2]string{
{"disable-multilib", ""},
{"enable-default-pie", ""},
{"disable-nls", ""},
{"with-gnu-as", ""},
{"with-gnu-ld", ""},
{"with-system-zlib", ""},
{"enable-languages", "c,c++,go"},
{"with-native-system-header-dir", "/system/include"},
}},
{K: unique.Make(Ident("make")), V: []string{
"BOOT_CFLAGS='-O2 -g'",
"\x00",
"bootstrap",
}},
{K: unique.Make(Ident("skip-check")), V: true},
}},
{K: unique.Make(Ident("inputs")), V: Array{
{Ident("binutils")},
{Ident("mpc")},
{Ident("zlib")},
{Ident("libucontext")},
{Ident("kernel-headers")},
}},
},
{
{K: unique.Make(Ident("amd64")), V: "''"},
{K: unique.Make(Ident("arm64")), V: "''"},
{K: unique.Make(Ident("default"))},
},
{{K: unique.Make(Ident("key")), V: "\xfd"}},
}
if !reflect.DeepEqual(got, want) {
t.Errorf("package: args = %#v, want %#v", got, want)
}
}
func BenchmarkEvaluate(b *testing.B) {
var gcc Func
if e, err := Parse(strings.NewReader(sample)); err != nil {
b.Fatal(err)
} else {
gcc = e[0].(Func)
}
s := []Frame{{
Func: map[unique.Handle[Ident]]F{
unique.Make(Ident("remoteTar")): {F: func(
FArgs,
) (v any, set bool, err error) {
return
}, V: map[unique.Handle[Ident]]any{
unique.Make(Ident("gzip")): 0xcafe,
}},
unique.Make(Ident("make")): {F: func(
FArgs,
) (v any, set bool, err error) {
return
}},
unique.Make(Ident("arch")): {F: func(
FArgs,
) (v any, set bool, err error) {
return
}},
unique.Make(Ident("noop")): {F: func(
FArgs,
) (v any, set bool, err error) {
return
}, V: map[unique.Handle[Ident]]any{
unique.Make(Ident("value")): "\xfd",
}},
},
}}
for b.Loop() {
if _, _, err := Evaluate[string](func(
Ident,
FArgs,
) (v any, set bool, err error) {
return
}, s, gcc); err != nil {
b.Fatal(err)
}
}
}

View File

@@ -1,57 +0,0 @@
package gcc {
description = "The GNU Compiler Collection";
website = "https://www.gnu.org/software/gcc";
anitya = 6502;
version* = "16.1.0";
source = remoteTar {
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
"gcc-"+version+"/gcc-"+version+".tar.gz";
checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
compress = gzip;
};
patches = [
"musl-off64_t-loff_t.patch",
"musl-legacy-lfs.patch",
];
// GCC spends most of its time in its many configure scripts, however
// it also saturates the CPU for a consequential amount of time.
exclusive = true;
exec = make {
configure = {
"disable-multilib";
"enable-default-pie";
"disable-nls";
"with-gnu-as";
"with-gnu-ld";
"with-system-zlib";
"enable-languages": "c,c++,go";
"with-native-system-header-dir": "/system/include";
"with-multilib-list": arch {
amd64, arm64 = "''";
default = unset;
};
};
make = [
"BOOT_CFLAGS='-O2 -g'",
noop { key = value; } + "\x00",
"bootstrap",
];
// This toolchain is hacked to pieces, it is not expected to ever work
// well in its current state. That does not matter as long as the
// toolchain it produces passes its own test suite.
skip-check = true;
};
inputs = [
binutils,
mpc,
zlib,
libucontext,
kernel-headers,
];
}

View File

@@ -85,13 +85,13 @@ func (a busyboxBin) Cure(t *pkg.TContext) (err error) {
// newBusyboxBin returns a [pkg.Artifact] containing a busybox installation from
// the https://busybox.net/downloads/binaries/ binary release.
func (s *S) newBusyboxBin() pkg.Artifact {
func newBusyboxBin() pkg.Artifact {
var version, url, checksum string
switch s.arch {
switch arch {
case "amd64":
version = "1.35.0"
url = "https://busybox.net/downloads/binaries/" +
version + "-" + s.linuxArch() + "-linux-musl/busybox"
version + "-" + linuxArch() + "-linux-musl/busybox"
checksum = "L7OBIsPu9enNHn7FqpBT1kOg_mCLNmetSeNMA3i4Y60Z5jTgnlX3qX3zcQtLx5AB"
case "arm64":
version = "1.31.0"
@@ -100,11 +100,11 @@ func (s *S) newBusyboxBin() pkg.Artifact {
checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg"
default:
panic("unsupported target " + s.arch)
panic("unsupported target " + arch)
}
return pkg.NewExec(
"busybox-bin-"+version, s.arch, nil, pkg.ExecTimeoutMax, false, false,
"busybox-bin-"+version, arch, nil, pkg.ExecTimeoutMax, false, false,
fhs.AbsRoot, []string{
"PATH=/system/bin",
},

View File

@@ -26,7 +26,7 @@ func (t Toolchain) newBzip2() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Bzip2] = Metadata{
f: Toolchain.newBzip2,
Name: "bzip2",
@@ -34,5 +34,5 @@ func init() {
Website: "https://sourceware.org/bzip2/",
ID: 237,
})
}
}

View File

@@ -106,7 +106,7 @@ index 2ead810437..f85cbb8b1c 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[CMake] = Metadata{
f: Toolchain.newCMake,
Name: "cmake",
@@ -114,7 +114,7 @@ func init() {
Website: "https://cmake.org/",
ID: 306,
})
}
}
// CMakeHelper is the [CMake] build system helper.
@@ -164,7 +164,7 @@ func (*CMakeHelper) createDir() bool { return true }
func (*CMakeHelper) wantsDir() string { return "/cure/" }
// script generates the cure script.
func (attr *CMakeHelper) script(s *S, name string) string {
func (attr *CMakeHelper) script(name string) string {
if attr == nil {
attr = new(CMakeHelper)
}
@@ -180,7 +180,7 @@ func (attr *CMakeHelper) script(s *S, name string) string {
}
script := attr.Script
if !attr.SkipTest && s.opts&OptSkipCheck == 0 {
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
script += "\n" + test
}

View File

@@ -90,7 +90,7 @@ func (t Toolchain) newConnman() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Connman] = Metadata{
f: Toolchain.newConnman,
Name: "connman",
@@ -105,5 +105,5 @@ func init() {
},
ID: 337,
})
}
}

View File

@@ -39,7 +39,7 @@ chmod +w tests/data && rm -f tests/data/test459
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Curl] = Metadata{
f: Toolchain.newCurl,
Name: "curl",
@@ -52,5 +52,5 @@ func init() {
},
ID: 381,
})
}
}

View File

@@ -29,7 +29,7 @@ func (t Toolchain) newDBus() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[DBus] = Metadata{
f: Toolchain.newDBus,
Name: "dbus",
@@ -42,7 +42,7 @@ func init() {
},
ID: 5356,
})
}
}
func (t Toolchain) newXDGDBusProxy() (pkg.Artifact, string) {
@@ -65,7 +65,7 @@ func (t Toolchain) newXDGDBusProxy() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XDGDBusProxy] = Metadata{
f: Toolchain.newXDGDBusProxy,
Name: "xdg-dbus-proxy",
@@ -77,5 +77,5 @@ func init() {
},
ID: 58434,
})
}
}

View File

@@ -31,7 +31,7 @@ func (t Toolchain) newDTC() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[DTC] = Metadata{
f: Toolchain.newDTC,
Name: "dtc",
@@ -39,5 +39,5 @@ func init() {
Website: "https://git.kernel.org/pub/scm/utils/dtc/dtc.git/",
ID: 16911,
})
}
}

View File

@@ -39,7 +39,7 @@ func (t Toolchain) newElfutils() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Elfutils] = Metadata{
f: Toolchain.newElfutils,
Name: "elfutils",
@@ -55,5 +55,5 @@ func init() {
},
ID: 5679,
})
}
}

View File

@@ -46,7 +46,7 @@ index f135ad9..85c784c 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Fakeroot] = Metadata{
f: Toolchain.newFakeroot,
Name: "fakeroot",
@@ -54,5 +54,5 @@ func init() {
Website: "https://salsa.debian.org/clint/fakeroot",
ID: 12048,
})
}
}

View File

@@ -20,7 +20,7 @@ func (t Toolchain) newFlex() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Flex] = Metadata{
f: Toolchain.newFlex,
Name: "flex",
@@ -28,5 +28,5 @@ func init() {
Website: "https://github.com/westes/flex/",
ID: 819,
})
}
}

View File

@@ -15,7 +15,7 @@ func (t Toolchain) newFreetype() (pkg.Artifact, string) {
), nil, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Freetype] = Metadata{
f: Toolchain.newFreetype,
Name: "freetype",
@@ -23,5 +23,5 @@ func init() {
Website: "http://www.freetype.org/",
ID: 854,
})
}
}

View File

@@ -31,7 +31,7 @@ func (t Toolchain) newFuse() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Fuse] = Metadata{
f: Toolchain.newFuse,
Name: "fuse",
@@ -39,5 +39,5 @@ func init() {
Website: "https://github.com/libfuse/libfuse/",
ID: 861,
})
}
}

View File

@@ -88,7 +88,7 @@ disable_test t5515-fetch-merge-logic
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Git] = Metadata{
f: Toolchain.newGit,
Name: "git",
@@ -102,7 +102,7 @@ func init() {
},
ID: 5350,
})
}
}
// NewViaGit returns a [pkg.Artifact] for cloning a git repository.
@@ -113,7 +113,7 @@ func (t Toolchain) NewViaGit(
return t.New(strings.TrimSuffix(
path.Base(url),
".git",
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
)+"-src-"+path.Base(rev), THostNet, t.AppendPresets(nil,
NSSCACert,
Git,
), &checksum, nil, `

View File

@@ -22,7 +22,7 @@ func (t Toolchain) newSPIRVHeaders() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[SPIRVHeaders] = Metadata{
f: Toolchain.newSPIRVHeaders,
Name: "spirv-headers",
@@ -49,7 +49,7 @@ func init() {
}
return v.Latest
},
})
}
}
func (t Toolchain) newSPIRVTools() (pkg.Artifact, string) {
@@ -72,7 +72,7 @@ func (t Toolchain) newSPIRVTools() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[SPIRVTools] = Metadata{
f: Toolchain.newSPIRVTools,
Name: "spirv-tools",
@@ -86,7 +86,7 @@ func init() {
ID: 14894,
latest: (*Versions).getStable,
})
}
}
func (t Toolchain) newGlslang() (pkg.Artifact, string) {
@@ -116,7 +116,7 @@ func (t Toolchain) newGlslang() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Glslang] = Metadata{
f: Toolchain.newGlslang,
Name: "glslang",
@@ -124,7 +124,7 @@ func init() {
Website: "https://github.com/KhronosGroup/glslang",
ID: 205796,
})
}
}
func (t Toolchain) newSPIRVLLVMTranslator() (pkg.Artifact, string) {
@@ -137,7 +137,7 @@ func (t Toolchain) newSPIRVLLVMTranslator() (pkg.Artifact, string) {
"cooperative_matrix_constant_null.spvasm",
}
switch t.arch {
switch arch {
case "arm64":
skipChecks = append(skipChecks,
// LLVM ERROR: unsupported calling convention
@@ -232,7 +232,7 @@ export LIT_OPTS=` + litArgs(true, skipChecks...) + `
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[SPIRVLLVMTranslator] = Metadata{
f: Toolchain.newSPIRVLLVMTranslator,
Name: "spirv-llvm-translator",
@@ -244,5 +244,5 @@ func init() {
},
ID: 227273,
})
}
}

View File

@@ -63,7 +63,7 @@ chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[M4] = Metadata{
f: Toolchain.newM4,
Name: "m4",
@@ -71,7 +71,7 @@ func init() {
Website: "https://www.gnu.org/software/m4/",
ID: 1871,
})
}
}
func (t Toolchain) newBison() (pkg.Artifact, string) {
@@ -98,7 +98,7 @@ func (t Toolchain) newBison() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Bison] = Metadata{
f: Toolchain.newBison,
Name: "bison",
@@ -106,7 +106,7 @@ func init() {
Website: "https://www.gnu.org/software/bison/",
ID: 193,
})
}
}
func (t Toolchain) newSed() (pkg.Artifact, string) {
@@ -125,7 +125,7 @@ func (t Toolchain) newSed() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Sed] = Metadata{
f: Toolchain.newSed,
Name: "sed",
@@ -133,7 +133,7 @@ func init() {
Website: "https://www.gnu.org/software/sed/",
ID: 4789,
})
}
}
func (t Toolchain) newAutoconf() (pkg.Artifact, string) {
@@ -160,7 +160,7 @@ func (t Toolchain) newAutoconf() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Autoconf] = Metadata{
f: Toolchain.newAutoconf,
Name: "autoconf",
@@ -173,7 +173,7 @@ func init() {
},
ID: 141,
})
}
}
func (t Toolchain) newAutomake() (pkg.Artifact, string) {
@@ -205,7 +205,7 @@ test_disable '#!/bin/sh' t/pr9.sh
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Automake] = Metadata{
f: Toolchain.newAutomake,
Name: "automake",
@@ -217,7 +217,7 @@ func init() {
},
ID: 144,
})
}
}
func (t Toolchain) newLibtool() (pkg.Artifact, string) {
@@ -231,7 +231,7 @@ func (t Toolchain) newLibtool() (pkg.Artifact, string) {
pkg.TarGzip,
), nil, &MakeHelper{
// _Z2a2c: symbol not found
SkipCheck: t.stage.isStage0(),
SkipCheck: t.isStage0(),
Check: []string{
"TESTSUITEFLAGS=" + jobsFlagE,
@@ -243,7 +243,7 @@ func (t Toolchain) newLibtool() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libtool] = Metadata{
f: Toolchain.newLibtool,
Name: "libtool",
@@ -251,7 +251,7 @@ func init() {
Website: "https://www.gnu.org/software/libtool/",
ID: 1741,
})
}
}
func (t Toolchain) newGzip() (pkg.Artifact, string) {
@@ -269,7 +269,7 @@ func (t Toolchain) newGzip() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Gzip] = Metadata{
f: Toolchain.newGzip,
Name: "gzip",
@@ -277,7 +277,7 @@ func init() {
Website: "https://www.gnu.org/software/gzip/",
ID: 1290,
})
}
}
func (t Toolchain) newGettext() (pkg.Artifact, string) {
@@ -315,7 +315,7 @@ touch gettext-tools/autotools/archive.dir.tar
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Gettext] = Metadata{
f: Toolchain.newGettext,
Name: "gettext",
@@ -323,7 +323,7 @@ func init() {
Website: "https://www.gnu.org/software/gettext/",
ID: 898,
})
}
}
func (t Toolchain) newDiffutils() (pkg.Artifact, string) {
@@ -348,7 +348,7 @@ test_disable '#!/bin/sh' tests/cmp
}, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Diffutils] = Metadata{
f: Toolchain.newDiffutils,
Name: "diffutils",
@@ -356,7 +356,7 @@ func init() {
Website: "https://www.gnu.org/software/diffutils/",
ID: 436,
})
}
}
func (t Toolchain) newPatch() (pkg.Artifact, string) {
@@ -380,7 +380,7 @@ test_disable '#!/bin/sh' tests/need-filename
}, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Patch] = Metadata{
f: Toolchain.newPatch,
Name: "patch",
@@ -388,7 +388,7 @@ func init() {
Website: "https://savannah.gnu.org/projects/patch/",
ID: 2597,
})
}
}
func (t Toolchain) newBash() (pkg.Artifact, string) {
@@ -410,7 +410,7 @@ func (t Toolchain) newBash() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Bash] = Metadata{
f: Toolchain.newBash,
Name: "bash",
@@ -418,7 +418,7 @@ func init() {
Website: "https://www.gnu.org/software/bash/",
ID: 166,
})
}
}
func (t Toolchain) newCoreutils() (pkg.Artifact, string) {
@@ -456,7 +456,7 @@ test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Coreutils] = Metadata{
f: Toolchain.newCoreutils,
Name: "coreutils",
@@ -464,7 +464,7 @@ func init() {
Website: "https://www.gnu.org/software/coreutils/",
ID: 343,
})
}
}
func (t Toolchain) newTexinfo() (pkg.Artifact, string) {
@@ -484,7 +484,7 @@ func (t Toolchain) newTexinfo() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Texinfo] = Metadata{
f: Toolchain.newTexinfo,
Name: "texinfo",
@@ -497,7 +497,7 @@ func init() {
},
ID: 4958,
})
}
}
func (t Toolchain) newGperf() (pkg.Artifact, string) {
@@ -514,7 +514,7 @@ func (t Toolchain) newGperf() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Gperf] = Metadata{
f: Toolchain.newGperf,
Name: "gperf",
@@ -522,7 +522,7 @@ func init() {
Website: "https://www.gnu.org/software/gperf/",
ID: 1237,
})
}
}
func (t Toolchain) newGawk() (pkg.Artifact, string) {
@@ -542,7 +542,7 @@ func (t Toolchain) newGawk() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Gawk] = Metadata{
f: Toolchain.newGawk,
Name: "gawk",
@@ -550,7 +550,7 @@ func init() {
Website: "https://www.gnu.org/software/gawk/",
ID: 868,
})
}
}
func (t Toolchain) newGrep() (pkg.Artifact, string) {
@@ -575,7 +575,7 @@ test_disable 'int main(){return 0;}' gnulib-tests/test-c32ispunct.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Grep] = Metadata{
f: Toolchain.newGrep,
Name: "grep",
@@ -583,7 +583,7 @@ func init() {
Website: "https://www.gnu.org/software/grep/",
ID: 1251,
})
}
}
func (t Toolchain) newFindutils() (pkg.Artifact, string) {
@@ -606,7 +606,7 @@ echo 'int main(){return 0;}' > tests/xargs/test-sigusr.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Findutils] = Metadata{
f: Toolchain.newFindutils,
Name: "findutils",
@@ -614,7 +614,7 @@ func init() {
Website: "https://www.gnu.org/software/findutils/",
ID: 812,
})
}
}
func (t Toolchain) newBC() (pkg.Artifact, string) {
@@ -635,7 +635,7 @@ func (t Toolchain) newBC() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[BC] = Metadata{
f: Toolchain.newBC,
Name: "bc",
@@ -643,7 +643,7 @@ func init() {
Website: "https://www.gnu.org/software/bc/",
ID: 170,
})
}
}
func (t Toolchain) newLibiconv() (pkg.Artifact, string) {
@@ -658,7 +658,7 @@ func (t Toolchain) newLibiconv() (pkg.Artifact, string) {
), nil, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libiconv] = Metadata{
f: Toolchain.newLibiconv,
Name: "libiconv",
@@ -666,7 +666,7 @@ func init() {
Website: "https://www.gnu.org/software/libiconv/",
ID: 10656,
})
}
}
func (t Toolchain) newTar() (pkg.Artifact, string) {
@@ -700,7 +700,7 @@ func (t Toolchain) newTar() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Tar] = Metadata{
f: Toolchain.newTar,
Name: "tar",
@@ -708,7 +708,7 @@ func init() {
Website: "https://www.gnu.org/software/tar/",
ID: 4939,
})
}
}
func (t Toolchain) newParallel() (pkg.Artifact, string) {
@@ -730,7 +730,7 @@ ln -s ../system/bin/bash /bin/
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Parallel] = Metadata{
f: Toolchain.newParallel,
Name: "parallel",
@@ -742,7 +742,7 @@ func init() {
},
ID: 5448,
})
}
}
func (t Toolchain) newLibunistring() (pkg.Artifact, string) {
@@ -767,7 +767,7 @@ test_disable 'int main(){return 0;}' tests/test-c32ispunct.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libunistring] = Metadata{
f: Toolchain.newLibunistring,
Name: "libunistring",
@@ -775,7 +775,7 @@ func init() {
Website: "https://www.gnu.org/software/libunistring/",
ID: 1747,
})
}
}
func (t Toolchain) newLibtasn1() (pkg.Artifact, string) {
@@ -790,7 +790,7 @@ func (t Toolchain) newLibtasn1() (pkg.Artifact, string) {
), nil, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libtasn1] = Metadata{
f: Toolchain.newLibtasn1,
Name: "libtasn1",
@@ -798,7 +798,7 @@ func init() {
Website: "https://www.gnu.org/software/libtasn1/",
ID: 1734,
})
}
}
func (t Toolchain) newReadline() (pkg.Artifact, string) {
@@ -820,7 +820,7 @@ func (t Toolchain) newReadline() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Readline] = Metadata{
f: Toolchain.newReadline,
Name: "readline",
@@ -832,7 +832,7 @@ func init() {
},
ID: 4173,
})
}
}
func (t Toolchain) newGnuTLS() (pkg.Artifact, string) {
@@ -842,7 +842,7 @@ func (t Toolchain) newGnuTLS() (pkg.Artifact, string) {
)
var configureExtra []KV
switch t.arch {
switch arch {
case "arm64":
configureExtra = []KV{
{"disable-hardware-acceleration"},
@@ -997,7 +997,7 @@ index 1b78b8cf1..350156a86 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[GnuTLS] = Metadata{
f: Toolchain.newGnuTLS,
Name: "gnutls",
@@ -1013,7 +1013,7 @@ func init() {
},
ID: 1221,
})
}
}
func (t Toolchain) newBinutils() (pkg.Artifact, string) {
@@ -1030,7 +1030,7 @@ func (t Toolchain) newBinutils() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Binutils] = Metadata{
f: Toolchain.newBinutils,
Name: "binutils",
@@ -1038,7 +1038,7 @@ func init() {
Website: "https://www.gnu.org/software/binutils/",
ID: 7981,
})
}
}
func (t Toolchain) newGMP() (pkg.Artifact, string) {
@@ -1060,7 +1060,7 @@ func (t Toolchain) newGMP() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[GMP] = Metadata{
f: Toolchain.newGMP,
Name: "gmp",
@@ -1068,7 +1068,7 @@ func init() {
Website: "https://gmplib.org/",
ID: 1186,
})
}
}
func (t Toolchain) newMPFR() (pkg.Artifact, string) {
@@ -1086,7 +1086,7 @@ func (t Toolchain) newMPFR() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[MPFR] = Metadata{
f: Toolchain.newMPFR,
Name: "mpfr",
@@ -1098,7 +1098,7 @@ func init() {
},
ID: 2019,
})
}
}
func (t Toolchain) newMPC() (pkg.Artifact, string) {
@@ -1125,7 +1125,7 @@ func (t Toolchain) newMPC() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[MPC] = Metadata{
f: Toolchain.newMPC,
Name: "mpc",
@@ -1137,7 +1137,7 @@ func init() {
},
ID: 1667,
})
}
}
func (t Toolchain) newGCC() (pkg.Artifact, string) {
@@ -1147,7 +1147,7 @@ func (t Toolchain) newGCC() (pkg.Artifact, string) {
)
var configureExtra []KV
switch t.arch {
switch arch {
case "amd64", "arm64":
configureExtra = append(configureExtra, KV{"with-multilib-list", "''"})
}
@@ -1346,7 +1346,7 @@ ln -s system/lib /work/
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[gcc] = Metadata{
f: Toolchain.newGCC,
Name: "gcc",
@@ -1362,5 +1362,5 @@ func init() {
},
ID: 6502,
})
}
}

View File

@@ -9,7 +9,7 @@ import (
// newGoBootstrap returns the Go bootstrap toolchain.
func (t Toolchain) newGoBootstrap() pkg.Artifact {
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
return t.New("go1.4-bootstrap", 0, t.Append(nil,
return t.New("go1.4-bootstrap", 0, t.AppendPresets(nil,
Bash,
), nil, []string{
"CGO_ENABLED=0",
@@ -35,10 +35,10 @@ func (t Toolchain) newGo(
extra ...pkg.Artifact,
) pkg.Artifact {
name := "all"
if t.opts&OptSkipCheck != 0 {
if presetOpts&OptSkipCheck != 0 {
name = "make"
}
return t.New("go"+version, 0, t.Append(extra,
return t.New("go"+version, 0, t.AppendPresets(extra,
Bash,
), nil, slices.Concat([]string{
"CC=cc",
@@ -72,17 +72,17 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
finalEnv []string
)
switch t.arch {
switch arch {
case "amd64":
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
case "arm64", "riscv64":
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
bootstrapExtra = t.Append(bootstrapExtra, gcc)
bootstrapExtra = t.AppendPresets(bootstrapExtra, gcc)
finalEnv = append(finalEnv, "CGO_ENABLED=0")
default:
panic("unsupported target " + t.arch)
panic("unsupported target " + arch)
}
go119 := t.newGo(
@@ -106,8 +106,8 @@ echo \
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
[]string{"CGO_ENABLED=0"}, `
sed -i \
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+t.arch+`/obj.go
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+arch+`/obj.go
rm \
crypto/tls/handshake_client_test.go \
@@ -124,8 +124,8 @@ echo \
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
[]string{"CGO_ENABLED=0"}, `
sed -i \
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+t.arch+`/obj.go
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+arch+`/obj.go
`, go121,
)
@@ -134,8 +134,8 @@ sed -i \
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
[]string{"CGO_ENABLED=0"}, `
sed -i \
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+t.arch+`/obj.go
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+arch+`/obj.go
rm \
os/root_unix_test.go \
@@ -152,8 +152,8 @@ rm \
checksum,
finalEnv, `
sed -i \
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+t.arch+`/obj.go
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+arch+`/obj.go
sed -i \
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
internal/runtime/gc/scan/scan_amd64.go
@@ -166,7 +166,7 @@ rm \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Go] = Metadata{
f: Toolchain.newGoLatest,
Name: "go",
@@ -174,5 +174,5 @@ func init() {
Website: "https://go.dev/",
ID: 1227,
})
}
}

View File

@@ -42,7 +42,7 @@ func (t Toolchain) newGLib() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[GLib] = Metadata{
f: Toolchain.newGLib,
Name: "glib",
@@ -56,5 +56,5 @@ func init() {
},
ID: 10024,
})
}
}

View File

@@ -14,7 +14,7 @@ go build -o /bin/hostname /usr/src/hostname/main.go
hostname = ""
}
return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.Append(nil,
return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, t.AppendPresets(nil,
Go,
PkgConfig,
@@ -58,7 +58,7 @@ func main() {
)))
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Hakurei] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newHakurei("", `
mkdir -p /work/system/libexec/hakurei/
@@ -93,11 +93,11 @@ mkdir -p /work/system/bin/
Website: "https://hakurei.app/",
ID: 388834,
})
native.MustRegister(&Artifact{
}
artifactsM[HakureiDist] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
name := "all"
if t.opts&OptSkipCheck != 0 {
if presetOpts&OptSkipCheck != 0 {
name = "make"
}
return t.newHakurei("-dist", `
@@ -109,5 +109,5 @@ DESTDIR=/work /usr/src/hakurei/`+name+`.sh
Name: "hakurei-dist",
Description: "low-level userspace tooling for Rosa OS (distribution tarball)",
Website: "https://hakurei.app/",
})
}
}

View File

@@ -22,7 +22,7 @@ func (t Toolchain) newHwdata() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Hwdata] = Metadata{
f: Toolchain.newHwdata,
Name: "hwdata",
@@ -30,5 +30,5 @@ func init() {
Website: "https://github.com/vcrhonek/hwdata",
ID: 5387,
})
}
}

View File

@@ -6,7 +6,7 @@ import (
)
func init() {
native.MustRegister(&Artifact{
artifactsM[EarlyInit] = Metadata{
Name: "earlyinit",
Description: "Rosa OS initramfs init program",
@@ -24,14 +24,15 @@ go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w
echo
`, false), Unversioned
},
})
}
}
func (t Toolchain) newImageSystem() (pkg.Artifact, string) {
return t.New("system.img", TNoToolchain, t.Append(nil,
return t.New("system.img", TNoToolchain, t.AppendPresets(nil,
SquashfsTools,
), nil, nil, `
mksquashfs /mnt/system /work/system.img
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.Append(nil,
`, pkg.Path(fhs.AbsRoot.Append("mnt"), false, t.AppendPresets(nil,
Musl,
Mksh,
Toybox,
@@ -42,15 +43,16 @@ mksquashfs /mnt/system /work/system.img
)...)), Unversioned
}
func init() {
native.MustRegister(&Artifact{
artifactsM[ImageSystem] = Metadata{
Name: "system-image",
Description: "Rosa OS system image",
f: Toolchain.newImageSystem,
})
}
}
func (t Toolchain) newImageInitramfs() (pkg.Artifact, string) {
return t.New("initramfs", TNoToolchain, t.Append(nil,
return t.New("initramfs", TNoToolchain, t.AppendPresets(nil,
Zstd,
EarlyInit,
GenInitCPIO,
@@ -64,10 +66,10 @@ file /init /system/libexec/hakurei/earlyinit 0555 0 0
`)))), Unversioned
}
func init() {
native.MustRegister(&Artifact{
artifactsM[ImageInitramfs] = Metadata{
Name: "initramfs-image",
Description: "Rosa OS initramfs image",
f: Toolchain.newImageInitramfs,
})
}
}

View File

@@ -19,23 +19,20 @@ chmod -R +w /work/usr/src/linux/
`, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion
}
func init() {
native.MustRegister(&Artifact{
artifactsM[KernelSource] = Metadata{
f: Toolchain.newKernelSource,
Name: "kernel-source",
Description: "a writable kernel source tree installed to /usr/src/linux",
Website: "https://kernel.org/",
})
}
}
func (t Toolchain) newKernelHeaders() (pkg.Artifact, string) {
checksum := perArch[string]{
"amd64": "lCmBNcMeUmXifg0vecKOPy3GAaFcJSmOPnf3wit9xYTDSTsFADPt1xxUFfmTn1fD",
"arm64": "PlRxp4JzZeMGx7CScRlT1NBzc2NVyJlb8Gm8sa3ofFght9ZT101ZJhcIXiCkHSHM",
}
const checksum = "lCmBNcMeUmXifg0vecKOPy3GAaFcJSmOPnf3wit9xYTDSTsFADPt1xxUFfmTn1fD"
return t.NewPackage("kernel-headers", kernelVersion, kernelSource, &PackageAttr{
Flag: TEarly,
KnownChecksum: new(mustDecode(checksum.unwrap(t.S))),
KnownChecksum: new(mustDecode(checksum)),
Paths: []pkg.ExecPath{
// updated manually for API changes
@@ -70,13 +67,13 @@ cat \
), kernelVersion
}
func init() {
native.MustRegister(&Artifact{
artifactsM[KernelHeaders] = Metadata{
f: Toolchain.newKernelHeaders,
Name: "kernel-headers",
Description: "an installation of kernel headers",
Website: "https://kernel.org/",
})
}
}
func (t Toolchain) newKernel() (pkg.Artifact, string) {
@@ -1275,7 +1272,7 @@ rm -v /work/system/lib/modules/` + kernelVersion + `/build
), kernelVersion
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Kernel] = Metadata{
f: Toolchain.newKernel,
Name: "kernel",
@@ -1283,7 +1280,7 @@ func init() {
Website: "https://kernel.org/",
ID: 375621,
})
}
}
func (t Toolchain) newGenInitCPIO() (pkg.Artifact, string) {
@@ -1293,12 +1290,12 @@ 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{
artifactsM[GenInitCPIO] = Metadata{
f: Toolchain.newGenInitCPIO,
Name: "gen_init_cpio",
Description: "a program in the kernel source tree for creating initramfs archive",
})
}
}
func (t Toolchain) newFirmware() (pkg.Artifact, string) {
@@ -1340,7 +1337,7 @@ func (t Toolchain) newFirmware() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Firmware] = Metadata{
f: Toolchain.newFirmware,
Name: "firmware",
@@ -1348,5 +1345,5 @@ func init() {
Website: "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/",
ID: 141464,
})
}
}

View File

@@ -32,7 +32,7 @@ func (t Toolchain) newKmod() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Kmod] = Metadata{
f: Toolchain.newKmod,
Name: "kmod",
@@ -46,5 +46,5 @@ func init() {
},
ID: 1517,
})
}
}

View File

@@ -88,7 +88,7 @@ install -Dv /usr/src/CTestCustom.cmake /cure/
}, (*CMakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libarchive] = Metadata{
f: Toolchain.newLibarchive,
Name: "libarchive",
@@ -96,5 +96,5 @@ func init() {
Website: "https://www.libarchive.org/",
ID: 1558,
})
}
}

View File

@@ -21,7 +21,7 @@ install -D /usr/src/libmd/src/helper.c src/helper.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libmd] = Metadata{
f: Toolchain.newLibmd,
Name: "libmd",
@@ -29,7 +29,7 @@ func init() {
Website: "https://www.hadrons.org/software/libmd/",
ID: 15525,
})
}
}
func (t Toolchain) newLibbsd() (pkg.Artifact, string) {
@@ -50,7 +50,7 @@ func (t Toolchain) newLibbsd() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libbsd] = Metadata{
f: Toolchain.newLibbsd,
Name: "libbsd",
@@ -58,5 +58,5 @@ func init() {
Website: "https://libbsd.freedesktop.org/",
ID: 1567,
})
}
}

View File

@@ -42,7 +42,7 @@ ln -s ../system/bin/bash /bin/
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libcap] = Metadata{
f: Toolchain.newLibcap,
Name: "libcap",
@@ -50,5 +50,5 @@ func init() {
Website: "https://sites.google.com/site/fullycapable/",
ID: 1569,
})
}
}

View File

@@ -38,7 +38,7 @@ index eba7eae..f916d2e 100644
}, (*CMakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libconfig] = Metadata{
f: Toolchain.newLibconfig,
Name: "libconfig",
@@ -46,5 +46,5 @@ func init() {
Website: "https://hyperrealm.github.io/libconfig/",
ID: 1580,
})
}
}

View File

@@ -18,7 +18,7 @@ func (t Toolchain) newLibdisplayInfo() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibdisplayInfo] = Metadata{
f: Toolchain.newLibdisplayInfo,
Name: "libdisplay-info",
@@ -26,5 +26,5 @@ func init() {
Website: "https://gitlab.freedesktop.org/emersion/libdisplay-info",
ID: 326668,
})
}
}

View File

@@ -21,7 +21,7 @@ func (t Toolchain) newLibepoxy() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libepoxy] = Metadata{
f: Toolchain.newLibepoxy,
Name: "libepoxy",
@@ -29,5 +29,5 @@ func init() {
Website: "https://github.com/anholt/libepoxy",
ID: 6090,
})
}
}

View File

@@ -14,7 +14,7 @@ func (t Toolchain) newLibev() (pkg.Artifact, string) {
), nil, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libev] = Metadata{
f: Toolchain.newLibev,
Name: "libev",
@@ -22,5 +22,5 @@ func init() {
Website: "http://libev.schmorp.de/",
ID: 1605,
})
}
}

View File

@@ -22,7 +22,7 @@ func (t Toolchain) newLibexpat() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libexpat] = Metadata{
f: Toolchain.newLibexpat,
Name: "libexpat",
@@ -30,5 +30,5 @@ func init() {
Website: "https://libexpat.github.io/",
ID: 770,
})
}
}

View File

@@ -18,7 +18,7 @@ func (t Toolchain) newLibffi() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libffi] = Metadata{
f: Toolchain.newLibffi,
Name: "libffi",
@@ -26,5 +26,5 @@ func init() {
Website: "https://sourceware.org/libffi/",
ID: 1611,
})
}
}

View File

@@ -24,7 +24,7 @@ mkdir /dev/shm/gd
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libgd] = Metadata{
f: Toolchain.newLibgd,
Name: "libgd",
@@ -36,5 +36,5 @@ func init() {
},
ID: 880,
})
}
}

View File

@@ -22,7 +22,7 @@ func (t Toolchain) newLibpng() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libpng] = Metadata{
f: Toolchain.newLibpng,
Name: "libpng",
@@ -34,5 +34,5 @@ func init() {
},
ID: 1705,
})
}
}

View File

@@ -25,7 +25,7 @@ test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libpsl] = Metadata{
f: Toolchain.newLibpsl,
Name: "libpsl",
@@ -33,5 +33,5 @@ func init() {
Website: "https://rockdaboot.github.io/libpsl/",
ID: 7305,
})
}
}

View File

@@ -43,7 +43,7 @@ index adccef3..65a277a 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libseccomp] = Metadata{
f: Toolchain.newLibseccomp,
Name: "libseccomp",
@@ -51,5 +51,5 @@ func init() {
Website: "https://github.com/seccomp/libseccomp/",
ID: 13823,
})
}
}

View File

@@ -32,7 +32,7 @@ func (t Toolchain) newLibtirpc() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libtirpc] = Metadata{
f: Toolchain.newLibtirpc,
Name: "libtirpc",
@@ -40,5 +40,5 @@ func init() {
Website: "https://sourceforge.net/projects/libtirpc/",
ID: 1740,
})
}
}

View File

@@ -21,13 +21,13 @@ func (t Toolchain) newLibucontext() (pkg.Artifact, string) {
SkipConfigure: true,
InPlace: true,
Make: []string{
"ARCH=" + t.linuxArch(),
"ARCH=" + linuxArch(),
},
Install: "make prefix=/system DESTDIR=/work install",
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libucontext] = Metadata{
f: Toolchain.newLibucontext,
Name: "libucontext",
@@ -35,5 +35,5 @@ func init() {
Website: "https://github.com/kaniini/libucontext/",
ID: 17085,
})
}
}

View File

@@ -20,7 +20,7 @@ func (t Toolchain) newLibxml2() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxml2] = Metadata{
f: Toolchain.newLibxml2,
Name: "libxml2",
@@ -28,5 +28,5 @@ func init() {
Website: "https://gitlab.gnome.org/GNOME/libxml2/",
ID: 1783,
})
}
}

View File

@@ -26,7 +26,7 @@ func (t Toolchain) newLibxslt() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxslt] = Metadata{
f: Toolchain.newLibxslt,
Name: "libxslt",
@@ -38,5 +38,5 @@ func init() {
},
ID: 13301,
})
}
}

View File

@@ -30,9 +30,9 @@ func litArgs(verbose bool, skipChecks ...string) string {
}
func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) {
source, version := t.Load(llvmSource)
version := t.Version(llvmSource)
major, _, _ := strings.Cut(version, ".")
return t.NewPackage("early-compiler-rt", version, source, &PackageAttr{
return t.NewPackage("early-compiler-rt", version, t.Load(llvmSource), &PackageAttr{
Flag: TExclusive,
}, &CMakeHelper{
Append: []string{"compiler-rt"},
@@ -71,10 +71,10 @@ ln -s \
"/work/system/lib/clang/` + major + `/lib/"
ln -s \
"clang_rt.crtbegin-` + t.linuxArch() + `.o" \
"clang_rt.crtbegin-` + linuxArch() + `.o" \
"/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
ln -s \
"clang_rt.crtend-` + t.linuxArch() + `.o" \
"clang_rt.crtend-` + linuxArch() + `.o" \
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
`,
},
@@ -85,7 +85,7 @@ ln -s \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[earlyCompilerRT] = Metadata{
f: Toolchain.newEarlyCompilerRT,
Name: "early-compiler-rt",
@@ -94,12 +94,12 @@ func init() {
Dependencies: P{
Musl,
},
})
}
}
func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
source, version := t.Load(llvmSource)
return t.NewPackage("early-runtimes", version, source, &PackageAttr{
version := t.Version(llvmSource)
return t.NewPackage("early-runtimes", version, t.Load(llvmSource), &PackageAttr{
Flag: TExclusive,
}, &CMakeHelper{
Append: []string{"runtimes"},
@@ -145,7 +145,7 @@ func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[earlyRuntimes] = Metadata{
f: Toolchain.newEarlyRuntimes,
Name: "early-runtimes",
@@ -154,12 +154,12 @@ func init() {
Dependencies: P{
earlyCompilerRT,
},
})
}
}
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
early := muslHeaders
if t.stage.isStage0() {
var early PArtifact = muslHeaders
if t.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
@@ -217,7 +217,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
}, ";") + "'"},
}
if !t.stage.isStage0() {
if !t.isStage0() {
skipChecks := []string{
// expensive, pointless to run here
"benchmarks",
@@ -247,7 +247,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
// unwind: fails on musl
"eh_frame_fde_pc_range",
}
switch t.arch {
switch arch {
case "arm64":
skipChecks = append(skipChecks,
// LLVM: intermittently crashes
@@ -257,7 +257,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
)
}
if t.opts&OptLLVMNoLTO == 0 {
if presetOpts&OptLLVMNoLTO == 0 {
cache = append(cache, []KV{
// very expensive
{"LLVM_ENABLE_LTO", "Thin"},
@@ -273,8 +273,8 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
}...)
}
source, version := t.Load(llvmSource)
return t.NewPackage("llvm", version, source, &PackageAttr{
version := t.Version(llvmSource)
return t.NewPackage("llvm", version, t.Load(llvmSource), &PackageAttr{
Flag: TExclusive,
}, &CMakeHelper{
Append: []string{"llvm"},
@@ -291,7 +291,7 @@ ln -s clang++ /work/system/bin/c++
// 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(),
SkipTest: t.isStage0(),
Test: `
chmod +w /bin && ln -s \
@@ -324,7 +324,7 @@ func init() {
checksum = "32gOaLPHcUlo3hkdk5RbFumTE01XKeCAYZcpvn8IDHF95egXVfDFSl6eZL3ChMen"
)
native.MustRegister(&Artifact{
artifactsM[llvmSource] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.NewPatchedSource("llvm", version, newFromGitHub(
"llvm/llvm-project",
@@ -337,9 +337,9 @@ func init() {
Description: "LLVM monorepo with Rosa OS patches",
ID: 1830,
})
}
native.MustRegister(&Artifact{
artifactsM[LLVM] = Metadata{
f: Toolchain.newLLVM,
Name: "llvm",
@@ -351,5 +351,5 @@ func init() {
Zstd,
Musl,
},
})
}
}

View File

@@ -47,7 +47,7 @@ ln -s \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LMSensors] = Metadata{
f: Toolchain.newLMSensors,
Name: "lm_sensors",
@@ -55,5 +55,5 @@ func init() {
Website: "https://hwmon.wiki.kernel.org/lm_sensors",
ID: 1831,
})
}
}

View File

@@ -27,7 +27,7 @@ cd "$(mktemp -d)"
))), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Make] = Metadata{
f: Toolchain.newMake,
Name: "make",
@@ -35,7 +35,7 @@ func init() {
Website: "https://www.gnu.org/software/make/",
ID: 1877,
})
}
}
// MakeHelper is the [Make] build system helper.
@@ -123,7 +123,7 @@ func (attr *MakeHelper) wantsDir() string {
}
// script generates the cure script.
func (attr *MakeHelper) script(s *S, name string) string {
func (attr *MakeHelper) script(name string) string {
if attr == nil {
attr = new(MakeHelper)
}
@@ -194,7 +194,7 @@ make \
}
scriptMake += "\n"
if !attr.SkipCheck && s.opts&OptSkipCheck == 0 {
if !attr.SkipCheck && presetOpts&OptSkipCheck == 0 {
scriptMake += attr.ScriptCheckEarly + `make \
` + jobsFlagE + ` \
`

View File

@@ -35,7 +35,7 @@ trap 'kill $XVFB_PID && wait $XVFB_PID' EXIT
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libglvnd] = Metadata{
f: Toolchain.newLibglvnd,
Name: "libglvnd",
@@ -47,7 +47,7 @@ func init() {
},
ID: 12098,
})
}
}
func (t Toolchain) newLibdrm() (pkg.Artifact, string) {
@@ -72,7 +72,7 @@ func (t Toolchain) newLibdrm() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libdrm] = Metadata{
f: Toolchain.newLibdrm,
Name: "libdrm",
@@ -84,7 +84,7 @@ func init() {
},
ID: 1596,
})
}
}
func (t Toolchain) newLibva() (pkg.Artifact, string) {
@@ -111,7 +111,7 @@ func (t Toolchain) newLibva() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libva] = Metadata{
f: Toolchain.newLibva,
Name: "libva",
@@ -126,7 +126,7 @@ func init() {
},
ID: 1752,
})
}
}
func (t Toolchain) newMesa() (pkg.Artifact, string) {
@@ -238,7 +238,7 @@ func (t Toolchain) newMesa() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Mesa] = Metadata{
f: Toolchain.newMesa,
Name: "mesa",
@@ -261,5 +261,5 @@ func init() {
ID: 1970,
latest: (*Versions).getStable,
})
}
}

View File

@@ -52,7 +52,7 @@ python3 ./run_project_tests.py \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Meson] = Metadata{
f: Toolchain.newMeson,
Name: "meson",
@@ -67,7 +67,7 @@ func init() {
},
ID: 6472,
})
}
}
// MesonHelper is the [Meson] build system helper.
@@ -106,7 +106,7 @@ func (*MesonHelper) createDir() bool { return false }
func (*MesonHelper) wantsDir() string { return `"$(mktemp -d)"` }
// script generates the cure script.
func (attr *MesonHelper) script(s *S, name string) string {
func (attr *MesonHelper) script(name string) string {
if attr == nil {
attr = new(MesonHelper)
}
@@ -117,7 +117,7 @@ func (attr *MesonHelper) script(s *S, name string) string {
}
var scriptTest string
if !attr.SkipTest && s.opts&OptSkipCheck == 0 {
if !attr.SkipTest && presetOpts&OptSkipCheck == 0 {
scriptTest = `
meson test \
--print-errorlogs`

View File

@@ -8,10 +8,10 @@ func (t Toolchain) newMksh() (pkg.Artifact, string) {
checksum = "0Zj-k4nXEu3IuJY4lvwD2OrC2t27GdZj8SPy4DoaeuBRH1padWb7oREpYgwY8JNq"
)
scriptTest := "./test.sh -C regress:no-ctty\n"
if t.opts&OptSkipCheck != 0 {
if presetOpts&OptSkipCheck != 0 {
scriptTest = ""
}
return t.New("mksh-"+version, 0, t.Append(nil,
return t.New("mksh-"+version, 0, t.AppendPresets(nil,
Perl,
Coreutils,
), nil, []string{
@@ -36,7 +36,7 @@ ln -vs ../system/bin/sh /work/bin/
))), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Mksh] = Metadata{
f: Toolchain.newMksh,
Name: "mksh",
@@ -44,5 +44,5 @@ func init() {
Website: "https://www.mirbsd.org/mksh",
ID: 5590,
})
}
}

View File

@@ -24,7 +24,7 @@ func (t Toolchain) newMuslFts() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[MuslFts] = Metadata{
f: Toolchain.newMuslFts,
Name: "musl-fts",
@@ -32,5 +32,5 @@ func init() {
Website: "https://github.com/void-linux/musl-fts",
ID: 26980,
})
}
}

View File

@@ -24,7 +24,7 @@ func (t Toolchain) newMuslObstack() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[MuslObstack] = Metadata{
f: Toolchain.newMuslObstack,
Name: "musl-obstack",
@@ -32,5 +32,5 @@ func init() {
Website: "https://github.com/void-linux/musl-obstack",
ID: 146206,
})
}
}

View File

@@ -14,7 +14,7 @@ func (t Toolchain) newMusl(headers bool) (pkg.Artifact, string) {
SkipCheck: true,
Script: `
mkdir -p /work/system/bin
COMPAT_LINKER_NAME="ld-musl-` + t.linuxArch() + `.so.1"
COMPAT_LINKER_NAME="ld-musl-` + linuxArch() + `.so.1"
ln -vs ../lib/libc.so /work/system/bin/linker
ln -vs ../lib/libc.so /work/system/bin/ldd
ln -vs libc.so "/work/system/lib/${COMPAT_LINKER_NAME}"
@@ -34,9 +34,9 @@ rmdir -v /work/lib
}
env := []string{
"LDFLAGS=" + t.earlyLDFLAGS(false),
"LDFLAGS=" + earlyLDFLAGS(false),
}
if t.stage.isStage0() {
if t.isStage0() {
env = append(env,
"CC=clang",
"AR=ar",
@@ -75,7 +75,7 @@ index 715948f4..c2fece68 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Musl] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newMusl(false)
},
@@ -85,14 +85,14 @@ func init() {
Website: "https://musl.libc.org/",
ID: 11688,
})
}
native.MustRegister(&Artifact{
artifactsM[muslHeaders] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newMusl(true)
},
Name: "musl-headers",
Description: "system installation of musl headers",
})
}
}

View File

@@ -26,7 +26,7 @@ func (t Toolchain) newNcurses() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Ncurses] = Metadata{
f: Toolchain.newNcurses,
Name: "ncurses",
@@ -34,5 +34,5 @@ func init() {
Website: "https://invisible-island.net/ncurses/",
ID: 373226,
})
}
}

View File

@@ -39,7 +39,7 @@ index d223ac2..a7878d0 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libmnl] = Metadata{
f: Toolchain.newLibmnl,
Name: "libmnl",
@@ -47,7 +47,7 @@ func init() {
Website: "https://www.netfilter.org/projects/libmnl/",
ID: 1663,
})
}
}
func (t Toolchain) newLibnftnl() (pkg.Artifact, string) {
@@ -77,7 +77,7 @@ func (t Toolchain) newLibnftnl() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libnftnl] = Metadata{
f: Toolchain.newLibnftnl,
Name: "libnftnl",
@@ -89,7 +89,7 @@ func init() {
},
ID: 1681,
})
}
}
func (t Toolchain) newIPTables() (pkg.Artifact, string) {
@@ -131,7 +131,7 @@ chmod +w /etc/ && ln -s ../usr/src/iptables/etc/ethertypes /etc/
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[IPTables] = Metadata{
f: Toolchain.newIPTables,
Name: "iptables",
@@ -143,5 +143,5 @@ func init() {
},
ID: 1394,
})
}
}

View File

@@ -19,7 +19,7 @@ func (t Toolchain) newNettle() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Nettle] = Metadata{
f: Toolchain.newNettle,
Name: "nettle",
@@ -31,5 +31,5 @@ func init() {
},
ID: 2073,
})
}
}

View File

@@ -19,7 +19,7 @@ func (t Toolchain) newNettle3() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[nettle3] = Metadata{
f: Toolchain.newNettle3,
Name: "nettle3",
@@ -29,5 +29,5 @@ func init() {
Dependencies: P{
GMP,
},
})
}
}

View File

@@ -7,11 +7,9 @@ func (t Toolchain) newNinja() (pkg.Artifact, string) {
version = "1.13.2"
checksum = "ygKWMa0YV2lWKiFro5hnL-vcKbc_-RACZuPu0Io8qDvgQlZ0dxv7hPNSFkt4214v"
)
python, _ := t.Load(Python)
bash, _ := t.Load(Bash)
return t.New("ninja-"+version, 0, []pkg.Artifact{
python,
bash,
t.Load(Python),
t.Load(Bash),
}, nil, nil, `
cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \
@@ -39,7 +37,7 @@ cp ninja /work/system/bin/
))), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Ninja] = Metadata{
f: Toolchain.newNinja,
Name: "ninja",
@@ -47,5 +45,5 @@ func init() {
Website: "https://ninja-build.org/",
ID: 2089,
})
}
}

View File

@@ -67,7 +67,7 @@ cp -r \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[NSS] = Metadata{
f: Toolchain.newNSS,
Name: "nss",
@@ -79,7 +79,7 @@ func init() {
},
ID: 2503,
})
}
}
func init() {
@@ -87,7 +87,7 @@ func init() {
version = "0.5.1"
checksum = "oxjnuIrPVMPvD6x8VFLqB7EdbfuhouGQdtPuHDpEHGzoyH5nkxqtYN9UthMY9noA"
)
native.newPythonPackage(
artifactsM[buildcatrust] = newPythonPackage(
"buildcatrust", 233988,
"transform certificate stores between formats",
"https://github.com/nix-community/buildcatrust",
@@ -103,7 +103,7 @@ rm buildcatrust/tests/test_nonhermetic.py
}
func (t Toolchain) newNSSCACert() (pkg.Artifact, string) {
return t.New("nss-cacert", 0, t.Append(nil,
return t.New("nss-cacert", 0, t.AppendPresets(nil,
Bash,
NSS,
@@ -120,11 +120,11 @@ buildcatrust \
`), Unversioned
}
func init() {
native.MustRegister(&Artifact{
artifactsM[NSSCACert] = Metadata{
f: Toolchain.newNSSCACert,
Name: "nss-cacert",
Description: "bundle of X.509 certificates of public Certificate Authorities",
Website: "https://curl.se/docs/caextract.html",
})
}
}

View File

@@ -40,7 +40,7 @@ func (t Toolchain) newOpenSSL() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[OpenSSL] = Metadata{
f: Toolchain.newOpenSSL,
Name: "openssl",
@@ -51,5 +51,5 @@ func init() {
// strange malformed tags treated as pre-releases in Anitya
latest: (*Versions).getStable,
})
}
}

View File

@@ -23,7 +23,7 @@ func (t Toolchain) newP11Kit() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[P11Kit] = Metadata{
f: Toolchain.newP11Kit,
Name: "p11-kit",
@@ -36,5 +36,5 @@ func init() {
},
ID: 2582,
})
}
}

View File

@@ -32,7 +32,7 @@ ln -s ../system/bin/toybox /bin/echo
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PCRE2] = Metadata{
f: Toolchain.newPCRE2,
Name: "pcre2",
@@ -40,5 +40,5 @@ func init() {
Website: "https://pcre2project.github.io/pcre2/",
ID: 5832,
})
}
}

View File

@@ -50,7 +50,7 @@ chmod +w /system/bin && rm -f /system/bin/ps # perl does not like toybox ps
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Perl] = Metadata{
f: Toolchain.newPerl,
Name: "perl",
@@ -61,7 +61,7 @@ func init() {
// odd-even versioning
latest: (*Versions).getStable,
})
}
}
// newViaPerlModuleBuild installs a perl module via Build.PL.
@@ -69,12 +69,12 @@ func (t Toolchain) newViaPerlModuleBuild(
name, version string,
source pkg.Artifact,
patches []KV,
extra ...ArtifactH,
extra ...PArtifact,
) pkg.Artifact {
if name == "" || version == "" {
panic("names must be non-empty")
}
return t.New("perl-"+name, 0, t.Append(nil,
return t.New("perl-"+name, 0, t.AppendPresets(nil,
slices.Concat(P{Perl}, extra)...,
), nil, nil, `
cd /usr/src/`+name+`
@@ -100,7 +100,7 @@ func (t Toolchain) newPerlModuleBuild() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlModuleBuild] = Metadata{
f: Toolchain.newPerlModuleBuild,
Name: "perl-Module::Build",
@@ -110,7 +110,7 @@ func init() {
Dependencies: P{
Perl,
},
})
}
}
// newViaPerlMakeMaker installs a perl module via Makefile.PL.
@@ -118,7 +118,7 @@ func (t Toolchain) newViaPerlMakeMaker(
name, version string,
source pkg.Artifact,
patches []KV,
extra ...ArtifactH,
extra ...PArtifact,
) pkg.Artifact {
return t.NewPackage("perl-"+name, version, source, &PackageAttr{
// uses source tree as scratch space
@@ -154,7 +154,7 @@ func (t Toolchain) newPerlLocaleGettext() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlLocaleGettext] = Metadata{
f: Toolchain.newPerlLocaleGettext,
Name: "perl-Locale::gettext",
@@ -162,7 +162,7 @@ func init() {
Website: "https://metacpan.org/release/Locale-gettext",
ID: 7523,
})
}
}
func (t Toolchain) newPerlPodParser() (pkg.Artifact, string) {
@@ -178,7 +178,7 @@ func (t Toolchain) newPerlPodParser() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlPodParser] = Metadata{
f: Toolchain.newPerlPodParser,
Name: "perl-Pod::Parser",
@@ -186,7 +186,7 @@ func init() {
Website: "https://metacpan.org/release/Pod-Parser",
ID: 3244,
})
}
}
func (t Toolchain) newPerlSGMLS() (pkg.Artifact, string) {
@@ -202,7 +202,7 @@ func (t Toolchain) newPerlSGMLS() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlSGMLS] = Metadata{
f: Toolchain.newPerlSGMLS,
Name: "perl-SGMLS",
@@ -224,7 +224,7 @@ func init() {
}
return v.Latest
},
})
}
}
func (t Toolchain) newPerlTermReadKey() (pkg.Artifact, string) {
@@ -240,7 +240,7 @@ func (t Toolchain) newPerlTermReadKey() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlTermReadKey] = Metadata{
f: Toolchain.newPerlTermReadKey,
Name: "perl-Term::ReadKey",
@@ -248,7 +248,7 @@ func init() {
Website: "https://metacpan.org/release/TermReadKey",
ID: 3372,
})
}
}
func (t Toolchain) newPerlTextCharWidth() (pkg.Artifact, string) {
@@ -264,7 +264,7 @@ func (t Toolchain) newPerlTextCharWidth() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlTextCharWidth] = Metadata{
f: Toolchain.newPerlTextCharWidth,
Name: "perl-Text::CharWidth",
@@ -272,7 +272,7 @@ func init() {
Website: "https://metacpan.org/release/Text-CharWidth",
ID: 14380,
})
}
}
func (t Toolchain) newPerlTextWrapI18N() (pkg.Artifact, string) {
@@ -290,7 +290,7 @@ func (t Toolchain) newPerlTextWrapI18N() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlTextWrapI18N] = Metadata{
f: Toolchain.newPerlTextWrapI18N,
Name: "perl-Text::WrapI18N",
@@ -302,7 +302,7 @@ func init() {
},
ID: 14385,
})
}
}
func (t Toolchain) newPerlMIMECharset() (pkg.Artifact, string) {
@@ -318,7 +318,7 @@ func (t Toolchain) newPerlMIMECharset() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlMIMECharset] = Metadata{
f: Toolchain.newPerlMIMECharset,
Name: "perl-MIME::Charset",
@@ -326,7 +326,7 @@ func init() {
Website: "https://metacpan.org/release/MIME-Charset",
ID: 3070,
})
}
}
func (t Toolchain) newPerlUnicodeLineBreak() (pkg.Artifact, string) {
@@ -344,7 +344,7 @@ func (t Toolchain) newPerlUnicodeLineBreak() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlUnicodeLineBreak] = Metadata{
f: Toolchain.newPerlUnicodeLineBreak,
Name: "perl-Unicode::LineBreak",
@@ -356,7 +356,7 @@ func init() {
},
ID: 6033,
})
}
}
func (t Toolchain) newPerlYAMLTiny() (pkg.Artifact, string) {
@@ -372,7 +372,7 @@ func (t Toolchain) newPerlYAMLTiny() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlYAMLTiny] = Metadata{
f: Toolchain.newPerlYAMLTiny,
Name: "perl-YAML::Tiny",
@@ -380,7 +380,7 @@ func init() {
Website: "https://metacpan.org/release/YAML-Tiny",
ID: 3549,
})
}
}
func (t Toolchain) newPerlTestCmd() (pkg.Artifact, string) {
@@ -396,7 +396,7 @@ func (t Toolchain) newPerlTestCmd() (pkg.Artifact, string) {
), nil), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PerlTestCmd] = Metadata{
f: Toolchain.newPerlTestCmd,
Name: "perl-Test::Cmd",
@@ -404,5 +404,5 @@ func init() {
Website: "https://metacpan.org/release/Test-Cmd",
ID: 6014,
})
}
}

View File

@@ -19,7 +19,7 @@ func (t Toolchain) newPixman() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Pixman] = Metadata{
f: Toolchain.newPixman,
Name: "pixman",
@@ -27,5 +27,5 @@ func init() {
Website: "https://pixman.org/",
ID: 3648,
})
}
}

View File

@@ -24,7 +24,7 @@ func (t Toolchain) newPkgConfig() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[PkgConfig] = Metadata{
f: Toolchain.newPkgConfig,
Name: "pkg-config",
@@ -32,5 +32,5 @@ func init() {
Website: "https://pkgconfig.freedesktop.org/",
ID: 3649,
})
}
}

View File

@@ -27,7 +27,7 @@ func (t Toolchain) newProcps() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Procps] = Metadata{
f: Toolchain.newProcps,
Name: "procps",
@@ -35,5 +35,5 @@ func init() {
Website: "https://gitlab.com/procps-ng/procps",
ID: 3708,
})
}
}

View File

@@ -73,7 +73,7 @@ index 19aea290b58..51603ba9510 100644
// _ctypes appears to infer something from the linker name
"LDFLAGS=-Wl,--dynamic-linker=/system/lib/" +
"ld-musl-" + t.linuxArch() + ".so.1",
"ld-musl-" + linuxArch() + ".so.1",
},
}, &MakeHelper{
Check: []string{"test"},
@@ -88,7 +88,7 @@ index 19aea290b58..51603ba9510 100644
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Python] = Metadata{
f: Toolchain.newPython,
Name: "python",
@@ -103,7 +103,7 @@ func init() {
},
ID: 13254,
})
}
}
// PipHelper is the [Python] pip packaging helper.
@@ -150,7 +150,7 @@ func (*PipHelper) createDir() bool { return false }
func (*PipHelper) wantsDir() string { return `"$(mktemp -d)"` }
// script generates the pip3 install command.
func (attr *PipHelper) script(_ *S, name string) string {
func (attr *PipHelper) script(name string) string {
if attr == nil {
attr = new(PipHelper)
}
@@ -193,14 +193,14 @@ pip3 install \
` + script
}
// newPythonPackage registers a new [Python] package.
func (s *S) newPythonPackage(
// newPythonPackage creates [Metadata] for a [Python] package.
func newPythonPackage(
name string, id int, description, website, version string,
source pkg.Artifact, attrP *PackageAttr, attr *PipHelper,
build P, extra ...ArtifactH,
) {
build P, extra ...PArtifact,
) Metadata {
name = "python-" + name
s.MustRegister(&Artifact{
return Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.NewPackage(name, version, source, attrP, attr, slices.Concat(
P{Python},
@@ -216,7 +216,7 @@ func (s *S) newPythonPackage(
Dependencies: slices.Concat(P{Python}, extra),
ID: id,
})
}
}
func init() {
@@ -224,7 +224,7 @@ func init() {
version = "0.47.0"
checksum = "HZ-MvkUP8mbbx2YmsRNswj_bbOCIiXckuHqL5Qbvb5NxN5DYfWnqwkGNyS7OrId0"
)
native.newPythonPackage(
artifactsM[PythonWheel] = newPythonPackage(
"wheel", 11428,
"the official binary distribution format for Python",
"https://peps.python.org/pep-0427/",
@@ -242,7 +242,7 @@ func init() {
version = "82.0.1"
checksum = "nznP46Tj539yqswtOrIM4nQgwLA1h-ApKX7z7ghazROCpyF5swtQGwsZoI93wkhc"
)
native.newPythonPackage(
artifactsM[PythonSetuptools] = newPythonPackage(
"setuptools", 4021,
"the autotools of the Python ecosystem",
"https://pypi.org/project/setuptools/",
@@ -262,7 +262,7 @@ func init() {
version = "1.1.1"
checksum = "rXZixTsZcRcIoUC1LvWrjySsiXSv5uhW6ng2P-yXZrbdj7FrSrDeJLCfC2b-ladV"
)
native.newPythonPackage(
artifactsM[PythonVCSVersioning] = newPythonPackage(
"vcs-versioning", 389421,
"core VCS versioning functionality extracted as a standalone library",
"https://setuptools-scm.readthedocs.io/en/latest/",
@@ -289,7 +289,7 @@ func init() {
version = "10.0.5"
checksum = "vTN_TPd-b4Wbsw5WmAcsWjrs-FNXXznOeVTDnb54NtXve9Oy-eb2HPy-RG3FzNqp"
)
native.newPythonPackage(
artifactsM[PythonSetuptoolsSCM] = newPythonPackage(
"setuptools-scm", 7874,
"extracts Python package versions from Git or Mercurial metadata",
"https://setuptools-scm.readthedocs.io/en/latest/",
@@ -316,7 +316,7 @@ func init() {
version = "3.12.0"
checksum = "VcTsiGiDU1aPLbjSPe38f9OjJDCLcxFz9loObJqUI1ZxDHXAaQMxBpNyLz_G1Rff"
)
native.newPythonPackage(
artifactsM[PythonFlitCore] = newPythonPackage(
"flit-core", 44841,
"a PEP 517 build backend for packages using Flit",
"https://flit.pypa.io/",
@@ -337,7 +337,7 @@ func init() {
version = "26.2"
checksum = "rdpGa2EkPFbj1mFtLKLnSwIX9gPfELcuneiICjRVDNw6By49szTFVoW8gtMMZ6ZS"
)
native.newPythonPackage(
artifactsM[PythonPackaging] = newPythonPackage(
"packaging", 60461,
"reusable core utilities for various Python Packaging interoperability specifications",
"https://packaging.pypa.io/",
@@ -352,10 +352,10 @@ func init() {
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LIT] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
source, version := t.Load(llvmSource)
return t.NewPackage("lit", version, source, nil, &PipHelper{
version := t.Version(LLVM)
return t.NewPackage("lit", version, t.Load(llvmSource), nil, &PipHelper{
Append: []string{"llvm", "utils", "lit"},
// already checked during llvm
SkipCheck: true,
@@ -371,7 +371,7 @@ func init() {
Dependencies: P{
Python,
},
})
}
}
func init() {
@@ -379,7 +379,7 @@ func init() {
version = "1.1.1"
checksum = "1fVwoal6FoKXczoG3qRUi87TxSWESSGcgvnbEZDYuaOgsO25o36iF3SbAhwkr4Va"
)
native.newPythonPackage(
artifactsM[PythonPathspec] = newPythonPackage(
"pathspec", 23424,
"utility library for gitignore style pattern matching of file paths",
"https://github.com/cpburnz/python-pathspec",
@@ -398,7 +398,7 @@ func init() {
version = "2026.5.7.17"
checksum = "1Fcps0gK9P4ofwGL8MISN9k1Q40-quxX7NDpIna50TmziBNrZy-0Vz0I9yIeHCoP"
)
native.newPythonPackage(
artifactsM[PythonTroveClassifiers] = newPythonPackage(
"trove-classifiers", 88298,
"canonical source for classifiers on PyPI",
"https://pypi.org/p/trove-classifiers/",
@@ -417,7 +417,7 @@ func init() {
version = "1.6.0"
checksum = "GiUgDkKjF8Xn1cmq6iMhTGXzcPIYeaJrvQpHBSAJapNVx4UyuiTXqd5eVlxSClJu"
)
native.newPythonPackage(
artifactsM[PythonPluggy] = newPythonPackage(
"pluggy", 7500,
"the core framework used by the pytest, tox, and devpi projects",
"https://pluggy.readthedocs.io/en/latest/",
@@ -440,7 +440,7 @@ func init() {
version = "1.16.5"
checksum = "V2eREtqZLZeV85yb4O-bfAJCUluHcQP76Qfs0QH5s7RF_Oc8xIP8jD0jl85qFyWk"
)
native.newPythonPackage(
artifactsM[PythonHatchling] = newPythonPackage(
"hatchling", 16137,
"the extensible, standards compliant build backend used by Hatch",
"https://hatch.pypa.io/latest/",
@@ -465,7 +465,7 @@ func init() {
version = "2.20.0"
checksum = "L-2P6vn7c_CNZYliE5CJAWLxO1ziDQVVkf8bnZbHj8aSCQ43oWv11wC9KzU9MeCa"
)
native.newPythonPackage(
artifactsM[PythonPygments] = newPythonPackage(
"pygments", 3986,
"a syntax highlighting package written in Python",
"https://pygments.org/",
@@ -484,7 +484,7 @@ func init() {
version = "2.3.0"
checksum = "mH7VBZaXcYatBPE3RQQZvSzz_Ay8IPPek60NpPHZulPq4ReAFUUsA4EPWfiyMknZ"
)
native.newPythonPackage(
artifactsM[PythonIniConfig] = newPythonPackage(
"iniconfig", 114778,
"a small and simple INI-file parser module",
"https://github.com/pytest-dev/iniconfig",
@@ -507,7 +507,7 @@ func init() {
version = "9.0.3"
checksum = "qfLL_znWhbJCDbNJvrx9H3-orJ86z4ifhaW0bIn21jl2sDP-FVoX_1yieOypArQe"
)
native.newPythonPackage(
artifactsM[PythonPyTest] = newPythonPackage(
"pytest", 3765,
"the pytest framework",
"https://pytest.org",
@@ -534,7 +534,7 @@ func init() {
version = "3.0.3"
checksum = "txRGYdWE3his1lHHRI-lZADw0-ILvUg2l5OGdFHtFXIb_QowGxwdxHCUSJIgmjQs"
)
native.newPythonPackage(
artifactsM[PythonMarkupSafe] = newPythonPackage(
"markupsafe", 3918,
"implements a text object that escapes characters so it is safe to use in HTML and XML",
"https://markupsafe.palletsprojects.com/",
@@ -553,7 +553,7 @@ func init() {
version = "1.3.12"
checksum = "OZbBsQe2MzRuAo5Mr4qRwWHGqU1EEZeBuSprDDIceAtMLIUJtO7SbERlxHIxNhLk"
)
native.newPythonPackage(
artifactsM[PythonMako] = newPythonPackage(
"mako", 3915,
"a template library written in Python",
"https://www.makotemplates.org/",
@@ -571,7 +571,7 @@ func init() {
version = "6.0.3"
checksum = "7wDv0RW9chBdu9l5Q4Hun5F2HHdo105ZSIixwdFPKbEYbftW9YxmsegfL-zafnbJ"
)
native.newPythonPackage(
artifactsM[PythonPyYAML] = newPythonPackage(
"pyyaml", 4123,
"a YAML parser and emitter for Python",
"https://pyyaml.org/",
@@ -590,7 +590,7 @@ func init() {
version = "3.00"
checksum = "4qfCMFKp0fLsRsloOAF780tXX_Ce_68RwinCmjNGObAX32WpF_iBafIKW1S1bYlA"
)
native.newPythonPackage(
artifactsM[PythonPycparser] = newPythonPackage(
"pycparser", 8175,
"complete C99 parser in pure Python",
"https://github.com/eliben/pycparser",

View File

@@ -94,7 +94,7 @@ EOF
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[QEMU] = Metadata{
f: Toolchain.newQEMU,
Name: "qemu",
@@ -107,5 +107,5 @@ func init() {
},
ID: 13607,
})
}
}

View File

@@ -21,7 +21,7 @@ ln -s ../system/bin/toybox /bin/echo
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Rdfind] = Metadata{
f: Toolchain.newRdfind,
Name: "rdfind",
@@ -33,5 +33,5 @@ func init() {
},
ID: 231641,
})
}
}

View File

@@ -32,15 +32,10 @@ func WriteReport(msg message.Msg, w io.Writer, c *pkg.Cache) error {
zero [wordSize]byte
buf [len(pkg.ID{}) + wordSize]byte
)
t := native.Std()
for _, p := range native.Collect() {
meta := native.Get(p)
if meta == nil {
return errors.New("artifact " + p.String() + " in inconsistent state")
}
a, _ := t.MustLoad(p)
for i := range PresetEnd {
a := Std.Load(PArtifact(i))
if _, ok := a.(pkg.FileArtifact); ok {
msg.Verbosef("skipping file artifact %s", meta.Name)
msg.Verbosef("skipping file artifact %s", artifactsM[i].Name)
continue
}
@@ -49,7 +44,7 @@ func WriteReport(msg message.Msg, w io.Writer, c *pkg.Cache) error {
var f *os.File
if r, err := c.OpenStatus(a); err != nil {
if errors.Is(err, os.ErrNotExist) {
msg.Verbosef("artifact %s unavailable", meta.Name)
msg.Verbosef("artifact %s unavailable", artifactsM[i].Name)
continue
}
return err
@@ -57,7 +52,7 @@ func WriteReport(msg message.Msg, w io.Writer, c *pkg.Cache) error {
f = r.(*os.File)
}
msg.Verbosef("writing artifact %s...", meta.Name)
msg.Verbosef("writing artifact %s...", artifactsM[i].Name)
var sz int64
if fi, err := f.Stat(); err != nil {

View File

@@ -2,6 +2,7 @@
package rosa
import (
"errors"
"path"
"slices"
"strconv"
@@ -42,7 +43,7 @@ func mustDecode(s string) pkg.Checksum {
}
// KV is a key-value pair of strings.
type KV = [2]string
type KV [2]string
var (
// AbsUsrSrc is the conventional directory to place source code under.
@@ -53,8 +54,8 @@ var (
)
// linuxArch returns the architecture name used by linux corresponding to arch.
func (s *S) linuxArch() string {
switch s.arch {
func linuxArch() string {
switch arch {
case "amd64":
return "x86_64"
case "arm64":
@@ -63,23 +64,23 @@ func (s *S) linuxArch() string {
return "riscv64"
default:
panic("unsupported target " + s.arch)
panic("unsupported target " + arch)
}
}
// triple returns the Rosa OS host triple corresponding to arch.
func (s *S) triple() string {
return s.linuxArch() + "-rosa-linux-musl"
// triplet returns the Rosa OS host triple corresponding to arch.
func triplet() string {
return linuxArch() + "-rosa-linux-musl"
}
// perArch is a value that differs per architecture.
type perArch[T any] map[string]T
// unwrap returns the value for the current architecture.
func (p perArch[T]) unwrap(s *S) T {
v, ok := p[s.arch]
func (p perArch[T]) unwrap() T {
v, ok := p[arch]
if !ok {
panic("unsupported target " + s.arch)
panic("unsupported target " + arch)
}
return v
}
@@ -90,60 +91,63 @@ const (
)
// earlyLDFLAGS returns LDFLAGS corresponding to triplet.
func (s *S) earlyLDFLAGS(static bool) string {
p := "-fuse-ld=lld " +
func earlyLDFLAGS(static bool) string {
s := "-fuse-ld=lld " +
"-L/system/lib -Wl,-rpath=/system/lib " +
"-L/system/lib/" + s.triple() + " " +
"-Wl,-rpath=/system/lib/" + s.triple() + " " +
"-L/system/lib/" + triplet() + " " +
"-Wl,-rpath=/system/lib/" + triplet() + " " +
"-rtlib=compiler-rt " +
"-unwindlib=libunwind " +
"-Wl,--as-needed"
if !static {
p += " -Wl,--dynamic-linker=/system/bin/linker"
s += " -Wl,--dynamic-linker=/system/bin/linker"
}
return p
return s
}
// Toolchain denotes the infrastructure to compile a [pkg.Artifact] on.
type Toolchain uint32
const (
// _stageBusybox denotes a busybox installation from the busyboxBin
// binary distribution. This is defined as a [Stage] to make use of the
// toolchain abstractions to preprocess stageGentoo and is not a real,
// _toolchainBusybox denotes a busybox installation from the busyboxBin
// binary distribution. This is defined as a toolchain to make use of the
// toolchain abstractions to preprocess toolchainGentoo and is not a real,
// functioning toolchain. It does not contain any compilers.
_stageBusybox Stage = iota
_toolchainBusybox Toolchain = iota
// stageGentoo denotes the toolchain in a Gentoo stage3 tarball. Special
// care must be taken to compile correctly against this stage.
stageGentoo
// toolchainGentoo denotes the toolchain in a Gentoo stage3 tarball. Special
// care must be taken to compile correctly against this toolchain.
toolchainGentoo
// stageIntermediateGentoo is like stageIntermediate, but compiled against
// stageGentoo.
stageIntermediateGentoo
// toolchainIntermediateGentoo is like to toolchainIntermediate, but
// compiled against toolchainGentoo.
toolchainIntermediateGentoo
// stageStdGentoo is like Std, but bootstrapped from stageGentoo. This
// toolchain creates the first [Stage0] distribution.
stageStdGentoo
// toolchainStdGentoo is like Std, but bootstrapped from toolchainGentoo.
// This toolchain creates the first [Stage0] distribution.
toolchainStdGentoo
// stageEarly denotes the stage0 toolchain. Special care must be taken
// toolchainStage0 denotes the stage0 toolchain. Special care must be taken
// to compile correctly against this toolchain.
stageEarly
toolchainStage0
// stageIntermediate denotes the intermediate toolchain compiled against
// stageEarly. This toolchain should be functionally identical to [Std]
// toolchainIntermediate denotes the intermediate toolchain compiled against
// toolchainStage0. This toolchain should be functionally identical to [Std]
// and is used to bootstrap [Std].
stageIntermediate
toolchainIntermediate
// Std denotes the standard Rosa OS toolchain.
Std
// _stageEnd is the total number of stages available and does not denote a
// valid toolchain.
_stageEnd
// _toolchainEnd is the total number of toolchains available and does not
// denote a valid toolchain.
_toolchainEnd
)
// isStage0 returns whether t is a stage0 toolchain.
func (t Stage) isStage0() bool {
func (t Toolchain) isStage0() bool {
switch t {
case stageGentoo, stageEarly:
case toolchainGentoo, toolchainStage0:
return true
default:
return false
@@ -151,9 +155,9 @@ func (t Stage) isStage0() bool {
}
// isIntermediate returns whether t is an intermediate toolchain.
func (t Stage) isIntermediate() bool {
func (t Toolchain) isIntermediate() bool {
switch t {
case stageIntermediateGentoo, stageIntermediate:
case toolchainIntermediateGentoo, toolchainIntermediate:
return true
default:
return false
@@ -161,9 +165,9 @@ func (t Stage) isIntermediate() bool {
}
// isStd returns whether t is considered functionally equivalent to [Std].
func (t Stage) isStd() bool {
func (t Toolchain) isStd() bool {
switch t {
case stageStdGentoo, Std:
case toolchainStdGentoo, Std:
return true
default:
return false
@@ -220,7 +224,26 @@ const (
THostNet
)
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
var (
// gentooStage3 is the url of a Gentoo stage3 tarball.
gentooStage3 string
// gentooStage3Checksum is the expected checksum of gentooStage3.
gentooStage3Checksum pkg.Checksum
)
// SetGentooStage3 sets the Gentoo stage3 tarball url and checksum. It panics
// if given zero values or if these values have already been set.
func SetGentooStage3(url string, checksum pkg.Checksum) {
if gentooStage3 != "" {
panic(errors.New("attempting to set Gentoo stage3 url twice"))
}
if url == "" {
panic(errors.New("attempting to set Gentoo stage3 url to the zero value"))
}
gentooStage3, gentooStage3Checksum = url, checksum
}
// New returns a [pkg.Artifact] compiled on this toolchain.
func (t Toolchain) New(
name string,
flag int,
@@ -234,21 +257,20 @@ func (t Toolchain) New(
const lcMessages = "LC_MESSAGES=C.UTF-8"
var support []pkg.Artifact
switch t.stage {
case _stageBusybox:
switch t {
case _toolchainBusybox:
name += "-early"
support = slices.Concat([]pkg.Artifact{t.newBusyboxBin()}, extra)
support = slices.Concat([]pkg.Artifact{newBusyboxBin()}, extra)
env = fixupEnviron(env, nil, "/system/bin")
case stageGentoo, stageEarly:
case toolchainGentoo, toolchainStage0:
name += "-boot"
support = append(support, extra...)
support = append(support, cureEtc{})
if t.stage == stageEarly {
a, _ := t.Load(stage0Dist)
support = append(support, a)
if t == toolchainStage0 {
support = append(support, t.Load(stage0Dist))
} else {
support = append(support, t.S.New(_stageBusybox).New("gentoo", 0, nil, nil, nil, `
support = append(support, _toolchainBusybox.New("gentoo", 0, nil, nil, nil, `
tar -C /work -xf /usr/src/stage3.tar.xz
rm -rf /work/dev/ /work/proc/
ln -vs ../usr/bin /work/bin
@@ -259,22 +281,22 @@ mkdir -vp /work/system/bin
.)
`, pkg.Path(AbsUsrSrc.Append("stage3.tar.xz"), false,
pkg.NewHTTPGet(
nil, t.gentooStage3,
t.gentooStage3Checksum,
nil, gentooStage3,
gentooStage3Checksum,
),
)))
}
env = fixupEnviron(env, []string{
EnvTriplet + "=" + t.triple(),
EnvTriplet + "=" + triplet(),
lcMessages,
"LDFLAGS=" + t.earlyLDFLAGS(true),
"LDFLAGS=" + earlyLDFLAGS(true),
}, "/system/bin",
"/usr/bin",
)
case stageIntermediateGentoo, stageStdGentoo,
stageIntermediate, Std:
if t.stage.isIntermediate() {
case toolchainIntermediateGentoo, toolchainStdGentoo,
toolchainIntermediate, Std:
if t.isIntermediate() {
name += "-std"
}
@@ -288,7 +310,7 @@ mkdir -vp /work/system/bin
base = Musl
}
support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{
support = slices.Concat(extra, (t-1).AppendPresets([]pkg.Artifact{
cureEtc{newIANAEtc()},
},
base,
@@ -296,16 +318,16 @@ mkdir -vp /work/system/bin
toybox,
))
env = fixupEnviron(env, []string{
EnvTriplet + "=" + t.triple(),
EnvTriplet + "=" + triplet(),
lcMessages,
}, "/system/bin", "/bin")
default:
panic("unsupported toolchain " + strconv.Itoa(int(t.stage)))
panic("unsupported toolchain " + strconv.Itoa(int(t)))
}
return pkg.NewExec(
name, t.arch, knownChecksum, pkg.ExecTimeoutMax,
name, arch, knownChecksum, pkg.ExecTimeoutMax,
flag&THostNet != 0,
flag&TExclusive != 0,
fhs.AbsRoot, env,
@@ -357,7 +379,7 @@ cat /usr/src/` + name + `-patches/* | \
`
aname += "-patched"
}
return t.New(aname, 0, t.Append(nil,
return t.New(aname, 0, t.AppendPresets(nil,
Patch,
), nil, nil, script, paths...)
}
@@ -385,7 +407,7 @@ type Helper interface {
// also empty. The special value helperInPlace omits the cd statement.
wantsDir() string
// script returns the helper-specific segment of cure script.
script(s *S, name string) string
script(name string) string
}
// PackageAttr holds build-system-agnostic attributes.
@@ -414,39 +436,43 @@ type PackageAttr struct {
Flag int
}
// pa holds whether an [ArtifactH] is present.
type pa = map[ArtifactH]struct{}
// pa holds whether a [PArtifact] is present.
type pa = [PresetEnd]bool
// paPool holds addresses of pa.
var paPool = sync.Pool{New: func() any { return make(pa) }}
var paPool = sync.Pool{New: func() any { return new(pa) }}
// paGet returns the address of a new pa.
func paGet() pa { return paPool.Get().(pa) }
func paGet() *pa { return paPool.Get().(*pa) }
// paPut returns a pa to paPool.
func paPut(pv pa) { clear(pv); paPool.Put(pv) }
func paPut(pv *pa) { *pv = pa{}; paPool.Put(pv) }
// appendHandle recursively appends an [Artifact] named by its handle, and its
// runtime dependencies.
func (t Toolchain) appendHandle(a []pkg.Artifact, pv pa, p ArtifactH) []pkg.Artifact {
if _, ok := pv[p]; ok {
// appendPreset recursively appends a [PArtifact] and its runtime dependencies.
func (t Toolchain) appendPreset(
a []pkg.Artifact,
pv *pa, p PArtifact,
) []pkg.Artifact {
if pv[p] {
return a
}
pv[p] = struct{}{}
pv[p] = true
for _, d := range t.MustGet(p).Dependencies {
a = t.appendHandle(a, pv, d)
for _, d := range GetMetadata(p).Dependencies {
a = t.appendPreset(a, pv, d)
}
d, _ := t.Load(p)
return append(a, d)
return append(a, t.Load(p))
}
// Append recursively appends multiple [Artifact] named by their handles, and
// their runtime dependencies.
func (t Toolchain) Append(a []pkg.Artifact, handles ...ArtifactH) []pkg.Artifact {
// AppendPresets recursively appends multiple [PArtifact] and their runtime
// dependencies.
func (t Toolchain) AppendPresets(
a []pkg.Artifact,
presets ...PArtifact,
) []pkg.Artifact {
pv := paGet()
for _, p := range handles {
a = t.appendHandle(a, pv, p)
for _, p := range presets {
a = t.appendPreset(a, pv, p)
}
paPut(pv)
return a
@@ -458,7 +484,7 @@ func (t Toolchain) NewPackage(
source pkg.Artifact,
attr *PackageAttr,
helper Helper,
extra ...ArtifactH,
extra ...PArtifact,
) pkg.Artifact {
if attr == nil {
attr = new(PackageAttr)
@@ -475,10 +501,10 @@ func (t Toolchain) NewPackage(
{
pv := paGet()
for _, p := range helper.extra(attr.Flag) {
extraRes = t.appendHandle(extraRes, pv, p)
extraRes = t.appendPreset(extraRes, pv, p)
}
for _, p := range extra {
extraRes = t.appendHandle(extraRes, pv, p)
extraRes = t.appendPreset(extraRes, pv, p)
}
paPut(pv)
}
@@ -528,7 +554,7 @@ cd '/usr/src/` + name + `/'
extraRes,
attr.KnownChecksum,
attr.Env,
scriptEarly+helper.script(t.S, name),
scriptEarly+helper.script(name),
slices.Concat(attr.Paths, []pkg.ExecPath{
pkg.Path(AbsUsrSrc.Append(
name+sourceSuffix,
@@ -600,11 +626,3 @@ func newFromGitHubRelease(
compression,
)
}
// native contains natively-implemented and built-in azalea-based [Artifact].
// It is generally recommended to clone this instance for custom [Artifact]
// registrations.
var native S
// Native returns the global [S].
func Native() *S { return &native }

View File

@@ -28,7 +28,7 @@ var (
)
func TestMain(m *testing.M) {
rosa.Native().DropCaches("", rosa.OptLLVMNoLTO)
rosa.DropCaches("", rosa.OptLLVMNoLTO)
container.TryArgv0(nil)
code := m.Run()
@@ -77,9 +77,10 @@ func TestCureAll(t *testing.T) {
cache := getCache(t)
t.Parallel()
for _, p := range rosa.Native().Collect() {
a, _ := rosa.Native().Std().MustLoad(p)
meta := rosa.Native().MustGet(p)
for i := range rosa.PresetEnd {
p := rosa.PArtifact(i)
meta := rosa.GetMetadata(p)
a := rosa.Std.Load(p)
t.Run(meta.Name, func(t *testing.T) {
t.Parallel()
@@ -93,13 +94,14 @@ func TestCureAll(t *testing.T) {
}
func BenchmarkStage3(b *testing.B) {
t := rosa.Native().Clone().Std()
arch, flags := rosa.Arch(), rosa.Flags()
b.Cleanup(func() { rosa.DropCaches(arch, flags) })
for b.Loop() {
t.MustLoad(rosa.LLVM)
rosa.Std.Load(rosa.LLVM)
b.StopTimer()
t.DropCaches("", 0)
rosa.DropCaches("", 0)
b.StartTimer()
}
}

View File

@@ -27,7 +27,7 @@ func (t Toolchain) newRsync() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Rsync] = Metadata{
f: Toolchain.newRsync,
Name: "rsync",
@@ -35,5 +35,5 @@ func init() {
Website: "https://rsync.samba.org/",
ID: 4217,
})
}
}

40
internal/rosa/ruby.go Normal file
View File

@@ -0,0 +1,40 @@
package rosa
import (
"strings"
"hakurei.app/internal/pkg"
)
func (t Toolchain) newRuby() (pkg.Artifact, string) {
const (
version = "4.0.4"
checksum = "QyulcwFhodxYsuYu2MfMgk5nnVpsR5NO2NGsJ3AIMFJQdafn6ZkFBJhVp_XhU6gU"
)
return t.NewPackage("ruby", version, newTar(
"https://cache.ruby-lang.org/pub/ruby/"+
strings.Join(strings.SplitN(version, ".", 3)[:2], ".")+
"/ruby-"+version+".tar.gz",
checksum,
pkg.TarGzip,
), nil, &MakeHelper{
SkipCheck: true,
Configure: []KV{[2]string{"--disable-install-doc"}},
},
Libffi,
OpenSSL,
), version
}
func init() {
artifactsM[Ruby] = Metadata{
f: Toolchain.newRuby,
Name: "ruby",
Description: "a programming language",
Website: "https://www.ruby-lang.org/",
// TODO(ophestra): resolve runtime deps
ID: 4223,
}
}

View File

@@ -42,7 +42,7 @@ func (t Toolchain) newSquashfsTools() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[SquashfsTools] = Metadata{
f: Toolchain.newSquashfsTools,
Name: "squashfs-tools",
@@ -56,5 +56,5 @@ func init() {
},
ID: 4879,
})
}
}

View File

@@ -6,56 +6,56 @@ import (
)
func (t Toolchain) newStage0() (pkg.Artifact, string) {
return t.New("rosa-stage0", 0, t.Append(nil,
return t.New("rosa-stage0", 0, t.AppendPresets(nil,
Bzip2,
), nil, nil, `
umask 377
tar \
-vjc \
-C /stage0 \
-f /work/stage0-`+t.triple()+`.tar.bz2 \
-f /work/stage0-`+triplet()+`.tar.bz2 \
.
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.Append(nil,
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.AppendPresets(nil,
LLVM,
Mksh,
toyboxEarly,
)...)), Unversioned
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Stage0] = Metadata{
f: Toolchain.newStage0,
Name: "rosa-stage0",
Description: "Rosa OS stage0 toolchain tarball for bootstrap",
})
}
}
func init() {
const version = "20260504"
native.MustRegister(&Artifact{
f: func(t Toolchain) (pkg.Artifact, string) {
artifactsM[stage0Dist] = Metadata{
f: func(Toolchain) (pkg.Artifact, string) {
return newTar(
"https://hakurei.app/seed/"+version+"/"+
"stage0-"+t.triple()+".tar.bz2",
"stage0-"+triplet()+".tar.bz2",
perArch[string]{
"amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk",
"arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH",
"riscv64": "Z2ODV0rIoo9iQRUIu35bsaOBeXc_9qQfGcyb2aGneatzNUJlXh5emSpEV2bOklUL",
}.unwrap(t.S),
}.unwrap(),
pkg.TarBzip2,
), version
},
Name: "stage0-dist",
Description: "Rosa OS stage0 bootstrap seed",
})
}
}
// HasStage0 returns whether a stage0 distribution is available.
func HasStage0() (ok bool) {
func() {
defer func() { ok = recover() == nil }()
native.New(stageEarly).Load(stage0Dist)
toolchainStage0.Load(stage0Dist)
}()
return
}

View File

@@ -1,566 +0,0 @@
package rosa
import (
"context"
"encoding/json"
"errors"
"io"
"io/fs"
"net/http"
"path/filepath"
"runtime"
"slices"
"strconv"
"strings"
"sync"
"sync/atomic"
"unique"
"unsafe"
"hakurei.app/internal/pkg"
"hakurei.app/internal/rosa/azalea"
)
// ArtifactH is a handle of the unique name of a prepared [pkg.Artifact].
type ArtifactH unique.Handle[string]
// H is a convenient function for acquiring an [ArtifactH] by name.
func H(name string) ArtifactH { return ArtifactH(unique.Make(name)) }
// String returns the name of p.
func (handle ArtifactH) String() string {
return unique.Handle[string](handle).Value()
}
// MarshalJSON represents [ArtifactH] by its [Artifact.Name].
func (handle ArtifactH) MarshalJSON() ([]byte, error) {
return json.Marshal(handle.String())
}
// UnmarshalJSON resolves [ArtifactH] by its [Artifact.Name].
func (handle *ArtifactH) UnmarshalJSON(data []byte) error {
var name string
if err := json.Unmarshal(data, &name); err != nil {
return err
}
*handle = ArtifactH(unique.Make(name))
return nil
}
// A HandleError is panicked when attempting to acquire an [Artifact] via an
// invalid [ArtifactH] with the Must suite of methods.
type HandleError ArtifactH
func (e HandleError) Error() string {
return "artifact " + strconv.Quote(ArtifactH(e).String()) + " not available"
}
type (
// Stage denotes the infrastructure to compile a [pkg.Artifact] on.
Stage uint32
// Toolchain refers to an instance of [S], and a [Stage] to compile on.
Toolchain struct {
stage Stage
*S
}
)
// 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)
// Unique package name.
Name string `json:"name"`
// Short user-facing description.
Description string `json:"description"`
// Project home page.
Website string `json:"website,omitempty"`
// Runtime dependencies.
Dependencies P `json:"dependencies"`
// Project identifier on [Anitya].
//
// [Anitya]: https://release-monitoring.org/
ID int `json:"-"`
// Whether to exclude from exported functions.
Exclude bool `json:"exclude,omitempty"`
// Optional custom version checking behaviour.
latest func(v *Versions) string
}
// GetLatest returns the latest version described by v.
func (meta *Artifact) GetLatest(v *Versions) string {
if meta.latest != nil {
return meta.latest(v)
}
return v.Latest
}
// Unversioned denotes an unversioned [Artifact].
const Unversioned = "\x00"
// UnpopulatedIDError is returned by [Artifact.GetLatest] for an instance of
// [Artifact] where ID is not populated.
type UnpopulatedIDError struct{}
func (UnpopulatedIDError) Unwrap() error { return errors.ErrUnsupported }
func (UnpopulatedIDError) Error() string { return "Anitya ID is not populated" }
// Versions are package versions returned by Anitya.
type Versions struct {
// The latest version for the project, as determined by the version sorting algorithm.
Latest string `json:"latest_version"`
// List of all versions that arent flagged as pre-release.
Stable []string `json:"stable_versions"`
// List of all versions stored, sorted from newest to oldest.
All []string `json:"versions"`
}
// getStable returns the first Stable version, or Latest if that is unavailable.
func (v *Versions) getStable() string {
if len(v.Stable) == 0 {
return v.Latest
}
return v.Stable[0]
}
// GetVersions returns versions fetched from Anitya.
func (meta *Artifact) GetVersions(ctx context.Context) (*Versions, error) {
if meta.ID == 0 {
return nil, UnpopulatedIDError{}
}
var resp *http.Response
if req, err := http.NewRequestWithContext(
ctx,
http.MethodGet,
"https://release-monitoring.org/api/v2/versions/?project_id="+
strconv.Itoa(meta.ID),
nil,
); err != nil {
return nil, err
} else {
req.Header.Set("User-Agent", "Rosa/1.1")
if resp, err = http.DefaultClient.Do(req); err != nil {
return nil, err
}
}
var v Versions
err := json.NewDecoder(resp.Body).Decode(&v)
return &v, errors.Join(err, resp.Body.Close())
}
// A cachedArtifact holds [pkg.Artifact] and its corresponding version string.
type cachedArtifact struct {
a pkg.Artifact
v string
}
const (
// OptSkipCheck skips running all test suites.
OptSkipCheck = 1 << iota
// OptLLVMNoLTO disables LTO in all [LLVM] stages.
OptLLVMNoLTO
)
// S holds a set of [Artifact].
type S struct {
// [ArtifactH] to [Artifact].
artifacts sync.Map
// Size of artifacts.
artifactCount atomic.Uint64
// Target architecture.
arch string
// For initialising arch.
archOnce sync.Once
// Built-in functions.
s []azalea.Frame
// For initialising s.
sOnce sync.Once
// Options for [pkg.Artifact] created against [S].
opts int
// Cached [pkg.Artifact].
c [_stageEnd]sync.Map
// URL of a Gentoo stage3 tarball.
gentooStage3 string
// Expected checksum of gentooStage3.
gentooStage3Checksum pkg.Checksum
}
// Clone returns a copy of s.
func (s *S) Clone() *S {
v := S{arch: s.arch}
s.artifacts.Range(func(key, value any) bool {
v.artifacts.Store(key, value)
v.artifactCount.Add(1)
return true
})
return &v
}
// wantsArch must be called before accessing arch.
func (s *S) wantsArch() {
s.archOnce.Do(func() {
if s.arch == "" {
s.arch = runtime.GOARCH
}
})
}
// Arch returns the target architecture.
func (s *S) Arch() string { s.wantsArch(); return s.arch }
// Flags returns the current preset flags.
func (s *S) Flags() int { return s.opts }
// DropCaches arranges for all cached [pkg.Artifact] to be freed some time after
// it returns. Must not be used concurrently with any other method.
func (s *S) DropCaches(targetArch string, flags int) {
if targetArch == "" {
targetArch = runtime.GOARCH
}
s.arch = targetArch
s.opts = flags
for i := range s.c {
s.c[i].Clear()
}
}
// Get returns the address of the named [Artifact].
func (s *S) Get(handle ArtifactH) (meta *Artifact) {
s.wantsArch()
v, ok := s.artifacts.Load(handle)
if ok {
meta = 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 {
panic(HandleError(handle))
}
return
}
// New returns a [Toolchain] for the specified [Stage].
func (s *S) New(stage Stage) Toolchain {
return Toolchain{S: s, stage: stage}
}
// Std is a convenience method that returns a [Toolchain] for the [Std] stage.
func (s *S) Std() Toolchain { return s.New(Std) }
// Load returns the resulting [pkg.Artifact] of [ArtifactH].
func (t Toolchain) Load(handle ArtifactH) (pkg.Artifact, string) {
t.wantsArch()
e, ok := t.c[t.stage].Load(handle)
if ok {
r := e.(cachedArtifact)
return r.a, r.v
}
meta := t.Get(handle)
if meta == nil {
return nil, ""
}
var r cachedArtifact
r.a, r.v = meta.f(t)
t.c[t.stage].Store(handle, r)
return r.a, r.v
}
// 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 {
panic(HandleError(handle))
}
return a, version
}
// 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 == "" {
return false
}
p := ArtifactH(unique.Make(meta.Name))
_, ok := s.artifacts.LoadOrStore(p, meta)
if !ok {
s.artifactCount.Add(1)
}
return !ok
}
// RegisterError is returned or panicked when attempting to register multiple
// [Artifact] with the same name.
type RegisterError ArtifactH
func (e RegisterError) Error() string {
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)))
}
}
// Count returns the number of [Artifact] registered to s.
func (s *S) Count() int {
return int(s.artifactCount.Load())
}
// Collect returns all [ArtifactH] registered to s.
func (s *S) Collect() (handles P) {
handles = make(P, 0, s.Count())
s.artifacts.Range(func(key, _ any) bool {
handles = append(handles, key.(ArtifactH))
return true
})
slices.SortFunc(handles, func(a, b ArtifactH) int {
return strings.Compare(a.String(), b.String())
})
return
}
// getS must be called before accessing s. This value is not currently safe for
// concurrent use, but the underlying frame is immutable.
func (s *S) getS() []azalea.Frame {
s.sOnce.Do(func() {
s.wantsArch()
k := func(name string) unique.Handle[azalea.Ident] {
return unique.Make(azalea.Ident(name))
}
s.s = make([]azalea.Frame, 1, 1<<4)
s.s[0].Func = map[unique.Handle[azalea.Ident]]azalea.F{
// intenral/pkg built-ins
unique.Make(azalea.Ident("remoteTar")): {F: func(
args azalea.FArgs,
) (v any, set bool, err error) {
var url, checksum string
var compress uint32
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("url"): &url,
k("checksum"): &checksum,
k("compress"): &compress,
}); err != nil {
return
}
v = newTar(url, checksum, compress)
set = true
return
}, V: map[unique.Handle[azalea.Ident]]any{
k("uncompressed"): uint32(pkg.TarUncompressed),
k("gzip"): uint32(pkg.TarGzip),
k("bzip2"): uint32(pkg.TarBzip2),
}},
// high-level helpers
unique.Make(azalea.Ident("make")): {F: func(
args azalea.FArgs,
) (v any, set bool, err error) {
var attr MakeHelper
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("omitDefaults"): &attr.OmitDefaults,
k("generate"): &attr.Generate,
k("preMake"): &attr.ScriptMakeEarly,
k("preCheck"): &attr.ScriptCheckEarly,
k("postInstall"): &attr.Script,
k("inPlace"): &attr.InPlace,
k("skipConfigure"): &attr.SkipConfigure,
k("configureName"): &attr.ConfigureName,
k("configure"): &attr.Configure,
k("host"): &attr.Host,
k("build"): &attr.Build,
k("make"): &attr.Make,
k("skipCheck"): &attr.SkipCheck,
k("check"): &attr.Check,
k("install"): &attr.Install,
}); err != nil {
return
}
v = &attr
set = true
return
}},
}
})
return s.s
}
// toHandles makes handles out of an [azalea.Array] of identifiers.
func toHandles(idents azalea.Array) (P, error) {
handles := make(P, len(idents))
for i, p := range idents {
if len(p) != 1 {
return nil, azalea.EvaluationError{
Expr: p,
Err: errors.New("concatenation not allowed for handles"),
}
}
s, ok := p[0].(azalea.Ident)
if !ok {
return nil, azalea.EvaluationError{
Expr: p[0],
Err: errors.New("identifiers expected for handles"),
}
}
handles[i] = H(string(s))
}
return handles, nil
}
// evalContext holds per-reader context.
type evalContext struct{ b fs.FS }
// f implements [azalea.PF].
func (ctx *evalContext) f(
name azalea.Ident,
args azalea.FArgs,
) (v any, set bool, err error) {
k := func(name string) unique.Handle[azalea.Ident] {
return unique.Make(azalea.Ident(name))
}
meta := Artifact{Name: string(name)}
var (
attr PackageAttr
patches []string
anitya int64
version string
source pkg.Artifact
helper Helper
inputs, runtimes azalea.Array
)
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("description"): &meta.Description,
k("website"): &meta.Website,
k("anitya"): &anitya,
k("version"): &version,
k("source"): &source,
k("writable"): &attr.Writable,
k("chmod"): &attr.Chmod,
k("enterSource"): &attr.EnterSource,
k("env"): &attr.Env,
k("early"): &attr.ScriptEarly,
k("patches"): &patches,
k("exec"): &helper,
k("inputs"): &inputs,
k("runtime"): &runtimes,
}); err != nil {
return
}
var inputsH P
if inputsH, err = toHandles(inputs); err != nil {
return
} else if meta.Dependencies, err = toHandles(runtimes); err != nil {
return
}
for _, pathname := range patches {
var p []byte
p, err = fs.ReadFile(ctx.b, pathname)
if err != nil {
return
}
attr.Patches = append(attr.Patches, KV{
strings.TrimSuffix(filepath.Base(pathname), ".patch"),
unsafe.String(unsafe.SliceData(p), len(p)),
})
}
meta.ID = int(anitya)
meta.f = func(t Toolchain) (pkg.Artifact, string) {
return t.NewPackage(
meta.Name,
version,
source,
&attr,
helper,
inputsH...,
), version
}
v = meta
set = true
return
}
var (
// ErrToplevel is returned by [S.Evaluate] when encountering a toplevel
// expression other than a package declaration.
ErrToplevel = errors.New("top level must only contain package declarations")
)
// Evaluate defines all package declarations from r. The backing filesystem is
// directly exposed to azalea pathnames.
func (s *S) Evaluate(r io.Reader, b fs.FS) error {
var pending []*azalea.Func
if expressions, err := azalea.Parse(r); err != nil {
return err
} else {
pending = make([]*azalea.Func, len(expressions))
for i, expr := range expressions {
f, ok := expr.(azalea.Func)
if !ok || !f.Package {
return ErrToplevel
}
pending[i] = &f
}
}
ctx := evalContext{b}
for _, f := range pending {
meta, 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) {
return RegisterError(H(string(f.Ident)))
}
}
return nil
}
// SetGentooStage3 sets the Gentoo stage3 tarball url and checksum. It panics
// if given zero values or if these values have already been set.
func (s *S) SetGentooStage3(url string, checksum pkg.Checksum) {
if s.gentooStage3 != "" {
panic(errors.New("attempting to set Gentoo stage3 url twice"))
}
if url == "" {
panic(errors.New("attempting to set Gentoo stage3 url to the zero value"))
}
s.gentooStage3, s.gentooStage3Checksum = url, checksum
s.DropCaches(s.Arch(), s.Flags())
}

View File

@@ -1,195 +0,0 @@
package rosa
var (
LLVM = H("llvm")
EarlyInit = H("earlyinit")
ImageSystem = H("system-image")
ImageInitramfs = H("initramfs-image")
Kernel = H("kernel")
KernelHeaders = H("kernel-headers")
KernelSource = H("kernel-source")
Firmware = H("firmware")
ACL = H("acl")
ArgpStandalone = H("argp-standalone")
Attr = H("attr")
Autoconf = H("autoconf")
Automake = H("automake")
BC = H("bc")
Bash = H("bash")
Binutils = H("binutils")
Bison = H("bison")
Bzip2 = H("bzip2")
CMake = H("cmake")
Connman = H("connman")
Coreutils = H("coreutils")
Curl = H("curl")
DBus = H("dbus")
DTC = H("dtc")
Diffutils = H("diffutils")
Elfutils = H("elfutils")
Fakeroot = H("fakeroot")
Findutils = H("findutils")
Flex = H("flex")
FontUtil = H("font-util")
Freetype = H("freetype")
Fuse = H("fuse")
GMP = H("gmp")
GLib = H("glib")
Gawk = H("gawk")
GenInitCPIO = H("gen_init_cpio")
Gettext = H("gettext")
Git = H("git")
Glslang = H("glslang")
GnuTLS = H("gnutls")
Go = H("go")
Gperf = H("gperf")
Grep = H("grep")
Gzip = H("gzip")
Hakurei = H("hakurei")
HakureiDist = H("hakurei-dist")
Hwdata = H("hwdata")
IPTables = H("iptables")
Kmod = H("kmod")
LIT = H("lit")
LibX11 = H("libX11")
LibXau = H("libXau")
LibXdmcp = H("libXdmcp")
LibXext = H("libXext")
LibXfixes = H("libXfixes")
LibXfont2 = H("libXfont2")
LibXrandr = H("libXrandr")
LibXrender = H("libXrender")
LibXxf86vm = H("libXxf86vm")
Libarchive = H("libarchive")
Libbsd = H("libbsd")
Libcap = H("libcap")
Libconfig = H("libconfig")
LibdisplayInfo = H("libdisplay-info")
Libdrm = H("libdrm")
Libepoxy = H("libepoxy")
Libev = H("libev")
Libexpat = H("libexpat")
Libffi = H("libffi")
Libfontenc = H("libfontenc")
Libgd = H("libgd")
Libglvnd = H("libglvnd")
Libiconv = H("libiconv")
Libmd = H("libmd")
Libmnl = H("libmnl")
Libnftnl = H("libnftnl")
Libpciaccess = H("libpciaccess")
Libpng = H("libpng")
Libpsl = H("libpsl")
Libseccomp = H("libseccomp")
Libtasn1 = H("libtasn1")
Libtirpc = H("libtirpc")
Libtool = H("libtool")
Libucontext = H("libucontext")
Libunistring = H("libunistring")
Libva = H("libva")
LibxcbRenderUtil = H("libxcb-render-util")
LibxcbUtil = H("libxcb-util")
LibxcbUtilImage = H("libxcb-util-image")
LibxcbUtilKeysyms = H("libxcb-util-keysyms")
LibxcbUtilWM = H("libxcb-util-wm")
Libxcvt = H("libxcvt")
Libxkbfile = H("libxkbfile")
Libxml2 = H("libxml2")
Libxshmfence = H("libxshmfence")
Libxslt = H("libxslt")
Libxtrans = H("libxtrans")
LMSensors = H("lm_sensors")
M4 = H("m4")
MPC = H("mpc")
MPFR = H("mpfr")
Make = H("make")
Mesa = H("mesa")
Meson = H("meson")
Mksh = H("mksh")
MuslFts = H("musl-fts")
MuslObstack = H("musl-obstack")
NSS = H("nss")
NSSCACert = H("nss-cacert")
Ncurses = H("ncurses")
Nettle = H("nettle")
Ninja = H("ninja")
OpenSSL = H("openssl")
P11Kit = H("p11-kit")
PCRE2 = H("pcre2")
Parallel = H("parallel")
Patch = H("patch")
Perl = H("perl")
PerlLocaleGettext = H("perl-Locale::gettext")
PerlMIMECharset = H("perl-MIME::Charset")
PerlModuleBuild = H("perl-Module::Build")
PerlPodParser = H("perl-Pod::Parser")
PerlSGMLS = H("perl-SGMLS")
PerlTermReadKey = H("perl-Term::ReadKey")
PerlTestCmd = H("perl-Test::Cmd")
PerlTextCharWidth = H("perl-Text::CharWidth")
PerlTextWrapI18N = H("perl-Text::WrapI18N")
PerlUnicodeLineBreak = H("perl-Unicode::LineBreak")
PerlYAMLTiny = H("perl-YAML::Tiny")
Pixman = H("pixman")
PkgConfig = H("pkg-config")
Procps = H("procps")
Python = H("python")
PythonFlitCore = H("python-flit-core")
PythonHatchling = H("python-hatchling")
PythonIniConfig = H("python-iniconfig")
PythonMako = H("python-mako")
PythonMarkupSafe = H("python-markupsafe")
PythonPackaging = H("python-packaging")
PythonPathspec = H("python-pathspec")
PythonPluggy = H("python-pluggy")
PythonPyTest = H("python-pytest")
PythonPyYAML = H("python-pyyaml")
PythonPycparser = H("python-pycparser")
PythonPygments = H("python-pygments")
PythonSetuptools = H("python-setuptools")
PythonSetuptoolsSCM = H("python-setuptools-scm")
PythonTroveClassifiers = H("python-trove-classifiers")
PythonVCSVersioning = H("python-vcs-versioning")
PythonWheel = H("python-wheel")
QEMU = H("qemu")
Rdfind = H("rdfind")
Readline = H("readline")
Rsync = H("rsync")
Sed = H("sed")
SPIRVHeaders = H("spirv-headers")
SPIRVLLVMTranslator = H("spirv-llvm-translator")
SPIRVTools = H("spirv-tools")
SquashfsTools = H("squashfs-tools")
Strace = H("strace")
TamaGo = H("tamago")
Tar = H("tar")
Texinfo = H("texinfo")
Toybox = H("toybox")
toyboxEarly = H("toybox-early")
Unzip = H("unzip")
UtilLinux = H("util-linux")
VIM = H("vim")
Wayland = H("wayland")
WaylandProtocols = H("wayland-protocols")
XCB = H("xcb")
XCBProto = H("xcb-proto")
XDGDBusProxy = H("xdg-dbus-proxy")
XZ = H("xz")
Xkbcomp = H("xkbcomp")
XkeyboardConfig = H("xkeyboard-config")
XorgProto = H("xorgproto")
Xserver = H("xserver")
Zlib = H("zlib")
Zstd = H("zstd")
stage0Dist = H("stage0-dist")
llvmSource = H("llvm-project")
earlyCompilerRT = H("early-compiler-rt")
earlyRuntimes = H("early-runtimes")
buildcatrust = H("python-buildcatrust")
utilMacros = H("util-macros")
Musl = H("musl")
muslHeaders = H("musl-headers")
gcc = H("gcc")
nettle3 = H("nettle3")
Stage0 = H("rosa-stage0")
)

View File

@@ -1,33 +0,0 @@
package rosa_test
import (
"testing"
"hakurei.app/internal/rosa"
)
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.Parallel()
rosa.Native().Std().MustLoad(p)
})
}
}
func BenchmarkAll(b *testing.B) {
t := rosa.Native().Clone().Std()
for b.Loop() {
for _, p := range t.Collect() {
t.MustLoad(p)
}
b.StopTimer()
t.DropCaches("", 0)
b.StartTimer()
}
}

View File

@@ -37,7 +37,7 @@ sed -i 's/unsigned int msg_len;$/uint32_t msg_len;/g' \
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Strace] = Metadata{
f: Toolchain.newStrace,
Name: "strace",
@@ -45,5 +45,5 @@ func init() {
Website: "https://strace.io/",
ID: 4897,
})
}
}

View File

@@ -7,7 +7,7 @@ func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
version = "1.26.3"
checksum = "-nH3MjAzDDLTeJ2hRKYJcJwo5-Ikci4zOHfB8j1vKn7zrF9TS6zYaoLi8qohGwAE"
)
return t.New("tamago-go"+version, 0, t.Append(nil,
return t.New("tamago-go"+version, 0, t.AppendPresets(nil,
Bash,
Go,
), nil, []string{
@@ -21,8 +21,8 @@ cd /work/system/tamago/src
chmod -R +w ..
sed -i \
's,/lib/ld-musl-`+t.linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+t.arch+`/obj.go
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
cmd/link/internal/`+arch+`/obj.go
sed -i \
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
internal/runtime/gc/scan/scan_amd64.go
@@ -40,7 +40,7 @@ rm \
))), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[TamaGo] = Metadata{
f: Toolchain.newTamaGo,
Name: "tamago",
@@ -48,5 +48,5 @@ func init() {
Website: "https://github.com/usbarmory/tamago-go",
ID: 388872,
})
}
}

View File

@@ -41,7 +41,7 @@ sed -i \
's/^CONFIG_TOYBOX_ZHELP=y$/CONFIG_TOYBOX_ZHELP=0/' \
.config
` + script,
SkipCheck: t.stage.isStage0(),
SkipCheck: t.isStage0(),
Check: []string{
"USER=cure",
"tests",
@@ -59,7 +59,7 @@ ln -s ../../system/bin/env /work/usr/bin
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Toybox] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newToybox("", "")
},
@@ -69,9 +69,9 @@ func init() {
Website: "https://landley.net/toybox/",
ID: 13818,
})
}
native.MustRegister(&Artifact{
artifactsM[toyboxEarly] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newToybox("-early", `
echo '
@@ -86,5 +86,5 @@ CONFIG_DIFF=y
Name: "toybox-early",
Description: "a build of toybox with unfinished tools enabled to break dependency loops",
Website: "https://landley.net/toybox/",
})
}
}

View File

@@ -11,7 +11,7 @@ func (t Toolchain) newUnzip() (pkg.Artifact, string) {
version = "6.0"
checksum = "fcqjB1IOVRNJ16K5gTGEDt3zCJDVBc7EDSra9w3H93stqkNwH1vaPQs_QGOpQZu1"
)
return t.New("unzip-"+version, 0, t.Append(nil,
return t.New("unzip-"+version, 0, t.AppendPresets(nil,
Make,
Coreutils,
), nil, nil, `
@@ -32,7 +32,7 @@ mv unzip /work/system/bin/
))), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Unzip] = Metadata{
f: Toolchain.newUnzip,
Name: "unzip",
@@ -40,5 +40,5 @@ func init() {
Website: "https://infozip.sourceforge.net/",
ID: 8684,
})
}
}

View File

@@ -47,7 +47,7 @@ ln -s ../system/bin/bash /bin/
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[UtilLinux] = Metadata{
f: Toolchain.newUtilLinux,
Name: "util-linux",
@@ -58,5 +58,5 @@ func init() {
// release candidates confuse Anitya
latest: (*Versions).getStable,
})
}
}

View File

@@ -29,7 +29,7 @@ func (t Toolchain) newVIM() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[VIM] = Metadata{
f: Toolchain.newVIM,
Name: "vim",
@@ -41,5 +41,5 @@ func init() {
},
ID: 5092,
})
}
}

View File

@@ -35,7 +35,7 @@ echo 'int main(){}' > tests/sanity-test.c
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Wayland] = Metadata{
f: Toolchain.newWayland,
Name: "wayland",
@@ -49,7 +49,7 @@ func init() {
},
ID: 10061,
})
}
}
func (t Toolchain) newWaylandProtocols() (pkg.Artifact, string) {
@@ -121,7 +121,7 @@ GitLab
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[WaylandProtocols] = Metadata{
f: Toolchain.newWaylandProtocols,
Name: "wayland-protocols",
@@ -129,5 +129,5 @@ func init() {
Website: "https://wayland.freedesktop.org/",
ID: 13997,
})
}
}

View File

@@ -15,7 +15,7 @@ func (t Toolchain) newUtilMacros() (pkg.Artifact, string) {
), nil, (*MakeHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[utilMacros] = Metadata{
f: Toolchain.newUtilMacros,
Name: "util-macros",
@@ -23,7 +23,7 @@ func init() {
Website: "https://xorg.freedesktop.org/",
ID: 5252,
})
}
}
func (t Toolchain) newLibxtrans() (pkg.Artifact, string) {
@@ -47,7 +47,7 @@ func (t Toolchain) newLibxtrans() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxtrans] = Metadata{
f: Toolchain.newLibxtrans,
Name: "libxtrans",
@@ -55,7 +55,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/lib/libxtrans",
ID: 13441,
})
}
}
func (t Toolchain) newXorgProto() (pkg.Artifact, string) {
@@ -78,7 +78,7 @@ func (t Toolchain) newXorgProto() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XorgProto] = Metadata{
f: Toolchain.newXorgProto,
Name: "xorgproto",
@@ -86,7 +86,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/proto/xorgproto",
ID: 17190,
})
}
}
func (t Toolchain) newLibXau() (pkg.Artifact, string) {
@@ -112,7 +112,7 @@ func (t Toolchain) newLibXau() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXau] = Metadata{
f: Toolchain.newLibXau,
Name: "libXau",
@@ -124,7 +124,7 @@ func init() {
},
ID: 1765,
})
}
}
func (t Toolchain) newXCBProto() (pkg.Artifact, string) {
@@ -141,7 +141,7 @@ func (t Toolchain) newXCBProto() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XCBProto] = Metadata{
f: Toolchain.newXCBProto,
Name: "xcb-proto",
@@ -149,7 +149,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/proto/xcbproto",
ID: 13646,
})
}
}
func (t Toolchain) newXCB() (pkg.Artifact, string) {
@@ -170,7 +170,7 @@ func (t Toolchain) newXCB() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XCB] = Metadata{
f: Toolchain.newXCB,
Name: "xcb",
@@ -183,7 +183,7 @@ func init() {
},
ID: 1767,
})
}
}
func (t Toolchain) newLibxcbUtilKeysyms() (pkg.Artifact, string) {
@@ -202,7 +202,7 @@ func (t Toolchain) newLibxcbUtilKeysyms() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibxcbUtilKeysyms] = Metadata{
f: Toolchain.newLibxcbUtilKeysyms,
Name: "libxcb-util-keysyms",
@@ -214,7 +214,7 @@ func init() {
},
ID: 5168,
})
}
}
func (t Toolchain) newLibxcbUtilImage() (pkg.Artifact, string) {
@@ -233,7 +233,7 @@ func (t Toolchain) newLibxcbUtilImage() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibxcbUtilImage] = Metadata{
f: Toolchain.newLibxcbUtilImage,
Name: "libxcb-util-image",
@@ -245,7 +245,7 @@ func init() {
},
ID: 5168,
})
}
}
func (t Toolchain) newLibxcbUtilWM() (pkg.Artifact, string) {
@@ -265,7 +265,7 @@ func (t Toolchain) newLibxcbUtilWM() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibxcbUtilWM] = Metadata{
f: Toolchain.newLibxcbUtilWM,
Name: "libxcb-util-wm",
@@ -277,7 +277,7 @@ func init() {
},
ID: 5170,
})
}
}
func (t Toolchain) newLibxcbUtil() (pkg.Artifact, string) {
@@ -298,7 +298,7 @@ func (t Toolchain) newLibxcbUtil() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibxcbUtil] = Metadata{
f: Toolchain.newLibxcbUtil,
Name: "libxcb-util",
@@ -310,7 +310,7 @@ func init() {
},
ID: 5165,
})
}
}
func (t Toolchain) newLibxcbRenderUtil() (pkg.Artifact, string) {
@@ -331,7 +331,7 @@ func (t Toolchain) newLibxcbRenderUtil() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibxcbRenderUtil] = Metadata{
f: Toolchain.newLibxcbRenderUtil,
Name: "libxcb-render-util",
@@ -343,7 +343,7 @@ func init() {
},
ID: 5169,
})
}
}
func (t Toolchain) newLibX11() (pkg.Artifact, string) {
@@ -375,7 +375,7 @@ func (t Toolchain) newLibX11() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibX11] = Metadata{
f: Toolchain.newLibX11,
Name: "libX11",
@@ -387,7 +387,7 @@ func init() {
},
ID: 1764,
})
}
}
func (t Toolchain) newLibXext() (pkg.Artifact, string) {
@@ -412,7 +412,7 @@ func (t Toolchain) newLibXext() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXext] = Metadata{
f: Toolchain.newLibXext,
Name: "libXext",
@@ -424,7 +424,7 @@ func init() {
},
ID: 1774,
})
}
}
func (t Toolchain) newLibXfixes() (pkg.Artifact, string) {
@@ -450,7 +450,7 @@ func (t Toolchain) newLibXfixes() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXfixes] = Metadata{
f: Toolchain.newLibXfixes,
Name: "libXfixes",
@@ -462,7 +462,7 @@ func init() {
},
ID: 1775,
})
}
}
func (t Toolchain) newLibXrender() (pkg.Artifact, string) {
@@ -487,7 +487,7 @@ func (t Toolchain) newLibXrender() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXrender] = Metadata{
f: Toolchain.newLibXrender,
Name: "libXrender",
@@ -499,7 +499,7 @@ func init() {
},
ID: 1789,
})
}
}
func (t Toolchain) newLibxshmfence() (pkg.Artifact, string) {
@@ -524,7 +524,7 @@ func (t Toolchain) newLibxshmfence() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxshmfence] = Metadata{
f: Toolchain.newLibxshmfence,
Name: "libxshmfence",
@@ -532,7 +532,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/lib/libxshmfence",
ID: 1792,
})
}
}
func (t Toolchain) newLibXxf86vm() (pkg.Artifact, string) {
@@ -558,7 +558,7 @@ func (t Toolchain) newLibXxf86vm() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXxf86vm] = Metadata{
f: Toolchain.newLibXxf86vm,
Name: "libXxf86vm",
@@ -570,7 +570,7 @@ func init() {
},
ID: 1799,
})
}
}
func (t Toolchain) newLibXrandr() (pkg.Artifact, string) {
@@ -597,7 +597,7 @@ func (t Toolchain) newLibXrandr() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXrandr] = Metadata{
f: Toolchain.newLibXrandr,
Name: "libXrandr",
@@ -610,7 +610,7 @@ func init() {
},
ID: 1788,
})
}
}
func (t Toolchain) newFontUtil() (pkg.Artifact, string) {
@@ -634,7 +634,7 @@ func (t Toolchain) newFontUtil() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[FontUtil] = Metadata{
f: Toolchain.newFontUtil,
Name: "font-util",
@@ -642,7 +642,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/font/util",
ID: 15055,
})
}
}
func (t Toolchain) newLibfontenc() (pkg.Artifact, string) {
@@ -668,7 +668,7 @@ func (t Toolchain) newLibfontenc() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libfontenc] = Metadata{
f: Toolchain.newLibfontenc,
Name: "libfontenc",
@@ -676,7 +676,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/lib/libfontenc",
ID: 1613,
})
}
}
func (t Toolchain) newLibxkbfile() (pkg.Artifact, string) {
@@ -694,7 +694,7 @@ func (t Toolchain) newLibxkbfile() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxkbfile] = Metadata{
f: Toolchain.newLibxkbfile,
Name: "libxkbfile",
@@ -706,7 +706,7 @@ func init() {
},
ID: 1781,
})
}
}
func (t Toolchain) newXkbcomp() (pkg.Artifact, string) {
@@ -732,7 +732,7 @@ func (t Toolchain) newXkbcomp() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Xkbcomp] = Metadata{
f: Toolchain.newXkbcomp,
Name: "xkbcomp",
@@ -744,7 +744,7 @@ func init() {
},
ID: 15018,
})
}
}
func (t Toolchain) newLibXfont2() (pkg.Artifact, string) {
@@ -772,7 +772,7 @@ func (t Toolchain) newLibXfont2() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXfont2] = Metadata{
f: Toolchain.newLibXfont2,
Name: "libXfont2",
@@ -785,7 +785,7 @@ func init() {
},
ID: 17165,
})
}
}
func (t Toolchain) newLibxcvt() (pkg.Artifact, string) {
@@ -801,7 +801,7 @@ func (t Toolchain) newLibxcvt() (pkg.Artifact, string) {
), nil, (*MesonHelper)(nil)), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libxcvt] = Metadata{
f: Toolchain.newLibxcvt,
Name: "libxcvt",
@@ -809,7 +809,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/lib/libxcvt",
ID: 235147,
})
}
}
func (t Toolchain) newLibXdmcp() (pkg.Artifact, string) {
@@ -834,7 +834,7 @@ func (t Toolchain) newLibXdmcp() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[LibXdmcp] = Metadata{
f: Toolchain.newLibXdmcp,
Name: "libXdmcp",
@@ -842,7 +842,7 @@ func init() {
Website: "https://gitlab.freedesktop.org/xorg/lib/libxdmcp",
ID: 1772,
})
}
}
func (t Toolchain) newXkeyboardConfig() (pkg.Artifact, string) {
@@ -860,7 +860,7 @@ func (t Toolchain) newXkeyboardConfig() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XkeyboardConfig] = Metadata{
f: Toolchain.newXkeyboardConfig,
Name: "xkeyboard-config",
@@ -868,7 +868,7 @@ func init() {
Website: "https://www.freedesktop.org/wiki/Software/XKeyboardConfig/",
ID: 5191,
})
}
}
func (t Toolchain) newLibpciaccess() (pkg.Artifact, string) {
@@ -888,7 +888,7 @@ func (t Toolchain) newLibpciaccess() (pkg.Artifact, string) {
}), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Libpciaccess] = Metadata{
f: Toolchain.newLibpciaccess,
Name: "libpciaccess",
@@ -900,7 +900,7 @@ func init() {
},
ID: 1703,
})
}
}
func (t Toolchain) newXserver() (pkg.Artifact, string) {
@@ -955,7 +955,7 @@ func (t Toolchain) newXserver() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[Xserver] = Metadata{
f: Toolchain.newXserver,
Name: "xserver",
@@ -984,5 +984,5 @@ func init() {
},
ID: 5250,
})
}
}

View File

@@ -18,7 +18,7 @@ func (t Toolchain) newXZ() (pkg.Artifact, string) {
), version
}
func init() {
native.MustRegister(&Artifact{
artifactsM[XZ] = Metadata{
f: Toolchain.newXZ,
Name: "xz",
@@ -26,5 +26,5 @@ func init() {
Website: "https://tukaani.org/xz/",
ID: 5277,
})
}
}

Some files were not shown because too many files have changed in this diff Show More