Hello community,

here is the log from the commit of package go for openSUSE:Factory checked in 
at 2016-01-07 00:24:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/go (Old)
 and      /work/SRC/openSUSE:Factory/.go.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "go"

Changes:
--------
--- /work/SRC/openSUSE:Factory/go/go.changes    2015-12-24 12:17:15.000000000 
+0100
+++ /work/SRC/openSUSE:Factory/.go.new/go.changes       2016-01-07 
00:24:33.000000000 +0100
@@ -1,0 +2,15 @@
+Wed Dec 30 15:41:02 UTC 2015 - [email protected]
+
+- macro.go:
+  * added golang-macros.rb to deal with complicated macros
+    that are hard to be written in shell script
+  * support "--with-buildid" which is the former ugly
+    "WITH_FAKE_BUILDID" environment variable hack
+  * support "--shared" which is "-buildmode=shared -linkshared"
+    in case anyone need it
+  * add go_api_ver macro which is currently 1.5
+- install shared stdlib on x86_64
+- drop go-wiki-gadget.xml: it hasn't been used from the beginning
+- add go.gdbinit for debug friendly
+
+-------------------------------------------------------------------

Old:
----
  go-wiki-gadget.xml

New:
----
  go.gdbinit
  golang-macros.rb

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ go.spec ++++++
--- /var/tmp/diff_new_pack.2JN1BL/_old  2016-01-07 00:24:35.000000000 +0100
+++ /var/tmp/diff_new_pack.2JN1BL/_new  2016-01-07 00:24:35.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package go
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,7 @@
 %endif
 %endif
 
+%define go_api 1.5
 Name:           go
 Version:        1.5.2
 Release:        0
@@ -37,8 +38,9 @@
 Source1:        go-rpmlintrc
 Source2:        go.sh
 Source3:        macros.go
-Source4:        go-wiki-gadget.xml
-Source5:        README.SUSE
+Source4:        README.SUSE
+Source5:        golang-macros.rb
+Source6:        go.gdbinit
 # 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)
@@ -65,7 +67,6 @@
 %else
 BuildRequires:  go1.4
 %endif
-BuildRequires:  rpm
 %if 0%{?suse_version} >= 1210
 BuildRequires:  mercurial
 BuildRequires:  systemd
@@ -78,12 +79,16 @@
 BuildRequires:  rpm >= 4.11.1
 %endif
 %endif
+# for go.gdbinit, directory ownership
+BuildRequires:  gdb
 Requires(post):        update-alternatives
 Requires(postun):      update-alternatives
 Requires:       gcc
+# for golang-macros.rb
+Requires:       ruby
 Provides:       go-devel = %{name}%{version}
 Provides:       go-devel-static = %{name}%{version}
-Provides:       golang(API) = 1.5
+Provides:       golang(API) = %{go_api}
 Obsoletes:      go-devel < %{name}%{version}
 # go-vim/emacs were separate projects starting from 1.4
 Obsoletes:      go-emacs <= 1.3.3
@@ -119,10 +124,9 @@
 %if %{with_gccgo}
 %patch8 -p1
 %endif
-cp %{SOURCE5} .
+cp %{SOURCE4} .
 
 # setup go_arch (BSD-like scheme)
-cp %{SOURCE3} go.macros
 %ifarch %ix86
 %define go_arch 386
 %endif
@@ -141,7 +145,7 @@
 %ifarch ppc64le
 %define go_arch ppc64le
 %endif
-sed -i 's|GOARCH|%{go_arch}|' go.macros
+sed -i 's|GOARCH|%{go_arch}|' %{SOURCE3}
 
 %build
 %if %{with_gccgo}
@@ -160,6 +164,7 @@
 # Install race detection version of std libraries (amd64 only)
 cd ../
 bin/go install -race std
+bin/go install -buildmode=shared std
 %endif
 
 %install
