internal/rosa: create /bin symlinks via helper
Test / Create distribution (push) Successful in 3m19s
Test / Sandbox (push) Successful in 7m58s
Test / ShareFS (push) Successful in 10m31s
Test / Hakurei (push) Successful in 11m0s
Test / Sandbox (race detector) (push) Successful in 12m8s
Test / Hakurei (race detector) (push) Successful in 6m4s
Test / Flake checks (push) Successful in 2m47s

This centralises the workaround for surprisingly common buggy scripts with nonstandard hardcoded paths.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-07-01 14:25:30 +09:00
parent 3ab7116b29
commit 3975dd3e0f
17 changed files with 67 additions and 62 deletions
+1
View File
@@ -1,4 +1,5 @@
# produced by tools and text editors # produced by tools and text editors
*.swp
*.qcow2 *.qcow2
*.test *.test
*.out *.out
+8 -10
View File
@@ -341,6 +341,13 @@ ln -s \
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{ return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
Flag: TExclusive, Flag: TExclusive,
Bin: []string{
"chmod",
"mkdir",
"rm",
"tr",
"awk",
},
}, &CMakeHelper{ }, &CMakeHelper{
Append: []string{"llvm"}, Append: []string{"llvm"},
@@ -358,16 +365,7 @@ ln -s clang++ /work/system/bin/c++
// on 3-stage determinism to test later stages. // on 3-stage determinism to test later stages.
SkipTest: t.stage.isStage0(), SkipTest: t.stage.isStage0(),
Test: ` Test: "ninja " + jobsFlagE + " check-all",
chmod +w /bin && ln -s \
../system/bin/chmod \
../system/bin/mkdir \
../system/bin/rm \
../system/bin/tr \
../system/bin/awk \
/bin
ninja ` + jobsFlagE + ` check-all
`,
}, },
_python, _python,
_perl, _perl,
+2 -4
View File
@@ -13,10 +13,8 @@ package attr {
patches = [ "musl-errno.patch" ]; patches = [ "musl-errno.patch" ];
early = ` bin = [ "perl" ];
ln -s ../../system/bin/perl /usr/bin populateUsrBin = true;
`;
exec = make {}; exec = make {};
inputs = [ inputs = [
+2 -2
View File
@@ -12,8 +12,6 @@ package git {
}; };
early = ` early = `
ln -s ../../system/bin/perl /usr/bin/ || true
# test suite assumes apache # test suite assumes apache
rm -f /system/bin/httpd rm -f /system/bin/httpd
`; `;
@@ -22,6 +20,8 @@ rm -f /system/bin/httpd
enterSource = true; enterSource = true;
env = [ "NO_RUST=YesPlease" ]; env = [ "NO_RUST=YesPlease" ];
bin = [ "perl" ];
populateUsrBin = true;
exec = make { exec = make {
inPlace = true; inPlace = true;
generate = "make configure"; generate = "make configure";
+1 -4
View File
@@ -511,10 +511,7 @@ package parallel {
compress = bzip2; compress = bzip2;
}; };
early = ` bin = [ "bash" ];
ln -s ../system/bin/bash /bin/
`;
exec = make {}; exec = make {};
inputs = [ inputs = [
+2 -2
View File
@@ -12,6 +12,7 @@ package libcap {
}; };
// uses source tree as scratch space // uses source tree as scratch space
enterSource = true;
writable = true; writable = true;
chmod = true; chmod = true;
@@ -20,8 +21,7 @@ package libcap {
"lib=lib", "lib=lib",
]; ];
early = "\nln -s ../system/bin/bash /bin/\n"; bin = [ "bash" ];
exec = make { exec = make {
skipConfigure = true; skipConfigure = true;
inPlace = true; inPlace = true;
+1 -2
View File
@@ -11,8 +11,7 @@ package libinput {
checksum = "GxBGPN6YybQxrD2MDsIL8gdDYImXn4NAJi6EvTx_Hb_1jcbjwCrjeyjY2upUyTMi"; checksum = "GxBGPN6YybQxrD2MDsIL8gdDYImXn4NAJi6EvTx_Hb_1jcbjwCrjeyjY2upUyTMi";
}; };
early = "ln -sf ../system/bin/bash /bin/\n"; bin = [ "bash" ];
exec = meson { exec = meson {
setup = { setup = {
"Dmtdev": "false"; "Dmtdev": "false";
+1 -2
View File
@@ -13,8 +13,7 @@ package libseccomp {
}; };
patches = [ "fix-export-oob-read.patch" ]; patches = [ "fix-export-oob-read.patch" ];
early = "\nln -s ../system/bin/bash /bin/\n"; bin = [ "bash" ];
exec = make {}; exec = make {};
inputs = [ inputs = [
+2 -6
View File
@@ -14,12 +14,8 @@ package lm_sensors {
chmod = true; chmod = true;
enterSource = true; enterSource = true;
early = ` bin = [ "perl" ];
ln -s \ populateUsrBin = true;
../../system/bin/perl \
/usr/bin/
`;
exec = make { exec = make {
inPlace = true; inPlace = true;
skipConfigure = true; skipConfigure = true;
+1 -1
View File
@@ -81,13 +81,13 @@ sed -i \
extensions/libebt_snat.txlate extensions/libebt_snat.txlate
`; `;
bin = [ "bash" ];
exec = make { exec = make {
generate = "./autogen.sh"; generate = "./autogen.sh";
configure = { configure = {
"enable-static"; "enable-static";
}; };
preCheck = ` preCheck = `
ln -s ../system/bin/bash /bin/
chmod +w /etc/ && ln -s ../usr/src/iptables/etc/ethertypes /etc/ chmod +w /etc/ && ln -s ../usr/src/iptables/etc/ethertypes /etc/
`; `;
}; };
+4 -5
View File
@@ -15,6 +15,7 @@ package ninja {
"CFLAGS=-std=c++17", "CFLAGS=-std=c++17",
]; ];
bin = [ "echo" ];
exec = generic { exec = generic {
build = ` build = `
python3 /usr/src/ninja/configure.py \ python3 /usr/src/ninja/configure.py \
@@ -22,12 +23,10 @@ python3 /usr/src/ninja/configure.py \
--bootstrap --bootstrap
python3 /usr/src/ninja/configure.py \ python3 /usr/src/ninja/configure.py \
--gtest-source-dir=/usr/src/extra/googletest --gtest-source-dir=/usr/src/extra/googletest
./ninja ` + jobsFlagE + ` all`; ./ninja ` + jobsFlagE + ` all
`;
check = ` check = "./ninja_test";
chmod +w /bin/
ln -s ../system/bin/echo /bin/
./ninja_test`;
install = ` install = `
mkdir -p /work/system/bin/ mkdir -p /work/system/bin/
+2 -5
View File
@@ -12,11 +12,8 @@ package pcre2 {
compress = bzip2; compress = bzip2;
}; };
early = ` // RunGrepTest expects /bin/echo
# RunGrepTest expects /bin/echo bin = [ "echo" ];
ln -s ../system/bin/toybox /bin/echo
`;
exec = make { exec = make {
configure = { configure = {
"enable-jit"; "enable-jit";
+2 -3
View File
@@ -10,10 +10,9 @@ package rdfind {
compress = gzip; compress = gzip;
}; };
exec = make {
// test suite hard codes /bin/echo // test suite hard codes /bin/echo
preCheck = "\nln -s ../system/bin/toybox /bin/echo\n"; bin = [ "echo" ];
}; exec = make {};
inputs = [ nettle ]; inputs = [ nettle ];
runtime = [ nettle ]; runtime = [ nettle ];
+1 -2
View File
@@ -23,8 +23,7 @@ package util-linux {
compress = gzip; compress = gzip;
}; };
early = "\nln -s ../system/bin/bash /bin/\n"; bin = [ "bash" ];
exec = make { exec = make {
configure = { configure = {
"disable-use-tty-group"; "disable-use-tty-group";
+1 -4
View File
@@ -781,6 +781,7 @@ package xwayland {
checksum = "0D0bs8EbDzlyLIULvm6lizqzdx4g1-umdbjVVO7zk-cS1kVIaSkKronCqj95tz-A"; checksum = "0D0bs8EbDzlyLIULvm6lizqzdx4g1-umdbjVVO7zk-cS1kVIaSkKronCqj95tz-A";
}; };
bin = [ "bash" ];
exec = meson { exec = meson {
setup = { setup = {
"Dipv6": "false"; "Dipv6": "false";
@@ -788,10 +789,6 @@ package xwayland {
}; };
}; };
early = `
ln -sf ../system/bin/bash /bin/
`;
inputs = [ inputs = [
bash, bash,
gawk, gawk,
+24
View File
@@ -414,6 +414,10 @@ type PackageAttr struct {
// Passed to [Toolchain.NewPatchedSource]. // Passed to [Toolchain.NewPatchedSource].
Patches []KV Patches []KV
// Programs to make available in /bin/.
Bin []string
// Whether to replace /usr/bin/ with a symlink to /bin/.
PopulateUsrBin bool
// Unregistered extras. // Unregistered extras.
Extra []pkg.Artifact Extra []pkg.Artifact
@@ -544,6 +548,26 @@ cd '/usr/src/` + name + `/'
}) })
} }
bin := attr.Bin
if attr.PopulateUsrBin {
scriptEarly += `
chmod +w /usr/ /usr/bin/
rm -rf /usr/bin/
ln -s ../bin /usr/`
bin = append(bin, "env")
}
if t.stage != stageGentoo && len(bin) > 0 {
scriptEarly += "\nchmod +w /bin/" +
"\n(set -o braceexpand && ln -sf ../system/bin/"
if len(bin) > 1 {
scriptEarly += "{'" + strings.Join(bin, "','") + "'}"
} else {
scriptEarly += "'" + bin[0] + "'"
}
scriptEarly += " /bin/)\n"
}
return t.New( return t.New(
rn, rn,
attr.Flag, attr.Flag,
+2
View File
@@ -1009,6 +1009,8 @@ func (ctx *evalContext) pf(
k("enterSource"): &attr.EnterSource, k("enterSource"): &attr.EnterSource,
k("env"): &attr.Env, k("env"): &attr.Env,
k("early"): &attr.ScriptEarly, k("early"): &attr.ScriptEarly,
k("bin"): &attr.Bin,
k("populateUsrBin"): &attr.PopulateUsrBin,
k("patches"): &patches, k("patches"): &patches,
k("files"): &files, k("files"): &files,
k("exclusive"): &excl, k("exclusive"): &excl,