Update to 3.2.0
Add add-gobuild-and-gotest.patch Resolves: rhbz#1965292
This commit is contained in:
parent
55eae0128d
commit
08fa4220c4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/go-rpm-macros-3.0.8.tar.gz
|
||||
/go-rpm-macros-3.0.9.tar.gz
|
||||
/golist-0.10.1.tar.gz
|
||||
/go-rpm-macros-3.2.0.tar.gz
|
||||
|
32
add-gobuild-and-gotest.patch
Normal file
32
add-gobuild-and-gotest.patch
Normal file
@ -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,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: 10%{?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}
|
||||
@ -242,6 +250,11 @@ sed -i "s,golist,%{golist_execdir}/golist,g" %{buildroot}%{_bindir}/go-rpm-integ
|
||||
%{_spectemplatedir}/*.spec
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
2
sources
2
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (go-rpm-macros-3.2.0.tar.gz) = 5d1a7773c0044b3046d6c0006b8aae441b17a52a79b65b3a704619433b1ed27cd59972703ba4cba17ec3f15755d7d81ae99401a7daac2217c3e58adb360a91c7
|
||||
SHA512 (golist-0.10.1.tar.gz) = ba4ac34b635399c4234079f05de0c160fdb7144908d2f569ff6426f68ef05fcb3660431681a0d9d327907adedb94e952fb5246d591d39c80f3077a40171ab604
|
||||
SHA512 (go-rpm-macros-3.0.9.tar.gz) = 6cb9fe5b69038e0917b11e9f2ae025c2d91860a37e76f57ea8f3786b3fb51e4ef8764eb12a8dc8a123b31ddb1100bd3dd67ed75457b2f44b15b8b65f0831912a
|
||||
|
@ -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,11 +20,11 @@ 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:-}" -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}
|
||||
|
||||
@ -24,27 +33,32 @@ index b0ab4c4..942549f 100644
|
||||
|
||||
# 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}'" %{?**};
|
||||
+
|
||||
%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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user