make possible to override default traceback level at build time

add sub-package race containing std lib built with -race enabled
Related: BZ#1411242
This commit is contained in:
Jakub Čajka 2017-01-27 12:41:02 +01:00
parent 100fcef237
commit b881112930
2 changed files with 54 additions and 5 deletions

7
fedora.go Normal file
View File

@ -0,0 +1,7 @@
// +build rpm_crashtraceback
package runtime
func init() {
setTraceback("crash")
}

View File

@ -61,6 +61,13 @@
%global shared 0
%endif
# Pre build std lib with -race enabled
%ifarch x86_64
%global race 1
%else
%global race 0
%endif
# Fedora GOROOT
%global goroot /usr/lib/%{name}
@ -91,12 +98,14 @@
Name: golang
Version: 1.8
Release: 0.rc3.1%{?dist}
Release: 0.rc3.2%{?dist}
Summary: The Go Programming Language
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
License: BSD and Public Domain
URL: http://golang.org/
Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
# make possible to override default traceback level at build time by setting build tag rpm_crashtraceback
Source1: fedora.go
# The compiler is written in Go. Needs go(1.4+) compiler for build.
%if !%{golang_bootstrap}
@ -237,6 +246,16 @@ Summary: Golang shared object libraries
%{summary}.
%endif
%if %{race}
%package race
Summary: Golang std library with -race enabled
Requires: %{name} = %{version}-%{release}
%description race
%{summary}
%endif
%prep
%setup -q -n go
@ -250,6 +269,8 @@ Summary: Golang shared object libraries
%patch219 -p1
cp %{SOURCE1} ./src/runtime/
%build
# print out system information
uname -a
@ -291,6 +312,10 @@ popd
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
%endif
%if %{race}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std
%endif
%install
rm -rf $RPM_BUILD_ROOT
@ -313,17 +338,18 @@ 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
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_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}
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/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -printf '%{goroot}/%p\n' >> $pkg_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
@ -348,6 +374,13 @@ pushd $RPM_BUILD_ROOT%{goroot}
find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
%endif
%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
@ -465,7 +498,16 @@ fi
%files -f go-shared.list shared
%endif
%if %{race}
%files -f go-race.list race
%endif
%changelog
* Fri Jan 27 2017 Jakub Čajka <jcajka@redhat.com> - 1.8-0.rc3.2
- make possible to override default traceback level at build time
- add sub-package race containing std lib built with -race enabled
- Related: BZ#1411242
* Fri Jan 27 2017 Jakub Čajka <jcajka@redhat.com> - 1.8-0.rc3.1
- rebase to go1.8rc3
- Resolves: BZ#1411242