summaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2019-12-09 16:10:59 +0800
committerBruce Ashfield <bruce.ashfield@gmail.com>2019-12-10 02:26:15 -0500
commit06dad20a32c81b6a8b6e93c99cda6f1133abddc6 (patch)
tree330233c2bf4c12dfa7d2bed28384ca1ede512b38 /recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
parentc31e46fce79f32a6692358105e15d77c652a9c9a (diff)
downloadmeta-virtualization-06dad20a32c81b6a8b6e93c99cda6f1133abddc6.tar.gz
go: add back 1.12 version to avoid compilation failure
go 1.12 was removed from oe-core, but currently k8s cannot be built successfully with go 1.13. See link below. https://github.com/kubernetes/kubernetes/issues/82531 We need to wait for k8s to support go 1.13 and update it to latest release, as well as its depedencies. Before this is done, add back go 1.12 and use it. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch')
-rw-r--r--recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 00000000..29ef947a
--- /dev/null
+++ b/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,106 @@
1From 7cc60b3887be2d5674b9f5d422d022976cf205e5 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Fri, 2 Mar 2018 06:00:20 -0800
4Subject: [PATCH] cmd/go: make GOROOT precious by default
5
6The go build tool normally rebuilds whatever it detects is
7stale. This can be a problem when GOROOT is intended to
8be read-only and the go runtime has been built as a shared
9library, since we don't want every application to be rebuilding
10the shared runtime - particularly in cross-build/packaging
11setups, since that would lead to 'abi mismatch' runtime errors.
12
13This patch prevents the install and linkshared actions from
14installing to GOROOT unless overridden with the GOROOT_OVERRIDE
15environment variable.
16
17Upstream-Status: Inappropriate [OE specific]
18
19Signed-off-by: Matt Madison <matt@madison.systems>
20
21---
22 src/cmd/go/internal/work/action.go | 3 +++
23 src/cmd/go/internal/work/build.go | 5 +++++
24 src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
25 3 files changed, 33 insertions(+)
26
27Index: go/src/cmd/go/internal/work/action.go
28===================================================================
29--- go.orig/src/cmd/go/internal/work/action.go
30+++ go/src/cmd/go/internal/work/action.go
31@@ -600,6 +600,9 @@ func (b *Builder) addTransitiveLinkDeps(
32 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
33 continue
34 }
35+ if goRootPrecious && (p1.Standard || p1.Goroot) {
36+ continue
37+ }
38 haveShlib[filepath.Base(p1.Shlib)] = true
39 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
40 // we'll end up building an overall library or executable that depends at runtime
41Index: go/src/cmd/go/internal/work/build.go
42===================================================================
43--- go.orig/src/cmd/go/internal/work/build.go
44+++ go/src/cmd/go/internal/work/build.go
45@@ -147,6 +147,7 @@ See also: go install, go get, go clean.
46 }
47
48 const concurrentGCBackendCompilationEnabledByDefault = true
49+var goRootPrecious bool = true
50
51 func init() {
52 // break init cycle
53@@ -160,6 +161,10 @@ func init() {
54
55 AddBuildFlags(CmdBuild)
56 AddBuildFlags(CmdInstall)
57+
58+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
59+ goRootPrecious = false
60+ }
61 }
62
63 // Note that flags consulted by other parts of the code
64Index: go/src/cmd/go/internal/work/exec.go
65===================================================================
66--- go.orig/src/cmd/go/internal/work/exec.go
67+++ go/src/cmd/go/internal/work/exec.go
68@@ -436,6 +436,23 @@ func (b *Builder) build(a *Action) (err
69 return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target)
70 }
71
72+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
73+ _, err := os.Stat(a.Package.Target)
74+ if err == nil {
75+ a.built = a.Package.Target
76+ a.Target = a.Package.Target
77+ a.buildID = b.fileHash(a.Package.Target)
78+ a.Package.Stale = false
79+ a.Package.StaleReason = "GOROOT-resident package"
80+ return nil
81+ }
82+ a.Package.Stale = true
83+ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
84+ if b.IsCmdList {
85+ return nil
86+ }
87+ }
88+
89 if err := b.Mkdir(a.Objdir); err != nil {
90 return err
91 }
92@@ -1438,6 +1455,14 @@ func BuildInstallFunc(b *Builder, a *Act
93 return nil
94 }
95
96+ if goRootPrecious && a.Package != nil {
97+ p := a.Package
98+ if p.Standard || p.Goroot {
99+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
100+ return err
101+ }
102+ }
103+
104 if err := b.Mkdir(a.Objdir); err != nil {
105 return err
106 }