Hello community, here is the log from the commit of package go for openSUSE:Factory checked in at 2017-08-24 18:19:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go (Old) and /work/SRC/openSUSE:Factory/.go.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "go" Thu Aug 24 18:19:31 2017 rev:78 rq:518398 version:1.8.3 Changes: -------- --- /work/SRC/openSUSE:Factory/go/go.changes 2017-07-30 11:26:31.652612229 +0200 +++ /work/SRC/openSUSE:Factory/.go.new/go.changes 2017-08-24 18:19:35.902618643 +0200 @@ -1,0 +2,10 @@ +Wed Aug 9 07:45:47 UTC 2017 - asa...@suse.com + +- go-race: add compiler-rt TSAN binary, necessary for the race detector builds + to work. This requires building compiler-rt from source (becuase upstream Go + stores precompiled binaries in the tree, and we cannot use them). In + addition, a %check was added purely to ensure that we don't install the wrong + version of compiler-rt. boo#1052528 +- go-rpmlintrc: add some entries to address the .syso additions. + +------------------------------------------------------------------- New: ---- _service compiler-rt-g68e1532492f9b3fce0e9024f3c31411105965b11.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go.spec ++++++ --- /var/tmp/diff_new_pack.NuAOvn/_old 2017-08-24 18:19:38.206294279 +0200 +++ /var/tmp/diff_new_pack.NuAOvn/_new 2017-08-24 18:19:38.214293153 +0200 @@ -45,6 +45,16 @@ %define with_gccgo 1 %endif +# By default we don't include tsan. It's only supported on amd64. +%define tsan_arch x86_64 + +# Go has precompiled versions of LLVM's compiler-rt inside their source code. +# We cannot ship pre-compiled binaries so we have to recompile said source, +# however they vendor specific commits from upstream. This value comes from +# src/runtime/race/README (and we verify that it matches in check). +# See boo#1052528 for more details. +%define tsan_commit 68e1532492f9b3fce0e9024f3c31411105965b11 + %define go_api 1.8 # shared library support @@ -73,11 +83,13 @@ License: BSD-3-Clause Group: Development/Languages/Other Url: http://golang.org -Source0: http://golang.org/dl/go%{version}.src.tar.gz +Source: http://golang.org/dl/go%{version}.src.tar.gz Source1: go-rpmlintrc Source2: go.sh Source4: README.SUSE Source6: go.gdbinit +# We have to compile TSAN ourselves. boo#1052528 +Source100: compiler-rt-g%{tsan_commit}.tar.xz # PATCH-FIX-OPENSUSE add -s flag to 'go install' (don't rebuild/install std libs) Patch1: go-1.5-build-dont-reinstall-stdlibs.patch # PATCH-FIX-OPENSUSE re-enable build binary only packages (we are binary distro) @@ -119,6 +131,10 @@ BuildRequires: fdupes BuildRequires: systemd Recommends: go-doc = %{version} +%ifarch %{tsan_arch} +# Needed to compile compiler-rt/TSAN. +BuildRequires: gcc-c++ +%endif #BNC#818502 debug edit tool of rpm fails on i586 builds BuildRequires: bc BuildRequires: rpm >= 4.11.1 @@ -146,6 +162,7 @@ %package doc Summary: Go documentation +License: BSD-3-Clause Group: Documentation/Other Requires: go = %{version} Provides: go-doc = %{version} @@ -153,7 +170,28 @@ %description doc Go examples and documentation. +%ifarch %{tsan_arch} +# boo#1052528 +%package race +Summary: Go runtime race detector +License: NCSA or MIT +Group: Development/Languages/Other +Url: https://compiler-rt.llvm.org/ +Requires: go = %{version} +Supplements: go +ExclusiveArch: %{tsan_arch} + +%description race +Go runtime race detector libraries. Install this package if you wish to use the +-race option, in order to detect race conditions present in your Go programs. +%endif + %prep +%ifarch %{tsan_arch} +# compiler-rt +%setup -q -T -b 100 -n compiler-rt-g%{tsan_commit} +%endif +# go %setup -q -n go %patch1 -p1 %patch2 -p1 @@ -199,6 +237,20 @@ %endif %build +# Remove the pre-included .sysos, to avoid shipping things we didn't compile +# (which is against the openSUSE guidelines for packaging). +find . -type f -name '*.syso' -exec rm -vf {} \; + +# First, compile LLVM's TSAN, and replace the built-in with it. We can only do +# this for amd64. +%ifarch %{tsan_arch} +pushd ../compiler-rt*/lib/tsan/go +./buildgo.sh +popd +cp ../compiler-rt*/lib/tsan/go/race_linux_%{go_arch}.syso src/runtime/race/race_linux_%{go_arch}.syso +%endif + +# Now, compile Go. %if %{with_gccgo} export GOROOT_BOOTSTRAP=%{_prefix} %else @@ -212,8 +264,8 @@ HOST_EXTRA_CFLAGS="%{optflags} -Wno-error" ./make.bash cd ../ -%ifarch x86_64 -# Install race detection version of std libraries (amd64 only) +%ifarch %{tsan_arch} +# Install TSAN-friendly version of the std libraries. bin/go install -race std %endif @@ -221,6 +273,12 @@ bin/go install -buildmode=shared -linkshared std %endif +%check +%ifarch %{tsan_arch} +# Make sure that we have the right TSAN checked out. +grep "%{tsan_commit}" src/runtime/race/README +%endif + %install export GOROOT="%{buildroot}%{_libdir}/go/%{go_api}" install -Dm644 %{SOURCE2} $GOROOT/bin/profile.d/go.sh @@ -238,7 +296,7 @@ # source files for go install, godoc, etc install -d %{buildroot}%{_datadir}/go/%{go_api} -for ext in *.{go,c,h,s,S,py}; do +for ext in *.{go,c,h,s,S,py,syso}; do find src -name ${ext} -exec install -Dm644 \{\} %{buildroot}%{_datadir}/go/%{go_api}/\{\} \; done mkdir -p $GOROOT/src @@ -323,6 +381,11 @@ %doc %{_docdir}/go/%{go_api}/README.SUSE %doc %{_docdir}/go/%{go_api}/go%{go_api}.txt +# We don't include TSAN in the main Go package. +%ifarch %{tsan_arch} +%exclude %{_datadir}/go/%{go_api}/src/runtime/race/race_linux_%{go_arch}.syso +%endif + %files doc %defattr(-,root,root,-) %doc %{_docdir}/go/%{go_api}/codewalk @@ -335,4 +398,10 @@ %doc %{_docdir}/go/%{go_api}/*.css %doc %{_docdir}/go/%{go_api}/*.png +%ifarch %{tsan_arch} +%files race +%defattr(-,root,root,-) +%{_datadir}/go/%{go_api}/src/runtime/race/race_linux_%{go_arch}.syso +%endif + %changelog ++++++ _service ++++++ <services> <service name="tar_scm" mode="disabled"> <param name="url">https://git.llvm.org/git/compiler-rt.git</param> <param name="scm">git</param> <param name="exclude">.git</param> <!-- [boo#1052528] Always make sure this is kept up to date with src/runtime/race/README. --> <param name="versionformat">g%H</param> <param name="revision">68e1532492f9b3fce0e9024f3c31411105965b11</param> </service> <service name="recompress" mode="disabled"> <param name="file">compiler-rt-*.tar</param> <param name="compression">xz</param> </service> </services> ++++++ go-rpmlintrc ++++++ --- /var/tmp/diff_new_pack.NuAOvn/_old 2017-08-24 18:19:38.330276822 +0200 +++ /var/tmp/diff_new_pack.NuAOvn/_new 2017-08-24 18:19:38.330276822 +0200 @@ -1,2 +1,8 @@ addFilter("binaryinfo-readelf-failed") # go binaries are suposedly ELF-compliant addFilter("statically-linked-binary") # go doesn't yet support dynamic linking + +# .syso files are special. Note that while they are architecture-dependent, +# they are named to avoid conflicts (and we make sure of that in the RPM +# through go_arch). +addFilter("unstripped-binary-or-object.*\.syso$") +addFilter("arch-dependent-file-in-usr-share.*\.syso$")