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
+8 -10
View File
@@ -341,6 +341,13 @@ ln -s \
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
Flag: TExclusive,
Bin: []string{
"chmod",
"mkdir",
"rm",
"tr",
"awk",
},
}, &CMakeHelper{
Append: []string{"llvm"},
@@ -358,16 +365,7 @@ ln -s clang++ /work/system/bin/c++
// on 3-stage determinism to test later stages.
SkipTest: t.stage.isStage0(),
Test: `
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
`,
Test: "ninja " + jobsFlagE + " check-all",
},
_python,
_perl,
+2 -4
View File
@@ -13,10 +13,8 @@ package attr {
patches = [ "musl-errno.patch" ];
early = `
ln -s ../../system/bin/perl /usr/bin
`;
bin = [ "perl" ];
populateUsrBin = true;
exec = make {};
inputs = [
+2 -2
View File
@@ -12,8 +12,6 @@ package git {
};
early = `
ln -s ../../system/bin/perl /usr/bin/ || true
# test suite assumes apache
rm -f /system/bin/httpd
`;
@@ -22,6 +20,8 @@ rm -f /system/bin/httpd
enterSource = true;
env = [ "NO_RUST=YesPlease" ];
bin = [ "perl" ];
populateUsrBin = true;
exec = make {
inPlace = true;
generate = "make configure";
+1 -4
View File
@@ -511,10 +511,7 @@ package parallel {
compress = bzip2;
};
early = `
ln -s ../system/bin/bash /bin/
`;
bin = [ "bash" ];
exec = make {};
inputs = [
+2 -2
View File
@@ -12,6 +12,7 @@ package libcap {
};
// uses source tree as scratch space
enterSource = true;
writable = true;
chmod = true;
@@ -20,8 +21,7 @@ package libcap {
"lib=lib",
];
early = "\nln -s ../system/bin/bash /bin/\n";
bin = [ "bash" ];
exec = make {
skipConfigure = true;
inPlace = true;
+1 -2
View File
@@ -11,8 +11,7 @@ package libinput {
checksum = "GxBGPN6YybQxrD2MDsIL8gdDYImXn4NAJi6EvTx_Hb_1jcbjwCrjeyjY2upUyTMi";
};
early = "ln -sf ../system/bin/bash /bin/\n";
bin = [ "bash" ];
exec = meson {
setup = {
"Dmtdev": "false";
+1 -2
View File
@@ -13,8 +13,7 @@ package libseccomp {
};
patches = [ "fix-export-oob-read.patch" ];
early = "\nln -s ../system/bin/bash /bin/\n";
bin = [ "bash" ];
exec = make {};
inputs = [
+2 -6
View File
@@ -14,12 +14,8 @@ package lm_sensors {
chmod = true;
enterSource = true;
early = `
ln -s \
../../system/bin/perl \
/usr/bin/
`;
bin = [ "perl" ];
populateUsrBin = true;
exec = make {
inPlace = true;
skipConfigure = true;
+1 -1
View File
@@ -81,13 +81,13 @@ sed -i \
extensions/libebt_snat.txlate
`;
bin = [ "bash" ];
exec = make {
generate = "./autogen.sh";
configure = {
"enable-static";
};
preCheck = `
ln -s ../system/bin/bash /bin/
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",
];
bin = [ "echo" ];
exec = generic {
build = `
python3 /usr/src/ninja/configure.py \
@@ -22,12 +23,10 @@ python3 /usr/src/ninja/configure.py \
--bootstrap
python3 /usr/src/ninja/configure.py \
--gtest-source-dir=/usr/src/extra/googletest
./ninja ` + jobsFlagE + ` all`;
./ninja ` + jobsFlagE + ` all
`;
check = `
chmod +w /bin/
ln -s ../system/bin/echo /bin/
./ninja_test`;
check = "./ninja_test";
install = `
mkdir -p /work/system/bin/
+2 -5
View File
@@ -12,11 +12,8 @@ package pcre2 {
compress = bzip2;
};
early = `
# RunGrepTest expects /bin/echo
ln -s ../system/bin/toybox /bin/echo
`;
// RunGrepTest expects /bin/echo
bin = [ "echo" ];
exec = make {
configure = {
"enable-jit";
+3 -4
View File
@@ -10,10 +10,9 @@ package rdfind {
compress = gzip;
};
exec = make {
// test suite hard codes /bin/echo
preCheck = "\nln -s ../system/bin/toybox /bin/echo\n";
};
// test suite hard codes /bin/echo
bin = [ "echo" ];
exec = make {};
inputs = [ nettle ];
runtime = [ nettle ];
+1 -2
View File
@@ -23,8 +23,7 @@ package util-linux {
compress = gzip;
};
early = "\nln -s ../system/bin/bash /bin/\n";
bin = [ "bash" ];
exec = make {
configure = {
"disable-use-tty-group";
+1 -4
View File
@@ -781,6 +781,7 @@ package xwayland {
checksum = "0D0bs8EbDzlyLIULvm6lizqzdx4g1-umdbjVVO7zk-cS1kVIaSkKronCqj95tz-A";
};
bin = [ "bash" ];
exec = meson {
setup = {
"Dipv6": "false";
@@ -788,10 +789,6 @@ package xwayland {
};
};
early = `
ln -sf ../system/bin/bash /bin/
`;
inputs = [
bash,
gawk,
+24
View File
@@ -414,6 +414,10 @@ type PackageAttr struct {
// Passed to [Toolchain.NewPatchedSource].
Patches []KV
// Programs to make available in /bin/.
Bin []string
// Whether to replace /usr/bin/ with a symlink to /bin/.
PopulateUsrBin bool
// Unregistered extras.
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(
rn,
attr.Flag,
+11 -9
View File
@@ -1004,15 +1004,17 @@ func (ctx *evalContext) pf(
k("block"): &meta.Blocked,
k("latest"): &meta.latest,
k("writable"): &attr.Writable,
k("chmod"): &attr.Chmod,
k("enterSource"): &attr.EnterSource,
k("env"): &attr.Env,
k("early"): &attr.ScriptEarly,
k("patches"): &patches,
k("files"): &files,
k("exclusive"): &excl,
k("toyboxEarly"): &early,
k("writable"): &attr.Writable,
k("chmod"): &attr.Chmod,
k("enterSource"): &attr.EnterSource,
k("env"): &attr.Env,
k("early"): &attr.ScriptEarly,
k("bin"): &attr.Bin,
k("populateUsrBin"): &attr.PopulateUsrBin,
k("patches"): &patches,
k("files"): &files,
k("exclusive"): &excl,
k("toyboxEarly"): &early,
k("checksum"): &kc,
k("output"): &output,