Bug 2112392

Summary: macros: add new distribution-specific macros for package configurations
Product: Red Hat Enterprise Linux 9 Reporter: Amit Shah <amit>
Component: redhat-releaseAssignee: Stephen Gallagher <sgallagh>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: amit, amitshah, awalsh, bstinson, ffan, fweimer, idiez, jiyin, jwboyer, libhe, lisas, mmalik, omejzlik, pholica, pifang, ppisar, rduda, sgallagh, tpopela, vdoubkov, xiawu, xiliang, yalzhang, yanghliu, yoguo, zguo
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: redhat-release-9.2-0.8.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:55:29 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 Amit Shah 2022-07-29 15:08:49 UTC
Description of problem:

Define macros for commonly-used strings/urls to distinguish
distributions. Spec files have lots of `%{?fedora:}` and `%{?rhel}`
conditionals which can be defined in one place.

A commit was recently merged to Fedora: 
https://src.fedoraproject.org/rpms/fedora-release/pull-request/223

For changes using those values to actually work, the existing downstreams of Fedora that define %rhel need to add these.

This bz is to track changes in centos-release in Centos Stream.

A similar change will have to be made to redhat-release as well in RHEL sources.  (I do not have access to rhel sources, so this will need to be done by someone else.)

The main benefit of this change is to consolidate spec files and reduce customizations.

Examples where this change will benefit are in gdb.spec, elfutils.spec, clang.spec, gcc.spec.

Note: The component list does not have a 'centos-release' package, so I'm selecting redhat-release here.

Comment 1 Amit Shah 2022-07-29 15:10:33 UTC
The commit intended for CentOS is https://gitlab.com/amitshah/centos-release/-/commit/a16382bdea9c554741a63a4fb2b1f4a685422073.

Comment 5 Pavel Holica 2022-09-22 11:53:21 UTC
I've tried to verify the fix with redhat-release-9.2-0.5.el9, however, I've hit an issue while evaluating dist_debuginfod_url as it's not substituted in RHEL.

# rpm -E '%{dist_vendor}'
Red Hat, Inc.
# rpm -E '%{dist_name}'
Red Hat Enterprise Linux
# rpm -E '%{dist_home_url}'
https://www.redhat.com/
# rpm -E '%{dist_bug_report_url}'
https://bugzilla.redhat.com/
# rpm -E '%{dist_debuginfod_url}'
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.

# cat /usr/lib/rpm/macros.d/macros.dist
# dist macros.

%rhel 9
%__bootstrap         ~bootstrap
%dist %{!?distprefix0:%{?distprefix}}%{expand:%{lua:for i=0,9999 do print("%{?distprefix" .. i .."}") end}}.el9%{?distsuffix}%{?with_bootstrap:~bootstrap}
%el9 1
%dist_vendor         Red Hat, Inc.
%dist_name           Red Hat Enterprise Linux
%dist_home_url       https://www.redhat.com/
%dist_bug_report_url https://bugzilla.redhat.com/
%dist_debuginfod_url %{dist_debuginfod_url}

Comment 8 amitshah 2022-09-24 12:09:40 UTC
Thanks, Florian and Stephen pushing this through!  I owe you some beers :)

Pavel - I believe the lack of the dist_debuginfod_url macro in RHEL is expected -- according to the discussion in https://src.fedoraproject.org/rpms/elfutils/pull-request/9#comment-111860 CentOS and Fedora have a debuginfod server, and the macro is expected to be set there; but RHEL does not have one.

I suppose your test should confirm that this macro isn't set in RHEL -- just to ensure one doesn't sneak in by accident.

Comment 11 Pavel Holica 2022-10-20 11:28:31 UTC
Unfortuantely, is seem that this is still not implemented properly as we're hitting now following error when rpm is used:
error: /usr/lib/rpm/macros.d/macros.dist: line 11: Macro %dist_debuginfod_url has empty body

Moving back to assigned, please fix this.

Comment 12 Pavel Holica 2022-10-20 11:29:35 UTC
*** Bug 2136410 has been marked as a duplicate of this bug. ***

Comment 15 Panu Matilainen 2022-10-26 05:40:43 UTC
*** Bug 2137741 has been marked as a duplicate of this bug. ***

Comment 16 Michal Domonkos 2022-10-26 07:47:16 UTC
*** Bug 2137757 has been marked as a duplicate of this bug. ***

Comment 17 Pavel Holica 2022-10-31 06:39:15 UTC
*** Bug 2138300 has been marked as a duplicate of this bug. ***

Comment 22 Pavel Holica 2022-11-01 06:38:14 UTC
*** Bug 2139025 has been marked as a duplicate of this bug. ***

Comment 24 Pavel Holica 2022-11-02 06:28:17 UTC
*** Bug 2139157 has been marked as a duplicate of this bug. ***

Comment 25 Pavel Holica 2022-11-02 07:23:40 UTC
*** Bug 2139311 has been marked as a duplicate of this bug. ***

Comment 26 Pavel Holica 2022-11-09 07:05:44 UTC
*** Bug 2141059 has been marked as a duplicate of this bug. ***

Comment 30 errata-xmlrpc 2023-05-09 07:55:29 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 (redhat-release 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:2455