Skip to content

Commit cde8f69

Browse files
hartzelltgamblin
authored andcommitted
Bugfix/update go packages (#2369)
* Update go-bootstrap package The last C based Go src tree was the 1.4 series. For a while they were cutting new releases so that people could bootstrap from a C only system. Now they're recommending that you either use the release-1.4 branch or that you use a date-stamped tarball that they'll produce on an as-needed basis. There are several issues that keep 1.4.2 from building on a CentOS 7 system. I've switched to the date based tarball. The cgo bits were also mis-behaving, but they're not needed for the bootstrapping task so I've set an environment variable that disables them. Details [on the install-from-source page](https://golang.org/doc/install/source#go14) and these issues: - golang/go#17545 - golang/go#16352. * Update go package Switched from pulling from the git repository to using the source tarballs and added digest values. Added support for 1.7.3, continued supporting 1.6.2, including patches for a couple of problems (details in [17545](golang/go#17545) and [17986](golang/go#17986). Dropped support for 1.5.4 and 1.4.2 because they no longer pass their tests and the patches above to not apply.
1 parent 11bfccd commit cde8f69

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

var/spack/repos/builtin/packages/go-bootstrap/package.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ class GoBootstrap(Package):
4141

4242
extendable = True
4343

44-
# NOTE: [email protected].2 is the only supported bootstrapping compiler because all
44+
# NOTE: [email protected].x is the only supported bootstrapping compiler because all
4545
# later versions require a Go compiler to build.
46-
# See: https://golang.org/doc/install/source
47-
version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2')
46+
# See: https://golang.org/doc/install/source#go14 and
47+
# https://github.com/golang/go/issues/17545 and
48+
# https://github.com/golang/go/issues/16352
49+
version('1.4-bootstrap-20161024', '76e42c8152e8560ded880a6d1d1f53cb',
50+
url='https://storage.googleapis.com/golang/go1.4-bootstrap-20161024.tar.gz')
4851

4952
variant('test', default=True, description='Build and run tests as part of the build.')
5053

51-
provides('golang@:1.4.2')
54+
provides('golang@:1.4-bootstrap-20161024')
5255

5356
depends_on('git', type='alldeps')
5457

@@ -69,6 +72,7 @@ def patch(self):
6972
pass
7073

7174
def install(self, spec, prefix):
75+
env['CGO_ENABLED'] = '0'
7276
bash = which('bash')
7377
with working_dir('src'):
7478
bash('{0}.bash'.format('all' if '+test' in spec else 'make'))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- misc/cgo/testcshared/test.bash.orig 2016-11-19 00:00:11.917000000 +0000
2+
+++ misc/cgo/testcshared/test.bash 2016-11-19 00:00:22.081000000 +0000
3+
@@ -107,7 +107,7 @@
4+
5+
# test0: exported symbols in shared lib are accessible.
6+
# TODO(iant): using _shared here shouldn't really be necessary.
7+
-$(go env CC) ${GOGCCFLAGS} -I ${installdir} -o testp main0.c libgo.$libext
8+
+$(go env CC) ${GOGCCFLAGS} -I ${installdir} -o testp main0.c ./libgo.$libext
9+
binpush testp
10+
11+
output=$(run LD_LIBRARY_PATH=. ./testp)

var/spack/repos/builtin/packages/go/package.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@
3232
class Go(Package):
3333
"""The golang compiler and build environment"""
3434
homepage = "https://golang.org"
35-
url = "https://go.googlesource.com/go"
35+
url='https://storage.googleapis.com/golang/go1.7.3.src.tar.gz'
3636

3737
extendable = True
3838

39-
version('1.6.2', git='https://go.googlesource.com/go', tag='go1.6.2')
40-
version('1.5.4', git='https://go.googlesource.com/go', tag='go1.5.4')
41-
version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2')
39+
version('1.7.3', '83d1b7bd4281479ab7d153e5152c9fc9')
40+
version('1.6.2', 'd1b50fa98d9a71eeee829051411e6207')
4241

4342
variant('test', default=True, description='Build and run tests as part of the build.')
4443

@@ -49,6 +48,12 @@ class Go(Package):
4948
# should be a dep on external go compiler
5049
depends_on('go-bootstrap', type='build')
5150

51+
# https://github.com/golang/go/issues/17545
52+
patch('time_test.patch', when='@1.6.2:1.7.3')
53+
54+
# https://github.com/golang/go/issues/17986
55+
patch('misc-cgo-testcshared.patch', level=0, when='@1.6.2:1.7.3')
56+
5257
# NOTE: Older versions of Go attempt to download external files that have
5358
# since been moved while running the test suite. This patch modifies the
5459
# test files so that these tests don't cause false failures.
@@ -65,6 +70,9 @@ def patch(self):
6570
def patch(self):
6671
pass
6772

73+
def url_for_version(self, version):
74+
return "https://storage.googleapis.com/golang/go{0}.src.tar.gz".format(version)
75+
6876
def install(self, spec, prefix):
6977
bash = which('bash')
7078
with working_dir('src'):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/src/time/time_test.go b/src/time/time_test.go
2+
index 68236fd..2e47d08 100644
3+
--- a/src/time/time_test.go
4+
+++ b/src/time/time_test.go
5+
@@ -943,8 +943,11 @@ func TestLoadFixed(t *testing.T) {
6+
// but Go and most other systems use "east is positive".
7+
// So GMT+1 corresponds to -3600 in the Go zone, not +3600.
8+
name, offset := Now().In(loc).Zone()
9+
- if name != "GMT+1" || offset != -1*60*60 {
10+
- t.Errorf("Now().In(loc).Zone() = %q, %d, want %q, %d", name, offset, "GMT+1", -1*60*60)
11+
+ // The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1"
12+
+ // on earlier versions; we accept both. (Issue #17276).
13+
+ if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 {
14+
+ t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d",
15+
+ name, offset, "GMT+1", "-01", -1*60*60)
16+
}
17+
}
18+

0 commit comments

Comments
 (0)