13 Commits
Author SHA1 Message Date
cat 4dbfee0698 internal/rosa: force output colouring
Test / Create distribution (push) Successful in 58s
Test / Sandbox (push) Successful in 3m0s
Test / Hakurei (push) Successful in 4m45s
Test / Sandbox (race detector) (push) Successful in 6m0s
Test / Hakurei (race detector) (push) Successful in 7m16s
Test / ShareFS (push) Successful in 7m47s
Test / Flake checks (push) Successful in 2m56s
This sets known de facto standard environment variables to enable colours during builds.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 06:01:54 +09:00
cat 4e65e41101 internal/rosa/package/mesa: 26.1.5 to 26.1.6
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 3m33s
Test / Hakurei (push) Successful in 5m54s
Test / Sandbox (race detector) (push) Successful in 6m7s
Test / Hakurei (race detector) (push) Successful in 8m5s
Test / ShareFS (push) Successful in 7m16s
Test / Flake checks (push) Successful in 1m13s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 05:19:55 +09:00
cat b8306fe9e2 internal/rosa/package/python: vcs-versioning 2.2.2 to 2.2.3
Test / Create distribution (push) Successful in 1m7s
Test / Sandbox (push) Successful in 2m58s
Test / Hakurei (push) Successful in 6m24s
Test / Sandbox (race detector) (push) Successful in 5m37s
Test / Hakurei (race detector) (push) Successful in 8m14s
Test / ShareFS (push) Successful in 7m39s
Test / Flake checks (push) Successful in 1m20s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 05:19:21 +09:00
cat 6b246e9036 internal/rosa/package/glib: 2.89.2 to 2.89.3
Test / Sandbox (push) Successful in 1m32s
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (race detector) (push) Successful in 4m45s
Test / Hakurei (race detector) (push) Successful in 8m33s
Test / ShareFS (push) Successful in 7m26s
Test / Hakurei (push) Successful in 32m29s
Test / Flake checks (push) Successful in 1m9s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 05:18:23 +09:00
cat 869820ec6d cmd/mbf: enable output colouring
Test / Create distribution (push) Successful in 58s
Test / Sandbox (push) Successful in 3m36s
Test / Hakurei (push) Successful in 6m11s
Test / Sandbox (race detector) (push) Successful in 7m44s
Test / Hakurei (race detector) (push) Successful in 9m57s
Test / ShareFS (push) Successful in 10m35s
Test / Flake checks (push) Successful in 1m30s
This respects the de facto standards, on top of checking stderr.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 05:16:39 +09:00
cat 6fb2065a51 internal/pkg: optionally colour output
Test / Create distribution (push) Successful in 53s
Test / Sandbox (push) Successful in 2m55s
Test / Hakurei (push) Successful in 5m2s
Test / Sandbox (race detector) (push) Successful in 6m19s
Test / ShareFS (push) Successful in 8m41s
Test / Hakurei (race detector) (push) Successful in 8m49s
Test / Flake checks (push) Successful in 1m29s
This increases readability in some cases.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 05:15:19 +09:00
cat 698fd2d66a internal/rosa/package/libarchive: 3.8.8 to 3.8.9
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 3m8s
Test / Hakurei (push) Successful in 5m32s
Test / Sandbox (race detector) (push) Successful in 6m28s
Test / Hakurei (race detector) (push) Successful in 7m49s
Test / ShareFS (push) Successful in 8m9s
Test / Flake checks (push) Successful in 1m14s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 04:02:23 +09:00
cat 4cfbc93aa0 internal/rosa/package/gcc: binutils 2.46.1 to 2.47
Test / Create distribution (push) Successful in 55s
Test / Sandbox (push) Successful in 3m3s
Test / Hakurei (push) Successful in 4m59s
Test / Sandbox (race detector) (push) Successful in 6m24s
Test / Hakurei (race detector) (push) Successful in 8m0s
Test / ShareFS (push) Successful in 8m12s
Test / Flake checks (push) Successful in 1m15s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 04:02:00 +09:00
cat feec4b0d22 internal/rosa/package/cmake: 4.4.0 to 4.4.1
Test / Create distribution (push) Successful in 57s
Test / Sandbox (push) Successful in 2m59s
Test / Hakurei (push) Successful in 5m16s
Test / Sandbox (race detector) (push) Successful in 6m37s
Test / Hakurei (race detector) (push) Successful in 7m44s
Test / ShareFS (push) Successful in 8m23s
Test / Flake checks (push) Successful in 1m15s
Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 03:24:48 +09:00
cat 6487b41d92 internal/rosa: remove legacy exec helper
Test / Hakurei (race detector) (push) Successful in 9m33s
Test / Sandbox (push) Successful in 5m27s
Test / Sandbox (race detector) (push) Successful in 8m21s
Test / ShareFS (push) Successful in 10m32s
Test / Create distribution (push) Successful in 1m51s
Test / Hakurei (push) Successful in 3m5s
Test / Flake checks (push) Successful in 1m28s
This change also adds a fourth stage to the bootstrap machinery, offering more correct toolchain validation that works around LLVM dynamic linking flaws.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-30 00:18:22 +09:00
cat 7908fb9583 internal/rosa/llvm: exclude runtime symbols
Test / Hakurei (push) Successful in 4m44s
Test / Sandbox (push) Successful in 3m5s
Test / Sandbox (race detector) (push) Successful in 5m55s
Test / ShareFS (push) Successful in 7m22s
Test / Create distribution (push) Successful in 1m0s
Test / Hakurei (race detector) (push) Successful in 6m22s
Test / Flake checks (push) Successful in 1m13s
These leak by default when static linking, which is considered unacceptable for many libraries.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-29 03:00:59 +09:00
cat 95aa7c205c internal/rosa: remove calls to low-level exec helper
Test / Create distribution (push) Successful in 53s
Test / Sandbox (push) Successful in 2m54s
Test / Hakurei (push) Successful in 4m32s
Test / Sandbox (race detector) (push) Successful in 5m48s
Test / Hakurei (race detector) (push) Successful in 6m59s
Test / ShareFS (push) Successful in 7m29s
Test / Flake checks (push) Successful in 1m12s
This method predates the helper infrastructure, it is awkward to use and difficult to maintain for the replacement bootstrap mechanism. This change prepares for its removal.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-27 18:24:38 +09:00
cat bd0cc3656f internal/rosa/llvm: statically link libc++
Test / Hakurei (race detector) (push) Successful in 6m54s
Test / Sandbox (push) Successful in 2m53s
Test / Sandbox (race detector) (push) Successful in 5m58s
Test / ShareFS (push) Successful in 7m25s
Test / Create distribution (push) Successful in 53s
Test / Hakurei (push) Successful in 2m51s
Test / Flake checks (push) Successful in 1m9s
This avoids unnecessarily depending on the toolchain.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-07-27 18:15:00 +09:00
28 changed files with 263 additions and 204 deletions
+5
View File
@@ -28,6 +28,8 @@ type cache struct {
idle bool
// Unset [pkg.CSuppressInit].
verboseInit bool
// Whether to enable output colours.
color bool
// Unset [pkg.CExternShallow].
deep bool
// Loaded artifact of [rosa.QEMU].
@@ -61,6 +63,9 @@ func (cache *cache) open() (err error) {
if !cache.deep {
cache.attr.Flags |= pkg.CExternShallow
}
if cache.color {
cache.attr.Flags |= pkg.CColourOutput
}
done := make(chan struct{})
defer close(done)
+19 -4
View File
@@ -92,6 +92,11 @@ func main() {
var cm cache
defer func() { cm.Close() }()
if cm.color = ext.Isatty(syscall.Stderr) &&
os.Getenv("NO_COLOR") == "" &&
os.Getenv("TERM") != "dumb"; cm.color {
log.SetPrefix("\x1b[2mmbf: \x1b[0m")
}
var (
flagQuiet bool
@@ -616,7 +621,7 @@ func main() {
{
c.NewCommand(
"stage3",
"stage4",
"Check for toolchain 3-stage non-determinism",
func(args []string) (err error) {
var (
@@ -636,21 +641,31 @@ func main() {
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Std - 1).Load(_llvm)
pathname, checksum[0], err = cache.Cure(llvm)
pathname, _, err = cache.Cure(llvm)
return
}); err != nil {
return
}
log.Println("stage2:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Std).Load(_llvm)
pathname, checksum[1], err = cache.Cure(llvm)
pathname, checksum[0], err = cache.Cure(llvm)
return
}); err != nil {
return
}
log.Println("stage3:", pathname)
if err = cm.Do(func(cache *pkg.Cache) (err error) {
_, llvm := rosa.Native().New(rosa.Stage3).Load(_llvm)
pathname, checksum[1], err = cache.Cure(llvm)
return
}); err != nil {
return
}
log.Println("stage4:", pathname)
if checksum[0] != checksum[1] {
err = &pkg.ChecksumMismatchError{
Got: checksum[0].Value(),
@@ -658,7 +673,7 @@ func main() {
}
} else {
log.Println(
"stage2 is identical to stage3",
"stage3 is identical to stage4",
"("+pkg.Encode(checksum[0].Value())+")",
)
}
+15 -4
View File
@@ -444,7 +444,7 @@ func scanVerbose(
msg message.Msg,
cancel context.CancelFunc,
done chan<- struct{},
prefix string,
prefix, suffix string,
r io.Reader,
) {
defer close(done)
@@ -454,7 +454,7 @@ func scanVerbose(
bufio.MaxScanTokenSize<<12,
)
for s.Scan() {
msg.Verbose(prefix, s.Text())
msg.Verbose(prefix, s.Text()+suffix)
}
if err := s.Err(); err != nil && !errors.Is(err, os.ErrClosed) {
cancel()
@@ -728,14 +728,25 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) {
brStdout, brStderr := f.cache.getReader(stdout), f.cache.getReader(stderr)
stdoutDone, stderrDone := make(chan struct{}), make(chan struct{})
var suffix, prefixO, prefixE string
if f.cache.attr.Flags&CColourOutput != 0 {
suffix = "\x1b[0m"
prefixO = "\x1b[1;37m(" + a.name + ")\x1b[0m"
prefixE = "\x1b[1;97m(" + a.name + ")\x1b[0m"
} else {
prefixO = "(" + a.name + ":1)"
prefixE = "(" + a.name + ":2)"
}
go scanVerbose(
msg, cancel, stdoutDone,
"("+a.name+":1)",
prefixO, suffix,
io.TeeReader(brStdout, status),
)
go scanVerbose(
msg, cancel, stderrDone,
"("+a.name+":2)",
prefixE, suffix,
io.TeeReader(brStderr, status),
)
defer func() {
+3
View File
@@ -721,6 +721,9 @@ const (
// CExternShallow arranges for only non-flood inputs to be fetched when
// curing an [Artifact] available via the external cache.
CExternShallow
// CColourOutput enables output colouring via ANSI control sequences.
CColourOutput
)
// toplevel holds [context.WithCancel] over caller-supplied context, where all
+1 -1
View File
@@ -35,7 +35,7 @@ type CMakeHelper struct {
var _ Helper = new(CMakeHelper)
// extra returns the cmake handle alongside either ninja or make.
func (attr *CMakeHelper) extra(int) P {
func (attr *CMakeHelper) extra() P {
if attr != nil && attr.Make {
return P{_cmake, _make}
}
+14 -7
View File
@@ -20,19 +20,26 @@ func (t Toolchain) NewViaGit(
return t.New(strings.TrimSuffix(
path.Base(url),
".git",
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
_nssCACert,
_git,
), &checksum, nil, `
)+"-src", path.Base(rev), nil, &PackageAttr{
KnownChecksum: &checksum,
HostNet: true,
Paths: []pkg.ExecPath{resolvconf()},
}, &GenericHelper{
Build: `
git \
-c advice.detachedHead=false \
clone \
--depth=1 \
--revision=`+rev+` \
--revision=` + rev + ` \
--shallow-submodules \
--recurse-submodules \
`+url+` \
` + url + ` \
/work
rm -rf /work/.git
`, resolvconf())
`,
},
_nssCACert,
_git,
)
}
+2 -2
View File
@@ -13,7 +13,7 @@ func (t Toolchain) newGo(
script string,
boot ...pkg.Artifact,
) pkg.Artifact {
return t.NewPackage("go", version, newTar(
return t.New("go", version, newTar(
"https://go.dev/dl/go"+version+".src.tar.gz",
checksum,
pkg.Gzip,
@@ -75,7 +75,7 @@ func init() {
)
switch t.arch {
case "amd64":
bootstrapEarly = []pkg.Artifact{t.NewPackage("go", "1.4-bootstrap", newTar(
bootstrapEarly = []pkg.Artifact{t.New("go", "1.4-bootstrap", newTar(
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
"8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23",
pkg.Gzip,
+17 -3
View File
@@ -83,9 +83,11 @@ func init() {
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
{"LIBCXX_HARDENING_MODE", "fast"},
{"LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY", "ON"},
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "ON"},
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
{"LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY", "ON"},
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
{"LLVM_INSTALL_UTILS", "ON"},
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
@@ -138,6 +140,10 @@ func init() {
"CodeGen/PowerPC/ppc-tmmintrin.c",
"CodeGen/PowerPC/ppc-smmintrin.c",
"CodeGenCUDA/amdgpu-alias-undef-symbols.cu",
// clang: deadlocks with LIBCXXABI_ENABLE_STATIC_UNWINDER
"global-value-regex",
"global-hex-value-regex",
"check-globals",
// cxx: fails on musl
"close.dont-get-rid-of-buffer",
"re/re.traits",
@@ -178,8 +184,8 @@ func init() {
}...)
}
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
Flag: TExclusive,
return &meta, t.New("llvm", meta.Version, source, &PackageAttr{
Exclusive: true,
Bin: []string{
"chmod",
"mkdir",
@@ -187,6 +193,10 @@ func init() {
"tr",
"awk",
},
ScriptEarly: `
rm -f /system/bin/clang++.cfg
`,
}, &CMakeHelper{
Append: []string{"llvm"},
@@ -196,6 +206,10 @@ ln -s ld.lld /work/system/bin/ld
ln -s clang /work/system/bin/cc
ln -s clang /work/system/bin/cpp
ln -s clang++ /work/system/bin/c++
cat << EOF > /work/system/bin/clang++.cfg
-static-libstdc++
-Wl,--exclude-libs,libunwind.a:libc++.a:libc++experimental.a:libc++abi.a
EOF
`,
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
+8 -6
View File
@@ -52,15 +52,16 @@ type MakeHelper struct {
var _ Helper = new(MakeHelper)
// extra returns make and other optional dependencies.
func (attr *MakeHelper) extra(flag int) P {
extra := P{_make}
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
extra = append(extra,
func (attr *MakeHelper) extra() P {
if attr == nil || !attr.OmitDefaults {
return P{
_make,
_awk,
_coreutils,
)
}
}
return extra
return P{_make}
}
// wantsChmod returns whether the build system needs to be generated.
@@ -172,6 +173,7 @@ make \
scriptMake += attr.ScriptCheckEarly + `make \
` + jobsFlagE + ` \
` + loadFlagE + ` \
AM_COLOR_TESTS=always \
`
if len(attr.Check) > 0 {
scriptMake += strings.Join(attr.Check, " \\\n\t")
+1 -1
View File
@@ -35,7 +35,7 @@ type MesonHelper struct {
var _ Helper = new(MesonHelper)
// extra returns hardcoded meson runtime dependencies.
func (attr *MesonHelper) extra(int) P {
func (attr *MesonHelper) extra() P {
if !attr.isPython() {
return P{_muon}
}
+2 -1
View File
@@ -10,7 +10,9 @@ package bison {
compress = gzip;
};
toyboxEarly = true;
exec = make {
omitDefaults = true;
check = [
"TESTSUITEFLAGS=" + jobsFlagE + "' " + skipGNUTests {
tests = [
@@ -24,6 +26,5 @@ package bison {
];
};
toyboxEarly = true;
inputs = [ m4 ];
}
+3 -1
View File
@@ -18,5 +18,7 @@ package byacc {
writable = true;
chmod = true;
exec = make {};
exec = make {
omitDefaults = true;
};
}
+2 -2
View File
@@ -3,12 +3,12 @@ package cmake {
website = "https://cmake.org";
anitya = 306;
version# = "4.4.0";
version# = "4.4.1";
source = remoteGitHubRelease {
suffix = "Kitware/CMake";
tag = "v"+version;
name = "cmake-"+version+".tar.gz";
checksum = "ZL0Y19_mSJWsl3dMjRRQJAaCvl4_PqbwpgUC1aBA-cdVdrK_gt4ylpUM2GMoQMku";
checksum = "SI3WIDiH7-DsBt3xwNfz4YkqD2t3eukS84WhfJtz6c10M27RSzkUQsQUES7-1IO6";
compress = gzip;
};
patches = [ "disable-broken-tests-musl.patch" ];
+2 -2
View File
@@ -3,10 +3,10 @@ package binutils {
website = "https://www.gnu.org/software/binutils";
anitya = 7981;
version# = "2.46.1";
version# = "2.47";
source = remoteTar {
url = "https://ftpmirror.gnu.org/gnu/binutils/binutils-"+version+".tar.bz2";
checksum = "ihCVohBxX-URAR-YFDdVrL3inLYsEVX8KbbQmcbHaShHgqqmtsvUue1h3LXSjW-d";
checksum = "VjbMg5KtZ6VSeNc77Z5p8RKg9eZ56g29ViKbbsF3tcFhZu0Yurg0nZt7UwB577LM";
compress = bzip2;
};
+2 -2
View File
@@ -3,11 +3,11 @@ package glib {
website = "https://developer.gnome.org/glib";
anitya = 10024;
version# = "2.89.2";
version# = "2.89.3";
source = remoteGit {
url = "https://gitlab.gnome.org/GNOME/glib.git";
tag = version;
checksum = "ZetUwjVOKs0v2xtndzy7_4kvZY2VEESOTT45AAMJVLr22fmTRKit4MJOwruB0als";
checksum = "eM9KrXwhwKiZferwrILKmDeq-IGnSjr0EKqV90EEVl0Ee82QVcyVSf2LDMROHcOF";
};
files = {
+12 -4
View File
@@ -17,9 +17,11 @@ package m4 {
chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh
`;
exec = make {};
toyboxEarly = true;
exec = make {
omitDefaults = true;
};
inputs = [
diffutils,
@@ -194,7 +196,9 @@ test_disable '#!/bin/sh' tests/cmp
`;
toyboxEarly = true;
exec = make {};
exec = make {
omitDefaults = true;
};
}
package patch {
@@ -218,7 +222,9 @@ test_disable '#!/bin/sh' tests/need-filename
`;
toyboxEarly = true;
exec = make {};
exec = make {
omitDefaults = true;
};
}
package grep {
@@ -328,6 +334,7 @@ package bash {
toyboxEarly = true;
exec = make {
omitDefaults = true;
configure = {
"without-bash-malloc";
};
@@ -364,6 +371,7 @@ test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c
`;
exec = make {
omitDefaults = true;
configure = {
"enable-single-binary": "symlinks";
};
+1
View File
@@ -25,6 +25,7 @@ package kernel-headers {
toyboxEarly = true;
exec = make {
omitDefaults = true;
skipConfigure = true;
make = [
"-f /usr/src/kernel-headers/Makefile",
@@ -60,4 +60,5 @@ list(APPEND CTEST_CUSTOM_TESTS_IGNORE
"libarchive_test_read_format_tar_filename"
"libarchive_test_read_format_ustar_filename"
"libarchive_test_read_append_wrong_filter"
"libarchive_test_read_format_zip_ppmd8_aes256_streaming"
)
+2 -2
View File
@@ -3,11 +3,11 @@ package libarchive {
website = "https://www.libarchive.org";
anitya = 1558;
version# = "3.8.8";
version# = "3.8.9";
source = remoteGitHub {
suffix = "libarchive/libarchive";
tag = "v"+version;
checksum = "MYlQdlxHX14rFL_zEYvDArKgGVIueTPzSEDgCzaZkmi0_N7WsaEpogGO3qnHpfTc";
checksum = "8C_8Mr22elOAO8Qvxl-B-R-B35M7dpdFdAlph1CeE1L75JdyUnolee-P3KDRFc8T";
};
files = { "CTestCustom.cmake"; };
+2 -2
View File
@@ -4,12 +4,12 @@ package mesa {
anitya = 1970;
latest = anityaFallback;
version# = "26.1.5";
version# = "26.1.6";
source = remoteGitLab {
domain = "gitlab.freedesktop.org";
suffix = "mesa/mesa";
ref = "mesa-"+version;
checksum = "6C3NMUvTAOTjJtiHgvj9bFUO9dC1uu_by32ZgLQg5H6sNWzYQcwDpD6V3OFkWYJj";
checksum = "HP1c7RjHhbY0-j8Ja8wYTwD6JMb3nlGbusQgNgFIsSsjjGddawwwtzTJKJMZ2zqi";
};
exec = meson {
+2 -2
View File
@@ -194,11 +194,11 @@ package python-vcs-versioning {
website = "https://setuptools-scm.readthedocs.io/en/latest";
anitya = 389421;
version# = "2.2.2";
version# = "2.2.3";
source = remoteGitHub {
suffix = "pypa/setuptools-scm";
tag = "vcs-versioning-v"+version;
checksum = "dqKZGEjxWZ5xo4BjcpFOHxlEZfqrVWM79cRWa8OhGZY7VDSdOxrg7QVIhA6jsPcB";
checksum = "8nxxeo7Dh51dQo31w2m_pgZgcv4fqwsZyXGs0KHxm4MnfKZJtlXfsU0OoBRUJiuq";
};
env = [
+1
View File
@@ -15,6 +15,7 @@ package rsync {
toyboxEarly = true;
exec = make {
omitDefaults = true;
configure = {
"disable-openssl";
"disable-xxhash";
+1 -1
View File
@@ -82,7 +82,7 @@ package spirv-llvm-translator {
};
// litArgs emits shell syntax
early = "\nexport LIT_OPTS=" + litArgs {
early = "rm -f /system/bin/clang++.cfg\nexport LIT_OPTS=" + litArgs {
verbose = true;
skipChecks = arch {
+1 -1
View File
@@ -9,7 +9,7 @@ type MakeMakerHelper struct {
}
// extra returns perl.
func (*MakeMakerHelper) extra(int) P { return P{_perl, _make} }
func (*MakeMakerHelper) extra() P { return P{_perl, _make} }
// wantsChmod returns true.
func (*MakeMakerHelper) wantsChmod() bool { return true }
+1 -1
View File
@@ -26,7 +26,7 @@ type PipHelper struct {
var _ Helper = new(PipHelper)
// extra returns python, or pytest if defaults are assumed.
func (attr *PipHelper) extra(int) P {
func (attr *PipHelper) extra() P {
if attr == nil || (!attr.SkipCheck && attr.Check == "") {
return P{_pythonPyTest}
}
+135 -134
View File
@@ -121,6 +121,12 @@ const (
// Std denotes the standard Rosa OS toolchain.
Std
// Stage3 denotes the stage3 Rosa OS toolchain built on [Std]. Software
// built on this toolchain should be identical to [Std]. This is generally
// for validation of LLVM 3-stage nondeterminism only, due to dynamic
// linking complications.
Stage3
// _stageEnd is the total number of stages available and does not denote a
// valid toolchain.
_stageEnd
@@ -149,7 +155,7 @@ func (t Stage) isIntermediate() bool {
// isStd returns whether t is considered functionally equivalent to [Std].
func (t Stage) isStd() bool {
switch t {
case stageStdGentoo, Std:
case stageStdGentoo, Std, Stage3:
return true
default:
return false
@@ -198,17 +204,6 @@ const scriptName = "all"
// build script under.
var absCureScript = AbsSystem.Append(scriptName)
const (
// TExclusive denotes an exclusive [pkg.Artifact].
TExclusive = 1 << iota
// TEarly hints for an early variant of toybox to be used when available.
TEarly
// TNoToolchain excludes the LLVM toolchain.
TNoToolchain
// THostNet arranges for a [pkg.KindExecNet] to be created.
THostNet
)
var (
_stage0Dist = H("stage0-dist")
_mksh = H("mksh")
@@ -218,102 +213,6 @@ var (
_patch = H("patch")
)
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
func (t Toolchain) New(
name string,
flag int,
extra []pkg.Artifact,
knownChecksum *pkg.Checksum,
env []string,
script string,
paths ...pkg.ExecPath,
) pkg.Artifact {
const lcMessages = "LC_MESSAGES=C.UTF-8"
var support []pkg.Artifact
switch t.stage {
case stageGentoo, stageEarly:
name += "-boot"
support = append(support, extra...)
support = append(support, NewEtc(true))
if t.stage == stageEarly {
_, a := t.MustLoad(_stage0Dist)
support = append(support, a)
} else if t.gentooStage3 == nil {
panic(os.ErrInvalid)
} else {
support = append(support,
t.gentooStage3,
gentooOverlay{t.gentooStage3},
)
env = append(env,
"CC=clang",
"CXX=clang++",
)
}
env = fixupEnviron(env, []string{
EnvTriple + "=" + t.triple(),
lcMessages,
"LDFLAGS=" + t.earlyLDFLAGS(true),
}, "/system/bin",
"/usr/bin",
)
case stageIntermediateGentoo, stageStdGentoo,
stageIntermediate, Std:
if t.stage.isIntermediate() {
name += "-std"
}
toybox := _toybox
if flag&TEarly != 0 {
toybox = _toyboxEarly
}
base := _llvm
if flag&TNoToolchain != 0 {
base = _musl
}
support = slices.Concat(extra, t.S.New(t.stage-1).Append([]pkg.Artifact{
NewEtc(false),
},
base,
_mksh,
toybox,
))
env = fixupEnviron(env, []string{
EnvTriple + "=" + t.triple(),
lcMessages,
}, "/system/bin", "/bin")
default:
panic("unsupported toolchain " + strconv.Itoa(int(t.stage)))
}
return pkg.NewExec(
name, t.arch, knownChecksum, pkg.ExecTimeoutMax,
flag&THostNet != 0,
flag&TExclusive != 0,
fhs.AbsRoot, env,
absCureScript,
nil,
slices.Concat([]pkg.ExecPath{pkg.Path(
fhs.AbsRoot, true,
support...,
), pkg.Path(
absCureScript, false,
pkg.NewFile(scriptName, []byte(
"#!/system/bin/sh\n"+
"set -eu -o pipefail\n"+
script,
)),
)}, paths)...,
)
}
// HasStageEarly returns whether a stage0 distribution is available.
func (s *S) HasStageEarly() (ok bool) {
func() {
@@ -363,9 +262,14 @@ function apply {
buf.WriteString("'\n")
}
}
return t.New(name+"-src", 0, t.Append(nil,
return t.New(name+"-src", Unversioned, nil, &PackageAttr{
Paths: paths,
}, &GenericHelper{
Build: buf.String(),
},
_patch,
), nil, nil, buf.String(), paths...)
)
}
// helperInPlace is a special directory value for omitting the cd statement.
@@ -374,7 +278,7 @@ const helperInPlace = "\x00"
// Helper is a build system helper for [Toolchain.NewPackage].
type Helper interface {
// extra returns helper-specific dependencies.
extra(flag int) P
extra() P
// wantsChmod returns whether the source directory should be made writable.
wantsChmod() bool
@@ -416,12 +320,21 @@ type PackageAttr struct {
// Whether to replace /usr/bin/ with a symlink to /bin/.
PopulateUsrBin bool
// Hint for an early variant of toybox to be used when available.
Early bool
// Whether to omit output colour environment variables.
NoColor bool
// Exclude the LLVM toolchain.
NoToolchain bool
// Whether the resulting [pkg.Artifact] is exclusive.
Exclusive bool
// Whether to create [pkg.KindExecNet] instead of [pkg.KindExec].
HostNet bool
// Unregistered extras.
Extra []pkg.Artifact
// Passed through to [Toolchain.New], before source.
Paths []pkg.ExecPath
// Passed through to [Toolchain.New].
Flag int
}
// pa holds whether an [ArtifactH] is present.
@@ -462,8 +375,8 @@ func (t Toolchain) Append(a []pkg.Artifact, handles ...ArtifactH) []pkg.Artifact
return a
}
// NewPackage constructs a [pkg.Artifact] via a build system helper.
func (t Toolchain) NewPackage(
// New constructs a [pkg.Artifact] via a build system helper.
func (t Toolchain) New(
name, version string,
source pkg.Artifact,
attr *PackageAttr,
@@ -481,25 +394,102 @@ func (t Toolchain) NewPackage(
if version != Unversioned {
rn = name + "-" + version
}
root := make([]pkg.Artifact, 0, 1<<3+len(attr.Extra)+len(extra))
root = append(root, attr.Extra...)
const lcMessages = "LC_MESSAGES=C.UTF-8"
srn := rn
env := slices.Clone(attr.Env)
if !attr.NoColor {
env = append(env,
"CLICOLOR_FORCE=1",
"FORCE_COLOR=1",
)
}
var extraBoot []ArtifactH
switch t.stage {
case stageGentoo, stageEarly:
srn += "-boot"
root = append(root, NewEtc(true))
if t.stage == stageEarly {
extraBoot = append(extraBoot, _stage0Dist)
} else if t.gentooStage3 == nil {
panic(os.ErrInvalid)
} else {
env = append(env,
"CC=clang",
"CXX=clang++",
)
}
env = fixupEnviron(env, []string{
EnvTriple + "=" + t.triple(),
lcMessages,
"LDFLAGS=" + t.earlyLDFLAGS(true),
}, "/system/bin",
"/usr/bin",
)
case stageIntermediateGentoo, stageStdGentoo,
stageIntermediate, Std, Stage3:
if t.stage.isIntermediate() {
srn += "-std"
}
if t.stage == Stage3 {
srn += "-stage4"
}
toybox := _toybox
if attr.Early {
toybox = _toyboxEarly
}
base := _llvm
if attr.NoToolchain {
base = _musl
}
root = append(root, NewEtc(false))
extraBoot = append(extraBoot,
base,
_mksh,
toybox,
)
env = fixupEnviron(env, []string{
EnvTriple + "=" + t.triple(),
lcMessages,
}, "/system/bin", "/bin")
default:
panic("unsupported toolchain " + strconv.Itoa(int(t.stage)))
}
wantsChmod, wantsWrite := helper.wantsChmod(), helper.wantsWrite()
extraRes := make([]pkg.Artifact, 0, 1<<3+len(attr.Extra)+len(extra))
extraRes = append(extraRes, attr.Extra...)
{
pv := paGet()
for _, p := range helper.extra(attr.Flag) {
extraRes = t.appendHandle(extraRes, pv, p)
for _, p := range helper.extra() {
root = t.appendHandle(root, pv, p)
}
for _, p := range extra {
extraRes = t.appendHandle(extraRes, pv, p)
root = t.appendHandle(root, pv, p)
}
boot := t.S.New(t.stage - 1)
for _, p := range extraBoot {
root = boot.appendHandle(root, pv, p)
}
paPut(pv)
}
var (
scriptEarly string
sourceSuffix string
)
if t.stage == stageGentoo {
root = append(root,
t.gentooStage3,
gentooOverlay{t.gentooStage3},
)
}
var scriptEarly string
dir, create := helper.wantsDir()
helperScriptEarly := helper.scriptEarly()
if attr.EnterSource ||
@@ -524,7 +514,7 @@ cd '/usr/src/` + name + `/'
if source != nil {
paths = slices.Concat(attr.Paths, []pkg.ExecPath{
pkg.Path(AbsUsrSrc.Append(
name+sourceSuffix,
name,
), attr.Writable || wantsWrite, t.NewPatchedSource(
rn, source, !attr.Chmod && !wantsChmod, attr.Patches...,
)),
@@ -551,14 +541,25 @@ ln -s ../bin /usr/`
scriptEarly += " /bin/)\n"
}
return t.New(
rn,
attr.Flag,
extraRes,
attr.KnownChecksum,
attr.Env,
scriptEarly+helper.script(t, name),
paths...,
return pkg.NewExec(
srn, t.arch, attr.KnownChecksum, pkg.ExecTimeoutMax,
attr.HostNet,
attr.Exclusive,
fhs.AbsRoot, env,
absCureScript,
nil,
slices.Concat([]pkg.ExecPath{pkg.Path(
fhs.AbsRoot, true,
root...,
), pkg.Path(
absCureScript, false,
pkg.NewFile(scriptName, []byte(
"#!/system/bin/sh\n"+
"set -eu -o pipefail\n"+
scriptEarly+helper.script(t, name),
)),
)}, paths)...,
)
}
@@ -576,7 +577,7 @@ type GenericHelper struct {
var _ Helper = new(GenericHelper)
// extra is a noop.
func (*GenericHelper) extra(int) P { return nil }
func (*GenericHelper) extra() P { return nil }
// wantsChmod returns false.
func (*GenericHelper) wantsChmod() bool { return false }
+2 -2
View File
@@ -58,11 +58,11 @@ func getCache(t *testing.T) *pkg.Cache {
ctx, buildTestCacheCancel = signal.NotifyContext(context.Background(),
syscall.SIGINT, syscall.SIGTERM)
msg := message.New(log.New(os.Stderr, "rosa: ", 0))
msg := message.New(log.New(os.Stderr, "\x1b[2mrosa: \x1b[0m", 0))
msg.SwapVerbose(true)
if buildTestCache, err = pkg.Open(ctx, msg, a, &pkg.CacheAttr{
Flags: pkg.CSuppressInit,
Flags: pkg.CSuppressInit | pkg.CColourOutput,
}); err != nil {
t.Fatal(err)
}
+6 -19
View File
@@ -989,9 +989,6 @@ func (ctx *evalContext) pf(
attr PackageAttr
patches []string
files []KV
excl bool
early bool
minimal bool
anitya int64
kc any
@@ -1020,9 +1017,9 @@ func (ctx *evalContext) pf(
k("populateUsrBin"): &attr.PopulateUsrBin,
k("patches"): &patches,
k("files"): &files,
k("exclusive"): &excl,
k("toyboxEarly"): &early,
k("minimal"): &minimal,
k("exclusive"): &attr.Exclusive,
k("toyboxEarly"): &attr.Early,
k("minimal"): &attr.NoToolchain,
k("checksum"): &kc,
k("output"): &output,
@@ -1116,16 +1113,6 @@ func (ctx *evalContext) pf(
)
}
if excl {
attr.Flag |= TExclusive
}
if early {
attr.Flag |= TEarly
}
if minimal {
attr.Flag |= TNoToolchain
}
if kc != nil {
checksum, ok := kc.(string)
if !ok {
@@ -1162,7 +1149,7 @@ func (ctx *evalContext) pf(
}
}
v = cachedArtifact{&meta, ctx.t.NewPackage(
v = cachedArtifact{&meta, ctx.t.New(
meta.Name,
meta.Version,
source,
@@ -1175,8 +1162,8 @@ func (ctx *evalContext) pf(
}
var (
// ErrToplevel is returned by [S.Evaluate] when encountering a toplevel
// expression other than a package declaration.
// ErrToplevel is returned by [S.RegisterAzalea] when encountering a
// toplevel expression other than a package declaration.
ErrToplevel = errors.New("top level must only contain package declarations")
)