internal/rosa: respect preferred job count
All checks were successful
Test / Create distribution (push) Successful in 3m52s
Test / Sandbox (push) Successful in 9m15s
Test / ShareFS (push) Successful in 14m28s
Test / Sandbox (race detector) (push) Successful in 5m18s
Test / Hakurei (push) Successful in 8m11s
Test / Hakurei (race detector) (push) Successful in 9m23s
Test / Flake checks (push) Successful in 3m23s

This discontinues use of nproc, and also overrides detection behaviour in ninja.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-15 16:18:02 +09:00
parent 3352bb975b
commit 520c36db6d
11 changed files with 28 additions and 19 deletions

View File

@@ -91,7 +91,7 @@ index 2ead810437..f85cbb8b1c 100644
ConfigureName: "/usr/src/cmake/bootstrap",
Configure: []KV{
{"prefix", "/system"},
{"parallel", `"$(nproc)"`},
{"parallel", jobsE},
{"--"},
{"-DCMAKE_USE_OPENSSL", "OFF"},
{"-DCMake_TEST_NO_NETWORK", "ON"},
@@ -170,10 +170,8 @@ func (attr *CMakeHelper) script(name string) string {
}
generate := "Ninja"
jobs := ""
if attr.Make {
generate = "'Unix Makefiles'"
jobs += ` "--parallel=$(nproc)"`
}
return `
@@ -191,7 +189,7 @@ cmake -G ` + generate + ` \
}), " \\\n\t") + ` \
-DCMAKE_INSTALL_PREFIX=/system \
'/usr/src/` + name + `/` + filepath.Join(attr.Append...) + `'
cmake --build .` + jobs + `
cmake --build . --parallel=` + jobsE + `
cmake --install . --prefix=/work/system
` + attr.Script
}

View File

@@ -15,7 +15,7 @@ func (t Toolchain) newCurl() (pkg.Artifact, string) {
// remove broken test
Writable: true,
ScriptEarly: `
chmod +w tests/data && rm tests/data/test459
chmod +w tests/data && rm -f tests/data/test459
`,
}, &MakeHelper{
Configure: []KV{
@@ -25,7 +25,7 @@ chmod +w tests/data && rm tests/data/test459
{"disable-smb"},
},
Check: []string{
`TFLAGS="-j$(expr "$(nproc)" '*' 2)"`,
"TFLAGS=" + jobsLFlagE,
"test-nonflaky",
},
},

View File

@@ -58,7 +58,7 @@ disable_test t2200-add-update
"prove",
},
Install: `make \
"-j$(nproc)" \
` + jobsFlagE + ` \
DESTDIR=/work \
NO_INSTALL_HARDLINKS=1 \
install`,

View File

@@ -103,7 +103,7 @@ func (t Toolchain) newAutoconf() (pkg.Artifact, string) {
Flag: TExclusive,
}, &MakeHelper{
Check: []string{
`TESTSUITEFLAGS="-j$(nproc)"`,
"TESTSUITEFLAGS=" + jobsFlagE,
"check",
},
},
@@ -185,7 +185,7 @@ func (t Toolchain) newLibtool() (pkg.Artifact, string) {
pkg.TarGzip,
), nil, &MakeHelper{
Check: []string{
`TESTSUITEFLAGS="-j$(nproc)"`,
"TESTSUITEFLAGS=" + jobsFlagE,
"check",
},
},
@@ -732,7 +732,7 @@ func (t Toolchain) newTar() (pkg.Artifact, string) {
// very expensive
"TARTEST_SKIP_LARGE_FILES=1",
`TESTSUITEFLAGS="-j$(nproc)"`,
"TESTSUITEFLAGS=" + jobsFlagE,
"check",
},
},

View File

@@ -1221,7 +1221,7 @@ install -Dm0500 \
/sbin/depmod
make \
"-j$(nproc)" \
` + jobsFlagE + ` \
-f /usr/src/kernel/Makefile \
O=/tmp/kbuild \
LLVM=1 \
@@ -1309,7 +1309,7 @@ func (t Toolchain) newFirmware() (pkg.Artifact, string) {
"install-zst",
},
SkipCheck: true, // requires pre-commit
Install: `make "-j$(nproc)" DESTDIR=/work/system dedup`,
Install: "make " + jobsFlagE + " DESTDIR=/work/system dedup",
},
Parallel,
Rdfind,

View File

@@ -190,7 +190,7 @@ ln -s ld.lld /work/system/bin/ld
ln -s clang /work/system/bin/cc
ln -s clang++ /work/system/bin/c++
ninja check-all
ninja ` + jobsFlagE + ` check-all
`,
},
Python,
@@ -230,7 +230,7 @@ func (t Toolchain) newLibclc() (pkg.Artifact, string) {
{"LIBCLC_TARGETS_TO_BUILD", "all"},
},
Script: "ninja test",
Script: "ninja " + jobsFlagE + " test",
}), llvmVersion
}
func init() {

View File

@@ -185,7 +185,7 @@ func (attr *MakeHelper) script(name string) string {
scriptMake := `
make \
"-j$(nproc)"`
` + jobsFlagE
if len(attr.Make) > 0 {
scriptMake += " \\\n\t" + strings.Join(attr.Make, " \\\n\t")
}
@@ -193,7 +193,7 @@ make \
if !attr.SkipCheck {
scriptMake += attr.ScriptCheckEarly + `make \
"-j$(nproc)" \
` + jobsFlagE + ` \
`
if len(attr.Check) > 0 {
scriptMake += strings.Join(attr.Check, " \\\n\t")

View File

@@ -15,7 +15,7 @@ cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \
--bootstrap \
--gtest-source-dir=/usr/src/googletest
./ninja all
./ninja `+jobsFlagE+` all
./ninja_test
mkdir -p /work/system/bin/

View File

@@ -27,7 +27,7 @@ func (t Toolchain) newOpenSSL() (pkg.Artifact, string) {
{"openssldir", "etc/ssl"},
},
Check: []string{
`HARNESS_JOBS="$(expr "$(nproc)" '*' 2)"`,
"HARNESS_JOBS=" + jobsLE,
"test",
},
},

View File

@@ -43,7 +43,7 @@ rm -f /system/bin/ps # perl does not like toybox ps
{"Duseshrplib"},
},
Check: []string{
"TEST_JOBS=256",
"TEST_JOBS=" + jobsLE,
"test_harness",
},
Install: `LD_LIBRARY_PATH="$PWD" ./perl -Ilib -I. installperl --destdir=/work`,

View File

@@ -602,6 +602,17 @@ cd '/usr/src/` + name + `/'
)
}
const (
// jobsE is expression for preferred job count set by [pkg].
jobsE = `"$` + pkg.EnvJobs + `"`
// jobsE is expression for flag with preferred job count.
jobsFlagE = `"-j$` + pkg.EnvJobs + `"`
// jobsLE is expression for twice of preferred job count set by [pkg].
jobsLE = `"$(expr ` + jobsE + ` '*' 2)"`
// jobsE is expression for flag with double of preferred job count.
jobsLFlagE = `"-j$(expr ` + jobsE + ` '*' 2)"`
)
// newTar wraps [pkg.NewHTTPGetTar] with a simpler function signature.
func newTar(url, checksum string, compression uint32) pkg.Artifact {
return pkg.NewHTTPGetTar(nil, url, mustDecode(checksum), compression)