Bug 2227331

Summary: %gobuild macro doesn't include BUILDTAGS support
Product: Red Hat Enterprise Linux 8 Reporter: Lokesh Mandvekar <lsm5>
Component: go-srpm-macrosAssignee: David Benoit <dbenoit>
Status: CLOSED MIGRATED QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, jwboyer, sipoyare
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-22 17:07:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lokesh Mandvekar 2023-07-28 17:50:39 UTC
This bug was initially created as a copy of Bug #2227328

I am copying this bug because: 



Description of problem:

%gobuild macro on c8s does not include `BUILDTAGS` in its definition. This needs us to redefine gobuild on container-tools packages to get c8s builds to pass.
See: https://github.com/containers/podman/blob/main/rpm/podman.spec#L10-L15


Also, see the %gobuild defs on Fedora v/s C8S



On C9S
# rpm --eval %gobuild

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 ;


On Fedora:
$ rpm --eval %gobuild

  # https://pagure.io/go-rpm-macros/pull-request/38
  # Most of the default LDFLAGS for Fedora are not supported so we don't want
  # LDFLAGS to be automatically initialized with the Fedora flags.
  
  # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
     GO111MODULE=off \
  go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}  -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -compressdwarf=false -linkmode=external -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1   '" -a -v -x ;

Comment 1 Lokesh Mandvekar 2023-07-28 19:30:48 UTC
It would be nice to have `go-srpm-macros` also include a `Provides: go-rpm-macros` for consistency with Fedora and c9s.

Comment 2 RHEL Program Management 2023-09-22 17:06:00 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 3 RHEL Program Management 2023-09-22 17:07:37 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.