commit
b8268d7f5f
|
@ -0,0 +1,88 @@
|
||||||
|
From f3d446b60a082308ec5aaa2fdc36e31f566081bb Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||||
|
Date: Thu, 22 Mar 2018 11:49:09 +0100
|
||||||
|
Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
|
||||||
|
internal test suite
|
||||||
|
|
||||||
|
---
|
||||||
|
src/time/internal_test.go | 7 +++++--
|
||||||
|
src/time/zoneinfo_test.go | 3 ++-
|
||||||
|
src/time/zoneinfo_unix.go | 2 --
|
||||||
|
3 files changed, 7 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
|
||||||
|
index 35ce69b228..1cea04ed7e 100644
|
||||||
|
--- a/src/time/internal_test.go
|
||||||
|
+++ b/src/time/internal_test.go
|
||||||
|
@@ -4,13 +4,15 @@
|
||||||
|
|
||||||
|
package time
|
||||||
|
|
||||||
|
+import "runtime"
|
||||||
|
+
|
||||||
|
func init() {
|
||||||
|
// force US/Pacific for time zone tests
|
||||||
|
ForceUSPacificForTesting()
|
||||||
|
}
|
||||||
|
|
||||||
|
func initTestingZone() {
|
||||||
|
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
|
||||||
|
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
|
||||||
|
if err != nil {
|
||||||
|
panic("cannot load America/Los_Angeles for testing: " + err.Error())
|
||||||
|
}
|
||||||
|
@@ -21,8 +23,9 @@ func initTestingZone() {
|
||||||
|
var OrigZoneSources = zoneSources
|
||||||
|
|
||||||
|
func forceZipFileForTesting(zipOnly bool) {
|
||||||
|
- zoneSources = make([]string, len(OrigZoneSources))
|
||||||
|
+ zoneSources = make([]string, len(OrigZoneSources)+1)
|
||||||
|
copy(zoneSources, OrigZoneSources)
|
||||||
|
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||||
|
if zipOnly {
|
||||||
|
zoneSources = zoneSources[len(zoneSources)-1:]
|
||||||
|
}
|
||||||
|
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
|
||||||
|
index 277b68f798..be2aa6c687 100644
|
||||||
|
--- a/src/time/zoneinfo_test.go
|
||||||
|
+++ b/src/time/zoneinfo_test.go
|
||||||
|
@@ -9,6 +9,7 @@ import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
+ "runtime"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
@@ -139,7 +140,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
|
||||||
|
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
||||||
|
index d2465eef65..b8c934c9a9 100644
|
||||||
|
--- a/src/time/zoneinfo_unix.go
|
||||||
|
+++ b/src/time/zoneinfo_unix.go
|
||||||
|
@@ -12,7 +12,6 @@
|
||||||
|
package time
|
||||||
|
|
||||||
|
import (
|
||||||
|
- "runtime"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
@@ -22,7 +21,6 @@ var zoneSources = []string{
|
||||||
|
"/usr/share/zoneinfo/",
|
||||||
|
"/usr/share/lib/zoneinfo/",
|
||||||
|
"/usr/lib/locale/TZ/",
|
||||||
|
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
|
||||||
|
}
|
||||||
|
|
||||||
|
func initLocal() {
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
From 67a4711d09c6595c17f32470c15bf471c287777d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Munday <munday@ca.ibm.com>
|
||||||
|
Date: Tue, 17 Jan 2017 11:33:38 -0500
|
||||||
|
Subject: [PATCH 2/3] syscall: expose IfInfomsg.X__ifi_pad on s390x
|
||||||
|
|
||||||
|
Exposing this field on s390x improves compatibility with the other
|
||||||
|
linux architectures, all of which already expose it.
|
||||||
|
|
||||||
|
Fixes #18628 and updates #18632.
|
||||||
|
|
||||||
|
Change-Id: I08e8e1eb705f898cd8822f8bee0d61ce11d514b5
|
||||||
|
---
|
||||||
|
src/syscall/ztypes_linux_s390x.go | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go
|
||||||
|
index 91f5ceff20..59a8b1fccd 100644
|
||||||
|
--- a/src/syscall/ztypes_linux_s390x.go
|
||||||
|
+++ b/src/syscall/ztypes_linux_s390x.go
|
||||||
|
@@ -449,12 +449,12 @@ type RtAttr struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type IfInfomsg struct {
|
||||||
|
- Family uint8
|
||||||
|
- _ uint8
|
||||||
|
- Type uint16
|
||||||
|
- Index int32
|
||||||
|
- Flags uint32
|
||||||
|
- Change uint32
|
||||||
|
+ Family uint8
|
||||||
|
+ X__ifi_pad uint8
|
||||||
|
+ Type uint16
|
||||||
|
+ Index int32
|
||||||
|
+ Flags uint32
|
||||||
|
+ Change uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type IfAddrmsg struct {
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
From fa250374b727439159bc9f203b854bb5df00186f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||||
|
Date: Mon, 27 May 2019 15:12:53 +0200
|
||||||
|
Subject: [PATCH 3/3] cmd/go: disable Google's proxy and sumdb
|
||||||
|
|
||||||
|
---
|
||||||
|
src/cmd/go/internal/cfg/cfg.go | 4 ++--
|
||||||
|
src/cmd/go/testdata/script/mod_sumdb_golang.txt | 6 +++---
|
||||||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
|
||||||
|
index 57a3c1ff6f..e56c60e591 100644
|
||||||
|
--- a/src/cmd/go/internal/cfg/cfg.go
|
||||||
|
+++ b/src/cmd/go/internal/cfg/cfg.go
|
||||||
|
@@ -266,8 +266,8 @@ var (
|
||||||
|
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", buildcfg.GOPPC64))
|
||||||
|
GOWASM = envOr("GOWASM", fmt.Sprint(buildcfg.GOWASM))
|
||||||
|
|
||||||
|
- GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct")
|
||||||
|
- GOSUMDB = envOr("GOSUMDB", "sum.golang.org")
|
||||||
|
+ GOPROXY = envOr("GOPROXY", "direct")
|
||||||
|
+ GOSUMDB = envOr("GOSUMDB", "off")
|
||||||
|
GOPRIVATE = Getenv("GOPRIVATE")
|
||||||
|
GONOPROXY = envOr("GONOPROXY", GOPRIVATE)
|
||||||
|
GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE)
|
||||||
|
diff --git a/src/cmd/go/testdata/script/mod_sumdb_golang.txt b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
|
||||||
|
index becd88b52e..b2a1250372 100644
|
||||||
|
--- a/src/cmd/go/testdata/script/mod_sumdb_golang.txt
|
||||||
|
+++ b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
|
||||||
|
@@ -2,12 +2,12 @@
|
||||||
|
env GOPROXY=
|
||||||
|
env GOSUMDB=
|
||||||
|
go env GOPROXY
|
||||||
|
-stdout '^https://proxy.golang.org,direct$'
|
||||||
|
+stdout '^direct$'
|
||||||
|
go env GOSUMDB
|
||||||
|
-stdout '^sum.golang.org$'
|
||||||
|
+stdout '^off$'
|
||||||
|
env GOPROXY=https://proxy.golang.org
|
||||||
|
go env GOSUMDB
|
||||||
|
-stdout '^sum.golang.org$'
|
||||||
|
+stdout '^off$'
|
||||||
|
|
||||||
|
# Download direct from github.
|
||||||
|
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/src/cmd/go/testdata/script/list_std.txt b/src/cmd/go/testdata/script/list_std.txt
|
||||||
|
index 6ab1bd1674..4a00e436fd 100644
|
||||||
|
--- a/src/cmd/go/testdata/script/list_std.txt
|
||||||
|
+++ b/src/cmd/go/testdata/script/list_std.txt
|
||||||
|
@@ -6,7 +6,7 @@ env GO111MODULE=off
|
||||||
|
# Listing GOROOT should only find standard packages.
|
||||||
|
cd $GOROOT/src
|
||||||
|
go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./...
|
||||||
|
-! stdout .
|
||||||
|
+stdout _$GOROOT
|
||||||
|
|
||||||
|
# Standard packages should include cmd, but not cmd/vendor.
|
||||||
|
go list ./...
|
|
@ -0,0 +1,70 @@
|
||||||
|
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go
|
||||||
|
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||||
|
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go 2017-12-05 14:55:10.574637475 +0100
|
||||||
|
@@ -4,13 +4,15 @@
|
||||||
|
|
||||||
|
package time
|
||||||
|
|
||||||
|
+import "runtime"
|
||||||
|
+
|
||||||
|
func init() {
|
||||||
|
// force US/Pacific for time zone tests
|
||||||
|
ForceUSPacificForTesting()
|
||||||
|
}
|
||||||
|
|
||||||
|
func initTestingZone() {
|
||||||
|
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
|
||||||
|
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
|
||||||
|
if err != nil {
|
||||||
|
panic("cannot load America/Los_Angeles for testing: " + err.Error())
|
||||||
|
}
|
||||||
|
@@ -21,8 +23,9 @@ func initTestingZone() {
|
||||||
|
var OrigZoneSources = zoneSources
|
||||||
|
|
||||||
|
func forceZipFileForTesting(zipOnly bool) {
|
||||||
|
- zoneSources = make([]string, len(OrigZoneSources))
|
||||||
|
+ zoneSources = make([]string, len(OrigZoneSources)+1)
|
||||||
|
copy(zoneSources, OrigZoneSources)
|
||||||
|
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||||
|
if zipOnly {
|
||||||
|
zoneSources = zoneSources[len(zoneSources)-1:]
|
||||||
|
}
|
||||||
|
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go
|
||||||
|
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||||
|
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go 2017-12-05 14:58:09.823109248 +0100
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
+ "runtime"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testi
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
|
||||||
|
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go
|
||||||
|
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||||
|
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go 2017-12-05 14:55:10.574637475 +0100
|
||||||
|
@@ -12,7 +12,6 @@
|
||||||
|
package time
|
||||||
|
|
||||||
|
import (
|
||||||
|
- "runtime"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
@@ -22,7 +21,6 @@ var zoneSources = []string{
|
||||||
|
"/usr/share/zoneinfo/",
|
||||||
|
"/usr/share/lib/zoneinfo/",
|
||||||
|
"/usr/lib/locale/TZ/",
|
||||||
|
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
|
||||||
|
}
|
||||||
|
|
||||||
|
func initLocal() {
|
|
@ -0,0 +1 @@
|
||||||
|
add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py
|
|
@ -0,0 +1,3 @@
|
||||||
|
# there are ELF files in src which are testdata and shouldn't be modified
|
||||||
|
-b /usr/lib/golang/src
|
||||||
|
-b /usr/lib64/golang/src
|
|
@ -0,0 +1,7 @@
|
||||||
|
// +build rpm_crashtraceback
|
||||||
|
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
setTraceback("crash")
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
From d7cad65ab9179804e9f089ce97bc124e9ef79494 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
|
||||||
|
Date: Wed, 15 Dec 2021 16:02:15 +0100
|
||||||
|
Subject: [PATCH] Remove ed25519vectors_test.go
|
||||||
|
|
||||||
|
---
|
||||||
|
src/crypto/ed25519/ed25519vectors_test.go | 109 ----------------------
|
||||||
|
1 file changed, 109 deletions(-)
|
||||||
|
delete mode 100644 src/crypto/ed25519/ed25519vectors_test.go
|
||||||
|
|
||||||
|
diff --git a/src/crypto/ed25519/ed25519vectors_test.go b/src/crypto/ed25519/ed25519vectors_test.go
|
||||||
|
deleted file mode 100644
|
||||||
|
index 74fcdcdf4e..0000000000
|
||||||
|
--- a/src/crypto/ed25519/ed25519vectors_test.go
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,109 +0,0 @@
|
||||||
|
-// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
-// Use of this source code is governed by a BSD-style
|
||||||
|
-// license that can be found in the LICENSE file.
|
||||||
|
-
|
||||||
|
-package ed25519_test
|
||||||
|
-
|
||||||
|
-import (
|
||||||
|
- "crypto/ed25519"
|
||||||
|
- "encoding/hex"
|
||||||
|
- "encoding/json"
|
||||||
|
- "internal/testenv"
|
||||||
|
- "os"
|
||||||
|
- "os/exec"
|
||||||
|
- "path/filepath"
|
||||||
|
- "testing"
|
||||||
|
-)
|
||||||
|
-
|
||||||
|
-// TestEd25519Vectors runs a very large set of test vectors that exercise all
|
||||||
|
-// combinations of low-order points, low-order components, and non-canonical
|
||||||
|
-// encodings. These vectors lock in unspecified and spec-divergent behaviors in
|
||||||
|
-// edge cases that are not security relevant in most contexts, but that can
|
||||||
|
-// cause issues in consensus applications if changed.
|
||||||
|
-//
|
||||||
|
-// Our behavior matches the "classic" unwritten verification rules of the
|
||||||
|
-// "ref10" reference implementation.
|
||||||
|
-//
|
||||||
|
-// Note that although we test for these edge cases, they are not covered by the
|
||||||
|
-// Go 1 Compatibility Promise. Applications that need stable verification rules
|
||||||
|
-// should use github.com/hdevalence/ed25519consensus.
|
||||||
|
-//
|
||||||
|
-// See https://hdevalence.ca/blog/2020-10-04-its-25519am for more details.
|
||||||
|
-func TestEd25519Vectors(t *testing.T) {
|
||||||
|
- jsonVectors := downloadEd25519Vectors(t)
|
||||||
|
- var vectors []struct {
|
||||||
|
- A, R, S, M string
|
||||||
|
- Flags []string
|
||||||
|
- }
|
||||||
|
- if err := json.Unmarshal(jsonVectors, &vectors); err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
- for i, v := range vectors {
|
||||||
|
- expectedToVerify := true
|
||||||
|
- for _, f := range v.Flags {
|
||||||
|
- switch f {
|
||||||
|
- // We use the simplified verification formula that doesn't multiply
|
||||||
|
- // by the cofactor, so any low order residue will cause the
|
||||||
|
- // signature not to verify.
|
||||||
|
- //
|
||||||
|
- // This is allowed, but not required, by RFC 8032.
|
||||||
|
- case "LowOrderResidue":
|
||||||
|
- expectedToVerify = false
|
||||||
|
- // Our point decoding allows non-canonical encodings (in violation
|
||||||
|
- // of RFC 8032) but R is not decoded: instead, R is recomputed and
|
||||||
|
- // compared bytewise against the canonical encoding.
|
||||||
|
- case "NonCanonicalR":
|
||||||
|
- expectedToVerify = false
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- publicKey := decodeHex(t, v.A)
|
||||||
|
- signature := append(decodeHex(t, v.R), decodeHex(t, v.S)...)
|
||||||
|
- message := []byte(v.M)
|
||||||
|
-
|
||||||
|
- didVerify := ed25519.Verify(publicKey, message, signature)
|
||||||
|
- if didVerify && !expectedToVerify {
|
||||||
|
- t.Errorf("#%d: vector with flags %s unexpectedly verified", i, v.Flags)
|
||||||
|
- }
|
||||||
|
- if !didVerify && expectedToVerify {
|
||||||
|
- t.Errorf("#%d: vector with flags %s unexpectedly rejected", i, v.Flags)
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-func downloadEd25519Vectors(t *testing.T) []byte {
|
||||||
|
- testenv.MustHaveExternalNetwork(t)
|
||||||
|
-
|
||||||
|
- // Download the JSON test file from the GOPROXY with `go mod download`,
|
||||||
|
- // pinning the version so test and module caching works as expected.
|
||||||
|
- goTool := testenv.GoToolPath(t)
|
||||||
|
- path := "filippo.io/mostly-harmless/ed25519vectors@v0.0.0-20210322192420-30a2d7243a94"
|
||||||
|
- cmd := exec.Command(goTool, "mod", "download", "-json", path)
|
||||||
|
- // TODO: enable the sumdb once the TryBots proxy supports it.
|
||||||
|
- cmd.Env = append(os.Environ(), "GONOSUMDB=*")
|
||||||
|
- output, err := cmd.Output()
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatalf("failed to run `go mod download -json %s`, output: %s", path, output)
|
||||||
|
- }
|
||||||
|
- var dm struct {
|
||||||
|
- Dir string // absolute path to cached source root directory
|
||||||
|
- }
|
||||||
|
- if err := json.Unmarshal(output, &dm); err != nil {
|
||||||
|
- t.Fatal(err)
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- jsonVectors, err := os.ReadFile(filepath.Join(dm.Dir, "ed25519vectors.json"))
|
||||||
|
- if err != nil {
|
||||||
|
- t.Fatalf("failed to read ed25519vectors.json: %v", err)
|
||||||
|
- }
|
||||||
|
- return jsonVectors
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-func decodeHex(t *testing.T, s string) []byte {
|
||||||
|
- t.Helper()
|
||||||
|
- b, err := hex.DecodeString(s)
|
||||||
|
- if err != nil {
|
||||||
|
- t.Errorf("invalid hex: %v", err)
|
||||||
|
- }
|
||||||
|
- return b
|
||||||
|
-}
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go
|
||||||
|
index c569e0faa2eb..4ded218d2d8d 100644
|
||||||
|
--- a/src/sync/waitgroup_test.go
|
||||||
|
+++ b/src/sync/waitgroup_test.go
|
||||||
|
@@ -5,8 +5,6 @@
|
||||||
|
package sync_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
- "internal/race"
|
||||||
|
- "runtime"
|
||||||
|
. "sync"
|
||||||
|
"sync/atomic"
|
||||||
|
"testing"
|
||||||
|
@@ -48,12 +46,6 @@ func TestWaitGroup(t *testing.T) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-func knownRacy(t *testing.T) {
|
||||||
|
- if race.Enabled {
|
||||||
|
- t.Skip("skipping known-racy test under the race detector")
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
func TestWaitGroupMisuse(t *testing.T) {
|
||||||
|
defer func() {
|
||||||
|
err := recover()
|
||||||
|
@@ -68,124 +60,6 @@ func TestWaitGroupMisuse(t *testing.T) {
|
||||||
|
t.Fatal("Should panic")
|
||||||
|
}
|
||||||
|
|
||||||
|
-// pollUntilEqual blocks until v, loaded atomically, is
|
||||||
|
-// equal to the target.
|
||||||
|
-func pollUntilEqual(v *uint32, target uint32) {
|
||||||
|
- for {
|
||||||
|
- for i := 0; i < 1e3; i++ {
|
||||||
|
- if atomic.LoadUint32(v) == target {
|
||||||
|
- return
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- // yield to avoid deadlock with the garbage collector
|
||||||
|
- // see issue #20072
|
||||||
|
- runtime.Gosched()
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-func TestWaitGroupMisuse2(t *testing.T) {
|
||||||
|
- knownRacy(t)
|
||||||
|
- if runtime.NumCPU() <= 4 {
|
||||||
|
- t.Skip("NumCPU<=4, skipping: this test requires parallelism")
|
||||||
|
- }
|
||||||
|
- defer func() {
|
||||||
|
- err := recover()
|
||||||
|
- if err != "sync: negative WaitGroup counter" &&
|
||||||
|
- err != "sync: WaitGroup misuse: Add called concurrently with Wait" &&
|
||||||
|
- err != "sync: WaitGroup is reused before previous Wait has returned" {
|
||||||
|
- t.Fatalf("Unexpected panic: %#v", err)
|
||||||
|
- }
|
||||||
|
- }()
|
||||||
|
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
|
||||||
|
- done := make(chan interface{}, 2)
|
||||||
|
- // The detection is opportunistic, so we want it to panic
|
||||||
|
- // at least in one run out of a million.
|
||||||
|
- for i := 0; i < 1e6; i++ {
|
||||||
|
- var wg WaitGroup
|
||||||
|
- var here uint32
|
||||||
|
- wg.Add(1)
|
||||||
|
- go func() {
|
||||||
|
- defer func() {
|
||||||
|
- done <- recover()
|
||||||
|
- }()
|
||||||
|
- atomic.AddUint32(&here, 1)
|
||||||
|
- pollUntilEqual(&here, 3)
|
||||||
|
- wg.Wait()
|
||||||
|
- }()
|
||||||
|
- go func() {
|
||||||
|
- defer func() {
|
||||||
|
- done <- recover()
|
||||||
|
- }()
|
||||||
|
- atomic.AddUint32(&here, 1)
|
||||||
|
- pollUntilEqual(&here, 3)
|
||||||
|
- wg.Add(1) // This is the bad guy.
|
||||||
|
- wg.Done()
|
||||||
|
- }()
|
||||||
|
- atomic.AddUint32(&here, 1)
|
||||||
|
- pollUntilEqual(&here, 3)
|
||||||
|
- wg.Done()
|
||||||
|
- for j := 0; j < 2; j++ {
|
||||||
|
- if err := <-done; err != nil {
|
||||||
|
- panic(err)
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- t.Fatal("Should panic")
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-func TestWaitGroupMisuse3(t *testing.T) {
|
||||||
|
- knownRacy(t)
|
||||||
|
- if runtime.NumCPU() <= 1 {
|
||||||
|
- t.Skip("NumCPU==1, skipping: this test requires parallelism")
|
||||||
|
- }
|
||||||
|
- defer func() {
|
||||||
|
- err := recover()
|
||||||
|
- if err != "sync: negative WaitGroup counter" &&
|
||||||
|
- err != "sync: WaitGroup misuse: Add called concurrently with Wait" &&
|
||||||
|
- err != "sync: WaitGroup is reused before previous Wait has returned" {
|
||||||
|
- t.Fatalf("Unexpected panic: %#v", err)
|
||||||
|
- }
|
||||||
|
- }()
|
||||||
|
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
|
||||||
|
- done := make(chan interface{}, 3)
|
||||||
|
- // The detection is opportunistically, so we want it to panic
|
||||||
|
- // at least in one run out of a million.
|
||||||
|
- for i := 0; i < 1e6; i++ {
|
||||||
|
- var wg WaitGroup
|
||||||
|
- wg.Add(1)
|
||||||
|
- go func() {
|
||||||
|
- defer func() {
|
||||||
|
- done <- recover()
|
||||||
|
- }()
|
||||||
|
- wg.Done()
|
||||||
|
- }()
|
||||||
|
- go func() {
|
||||||
|
- defer func() {
|
||||||
|
- done <- recover()
|
||||||
|
- }()
|
||||||
|
- wg.Wait()
|
||||||
|
- // Start reusing the wg before waiting for the Wait below to return.
|
||||||
|
- wg.Add(1)
|
||||||
|
- go func() {
|
||||||
|
- wg.Done()
|
||||||
|
- }()
|
||||||
|
- wg.Wait()
|
||||||
|
- }()
|
||||||
|
- go func() {
|
||||||
|
- defer func() {
|
||||||
|
- done <- recover()
|
||||||
|
- }()
|
||||||
|
- wg.Wait()
|
||||||
|
- }()
|
||||||
|
- for j := 0; j < 3; j++ {
|
||||||
|
- if err := <-done; err != nil {
|
||||||
|
- panic(err)
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- t.Fatal("Should panic")
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
func TestWaitGroupRace(t *testing.T) {
|
||||||
|
// Run this test for about 1ms.
|
||||||
|
for i := 0; i < 1000; i++ {
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,444 @@
|
||||||
|
%bcond_with bootstrap
|
||||||
|
%bcond_with ignore_tests
|
||||||
|
|
||||||
|
%global debug_package %{nil}
|
||||||
|
%global _binaries_in_noarch_packages_terminate_build 0
|
||||||
|
%global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$
|
||||||
|
%global __strip /bin/true
|
||||||
|
%define _use_internal_dependency_generator 0
|
||||||
|
%define __find_requires %{nil}
|
||||||
|
%global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot /usr/lib/rpm/brp-compress
|
||||||
|
%global golibdir %{_libdir}/golang
|
||||||
|
|
||||||
|
%{!?gopath: %global gopath %{_datadir}/gocode}
|
||||||
|
|
||||||
|
%ifarch x86_64 ppc64le ppc64 aarch64 s390x
|
||||||
|
%global external_linker 1
|
||||||
|
%else
|
||||||
|
%global external_linker 0
|
||||||
|
%endif
|
||||||
|
%ifarch x86_64 ppc64le ppc64 aarch64 s390x
|
||||||
|
%global cgo_enabled 1
|
||||||
|
%else
|
||||||
|
%global cgo_enabled 0
|
||||||
|
%endif
|
||||||
|
%if %{with bootstrap}
|
||||||
|
%global golang_bootstrap 0
|
||||||
|
%else
|
||||||
|
%global golang_bootstrap 1
|
||||||
|
%endif
|
||||||
|
%if %{with ignore_tests}
|
||||||
|
%global fail_on_tests 0
|
||||||
|
%else
|
||||||
|
%global fail_on_tests 1
|
||||||
|
%endif
|
||||||
|
%ifarch x86_64 ppc64le ppc64 aarch64
|
||||||
|
%global shared 1
|
||||||
|
%else
|
||||||
|
%global shared 0
|
||||||
|
%endif
|
||||||
|
%ifarch x86_64 ppc64le
|
||||||
|
%global race 1
|
||||||
|
%else
|
||||||
|
%global race 0
|
||||||
|
%endif
|
||||||
|
%global goroot /usr/lib/%{name}
|
||||||
|
%ifarch x86_64
|
||||||
|
%global gohostarch amd64
|
||||||
|
%endif
|
||||||
|
%ifarch %{ix86}
|
||||||
|
%global gohostarch 386
|
||||||
|
%endif
|
||||||
|
%ifarch %{arm}
|
||||||
|
%global gohostarch arm
|
||||||
|
%endif
|
||||||
|
%ifarch aarch64
|
||||||
|
%global gohostarch arm64
|
||||||
|
%endif
|
||||||
|
%ifarch ppc64
|
||||||
|
%global gohostarch ppc64
|
||||||
|
%endif
|
||||||
|
%ifarch ppc64le
|
||||||
|
%global gohostarch ppc64le
|
||||||
|
%endif
|
||||||
|
%ifarch s390x
|
||||||
|
%global gohostarch s390x
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%global go_api 1.18.2
|
||||||
|
%global go_version %{go_api}
|
||||||
|
%global baserelease 1
|
||||||
|
|
||||||
|
Name: golang
|
||||||
|
Version: %{go_version}
|
||||||
|
Release: %{baserelease}%{?dist}
|
||||||
|
Summary: The Go Programming Language
|
||||||
|
License: BSD and Public Domain
|
||||||
|
URL: http://golang.org/
|
||||||
|
Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
|
||||||
|
Source1: powerel.go
|
||||||
|
Patch1: 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch
|
||||||
|
Patch2: 0002-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch
|
||||||
|
Patch3: 0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch
|
||||||
|
Patch215: go1.5-zoneinfo_testing_only.patch
|
||||||
|
Patch221: fix_TestScript_list_std.patch
|
||||||
|
Patch1952381: rhbz1952381.patch
|
||||||
|
Patch222: remove_waitgroup_misuse_tests.patch
|
||||||
|
Patch223: remove_ed25519vectors_test.patch
|
||||||
|
Source100: golang-gdbinit
|
||||||
|
Source101: golang-prelink.conf
|
||||||
|
|
||||||
|
%if !%{golang_bootstrap}
|
||||||
|
BuildRequires: gcc-go >= 5
|
||||||
|
%else
|
||||||
|
BuildRequires: golang > 1.4
|
||||||
|
%endif
|
||||||
|
BuildRequires: hostname
|
||||||
|
BuildRequires: net-tools
|
||||||
|
BuildRequires: pcre-devel, glibc-static, procps-ng
|
||||||
|
Provides: go = %{version}-%{release}
|
||||||
|
Provides: bundled(golang(github.com/google/pprof)) = 0.0.0.20201203190320.1bf35d6f28c2
|
||||||
|
Provides: bundled(golang(github.com/ianlancetaylor/demangle)) = 0.0.0.20200824232613.28f6c0f3b639
|
||||||
|
Provides: bundled(golang(golang.org/x/arch)) = 0.0.0.20201008161808.52c3e6f60cff
|
||||||
|
Provides: bundled(golang(golang.org/x/crypto)) = 0.0.0.20201016220609.9e8e0b390897
|
||||||
|
Provides: bundled(golang(golang.org/x/mod)) = 0.4.1
|
||||||
|
Provides: bundled(golang(golang.org/x/net)) = 0.0.0.20201209123823.ac852fbbde11
|
||||||
|
Provides: bundled(golang(golang.org/x/sys)) = 0.0.0.20201204225414.ed752295db88
|
||||||
|
Provides: bundled(golang(golang.org/x/text)) = 0.3.4
|
||||||
|
Provides: bundled(golang(golang.org/x/tools)) = 0.0.0.20210107193943.4ed967dd8eff
|
||||||
|
Provides: bundled(golang(golang.org/x/xerrors)) = 0.0.0.20200804184101.5ec99f83aff1
|
||||||
|
Requires: %{name}-bin = %{version}-%{release}
|
||||||
|
Requires: %{name}-src = %{version}-%{release}
|
||||||
|
Requires: go-srpm-macros
|
||||||
|
Obsoletes: %{name}-docs < 1.1-4
|
||||||
|
Obsoletes: %{name}-data < 1.1.1-4
|
||||||
|
Obsoletes: %{name}-vim < 1.4
|
||||||
|
Obsoletes: emacs-%{name} < 1.4
|
||||||
|
ExclusiveArch: %{golang_arches}
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
|
||||||
|
%package docs
|
||||||
|
Summary: Golang compiler docs
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
BuildArch: noarch
|
||||||
|
Obsoletes: %{name}-docs < 1.1-4
|
||||||
|
%description docs
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
|
||||||
|
%package misc
|
||||||
|
Summary: Golang compiler miscellaneous sources
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
BuildArch: noarch
|
||||||
|
%description misc
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
|
||||||
|
%package tests
|
||||||
|
Summary: Golang compiler tests for stdlib
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
BuildArch: noarch
|
||||||
|
%description tests
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
|
||||||
|
%package src
|
||||||
|
Summary: Golang compiler source tree
|
||||||
|
BuildArch: noarch
|
||||||
|
%description src
|
||||||
|
%{summary}
|
||||||
|
|
||||||
|
|
||||||
|
%package bin
|
||||||
|
Summary: Golang core compiler tools
|
||||||
|
Provides: %{name}-go = %{version}-%{release}
|
||||||
|
Requires: go = %{version}-%{release}
|
||||||
|
Obsoletes: %{name}-pkg-bin-linux-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-bin-linux-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-bin-linux-arm < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-linux-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-linux-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-linux-arm < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-darwin-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-darwin-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-windows-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-windows-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-plan9-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-plan9-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-freebsd-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-freebsd-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-freebsd-arm < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-netbsd-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-netbsd-amd64 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-netbsd-arm < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-openbsd-386 < 1.4.99
|
||||||
|
Obsoletes: %{name}-pkg-openbsd-amd64 < 1.4.99
|
||||||
|
Obsoletes: golang-vet < 0-12.1
|
||||||
|
Obsoletes: golang-cover < 0-12.1
|
||||||
|
Requires(post): %{_sbindir}/update-alternatives
|
||||||
|
Requires(preun): %{_sbindir}/update-alternatives
|
||||||
|
Requires: glibc
|
||||||
|
Requires: gcc
|
||||||
|
Requires: git
|
||||||
|
#Requires: subversion, mercurial
|
||||||
|
%description bin
|
||||||
|
%{summary}
|
||||||
|
|
||||||
|
# Workaround old RPM bug of symlink-replaced-with-dir failure
|
||||||
|
%pretrans -p <lua>
|
||||||
|
for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
|
||||||
|
path = "%{goroot}/" .. d
|
||||||
|
if posix.stat(path, "type") == "link" then
|
||||||
|
os.remove(path)
|
||||||
|
posix.mkdir(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%if %{shared}
|
||||||
|
%package shared
|
||||||
|
Summary: Golang shared object libraries
|
||||||
|
%description shared
|
||||||
|
%{summary}.
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%if %{race}
|
||||||
|
%package race
|
||||||
|
Summary: Golang std library with -race enabled
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
%description race
|
||||||
|
%{summary}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n go
|
||||||
|
%patch215 -p1
|
||||||
|
%patch221 -p1
|
||||||
|
%patch1952381 -p1
|
||||||
|
%patch222 -p1
|
||||||
|
%patch223 -p1
|
||||||
|
cp %{SOURCE1} ./src/runtime/
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
set -xe
|
||||||
|
uname -a
|
||||||
|
cat /proc/cpuinfo
|
||||||
|
cat /proc/meminfo
|
||||||
|
%if !%{golang_bootstrap}
|
||||||
|
export GOROOT_BOOTSTRAP=/
|
||||||
|
%else
|
||||||
|
export GOROOT_BOOTSTRAP=%{goroot}
|
||||||
|
%endif
|
||||||
|
export GOROOT_FINAL=%{goroot}
|
||||||
|
export GOHOSTOS=linux
|
||||||
|
export GOHOSTARCH=%{gohostarch}
|
||||||
|
|
||||||
|
pushd src
|
||||||
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
export LDFLAGS="$RPM_LD_FLAGS"
|
||||||
|
export CC="gcc"
|
||||||
|
export CC_FOR_TARGET="gcc"
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=%{gohostarch}
|
||||||
|
%if !%{external_linker}
|
||||||
|
export GO_LDFLAGS="-linkmode internal"
|
||||||
|
%endif
|
||||||
|
%if !%{cgo_enabled}
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
%endif
|
||||||
|
./make.bash --no-clean -v
|
||||||
|
popd
|
||||||
|
|
||||||
|
%if %{shared}
|
||||||
|
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{race}
|
||||||
|
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race -v -x std
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
echo "== 1 =="
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
rm -rf pkg/obj/go-build/*
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_bindir}
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{goroot}
|
||||||
|
cp -apv api bin doc lib pkg src misc test VERSION $RPM_BUILD_ROOT%{goroot}
|
||||||
|
|
||||||
|
echo "== 2 =="
|
||||||
|
find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \;
|
||||||
|
touch $RPM_BUILD_ROOT%{goroot}/pkg
|
||||||
|
find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \;
|
||||||
|
cwd=$(pwd)
|
||||||
|
src_list=$cwd/go-src.list
|
||||||
|
pkg_list=$cwd/go-pkg.list
|
||||||
|
shared_list=$cwd/go-shared.list
|
||||||
|
race_list=$cwd/go-race.list
|
||||||
|
misc_list=$cwd/go-misc.list
|
||||||
|
docs_list=$cwd/go-docs.list
|
||||||
|
tests_list=$cwd/go-tests.list
|
||||||
|
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
|
||||||
|
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
|
||||||
|
|
||||||
|
pushd $RPM_BUILD_ROOT%{goroot}
|
||||||
|
echo "== 3 =="
|
||||||
|
find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
|
||||||
|
find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $src_list
|
||||||
|
|
||||||
|
find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
|
||||||
|
find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%{goroot}/%p\n' >> $pkg_list
|
||||||
|
|
||||||
|
find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
|
||||||
|
find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
|
||||||
|
|
||||||
|
find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
|
||||||
|
find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
|
||||||
|
|
||||||
|
%if %{shared}
|
||||||
|
echo "== 4 =="
|
||||||
|
mkdir -p %{buildroot}/%{_libdir}/
|
||||||
|
mkdir -p %{buildroot}/%{golibdir}/
|
||||||
|
for file in $(find . -iname "*.so" ); do
|
||||||
|
chmod 755 $file
|
||||||
|
mv $file %{buildroot}/%{golibdir}
|
||||||
|
pushd $(dirname $file)
|
||||||
|
ln -fs %{golibdir}/$(basename $file) $(basename $file)
|
||||||
|
popd
|
||||||
|
echo "%%{goroot}/$file" >> $shared_list
|
||||||
|
echo "%%{golibdir}/$(basename $file)" >> $shared_list
|
||||||
|
done
|
||||||
|
find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list
|
||||||
|
find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
|
||||||
|
%endif
|
||||||
|
|
||||||
|
echo "== 5 =="
|
||||||
|
%if %{race}
|
||||||
|
find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list
|
||||||
|
find pkg/*_race/ ! -type d -printf '%{goroot}/%p\n' >> $race_list
|
||||||
|
%endif
|
||||||
|
find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
|
||||||
|
find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
|
||||||
|
find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
|
||||||
|
find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $tests_list
|
||||||
|
find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
|
||||||
|
find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "== 6 =="
|
||||||
|
rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}
|
||||||
|
ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go
|
||||||
|
ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x
|
||||||
|
|
||||||
|
echo "== 7 =="
|
||||||
|
rm -f $RPM_BUILD_ROOT%{_bindir}/go
|
||||||
|
ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go
|
||||||
|
rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt
|
||||||
|
ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
|
||||||
|
cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d
|
||||||
|
cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
|
||||||
|
sed -i 's/const defaultGO_LDSO = `.*`/const defaultGO_LDSO = ``/' $RPM_BUILD_ROOT%{goroot}/src/internal/buildcfg/zbootstrap.go
|
||||||
|
|
||||||
|
echo "== END OF INSTALL =="
|
||||||
|
|
||||||
|
|
||||||
|
%check
|
||||||
|
export GOROOT=$(pwd -P)
|
||||||
|
export PATH="$GOROOT"/bin:"$PATH"
|
||||||
|
cd src
|
||||||
|
export CC="gcc"
|
||||||
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
export LDFLAGS="$RPM_LD_FLAGS"
|
||||||
|
%if !%{external_linker}
|
||||||
|
export GO_LDFLAGS="-linkmode internal"
|
||||||
|
%endif
|
||||||
|
%if !%{cgo_enabled} || !%{external_linker}
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
%endif
|
||||||
|
#ifarch aarch64
|
||||||
|
#export CGO_CFLAGS="-mno-outline-atomics"
|
||||||
|
#endif
|
||||||
|
# make sure to not timeout
|
||||||
|
export GO_TEST_TIMEOUT_SCALE=2
|
||||||
|
%if %{fail_on_tests}
|
||||||
|
./run.bash --no-rebuild -v -v -v -k
|
||||||
|
%else
|
||||||
|
./run.bash --no-rebuild -v -v -v -k || :
|
||||||
|
%endif
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
|
||||||
|
%post bin
|
||||||
|
%{_sbindir}/update-alternatives --install %{_bindir}/go \
|
||||||
|
go %{goroot}/bin/go 90 \
|
||||||
|
--slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
|
||||||
|
|
||||||
|
|
||||||
|
%preun bin
|
||||||
|
if [ $1 = 0 ]; then
|
||||||
|
%{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE PATENTS
|
||||||
|
%doc AUTHORS CONTRIBUTORS
|
||||||
|
%doc %{goroot}/VERSION
|
||||||
|
%dir %{goroot}/doc
|
||||||
|
%dir %{goroot}
|
||||||
|
%{goroot}/api/
|
||||||
|
%{goroot}/lib/time/
|
||||||
|
%dir %{gopath}
|
||||||
|
%dir %{gopath}/src
|
||||||
|
%dir %{gopath}/src/github.com/
|
||||||
|
%dir %{gopath}/src/bitbucket.org/
|
||||||
|
%dir %{gopath}/src/code.google.com/
|
||||||
|
%dir %{gopath}/src/code.google.com/p/
|
||||||
|
%dir %{gopath}/src/golang.org
|
||||||
|
%dir %{gopath}/src/golang.org/x
|
||||||
|
%{_sysconfdir}/gdbinit.d
|
||||||
|
|
||||||
|
|
||||||
|
%files src -f go-src.list
|
||||||
|
|
||||||
|
|
||||||
|
%files docs -f go-docs.list
|
||||||
|
|
||||||
|
|
||||||
|
%files misc -f go-misc.list
|
||||||
|
|
||||||
|
|
||||||
|
%files tests -f go-tests.list
|
||||||
|
|
||||||
|
|
||||||
|
%files bin -f go-pkg.list
|
||||||
|
%{_bindir}/go
|
||||||
|
%{_bindir}/gofmt
|
||||||
|
%{goroot}/bin/linux_%{gohostarch}/go
|
||||||
|
%{goroot}/bin/linux_%{gohostarch}/gofmt
|
||||||
|
|
||||||
|
|
||||||
|
%if %{shared}
|
||||||
|
%files shared -f go-shared.list
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%if %{race}
|
||||||
|
%files race -f go-race.list
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Reference in New Issue