Commit 86a21a53 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Clean internal build cache after part is compiled/tested

@tomo reports that parts/golang1.17/pkg/obj/go-build takes ~ 1GB which makes it
wasteful if we want to upload result of compilation to shacache.

It turns out we can drop that particular build cache completely, because it is
used only during the build and test of Go itself and its standard library. And
when Go is installed it will be another - "user" build cache - that will be
used to maintain and reuse build artifacts. For the reference: in SlapOS that
latter "user" build cache is located inside go.work/

-> Purge internal build cache after compilation is over.

Size of parts/golang1.17 before and after hereby patch:

before: 1.6G
after:  447M

See also related discussion in nexedi/slapos!929 (comment 128379)

/reviewed-by @tomo, @jerome
/reviewed-on nexedi/slapos!1169
parent 3de263c1
......@@ -19,7 +19,11 @@ shared = true
configure-command = :
location = @@LOCATION@@
make-binary =
make-targets= cd src && unset GOBIN && ./all.bash && cp -alf .. ${:location}
# build and test Go and its standard library
# clean intermediate cache before installing
# contrary to build cache in gowork, build cache, that Go uses during its own build, is not reused anywhere:
# https://github.com/golang/go/blob/go1.18.2-0-g8ed0e51b5e/src/cmd/dist/build.go#L239-L242
make-targets= cd src && unset GOBIN && ./all.bash && GOCACHE=`pwd`/../pkg/obj/go-build ../bin/go clean -cache && cp -alf .. ${:location}
# some testdata files have an issue with slapos.extension.strip.
post-install = ${findutils:location}/bin/find ${:location}/src -type d -name testdata -exec rm -rf {} \; || true
environment =
......@@ -42,6 +46,8 @@ patches =
url = https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
md5sum = dbf727a4b0e365bf88d97cbfde590016
environment-extra =
# build Go without testing it
# NOTE go1.4 does not have build cache
make-targets= cd src && unset GOBIN && ./make.bash && cp -alf .. ${:location}
# skip-chown-tests.patch does not apply to go1.4, but we don't run go1.4 tests.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment