Accepting request 325388 from home:MargueriteSu:branches:devel:languages:go

OBS-URL: https://build.opensuse.org/request/show/325388
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=227
This commit is contained in:
Marguerite Su 2015-08-22 14:58:04 +00:00 committed by Git OBS Bridge
parent 8cba5e3da3
commit a41b62bc61
13 changed files with 175 additions and 94 deletions

View File

@ -2,12 +2,12 @@ Index: go/src/cmd/go/pkg.go
===================================================================
--- go.orig/src/cmd/go/pkg.go
+++ go/src/cmd/go/pkg.go
@@ -264,7 +264,7 @@ func loadImport(path string, srcDir stri
@@ -341,7 +341,7 @@ func loadImport(path, srcDir string, par
//
// TODO: After Go 1, decide when to pass build.AllowBinary here.
// See issue 3268 for mistakes to avoid.
- bp, err := buildContext.Import(path, srcDir, build.ImportComment)
+ bp, err := buildContext.Import(path, srcDir, build.AllowBinary | build.ImportComment)
bp.ImportPath = importPath
if gobin != "" {
bp.BinDir = gobin
// If we got an error from go/build about package not found,
// it contains the directories from $GOROOT and $GOPATH that

View File

@ -1,8 +1,22 @@
Index: go/src/crypto/x509/root_linux.go
===================================================================
--- go.orig/src/crypto/x509/root_linux.go
+++ go/src/crypto/x509/root_linux.go
@@ -6,8 +6,5 @@ package x509
// Possible certificate files; stop after finding one.
var certFiles = []string{
- "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
- "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL
- "/etc/ssl/ca-bundle.pem", // OpenSUSE
- "/etc/pki/tls/cacert.pem", // OpenELEC
+ "/etc/ssl/ca-bundle.pem", // openSUSE and SLE12+
}
Index: go/src/crypto/x509/root_unix.go
===================================================================
--- go.orig/src/crypto/x509/root_unix.go
+++ go/src/crypto/x509/root_unix.go
@@ -6,24 +6,20 @@
@@ -6,12 +6,15 @@
package x509
@ -12,32 +26,20 @@ Index: go/src/crypto/x509/root_unix.go
+ "os"
+)
// Possible certificate files; stop after finding one.
var certFiles = []string{
- "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
- "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL
- "/etc/ssl/ca-bundle.pem", // OpenSUSE
- "/etc/ssl/cert.pem", // OpenBSD
- "/usr/local/share/certs/ca-root-nss.crt", // FreeBSD/DragonFly
- "/etc/pki/tls/cacert.pem", // OpenELEC
- "/etc/certs/ca-certificates.crt", // Solaris 11.2+
+ "/etc/ssl/ca-bundle.pem", // openSUSE and SLE12+
}
// Possible directories with certificate files; stop after successfully
// reading at least one file from a directory.
var certDirectories = []string{
- "/system/etc/security/cacerts", // Android
-
+ "/etc/ssl/certs", // SLE11
}
func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
@@ -41,22 +37,24 @@ func initSystemRoots() {
@@ -29,22 +32,26 @@ func initSystemRoots() {
}
}
+ rootsAdded := false
+
for _, directory := range certDirectories {
fis, err := ioutil.ReadDir(directory)
if err != nil {
@ -58,6 +60,7 @@ Index: go/src/crypto/x509/root_unix.go
- return
- }
+ }
+
+ if rootsAdded {
+ systemRoots = roots
}

32
gcc5-go.patch Normal file
View File

@ -0,0 +1,32 @@
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -113,12 +113,12 @@ echo '##### Building Go bootstrap tool.'
echo cmd/dist
export GOROOT="$(cd .. && pwd)"
GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
+if [ ! -x "$GOROOT_BOOTSTRAP/bin/go-5" ]; then
echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
fi
rm -f cmd/dist/dist
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
+GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go-5" build -o cmd/dist/dist ./cmd/dist
# -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true)
Index: go/src/cmd/dist/buildtool.go
===================================================================
--- go.orig/src/cmd/dist/buildtool.go
+++ go/src/cmd/dist/buildtool.go
@@ -108,7 +108,7 @@ func bootstrapBuildTools() {
os.Setenv("GOHOSTARCH", "")
// Run Go 1.4 to build binaries.
- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...")
+ run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go-5", goroot_bootstrap), "install", "-v", "bootstrap/...")
// Copy binaries into tool binary directory.
for _, name := range bootstrapDirs {

View File

@ -1,12 +0,0 @@
Index: go/src/cmd/ld/elf.c
===================================================================
--- go.orig/src/cmd/ld/elf.c
+++ go/src/cmd/ld/elf.c
@@ -1323,6 +1323,7 @@ asmbelf(vlong symo)
sh->type = SHT_REL;
sh->flags = SHF_ALLOC;
sh->entsize = ELF32RELSIZE;
+ sh->addralign = 4;
sh->link = elfshname(".dynsym")->shnum;
shsym(sh, linklookup(ctxt, ".rel.plt", 0));

View File

@ -2,7 +2,7 @@ Index: go/src/cmd/go/build.go
===================================================================
--- go.orig/src/cmd/go/build.go
+++ go/src/cmd/go/build.go
@@ -118,6 +118,7 @@ func init() {
@@ -154,6 +154,7 @@ func init() {
}
// Flags set by multiple commands.
@ -10,18 +10,16 @@ Index: go/src/cmd/go/build.go
var buildA bool // -a flag
var buildN bool // -n flag
var buildP = runtime.NumCPU() // -p flag
@@ -170,6 +171,10 @@ func init() {
@@ -210,6 +211,8 @@ func init() {
// addBuildFlags adds the flags common to the build, clean, get,
// install, list, run, and test commands.
func addBuildFlags(cmd *Command) {
// NOTE: If you add flags here, also add them to testflag.go.
+
+ // OPENSUSE
+ cmd.Flag.BoolVar(&buildS, "s", false, "")
+
cmd.Flag.BoolVar(&buildA, "a", false, "")
cmd.Flag.BoolVar(&buildN, "n", false, "")
cmd.Flag.IntVar(&buildP, "p", buildP, "")
@@ -1070,6 +1075,11 @@ func (b *builder) getPkgConfigFlags(p *P
@@ -1503,6 +1506,11 @@ func (b *builder) linkShared(a *action)
// install is the action for installing a single package or executable.
func (b *builder) install(a *action) (err error) {

View File

@ -2,8 +2,8 @@ Index: go/src/cmd/go/pkg.go
===================================================================
--- go.orig/src/cmd/go/pkg.go
+++ go/src/cmd/go/pkg.go
@@ -748,6 +748,13 @@ func isStale(p *Package, topRoot map[str
return true
@@ -1373,6 +1373,13 @@ func isStale(p *Package) bool {
return false
}
+ // openSUSE bnc#776058
@ -13,6 +13,6 @@ Index: go/src/cmd/go/pkg.go
+ return false
+ }
+
olderThan := func(file string) bool {
fi, err := os.Stat(file)
return err != nil || fi.ModTime().After(built)
// Time-based staleness.
built := fi.ModTime()

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Thu Aug 20 15:26:42 UTC 2015 - i@marguerite.su
- update to version 1.5
* see https://golang.org/doc/go1.5
- add: go-1.5-build-dont-reinstall-stdlibs.patch
drop: go-build-dont-reinstall-stdlibs.patch
* refresh patch
- add: go-1.5-install-dont-reinstall-stdlibs.patch
drop: go-install-dont-reinstall-stdlibs.patch
* refresh patch
- drop: go-1.4.2-rel.plt-alignment.patch
* fix by upstream
- add gcc5-go.patch
* find /usr/bin/go-5 when bootstrapping with gcc5-go
- use update-alternatives for /usr/bin/go and profiles.d
so it can be co-installed with go1.4
-------------------------------------------------------------------
Tue Aug 11 16:06:28 UTC 2015 - jmassaguerpla@suse.com

126
go.spec
View File

@ -2,7 +2,6 @@
# spec file for package go
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011, Sascha Peilicke <saschpe@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,8 +16,14 @@
#
%if 0%{?suse_version} > 1320
%define with_gccgo 1
%else
%define with_gccgo 0
%endif
Name: go
Version: 1.4.2
Version: 1.5
Release: 0
Summary: A compiled, garbage-collected, concurrent programming language
License: BSD-3-Clause
@ -29,16 +34,16 @@ Source1: go-rpmlintrc
Source2: go.sh
Source3: macros.go
Source4: go-wiki-gadget.xml
Source5: README-openSUSE
Source5: README.SUSE
# PATCH-FIX-OPENSUSE add -s flag to 'go install' (don't rebuild/install std libs)
Patch1: go-build-dont-reinstall-stdlibs.patch
Patch1: go-1.5-build-dont-reinstall-stdlibs.patch
# PATCH-FIX-OPENSUSE re-enable build binary only packages (we are binary distro)
# see http://code.google.com/p/go/issues/detail?id=2775 & also issue 3268
Patch2: allow-binary-only-packages.patch
#PATCH-FIX-OPENSUSE use -x verbose build output for qemu-arm builders
Patch3: verbose-build.patch
# PATCH-FIX-OPENSUSE BNC#776058
Patch4: go-install-dont-reinstall-stdlibs.patch
Patch4: go-1.5-install-dont-reinstall-stdlibs.patch
# PATCH-FIX-OPENSUSE enable writing tools outside $GOROOT/pkg/tool for packaging
Patch5: tools-packaging.patch
# armv6l needs this patch for our build system
@ -47,8 +52,15 @@ Patch6: armv6l.patch
# PATCH-FIX-OPENSUSE fix_certificates_lookup.patch fcastelli@suse.com -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391
# PATCH-FIX-SUSE fix_certificates_lookup.patch fcastelli@suse.com -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391
Patch7: fix_certificates_lookup.patch
Patch8: go-1.4.2-rel.plt-alignment.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - find /usr/bin/go-5 when bootstrapping with gcc5-go
Patch8: gcc5-go.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# boostrap
%if %{with_gccgo}
BuildRequires: gcc5-go
%else
BuildRequires: go1.4
%endif
BuildRequires: rpm
%if 0%{?suse_version} >= 1210
BuildRequires: mercurial
@ -62,15 +74,17 @@ Recommends: go-doc
BuildRequires: rpm >= 4.11.1
%endif
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires: gcc
Provides: go-devel = %{name}%{version}
Provides: go-devel-static = %{name}%{version}
Provides: golang(API) = 1.4
Provides: golang(API) = 1.5
Obsoletes: go-devel < %{name}%{version}
# go-vim/emacs were separate projects starting from 1.4
Obsoletes: go-emacs <= 1.3.3
Obsoletes: go-vim <= 1.3.3
ExclusiveArch: %ix86 x86_64 %arm
ExclusiveArch: %ix86 x86_64 %arm %ppc64 %ppc64le
%description
Go is an expressive, concurrent, garbage collected systems programming language
@ -98,7 +112,9 @@ Go examples and documentation.
%patch6 -p1
%endif
%patch7 -p1
%if %{with_gccgo}
%patch8 -p1
%endif
cp %{SOURCE5} .
# setup go_arch (BSD-like scheme)
@ -117,6 +133,11 @@ sed -i 's|GOARCH|arm|' go.macros
%endif
%build
%if %{with_gccgo}
export GOROOT_BOOTSTRAP=%{_prefix}
%else
export GOROOT_BOOTSTRAP=%{_libdir}/go1.4
%endif
export GOROOT="`pwd`"
export GOROOT_FINAL=%{_libdir}/go
export GOBIN="$GOROOT/bin"
@ -132,9 +153,7 @@ bin/go install -race std
%install
export GOROOT="%{buildroot}%{_libdir}/%{name}"
# bash completion seems broken
#install -Dm644 misc/bash/go %%{buildroot}%%{_sysconfdir}/bash_completion.d/go.sh
install -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/go.sh
install -Dm644 %{SOURCE2} $GOROOT/bin/profile.d/go.sh
# locations for third party libraries, see README-openSUSE for info about locations.
install -d %{buildroot}%{_datadir}/go/contrib
@ -142,8 +161,8 @@ install -d $GOROOT/contrib/pkg/linux_%{go_arch}
ln -s %{_libdir}/%{name}/contrib/pkg/ %{buildroot}%{_datadir}/go/contrib/pkg
install -d %{buildroot}%{_datadir}/go/contrib/cmd
install -d %{buildroot}%{_datadir}/go/contrib/src
install -Dm644 README-openSUSE $GOROOT/contrib/
ln -s %{_libdir}/go/contrib/README-openSUSE %{buildroot}%{_datadir}/go/contrib/README-openSUSE
install -Dm644 README.SUSE $GOROOT/contrib/
ln -s %{_libdir}/go/contrib/README.SUSE %{buildroot}%{_datadir}/go/contrib/README.SUSE
# source files for go install, godoc, etc
install -d %{buildroot}%{_datadir}/go
@ -156,58 +175,81 @@ for i in $(ls %{buildroot}/usr/share/go/src);do
done
# copy document templates, packages, obj libs and command utilities
mkdir -p %{buildroot}%{_bindir}
mkdir -p $GOROOT/bin
mkdir -p $GOROOT/lib
# remove bootstrap
rm -rf pkg/bootstrap
mv pkg $GOROOT
mv bin/* %{buildroot}%{_bindir}
mv bin/* $GOROOT/bin
rm -f %{buildroot}%{_bindir}/{hgpatch,quietgcc}
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
touch %{buildroot}%{_sysconfdir}/alternatives/{go,gofmt,go.sh}
ln -sf %{_sysconfdir}/alternatives/go %{buildroot}%{_bindir}/go
ln -sf %{_sysconfdir}/alternatives/gofmt %{buildroot}%{_bindir}/gofmt
ln -sf %{_sysconfdir}/alternatives/go.sh %{buildroot}%{_sysconfdir}/profile.d/go.sh
# documentation and examples
# fix documetation permissions (rpmlint warning)
find doc/ misc/ -type f -exec chmod 0644 '{}' \;
# remove unwanted arch-dependant binaries (rpmlint warning)
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
rm -f misc/dashboard/builder/{gobuilder,*6,*.8}
rm -f misc/goplay/{goplay,*.6,*.8}
rm -rf misc/windows
rm -rf misc/cgo/test/{_*,*.o,*.out,*.6,*.8}
# remove kate syntax file, it is shipped with libktexteditor already
rm -f misc/kate/go.xml
# prepare go-doc
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r AUTHORS CONTRIBUTORS CONTRIBUTING.md LICENSE PATENTS README.md README.SUSE %{buildroot}%{_docdir}/%{name}
cp -r doc/* %{buildroot}%{_docdir}/%{name}
# install RPM macros ($GOARCH prepared in %%prep section)
install -Dm644 go.macros %{buildroot}%{_sysconfdir}/rpm/macros.go
# break hard links
rm %{buildroot}%{_libdir}/go/pkg/linux_%{go_arch}/{textflag,funcdata,cgocall,runtime}.h
ln -s %{_datadir}/go/src/cmd/ld/textflag.h %{buildroot}%{_libdir}/go/pkg/linux_%{go_arch}
ln -s %{_datadir}/go/src/runtime/{runtime,cgocall,funcdata}.h %{buildroot}%{_libdir}/go/pkg/linux_%{go_arch}
%if 0%{?suse_version} >= 1100
%fdupes %{buildroot}%{_prefix}
%fdupes -s %{buildroot}%{_prefix}
%endif
%post
update-alternatives \
--install %{_bindir}/go go %{_libdir}/%{name}/bin/go 30 \
--slave %{_bindir}/gofmt gofmt %{_libdir}/%{name}/bin/gofmt \
--slave %{_sysconfdir}/profile.d/go.sh go.sh %{_libdir}/%{name}/bin/profile.d/go.sh
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove go %{_libdir}/%{name}/bin/go
fi
%files
%defattr(-,root,root,-)
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS README README-openSUSE
%ifarch %ix86
%{_libdir}/go/pkg/tool/linux_%{go_arch}/8*
%endif
%ifarch x86_64
%{_libdir}/go/pkg/tool/linux_%{go_arch}/6*
%endif
%ifarch %arm
%{_libdir}/go/pkg/tool/linux_%{go_arch}/5*
%endif
%{_datadir}/go/
%{_bindir}/go*
%{_bindir}/go
%{_bindir}/gofmt
%{_libdir}/go/
# bash completion seems broken
#%%config %%{_sysconfdir}/bash_completion.d/go.sh
%{_datadir}/go/
%ghost %{_sysconfdir}/alternatives/go
%ghost %{_sysconfdir}/alternatives/gofmt
%ghost %{_sysconfdir}/alternatives/go.sh
%config %{_sysconfdir}/profile.d/go.sh
%config %{_sysconfdir}/rpm/macros.go
%dir %{_docdir}/%{name}/
%doc %{_docdir}/%{name}/AUTHORS
%doc %{_docdir}/%{name}/CONTRIBUTORS
%doc %{_docdir}/%{name}/CONTRIBUTING.md
%doc %{_docdir}/%{name}/LICENSE
%doc %{_docdir}/%{name}/PATENTS
%doc %{_docdir}/%{name}/README.md
%doc %{_docdir}/%{name}/README.SUSE
%files doc
%defattr(-,root,root,-)
%doc doc
%doc %{_docdir}/%{name}/codewalk
%doc %{_docdir}/%{name}/articles
%doc %{_docdir}/%{name}/progs
%doc %{_docdir}/%{name}/play
%doc %{_docdir}/%{name}/gopher
%doc %{_docdir}/%{name}/devel
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/*.css
%doc %{_docdir}/%{name}/*.png
%changelog

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:299a6fd8f8adfdce15bc06bde926e7b252ae8e24dd5b16b7d8791ed79e7b5e9b
size 10921896

3
go1.5.src.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be81abec996d5126c05f2d36facc8e58a94d9183a56f026fc9441401d80062db
size 12045689

View File

@ -18,7 +18,7 @@
%go_tooldir %{_datadir}/go/pkg/tool/linux_%{go_arch}
%go_exclusivearch \
ExclusiveArch: %ix86 x86_64 %arm
ExclusiveArch: %ix86 x86_64 %arm %ppc64 %ppc64le
%go_provides \
%go_exclusivearch \

View File

@ -2,18 +2,18 @@ Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -166,12 +166,12 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
@@ -153,12 +153,12 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
# use the host compiler, CC, from `cmd/dist/dist env` instead.
CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
- "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std
+ "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std
- "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+ "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
fi
echo "# Building packages and commands for $GOOS/$GOARCH."
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std
echo "##### Building packages and commands for $GOOS/$GOARCH."
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
rm -f "$GOTOOLDIR"/go_bootstrap