[1/6] go: log build id computations

Message ID 20220101112959.1866747-1-alex@linutronix.de
State Accepted, archived
Commit a587be1d18fc55fe57d1aa5aa7c9e26af887109e
Headers show
Series [1/6] go: log build id computations | expand

Commit Message

Alexander Kanavin Jan. 1, 2022, 11:29 a.m. UTC
go writes build-specific ids into binaries it produces
and has a custom system for calculating them from
file hashes, environment variables and other inputs
(not that dissimilar to sstate cache, actually). This can
go wrong :) in various ways (for purposes of reproducibility
in particular), so this enables useful logs to see what
happens and why.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/classes/go.bbclass                | 2 ++
 meta/recipes-devtools/go/go-common.inc | 2 ++
 2 files changed, 4 insertions(+)

Patch

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index aa54b4a08c..5c1fdd7d5f 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -2,6 +2,8 @@  inherit goarch
 
 GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
 
+export GODEBUG = "gocachehash=1"
+
 GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
 GOROOT = "${STAGING_LIBDIR}/go"
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc
index dfccebdb83..5bbf35b787 100644
--- a/meta/recipes-devtools/go/go-common.inc
+++ b/meta/recipes-devtools/go/go-common.inc
@@ -37,6 +37,8 @@  export GO386 ?= "${TARGET_GO386}"
 export GOMIPS ?= "${TARGET_GOMIPS}"
 export GOROOT_FINAL ?= "${libdir}/go"
 
+export GODEBUG = "gocachehash=1"
+
 do_compile:prepend() {
 	BUILD_CC=${BUILD_CC}
 }