Escape quotation marks in gobuildflags

Resolves: rhbz#1988717
This commit is contained in:
David Benoit 2021-08-03 23:39:14 -04:00
parent 17789f3a74
commit a7e920b5bf
No known key found for this signature in database
GPG Key ID: 58EDBABB7196BDD3
2 changed files with 10 additions and 5 deletions

View File

@ -20,7 +20,7 @@ Version: 3.0.9
ExclusiveArch: %{golang_arches} %{gccgo_arches}
Name: go-rpm-macros
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Build-stage rpm automation for Go packages
License: GPLv3+
@ -191,6 +191,10 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
%dir %{_spectemplatedir}
%changelog
* Wed Aug 03 2021 David Benoit <dbenoit@redhat.com> 3.0.9-7
- Escape quotation marks in gobuildflags
- Resolves: rhbz#1988717
* Tue Jul 27 2021 David Benoit <dbenoit@redhat.com> 3.0.9-6
- Remove arch conditional on gocompilerflags
- Related: rhbz#1982298

View File

@ -195,7 +195,7 @@ index 457b8f1..d650b26 100644
}
+
diff --git a/rpm/macros.d/macros.go-compilers-golang b/rpm/macros.d/macros.go-compilers-golang
index b0ab4c4..49bf9b6 100644
index b0ab4c4..942549f 100644
--- a/rpm/macros.d/macros.go-compilers-golang
+++ b/rpm/macros.d/macros.go-compilers-golang
@@ -20,6 +20,8 @@
@ -207,12 +207,13 @@ index b0ab4c4..49bf9b6 100644
# This *must* be all on one line, as it will be used in shell
# assignments. eg
#
@@ -29,22 +31,32 @@
@@ -29,22 +31,33 @@
#
# %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() %{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
@ -220,7 +221,7 @@ index b0ab4c4..49bf9b6 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}
+%_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://bugzilla.redhat.com/show_bug.cgi?id=995136#c12