Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1965292

Summary: go-srpm-macros on RHEL 9 should contain %gobuild and %gotest macros with hardening flags
Product: Red Hat Enterprise Linux 9 Reporter: Andreas Gerstmayr <agerstmayr>
Component: go-rpm-macrosAssignee: Alejandro Sáez Morollón <asm>
Status: CLOSED ERRATA QA Contact: Edjunior Barbosa Machado <emachado>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: asm, dbenoit, emachado, maxwell
Target Milestone: betaKeywords: Bugfix, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: go-rpm-macros-3.2.0-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:41:33 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 Andreas Gerstmayr 2021-05-27 11:40:24 UTC
Description of problem:
Since RHEL 8.4, go-srpm-macros contains the %gobuild and %gotest macros (see [bz 1916887]). However, on CentOS Stream / RHEL 9 the go-srpm-macros package does not contain these macros. Please add them there as well.

Version-Release number of selected component (if applicable):
go-srpm-macros-3.0.9-4.el9.rpm

How reproducible:
always

Steps to Reproduce:
1. dnf install -y go-srpm-macros
2. grep -R '%gobuild' /usr/lib/rpm/macros.d
3.

Actual results:
%gobuild and %gotest macros are not defined

Expected results:
%gobuild and %gotest macros are defined


Additional info:
I'm a bit confused regarding the packaging:

Fedora >= 31:
go-srpm-macros: contains other go macros
go-rpm-macros: contains %gobuild and %gotest macro

RHEL >= 8.4 < 9.0:
go-srpm-macros: contains %gobuild and %gotest macro
go-rpm-macros is not installable, but contains the go-srpm-macros subpackage

CentOS Stream/RHEL 9.0-beta:
go-srpm-macros: doesn't contain %gobuild and %gotest macro (this BZ)
go-rpm-macros is not installable, but contains the go-srpm-macros subpackage

For a package which should work on all distributions, I now always set go-srpm-macros as BuildRequires and conditionally on Fedora also go-rpm-macros. Is this the right way?

Comment 4 Alejandro Sáez Morollón 2022-11-23 13:29:57 UTC
The problem is related to where the macros are define. I just submitted a fix:

https://gitlab.com/redhat/centos-stream/rpms/go-rpm-macros/-/merge_requests/11


> For a package which should work on all distributions, I now always set
> go-srpm-macros as BuildRequires and conditionally on Fedora also
> go-rpm-macros. Is this the right way?

Yes, that's the right way. The upstream project used to be go-srpm-macros but now it is go-rpm-macros. RHEL still uses the go-srpm-macros reference but ships the new version.
RHEL 8 in particular ships a small version of the macros, and RHEL 9 only one of the files that the upstream project creates. The upstream project defines those two macros in a different file, hence the lack of them.

Comment 7 Maxwell G 2022-11-23 20:07:24 UTC
%gobuild and %gotest are defined in go-rpm-macros in RHEL 9. On RHEL 8, they are defined in two packages for some reason (see below). The definitions are different and one overrides the other.

- go-srpm-macros: part of Appstream and included in the default buildroot. It does not depend on golang
- go-compilers-go-compilers: part of the go-compilers source package. In CRB.

Please do not add a second definition of %gobuild to go-srpm-macros in RHEL 9. The situation in RHEL 8 is confusing enough.

Comment 14 errata-xmlrpc 2023-05-09 07:41:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (go-rpm-macros bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2275