@@ -214,7 +219,15 @@
 cp -r doc/* %{buildroot}%{_docdir}/%{name}
 
 # install RPM macros ($GOARCH prepared in %%prep section)
-install -Dm644 go.macros %{buildroot}%{_sysconfdir}/rpm/macros.go
+install -Dm644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.go
+install -Dm755 %{SOURCE5} %{buildroot}%{_prefix}/lib/rpm/golang-macros.rb
+
+# gdbinit
+mkdir -p %{buildroot}%{_sysconfdir}/gdbinit.d
+install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/gdbinit.d/go.gdb
+%if "%{_lib}" == "lib64"
+sed -i "s/lib/lib64/" %{buildroot}%{_sysconfdir}/gdbinit.d/go.gdb
+%endif
 
 %if 0%{?suse_version} >= 1100
 %fdupes -s %{buildroot}%{_prefix}
@@ -242,6 +255,8 @@
 %ghost %{_sysconfdir}/alternatives/go.sh
 %config %{_sysconfdir}/profile.d/go.sh
 %config %{_sysconfdir}/rpm/macros.go
+%{_prefix}/lib/rpm/golang-macros.rb
+%config %{_sysconfdir}/gdbinit.d/go.gdb
 %dir %{_docdir}/%{name}/
 %doc %{_docdir}/%{name}/AUTHORS
 %doc %{_docdir}/%{name}/CONTRIBUTORS

++++++ go.gdbinit ++++++
add-auto-load-safe-path /usr/lib/go/src/runtime/runtime-gdb.py
++++++ golang-macros.rb ++++++
#!/usr/bin/env ruby

require 'fileutils'
require 'securerandom'
require 'find'

# GLOBAL RPM MACROS
if File.directory?("/usr/src/packages") & File.writable?("/usr/src/packages")
        $topdir = "/usr/src/packages"
else
        $topdir = ENV["HOME"] + "/rpmbuild"
end

$builddir = $topdir + "/BUILD"
$buildrootdir = $topdir + "/BUILDROOT"
$bindir = "/usr/bin"
$datadir = "/usr/share"

$arch = ""
# x86_64-(gnu|linux|blabla...)
$rbarch = RUBY_PLATFORM.gsub(/-.*$/,"")
# architectures are defined in /usr/lib/rpm/macros
ix86 = ["i386","i486","i586","i686","pentium3","pentium4","athlon","geode"]
arm = 
["armv3l","armv4b","armv4l","armv4tl","armv5b","armv5l","armv5teb","armv5tel","armv5tejl","armv6l","armv6hl","armv7l","armv7hl","armv7hnl"]
if ix86.include?($rbarch)
        $libdir = "/usr/lib"
        $go_arch = "386"
        $arch = "i386"
end
if $rbarch == "x86_64"
        $libdir = "/usr/lib64"
        $go_arch = "amd64"
        $arch = $rbarch
end
if arm.include?($rbarch)
        $libdir = "/usr/lib"
        $go_arch = "arm"
        $arch = $rbarch
end
if $rbarch == "aarch64"
        $libdir = "/usr/lib64"
        $go_arch = "arm64"
        $arch = $rbarch
end
if $rbarch == "ppc64"
        $libdir = "/usr/lib64"
        $go_arch = "ppc64"
        $arch = $rbarch
end
if $rbarch == "ppc64le"
        $libdir = "/usr/lib64"
        $go_arch = "ppc64le"
        $arch = $rbarch
end

# we don't need to create buildroot which is 
$buildrootdir/%{name}-%{version}-%{release}.%{_arch},
# we just find the only directory under $buildrootdir
$buildroot = Dir.glob($buildrootdir + "/*." + $arch)[0]
# sometimes buildroot locates in tmppath/name-version-build
if $buildroot == nil
        $buildroot = Dir.glob("/var/tmp/*-build")[0]
end

$go_contribdir = $libdir + "/go/contrib/pkg/linux_" + $go_arch
$go_contribsrcdir = $datadir + "/go/contrib/src"
$go_tooldir = $datadir + "/go/pkg/tool/linux_" + $go_arch

# ARGV[0], the called method itself
if ARGV[0] == "--prep"

        puts "Preparation Stage:\n"

        # ARGV[1] the import path
        if ARGV[1] == nil
                puts "[ERROR]Empty IMPORTPATH! Please specify a valid one.\n"
        else
                gopath = $builddir + "/go"
                puts "GOPATH set to: " + gopath + "\n"

                importpath = ARGV[1]
                puts "IMPORTPATH set to: " + importpath + "\n"

                # export IMPORTPATH to a temp file, as ruby can't export system 
environment variables
                # like shell scripts
                File.open("/tmp/importpath.txt","w") do |f|
                        f.puts(importpath)
                end

                # return current directory name, eg: ruby-2.2.4
                dir = File.basename(Dir.pwd)
                destination = gopath + "/src/" + importpath
                puts "Creating " + destination + "\n"
                FileUtils.mkdir_p(destination)

                # copy everything to destination
                puts "Copying everything under " + $builddir + "/" + dir + " to 
" + destination + " :\n"
                Dir.glob($builddir + "/" + dir + "/*").each do |f|
                        puts "Copying " + f + "\n"
                        FileUtils.cp_r(f, File.join(destination, 
File.basename(f)))
                end
                puts "Files are moved!\n"

                # create target directories
                puts "Creating directory for binaries " + $buildroot + $bindir 
+ "\n"  
                FileUtils.mkdir_p($buildroot + $bindir)
                puts "Creating directory for contrib " + $buildroot + 
$go_contribdir + "\n"     
                FileUtils.mkdir_p($buildroot + $go_contribdir)
                puts "Creating directory for source " + $buildroot + 
$go_contribsrcdir + "\n"
                FileUtils.mkdir_p($buildroot + $go_contribsrcdir)
                puts "Creating directory for tool " + $buildroot + $go_tooldir 
+ "\n"
                FileUtils.mkdir_p($buildroot + $go_tooldir)
        end

        puts "Preparation Finished!\n"

elsif ARGV[0] == "--build"

        puts "Build stage:\n"

        gopath = $builddir + "/go:" + $libdir + "/go/contrib"
        gobin = $builddir + "/go/bin"
        buildflags = "-s -v -p 4 -x"

        # get importpath from /tmp/importpath.txt saved by prep()
        importpath = open("/tmp/importpath.txt","r").gets.strip!

        # ARGV[0] is "--build" itself, there can be "--with-buildid" or 
"--shared"
        # all else are treated as MODs
        mods = ARGV
        mods.delete_at(0) # drop "--build"
        sharedflags = ""
        buildidflags = ""

        if mods.include?("--shared")
                sharedflags = "-buildmode=shared -linkshared"
                mods.delete("--shared")
        end

        if mods.include?("--with-buildid")
                buildid = "0x" + SecureRandom.hex(20)
                buildidflags = '-ldflags "-B ' + buildid + '"'
                mods.delete("--with-buildid")
        end

        # MODs: nil, "...", "/...", "foo...", "foo/...", "foo bar", "foo bar... 
baz" and etc
        if mods.empty?
                system("GOPATH=\"#{gopath}\" GOBIN=\"#{gobin}\" go install 
#{sharedflags} #{buildidflags} #{buildflags} #{importpath}") 
        else
                for mod in mods do
                        if mod == "..."
                                system("GOPATH=\"#{gopath}\" GOBIN=\"#{gobin}\" 
go install #{sharedflags} #{buildidflags} #{buildflags} #{importpath}...")
                                break
                        else
                                system("GOPATH=\"#{gopath}\" GOBIN=\"#{gobin}\" 
go install #{sharedflags} #{buildidflags} #{buildflags} #{importpath}/#{mod}")
                        end
                end
        end

        puts "Build Finished!\n"

elsif ARGV[0] == "--install"

        puts "Installation stage:\n"

        unless Dir["#{$builddir}/go/pkg/*"].empty?
                puts "Copying generated stuff to " + $buildroot + $go_contribdir
                Dir.glob($builddir + "/go/pkg/linux_" + $go_arch + "/*").each 
do |f|
                        puts "Copying " + f
                        FileUtils.cp_r(f, $buildroot + $go_contribdir)
                end
                puts "Done!"
        end

        unless Dir["#{$builddir}/go/bin/*"].empty?
                puts "Copyig binaries to " + $buildroot + $bindir
                Dir.glob($builddir + "/go/bin/*").each do |f|
                        puts "Copying " + f
                        FileUtils.chmod_R(0755,f)
                        FileUtils.cp_r(f,$buildroot + $bindir)
                end
                puts "Done!"
        end

        puts "Install finished!\n"

elsif ARGV[0] == "--source"

        puts "Source package creation:"

        puts "This will copy all *.go files in #{$builddir}/go/src, but 
resource files needed are still not copyed"

        Find.find($builddir + "/go/src") do |f|
                unless FileTest.directory?(f)
                        if f.index(".go")
                                puts "Copying " + f
                                FileUtils.chmod_R(0644,f)

                                # create the same hierarchy
                                dir = $buildroot + $go_contribsrcdir + 
f.gsub($builddir + "/go/src",'')
                                dir1 = dir.gsub(File.basename(dir),'')
                                FileUtils.mkdir_p(dir1)
                                FileUtils.install(f,dir1)
                        end
                end
        end

        # remove previous created tmp file
        File.delete("/tmp/importpath.txt")

        puts "Source package created!"

elsif ARGV[0] == "--fix"

        puts "Fixing stuff..."

        # only "--fix" is given, no other parameters
        if ARGV.length == 1
                puts "[ERROR]gofix: please specify a valid importpath, see: go 
help fix"
        else
                gopath = $builddir + "/go"
                system("GOPATH=#{gopath} go fix #{ARGV[1]}...")
        end

        puts "Fixed!"

elsif ARGV[0] == "--test"

        puts "Testing codes..."

        # only "--test" is given, no other parameters
        if ARGV.length == 1
                puts "[ERROR]gotest: please specify a valid importpath, see: go 
help test"
        else
                gopath = $builddir + "/go:" + $libdir + "/go/contrib"
                system("GOPATH=#{gopath} go test -x #{ARGV[1]}...")
        end

        puts "Test passed!"

else

        puts "Please specify a valid method: --prep, --build, --install, --fix, 
--test, --source."

end

++++++ macros.go ++++++
--- /var/tmp/diff_new_pack.2JN1BL/_old  2016-01-07 00:24:35.000000000 +0100
+++ /var/tmp/diff_new_pack.2JN1BL/_new  2016-01-07 00:24:35.000000000 +0100
@@ -9,6 +9,7 @@
 %go_ver         %(LC_ALL=C rpm -q --qf '%%{epoch}:%%{version}\\n' go | sed -e 
's/(none)://' -e 's/ 0:/ /' | grep -v "is not")
 %go_arch        GOARCH
 %go_build_ver   %(go version | sed 's/^go version //' | sed 's:\/::g' | tr -d 
' ' | cut -c 1-7 )
+%go_api_ver %(echo %{go_ver} | sed 's/\.[0-9]$//')
 
 %go_dir          %{_libdir}/go
 %go_sitedir      %{_libdir}/go/pkg
@@ -28,28 +29,7 @@
 # Prepare the expected Go package build environement.
 # We need a $GOPATH: go help gopath
 # We need a valid importpath: go help packages
-%goprep() \
-export GOPATH=%{_builddir}/go \
-if [ %# -eq 0 ]; then \
-  echo "goprep: please specify a valid importpath, see: go help packages" \
-  exit 1 \
-else \
-  export IMPORTPATH=%1 \
-fi \
-# create the importpath and move the package there \
-pkg_dir=$(basename $PWD) \
-cd %{_builddir} \
-mkdir -p $GOPATH/src/$IMPORTPATH \
-(shopt -s dotglob; mv -- ${pkg_dir}/* $GOPATH/src/$IMPORTPATH) \
-# now link the old location to the new (for compatibility) \
-rmdir ${pkg_dir} \
-ln -s $GOPATH/src/$IMPORTPATH ${pkg_dir} \
-cd ${pkg_dir} \
-# we'll be installing packages/binaries/tools, make the targ dirs \
-install -d %{buildroot}%{go_contribdir} \
-install -d %{buildroot}%{go_tooldir} \
-install -d %{buildroot}%{_bindir} \
-%{nil}
+%goprep /usr/lib/rpm/golang-macros.rb --prep
 
 # %%gobuild macro actually performs the command "go install", but the go
 # toolchain will install to the $GOPATH which allows us then customise the 
final
@@ -99,78 +79,16 @@
 #              go install importpath/baz
 #
 # See: go help install, go help packages
-%gobuild() \
-export BUILDFLAGS="-s -v -p 4 -x" \
-export GOPATH=%{_builddir}/go:%{_libdir}/go/contrib \
-export GOBIN=%{_builddir}/go/bin \
-MOD="" \
-if [ %# -gt 0 ]; then \
-  for mod in %*; do \
-    if [ $mod == "..." ]; then \
-      MOD=$MOD... \
-      if [ "$WITH_FAKE_BUILDID" = "true" ] ; then \
-       go install $BUILDFLAGS -ldflags "-B 0x$(head -c20 /dev/urandom | od -An 
-tx1 | tr -d ' \\n')" $IMPORTPATH$MOD \
-      else \
-       go install $BUILDFLAGS $IMPORTPATH$MOD \
-      fi \
-      break \
-    else \
-      MOD=/$mod \
-      if [ "$WITH_FAKE_BUILDID" = "true" ] ; then \
-        go install $BUILDFLAGS -ldflags "-B 0x$(head -c20 /dev/urandom | od 
-An -tx1 | tr -d ' \\n')" $IMPORTPATH$MOD \
-      else \
-        go install $BUILDFLAGS $IMPORTPATH$MOD \
-      fi \
-    fi \
-  done \
-else \
-  if [ "$WITH_FAKE_BUILDID" = "true" ] ; then \
-    go install $BUILDFLAGS -ldflags "-B 0x$(head -c20 /dev/urandom | od -An 
-tx1 | tr -d ' \\n')" $IMPORTPATH \
-  else \
-    go install $BUILDFLAGS $IMPORTPATH \
-  fi \
-fi \
-%{nil}
+%gobuild /usr/lib/rpm/golang-macros.rb --build 
 
 # Install all compiled packages and binaries to the buildroot
-%goinstall() \
-export GOPATH=%{_builddir}/go \
-install -d %{buildroot}%{go_contribdir} \
-TMPPKG=%{_builddir}/go/pkg \
-if [ "$(ls -A $TMPPKG)" ]; then \
-       cp -ar %{_builddir}/go/pkg/linux_%{go_arch}/* 
%{buildroot}%{go_contribdir} \
-fi \
-TMPBIN=%{_builddir}/go/bin \
-if [ "$(ls -A $TMPBIN)" ]; then \
-     install -m755 $TMPBIN/* %{buildroot}%{_bindir} \
-fi \
-%{nil}
-
-%gofix() \
-export GOPATH=%{_builddir}/go \
-if [ %# -eq 0 ]; then \
-  echo "gofix: please specify a valid importpath, see: go help fix" \
-  exit 1 \
-else \
-  go fix %1... \
-fi \
-%{nil}
-
-%gotest() \
-export GOPATH=%{_builddir}/go:%{_libdir}/go/contrib  \
-if [ %# -eq 0 ]; then \
-  echo "gotest: please specify a valid importpath, see: go help test" \
-  exit 1 \
-else \
-  go test -x %1... \
-fi \
-%{nil}
-
-%gosrc() \
-install -d %{buildroot}%{go_contribsrcdir} \
-cd %{_builddir}/go/src \
-find . -name "*.go" -exec install -Dm644 \{\} 
%{buildroot}%{go_contribsrcdir}/\{\} \\; \
-%{nil}
+%goinstall /usr/lib/rpm/golang-macros.rb --install
+
+%gofix /usr/lib/rpm/golang-macros.rb --fix
+
+%gotest /usr/lib/rpm/golang-macros.rb --test
+
+%gosrc /usr/lib/rpm/golang-macros.rb --source
 
 # Template for source sub-package
 %gosrc_package(n:r:) \


Reply via email to