import go-rpm-macros-3.2.0-1.el9

i9c changed/i9c/go-rpm-macros-3.2.0-1.el9
MSVSphere Packaging Team 2 years ago
parent 987caf4c7f
commit 3032261e4b

2
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/go-rpm-macros-3.0.9.tar.gz
SOURCES/go-rpm-macros-3.2.0.tar.gz
SOURCES/golist-0.10.1.tar.gz

@ -1,2 +1,2 @@
013899032cc1bcad52bb1fd4effe383e2afb7105 SOURCES/go-rpm-macros-3.0.9.tar.gz
0d0704c603edceb886cb94c588ed61179a5760e6 SOURCES/go-rpm-macros-3.2.0.tar.gz
bf428b2ba15f68df39e3da7647ccfdeb8beedd3b SOURCES/golist-0.10.1.tar.gz

@ -0,0 +1,32 @@
From 1001f5a99439556c5ad3efe6045923e985a52f82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Wed, 23 Nov 2022 13:43:23 +0100
Subject: [PATCH] Add %gobuild and %gotest
Both macros are define in rpm/macros.d/macros.go-compilers-gcc.
CentOS Stream 9 go-srpm-macros discards that file and only installs rpm/macros.d/macros.go-srpm.
This commit adds %gobuild and %gotest to rpm/macros.d/macros.go-srpm with the same options that RHEL 8 uses.
---
rpm/macros.d/macros.go-srpm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm
index a46f81f..05cd6c9 100644
--- a/rpm/macros.d/macros.go-srpm
+++ b/rpm/macros.d/macros.go-srpm
@@ -202,3 +202,11 @@ local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
local verbose = (rpm.expand("%{-v}") ~= "")
go.files("alt", suffix, processall, verbose)
}
+
+# Define commands for building
+# BUILD_ID can be generated for golang build no matter of debuginfo
+%gobuild(o:) \
+CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie '-tags=rpm_crashtraceback libtrust_openssl ' -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\
+
+# Define commands for testing
+%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};
--
2.38.1

@ -1,5 +1,14 @@
From c05378a9d5d7ceb0fef2a915df9b88750685a3a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Thu, 24 Nov 2022 15:05:06 +0100
Subject: [PATCH] Update default gobuild args
---
rpm/macros.d/macros.go-compilers-golang | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/rpm/macros.d/macros.go-compilers-golang b/rpm/macros.d/macros.go-compilers-golang
index b0ab4c4..942549f 100644
index 74428a3..8cee8e2 100644
--- a/rpm/macros.d/macros.go-compilers-golang
+++ b/rpm/macros.d/macros.go-compilers-golang
@@ -20,6 +20,8 @@
@ -11,40 +20,45 @@ index b0ab4c4..942549f 100644
# This *must* be all on one line, as it will be used in shell
# assignments. eg
#
@@ -29,22 +31,33 @@
@@ -29,13 +31,16 @@
#
# %make GOBUILDFLAGS="%gobuildflags"
#
-%gobuildflags() %{expand:%{gocompilerflags} -tags=\\"rpm_crashtraceback \\" -ldflags \\"${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'\\" -a -v -x}
+%gobuildflags() %{expand:%{gocompilerflags} -tags=\\"rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl\\" -ldflags \\"-linkmode=external -compressdwarf=false ${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'\\" -a -v -x}
+%_gobuildflags_internal() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x}
-%gobuildflags() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -compressdwarf=false -linkmode=external -extldflags '%{build_ldflags} %{?__golang_extldflags}'" -a -v -x}
+%gobuildflags() %{expand:%{gocompilerflags} -tags=\\"rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl\\" -ldflags \\"-linkmode=external -compressdwarf=false ${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'\\" -a -v -x}
+%_gobuildflags_internal() %{expand:%{gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-} libtrust_openssl" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} %{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x}
# Turn off Go modules
%gomodulesmode GO111MODULE=off
# Define commands for building
# BUILD_ID can be generated for golang build no matter of debuginfo
+
+%_gobuild_cmd CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build %{_gobuildflags_internal}
+%gobuild_compat_el8(o:) %{expand:%{_gobuild_cmd} %{?**};}
%gobuild(o:) %{expand:
# https://pagure.io/go-rpm-macros/pull-request/38
# Most of the default LDFLAGS for Fedora are not supported so we don't want
@@ -44,14 +49,16 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
%global _dwz_low_mem_die_limit 0
%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
- go build %{?gocompilerflags} -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**};
- go build %{gobuildflags} %{?**};
+ %{_gobuild_cmd} %{?**};
}
${workroot}${GOPATH:+:${GOPATH}}
# Define commands for testing
%gotestflags %{gocompilerflags}
%gotestextldflags %__global_ldflags %{?__golang_extldflags}
-%gotest() %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};
+
+%_gotest_cmd %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'"
%gotestextldflags %{build_ldflags} %{?__golang_extldflags}
-%gotest() %{expand:
- %undefine _auto_set_build_flags
- %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};
+%_gotest_cmd %{?gomodulesmode} go test %{gotestflags} -ldflags "${LDFLAGS:-} %{?currentgoldflags} -extldflags '%{gotestextldflags}'"
+%gotest_compat_el8(o:) %{expand:%{_gotest_cmd} %{?**};}
+%gotest(o:) %{expand:
+ %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} %{?gomodulesmode} \\
+ %{_gotest_cmd} %{?**};
+}
+
}
--
2.38.1

@ -1,5 +1,5 @@
%global forgeurl https://pagure.io/go-rpm-macros
Version: 3.0.9
Version: 3.2.0
%forgemeta
#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51
@ -35,7 +35,7 @@ Version: 3.0.9
ExclusiveArch: %{golang_arches} %{gccgo_arches}
Name: go-rpm-macros
Release: 9%{?dist}
Release: 1%{?dist}
Summary: Build-stage rpm automation for Go packages
License: GPLv3+
@ -74,6 +74,12 @@ Patch0: update-default-gobuild-args.patch
# without dependencies.
Patch1: golist-bootstrap-cli-no-vendor.patch
# RHEL 8 only provides the macros.go-srpm file which includes gobuild and gotest.
# C9S also only provides the macros.go-srpm file but it also follows upstream which includes gobuild and gotest in the macros.go-compilers-gcc.
# For a simple fix, this patch ports both RHEL 8 macros to macros.go-srpm.
# Resolves: rhbz#1965292
Patch2: add-gobuild-and-gotest.patch
%description
This package provides build-stage rpm automation to simplify the creation of Go
language (golang) packages.
@ -148,6 +154,8 @@ if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
fi
%endif
%patch2 -p1
%build
# build golist
%if 0%{?bundle_golist}
@ -245,6 +253,15 @@ sed -i "s,golist,%{golist_execdir}/golist,g" %{buildroot}%{_bindir}/go-rpm-integ
* Wed Mar 15 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 3.0.9-9
- Rebuilt for MSVSphere 9.1.
* Wed Nov 23 2022 Alejandro Sáez <asm@redhat.com> - 3.2.0-1
- Update to 3.2.0
- Add add-gobuild-and-gotest.patch
- Resolves: rhbz#1965292
* Wed Jan 26 2022 Alejandro Sáez <asm@redhat.com> - 3.0.9-10
- Fix typos in update-default-gobuild-args.patch
- Related: rhbz#2043107
* Tue Jan 18 2022 David Benoit <dbenoit@redhat.com> 3.0.9-9
- Delete remove-fedora-dependency-automation.patch
- Bundle golist in /usr/libexec

Loading…
Cancel
Save