extra/go to 1.8-3

This commit is contained in:
Kevin Mihelich 2017-04-03 18:25:22 +00:00
parent 4ecdb61ad4
commit 6d972c2713
2 changed files with 150 additions and 113 deletions

View file

@ -0,0 +1,93 @@
From 91563ced5897faf729a34be7081568efcfedda31 Mon Sep 17 00:00:00 2001
From: Alberto Donizetti <alb.donizetti@gmail.com>
Date: Thu, 9 Mar 2017 13:20:54 +0100
Subject: [PATCH] time: make the ParseInLocation test more robust
The tzdata 2017a update (2017-02-28) changed the abbreviation of the
Asia/Baghdad time zone (used in TestParseInLocation) from 'AST' to the
numeric '+03'.
Update the test so that it skips the checks if we're using a recent
tzdata release.
Fixes #19457
Change-Id: I45d705a5520743a611bdd194dc8f8d618679980c
Reviewed-on: https://go-review.googlesource.com/37964
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
---
src/time/format_test.go | 41 +++++++++++++++++++++++++++++++----------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/src/time/format_test.go b/src/time/format_test.go
index 219c2ca..d0013bc 100644
--- a/src/time/format_test.go
+++ b/src/time/format_test.go
@@ -245,27 +245,45 @@ func TestParseDayOutOfRange(t *testing.T) {
}
}
+// TestParseInLocation checks that the Parse and ParseInLocation
+// functions do not get confused by the fact that AST (Arabia Standard
+// Time) and AST (Atlantic Standard Time) are different time zones,
+// even though they have the same abbreviation.
+//
+// ICANN has been slowly phasing out invented abbreviation in favor of
+// numeric time zones (for example, the Asia/Baghdad time zone
+// abbreviation got changed from AST to +03 in the 2017a tzdata
+// release); but we still want to make sure that the time package does
+// not get confused on systems with slightly older tzdata packages.
func TestParseInLocation(t *testing.T) {
- // Check that Parse (and ParseInLocation) understand that
- // Feb 01 AST (Arabia Standard Time) and Feb 01 AST (Atlantic Standard Time)
- // are in different time zones even though both are called AST
baghdad, err := LoadLocation("Asia/Baghdad")
if err != nil {
t.Fatal(err)
}
- t1, err := ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", baghdad)
+ var t1, t2 Time
+
+ t1, err = ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", baghdad)
if err != nil {
t.Fatal(err)
}
- t2 := Date(2013, February, 1, 00, 00, 00, 0, baghdad)
- if t1 != t2 {
- t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad) = %v, want %v", t1, t2)
- }
+
_, offset := t1.Zone()
- if offset != 3*60*60 {
- t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad).Zone = _, %d, want _, %d", offset, 3*60*60)
+
+ // A zero offset means that ParseInLocation did not recognize the
+ // 'AST' abbreviation as matching the current location (Baghdad,
+ // where we'd expect a +03 hrs offset); likely because we're using
+ // a recent tzdata release (2017a or newer).
+ // If it happens, skip the Baghdad test.
+ if offset != 0 {
+ t2 = Date(2013, February, 1, 00, 00, 00, 0, baghdad)
+ if t1 != t2 {
+ t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad) = %v, want %v", t1, t2)
+ }
+ if offset != 3*60*60 {
+ t.Fatalf("ParseInLocation(Feb 01 2013 AST, Baghdad).Zone = _, %d, want _, %d", offset, 3*60*60)
+ }
}
blancSablon, err := LoadLocation("America/Blanc-Sablon")
@@ -273,6 +291,9 @@ func TestParseInLocation(t *testing.T) {
t.Fatal(err)
}
+ // In this case 'AST' means 'Atlantic Standard Time', and we
+ // expect the abbreviation to correctly match the american
+ // location.
t1, err = ParseInLocation("Jan 02 2006 MST", "Feb 01 2013 AST", blancSablon)
if err != nil {
t.Fatal(err)

View file

@ -1,145 +1,89 @@
# $Id$ # $Id$
# Maintainer: Alexander F Rødseth <xyproto@archlinux.org> # Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Maintainer: Pierre Neidhardt <ambrevar@gmail.com>
# Contributor: Vesa Kaihlavirta <vegai@iki.fi>
# Contributor: Rémy Oudompheng <remy@archlinux.org>
# Contributor: Andres Perera <andres87p gmail>
# Contributor: Matthew Bauer <mjbauer95@gmail.com>
# Contributor: Christian Himpel <chressie@gmail.com>
# Contributor: Mike Rosset <mike.rosset@gmail.com>
# Contributor: Daniel YC Lin <dlin.tw@gmail.com>
# Contributor: John Luebs <jkluebs@gmail.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org> # ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - added switches for our architectures # - added switches for our architectures
# - upstream patch for AArch64 # - upstream patch for AArch64
pkgname=('go' 'go-tools') pkgname=go
epoch=2 epoch=2
pkgver=1.8 pkgver=1.8
pkgrel=1.2 pkgrel=3
arch=('arm' 'armv6h' 'armv7h' 'aarch64') pkgdesc='Core compiler tools for the Go programming language'
arch=(i686 x86_64)
url='http://golang.org/' url='http://golang.org/'
license=('BSD') license=(BSD)
makedepends=('inetutils' 'git' 'go') makedepends=(git go)
options=('!strip' 'staticlibs') options=(!strip staticlibs)
source=("$pkgname-$pkgver::git+https://go.googlesource.com/go#tag=$pkgname$pkgver") _commit=cd6b6202dd1559b3ac63179b45f1833fcfbe7eca # go1.8
md5sums=('SKIP') source=(git+https://go.googlesource.com/go#commit=$_commit
_gourl=golang.org/x/tools/cmd 0001-time-make-the-ParseInLocation-test-more-robust.patch)
md5sums=('SKIP'
'a9031d2fdd5d0951980db7ffe20afe41')
export GOOS=linux
case "$CARCH" in
x86_64) export GOARCH=amd64 ;;
i686) export GOARCH=386 GO386=387 ;;
arm) export GOARCH=arm GOARM=5 ;;
armv6h) export GOARCH=arm GOARM=6 ;;
armv7h) export GOARCH=arm GOARM=7 ;;
aarch64) export GOARCH=arm64 ;;
esac
export GOROOT_FINAL=/usr/lib/go
export GOROOT_BOOTSTRAP=/usr/lib/go
prepare() { prepare() {
cd "$pkgname-$pkgver" cd $pkgname
# fixes time/format test with tzdata >=2017a
patch -p1 -i "$srcdir/0001-time-make-the-ParseInLocation-test-more-robust.patch"
# upstream patch for AArch64
git cherry-pick -n 3557d546090c7fedd69562c88d20767397de835d git cherry-pick -n 3557d546090c7fedd69562c88d20767397de835d
} }
build() { build() {
cd "$pkgname-$pkgver/src" export GOROOT="$srcdir/$pkgname"
export GOARCH=arm
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
[ "$CARCH" == 'aarch64' ] && export GOARCH=arm64
export GOROOT_FINAL=/usr/lib/go
export GOROOT_BOOTSTRAP=/usr/lib/go
export GOOS=linux
export GOPATH="$srcdir/"
export GOROOT="$srcdir/$pkgname-$pkgver"
export GOBIN="$GOROOT/bin" export GOBIN="$GOROOT/bin"
export GOPATH="$srcdir/"
bash make.bash --no-clean cd $pkgname/src
./make.bash --no-clean
# System-wide tools
for tool in godex godoc goimports gomvpkg gorename gotype; do
$GOROOT/bin/go get -d golang.org/x/tools/cmd/$tool
$GOROOT/bin/go build -v -x -o $GOPATH/bin/$tool $_gourl/$tool
done
# Distribution tools
for tool in benchcmp bundle callgraph digraph eg fiximports guru html2article present ssadump stress stringer ; do
$GOROOT/bin/go get -d golang.org/x/tools/cmd/$tool
$GOROOT/bin/go build -v -x -o $GOPATH/pkg/tool/${GOOS}_$GOARCH/$tool golang.org/x/tools/cmd/$tool
done
} }
check() { check() {
cd "$pkgname-$pkgver" export GOROOT="$srcdir/$pkgname"
export GOARCH=arm
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
[ "$CARCH" == 'aarch64' ] && export GOARCH=arm64
export GOROOT="$srcdir/$pkgname-$pkgver"
export GOBIN="$GOROOT/bin" export GOBIN="$GOROOT/bin"
export PATH="$srcdir/$pkgname-$pkgver/bin:$PATH" export PATH="$srcdir/$pkgname-$pkgver/bin:$PATH"
export GOROOT_BOOTSTRAP=/usr/lib/go export GO_TEST_TIMEOUT_SCALE=2
for tool in goimports gomvpkg gorename gotype \ # The cgo_test and race tests fail via run.bash but not if run manually.
benchcmp bundle callgraph digraph eg fiximports guru html2article present ssadump stress stringer; do # Assume that five "failed" messages are okay and just re-run failed tests.
GOPATH="$srcdir" $GOROOT/bin/go test -v -x $_gourl/$tool cd $pkgname/src
done ./run.bash --no-rebuild -v -v -v -k |& tee run.log
if (( $(grep -c Failed: run.log) > 5 )) && grep -q FAILED run.log; then
return 1
fi
# TestSimpleMulticastListener will fail in standard chroot go tool dist test -v -v -v -run=^cgo_test$
cd src && bash run.bash --no-rebuild || true go tool dist test -v -v -v -run=^race$
} }
package_go() { package() {
pkgdesc='Compiler and tools for the Go programming language from Google' cd $pkgbase
optdepends=('mercurial: for fetching sources from mercurial repositories'
'git: for fetching sources from git repositories'
'bzr: for fetching sources from bazaar repositories'
'subversion: for fetching sources from subversion repositories'
'go-tools: doc, goimports, gorename, and other tools.')
cd "$pkgname-$pkgver"
export GOROOT="$srcdir/$pkgname-$pkgver" install -d "$pkgdir/usr/bin" "$pkgdir/usr/lib/go" "$pkgdir/usr/share/doc/go"
export GOBIN="$GOROOT/bin" cp -a bin pkg src lib "$pkgdir/usr/lib/go"
export GOROOT_BOOTSTRAP=/usr/lib/go cp -r doc/* "$pkgdir/usr/share/doc/go"
ln -sf /usr/lib/go/bin/go "$pkgdir/usr/bin/go"
ln -sf /usr/lib/go/bin/gofmt "$pkgdir/usr/bin/gofmt"
ln -sf /usr/share/doc/go "$pkgdir/usr/lib/go/doc"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/go/LICENSE" install -Dm644 LICENSE "$pkgdir/usr/share/licenses/go/LICENSE"
mkdir -p "$pkgdir/usr/"{share/go,lib/go,lib/go/pkg,lib/go/src,lib/go/site/src}
cp -r doc misc -t "$pkgdir/usr/share/go"
ln -s /usr/share/go/doc "$pkgdir/usr/lib/go/doc"
cp -a bin "$pkgdir/usr"
cp -a pkg/{include,linux_$GOARCH,tool} "$pkgdir/usr/lib/go/pkg"
# The 'race' folder is not always generated for all architectures.
[ -d "pkg/linux_${GOARCH}_race" ] && cp -a pkg/linux_${GOARCH}_race "$pkgdir/usr/lib/go/pkg"
cp -a "$GOROOT/src" "$pkgdir/usr/lib/go/"
cp -a "$GOROOT/lib" "$pkgdir/usr/lib/go/"
# This is to make `# go get golang.org/x/tour/gotour` and then running the
# gotour executable work out of the box.
ln -sf /usr/bin "$pkgdir/usr/lib/go/bin"
install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION" install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION"
# For godoc command rm -rf "$pkgdir/usr/lib/go/pkg/bootstrap"
install -Dm644 favicon.ico "$pkgdir/usr/lib/go/favicon.ico" rm -rf "$pkgdir/usr/lib/go/pkg/tool/*/api"
# Clean Windows specific files.
rm -fv "$pkgdir"/usr/lib/go/src/*.bat
} }
package_go-tools() {
pkgdesc='Developer tools for the Go programming language (includes godoc)'
depends=('go')
GOOS=linux
install -Dm644 "$srcdir/src/$_gourl/../LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# System-wide tools
install -dm755 "$pkgdir/usr/bin"
install -p -m755 "$srcdir/bin"/* "$pkgdir/usr/bin"
# Distribution tools
install -dm755 "$pkgdir/usr/lib/go/pkg/tool/${GOOS}_$GOARCH"
install -p -m755 "$srcdir/pkg/tool/${GOOS}_$GOARCH"/* "$pkgdir/usr/lib/go/pkg/tool/${GOOS}_$GOARCH"
}
# vim:set ts=2 sw=2 et: