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
|
@ -436,6 +436,18 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None,
|
|||
if not args.ccache:
|
||||
env["CCACHE_DISABLE"] = "1"
|
||||
|
||||
# Cache binary objects from go in this path (like ccache)
|
||||
env["GOCACHE"] = "/home/pmos/.cache/go-build"
|
||||
|
||||
# Cache go modules (git repositories). Usually these should be bundled and
|
||||
# it should not be required to download them at build time, in that case
|
||||
# the APKBUILD sets the GOPATH (and therefore indirectly GOMODCACHE). But
|
||||
# e.g. when using --src they are not bundled, in that case it makes sense
|
||||
# to point GOMODCACHE at pmbootstrap's work dir so the modules are only
|
||||
# downloaded once.
|
||||
if args.go_mod_cache:
|
||||
env["GOMODCACHE"] = "/home/pmos/go/pkg/mod"
|
||||
|
||||
# Build the abuild command
|
||||
cmd = ["abuild", "-D", "postmarketOS"]
|
||||
if strict or "pmb:strict" in apkbuild["options"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue