forked from Mirror/pmbootstrap
pmb.config: mount go caching directories
Always set GOCACHE during build and let it point to pmbootstrap's work dir. This has a similar effect as using ccache for C/C++. Set GOMODCACHE conditionally: this is for caching the go modules (git repositories) that get cloned during a build if they are not bundled with the source. Usually APKBUILDs should cache them, but when using pmbootstrap build --src, they would get downloaded over and over again. Set GOMODCACHE automatically for --src and allow enabling/disabling this manually with new --go-mod-cache / --no-go-mod-cache. This speeds up multiple iterations of building the same package significantly. I'm using it for: $ pmbootstrap build postmarketos-mkinitfs --src=... I've verified that using the same GOCACHE dir for multiple architectures doesn't result in build artifacts for the wrong arch getting used. Reviewed-by: Clayton Craft <clayton@craftyguy.net> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230223064743.1773-1-ollieparanoid@postmarketos.org%3E
This commit is contained in:
parent
3ad159f98d
commit
a0cea6255a
4 changed files with 41 additions and 1 deletions
|
@ -273,7 +273,9 @@ def test_run_abuild(args, monkeypatch):
|
|||
|
||||
# Normal run
|
||||
output = "armhf/test-1-r2.apk"
|
||||
env = {"CARCH": "armhf", "SUDO_APK": "abuild-apk --no-progress"}
|
||||
env = {"CARCH": "armhf",
|
||||
"GOCACHE": "/home/pmos/.cache/go-build",
|
||||
"SUDO_APK": "abuild-apk --no-progress"}
|
||||
cmd = ["abuild", "-D", "postmarketOS", "-d"]
|
||||
assert func(args, apkbuild, "armhf") == (output, cmd, env)
|
||||
|
||||
|
@ -283,6 +285,7 @@ def test_run_abuild(args, monkeypatch):
|
|||
|
||||
# cross=native
|
||||
env = {"CARCH": "armhf",
|
||||
"GOCACHE": "/home/pmos/.cache/go-build",
|
||||
"SUDO_APK": "abuild-apk --no-progress",
|
||||
"CROSS_COMPILE": "armv6-alpine-linux-musleabihf-",
|
||||
"CC": "armv6-alpine-linux-musleabihf-gcc"}
|
||||
|
@ -293,6 +296,7 @@ def test_run_abuild(args, monkeypatch):
|
|||
(output, cmd, env) = func(args, apkbuild, "armhf", cross="distcc")
|
||||
assert output == "armhf/test-1-r2.apk"
|
||||
assert env["CARCH"] == "armhf"
|
||||
assert env["GOCACHE"] == "/home/pmos/.cache/go-build"
|
||||
assert env["CCACHE_PREFIX"] == "distcc"
|
||||
assert env["CCACHE_PATH"] == "/usr/lib/arch-bin-masquerade/armhf:/usr/bin"
|
||||
assert env["CCACHE_COMPILERCHECK"].startswith("string:")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue