fix zoneinfo test and cleanup others

the find for tests files needed improving.

Also fix the hostname // net-tools requirement
This commit is contained in:
Vincent Batts 2015-08-25 14:10:59 -04:00
parent b869aad629
commit 3cb3b22c16
2 changed files with 40 additions and 8 deletions

View File

@ -0,0 +1,21 @@
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index ed9502d..c2569e7 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -32,14 +32,14 @@ var zoneDirs = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
var origZoneDirs = zoneDirs
func forceZipFileForTesting(zipOnly bool) {
- zoneDirs = make([]string, len(origZoneDirs))
+ zoneDirs = make([]string, len(origZoneDirs)+1)
copy(zoneDirs, origZoneDirs)
+ zoneDirs = append(zoneDirs, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
for i := 0; i < len(zoneDirs)-1; i++ {
zoneDirs[i] = "/XXXNOEXIST"

View File

@ -44,7 +44,7 @@
Name: golang
Version: 1.5
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The Go Programming Language
License: BSD
@ -54,7 +54,11 @@ Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
# go1.5 bootstrapping. The compiler is written in golang.
BuildRequires: golang > 1.4
BuildRequires: pcre-devel
%if 0%{?rhel} == 6 || 0%{?fedora} < 23
BuildRequires: net-tools
%else
BuildRequires: hostname
%endif
# use the arch dependent path in the bootstrap
Patch212: golang-1.5-bootstrap-binary-path.patch
@ -75,6 +79,10 @@ Patch213: go1.5beta1-disable-TestGdbPython.patch
# this is not possible in the limitied build chroot
Patch214: go1.5beta2-disable-TestCloneNEWUSERAndRemapNoRootDisableSetgroups.patch
# we had been just removing the zoneinfo.zip, but that caused tests to fail for users that
# later run `go test -a std`. This makes it only use the zoneinfo.zip where needed in tests.
Patch215: ./go1.5-zoneinfo_testing_only.patch
# Having documentation separate was broken
Obsoletes: %{name}-docs < 1.1-4
@ -258,8 +266,8 @@ tests_list=$cwd/go-tests.list
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list
touch $src_list $pkg_list $docs_list $misc_list $tests_list
pushd $RPM_BUILD_ROOT%{goroot}
find src/ -type d ! -ipath '*/testdata/*' -printf '%%%dir %{goroot}/%p\n' >> $src_list
find src/ ! -type d ! -ipath '*/testdata/*' ! -name '*_test.go' -printf '%{goroot}/%p\n' >> $src_list
find src/ -type d ! -name testdata -a ! -ipath '*/testdata/*' -printf '%%%dir %{goroot}/%p\n' >> $src_list
find src/ ! -type d ! -ipath '*/testdata/*' -a ! -name '*_test*.go' -printf '%{goroot}/%p\n' >> $src_list
find bin/ pkg/ -type d -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
find bin/ pkg/ ! -type d -printf '%{goroot}/%p\n' >> $pkg_list
@ -270,13 +278,13 @@ pushd $RPM_BUILD_ROOT%{goroot}
find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
find src/ -type d -ipath '*/testdata/*' -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find src/ ! -type d -ipath '*/testdata/*' -o -name '*_test.go' -printf '%{goroot}/%p\n' >> $tests_list
find src/ -type d -name testdata -o -ipath '*/testdata/*' -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find src/ ! -type d -ipath '*/testdata/*' -o -name '*_test*.go' -printf '%{goroot}/%p\n' >> $tests_list
# this is only the zoneinfo.zip
find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
popd
# remove the unnecessary zoneinfo file (Go will always use the system one first)
rm -rfv $RPM_BUILD_ROOT%{goroot}/lib/time
# remove the doc Makefile
rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
@ -403,6 +411,9 @@ fi
%changelog
* Tue Aug 25 2015 Vincent Batts <vbatts@fedoraproject.org> - 1.5-3
- only allow the golang zoneinfo.zip to be used in tests
* Sun Aug 23 2015 Peter Robinson <pbrobinson@fedoraproject.org> 1.5-2
- Enable aarch64
- Minor cleanups