diff options
| author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-04-27 10:40:01 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-28 11:51:42 +0100 |
| commit | b3c193e5d51f99795810e76a3760b79d51016602 (patch) | |
| tree | ff255f2014b36b46e48cc65622e03e5327dae73f /meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch | |
| parent | 0f2998617042099a17d8ee721a9f76450b5c3666 (diff) | |
| download | poky-b3c193e5d51f99795810e76a3760b79d51016602.tar.gz | |
go: update 1.18 -> 1.18.1
Do not version patch directories; we carry only one version of go.
(From OE-Core rev: f7a9f330f92d85612196d7a8d77893a1b0a870aa)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch')
| -rw-r--r-- | meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch deleted file mode 100644 index 534d431045..0000000000 --- a/meta/recipes-devtools/go/go-1.18/0007-cmd-go-make-GOROOT-precious-by-default.patch +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | From 9ba507e076c744f4d394418e4a849e68cd426a4a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Kube <alexander.j.kube@gmail.com> | ||
| 3 | Date: Wed, 23 Oct 2019 21:18:56 +0430 | ||
| 4 | Subject: [PATCH 7/9] cmd/go: make GOROOT precious by default | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [OE specific] | ||
| 7 | |||
| 8 | The go build tool normally rebuilds whatever it detects is | ||
| 9 | stale. This can be a problem when GOROOT is intended to | ||
| 10 | be read-only and the go runtime has been built as a shared | ||
| 11 | library, since we don't want every application to be rebuilding | ||
| 12 | the shared runtime - particularly in cross-build/packaging | ||
| 13 | setups, since that would lead to 'abi mismatch' runtime errors. | ||
| 14 | |||
| 15 | This patch prevents the install and linkshared actions from | ||
| 16 | installing to GOROOT unless overridden with the GOROOT_OVERRIDE | ||
| 17 | environment variable. | ||
| 18 | |||
| 19 | Adapted to Go 1.13 from patches originally submitted to | ||
| 20 | the meta/recipes-devtools/go tree by | ||
| 21 | Matt Madison <matt@madison.systems>. | ||
| 22 | |||
| 23 | Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com> | ||
| 24 | --- | ||
| 25 | src/cmd/go/internal/work/action.go | 3 +++ | ||
| 26 | src/cmd/go/internal/work/build.go | 6 ++++++ | ||
| 27 | src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++ | ||
| 28 | 3 files changed, 34 insertions(+) | ||
| 29 | |||
| 30 | --- a/src/cmd/go/internal/work/action.go | ||
| 31 | +++ b/src/cmd/go/internal/work/action.go | ||
| 32 | @@ -673,6 +673,9 @@ func (b *Builder) addTransitiveLinkDeps( | ||
| 33 | if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] { | ||
| 34 | continue | ||
| 35 | } | ||
| 36 | + if goRootPrecious && (p1.Standard || p1.Goroot) { | ||
| 37 | + continue | ||
| 38 | + } | ||
| 39 | haveShlib[filepath.Base(p1.Shlib)] = true | ||
| 40 | // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild, | ||
| 41 | // we'll end up building an overall library or executable that depends at runtime | ||
| 42 | --- a/src/cmd/go/internal/work/build.go | ||
| 43 | +++ b/src/cmd/go/internal/work/build.go | ||
| 44 | @@ -197,6 +197,8 @@ See also: go install, go get, go clean. | ||
| 45 | |||
| 46 | const concurrentGCBackendCompilationEnabledByDefault = true | ||
| 47 | |||
| 48 | +var goRootPrecious bool = true | ||
| 49 | + | ||
| 50 | func init() { | ||
| 51 | // break init cycle | ||
| 52 | CmdBuild.Run = runBuild | ||
| 53 | @@ -209,6 +211,10 @@ func init() { | ||
| 54 | |||
| 55 | AddBuildFlags(CmdBuild, DefaultBuildFlags) | ||
| 56 | AddBuildFlags(CmdInstall, DefaultBuildFlags) | ||
| 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 | ||
| 64 | --- a/src/cmd/go/internal/work/exec.go | ||
| 65 | +++ b/src/cmd/go/internal/work/exec.go | ||
| 66 | @@ -535,6 +535,23 @@ func (b *Builder) build(ctx context.Cont | ||
| 67 | return errors.New("binary-only packages are no longer supported") | ||
| 68 | } | ||
| 69 | |||
| 70 | + if goRootPrecious && (a.Package.Standard || a.Package.Goroot) { | ||
| 71 | + _, err := os.Stat(a.Package.Target) | ||
| 72 | + if err == nil { | ||
| 73 | + a.built = a.Package.Target | ||
| 74 | + a.Target = a.Package.Target | ||
| 75 | + a.buildID = b.fileHash(a.Package.Target) | ||
| 76 | + a.Package.Stale = false | ||
| 77 | + a.Package.StaleReason = "GOROOT-resident package" | ||
| 78 | + return nil | ||
| 79 | + } | ||
| 80 | + a.Package.Stale = true | ||
| 81 | + a.Package.StaleReason = "missing or invalid GOROOT-resident package" | ||
| 82 | + if b.IsCmdList { | ||
| 83 | + return nil | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | if err := b.Mkdir(a.Objdir); err != nil { | ||
| 88 | return err | ||
| 89 | } | ||
| 90 | @@ -1585,6 +1602,14 @@ func (b *Builder) linkShared(ctx context | ||
| 91 | return err | ||
| 92 | } | ||
| 93 | |||
| 94 | + if goRootPrecious && a.Package != nil { | ||
| 95 | + p := a.Package | ||
| 96 | + if p.Standard || p.Goroot { | ||
| 97 | + err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath) | ||
| 98 | + return err | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | if err := b.Mkdir(a.Objdir); err != nil { | ||
| 103 | return err | ||
| 104 | } | ||
