public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/fedora-release] f45: macros: add new distribution-specific macros for package configurations
@ 2026-08-10  9:35 Amit Shah
  0 siblings, 0 replies; only message in thread
From: Amit Shah @ 2026-08-10  9:35 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/fedora-release
            Branch : f45
            Commit : d2c6293787e19348cf630343f1be1d5c7af75d50
            Author : Amit Shah <amitshah@fedoraproject.org>
            Date   : 2022-07-27T19:11:51+02:00
            Stats  : +27/-3 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/fedora-release/c/d2c6293787e19348cf630343f1be1d5c7af75d50?branch=f45

            Log:
            macros: add new distribution-specific macros for package configurations

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.

Amazon Linux is a new downstream distribution of Fedora that will add
its own definitions as well, so consolidate all of these in a new macros
file.

The macros here have been tested with local builds of clang and gdb.
Once this change is merged, I will submit updates to a few packages.

As examples, this is how clang.spec and gdb.spec will look after this
change:

clang.spec:
```
@@ -358,7 +360,7 @@ CFLAGS="$CFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
        \
        -DCLANG_BUILD_EXAMPLES:BOOL=OFF \
        -DBUILD_SHARED_LIBS=OFF \
-       -DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \
+       -DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \
 %ifarch %{arm}
        -DCLANG_DEFAULT_LINKER=lld \
 %endif
```

gdb.spec:
```
-# Change the version that gets printed at GDB startup, so it is RH specific.
+# Change the version that gets printed at GDB startup, so it is distro-specific.
 cat > gdb/version.in << _FOO
-%if 0%{!?rhel:1}
-Fedora %{version}-%{release}
-%else # !0%{!?rhel:1}
-Red Hat Enterprise Linux %{version}-%{release}
-%endif # !0%{!?rhel:1}
+%{?dist_name} %{version}-%{release}
 _FOO

 # Remove the info and other generated files added by the FSF release
```

Signed-off-by: Amit Shah <amitshah@fedoraproject.org>

---
diff --git a/fedora-release.spec b/fedora-release.spec
index cde523c..b786e84 100644
--- a/fedora-release.spec
+++ b/fedora-release.spec
@@ -889,8 +889,28 @@ ln -s fedora-release %{buildroot}%{_sysconfdir}/system-release
   %global prerelease \ Prerelease
 %endif
 
+# -------------------------------------------------------------------------
+# Definitions for /etc/os-release and for macros in macros.dist.  These
+# macros are useful for spec files where distribution-specific identifiers
+# are used to customize packages.
+
+# Name of vendor / name of distribution. Typically used to identify where
+# the binary comes from in --help or --version messages of programs.
+# Examples: gdb.spec, clang.spec
+%global dist_vendor Fedora
+%global dist_name   Fedora Linux
+
+# URL of the homepage of the distribution
+# Example: gstreamer1-plugins-base.spec
+%global dist_home_url https://fedoraproject.org/
+
+# Bugzilla / bug reporting URLs shown to users.
+# Examples: gcc.spec
+%global dist_bug_report_url https://bugzilla.redhat.com/
+# -------------------------------------------------------------------------
+
 cat << EOF >> os-release
-NAME="Fedora Linux"
+NAME="%{dist_name}"
 VERSION="%{dist_version} (%{release_name}%{?prerelease})"
 ID=fedora
 VERSION_ID=%{dist_version}
@@ -900,10 +920,10 @@ PRETTY_NAME="Fedora Linux %{dist_version} (%{release_name}%{?prerelease})"
 ANSI_COLOR="0;38;2;60;110;180"
 LOGO=fedora-logo-icon
 CPE_NAME="cpe:/o:fedoraproject:fedora:%{dist_version}"
-HOME_URL="https://fedoraproject.org/"
+HOME_URL="%{dist_home_url}"
 DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/%{doc_version}/system-administrators-guide/"
 SUPPORT_URL="https://ask.fedoraproject.org/"
-BUG_REPORT_URL="https://bugzilla.redhat.com/"
+BUG_REPORT_URL="%{dist_bug_report_url}"
 REDHAT_BUGZILLA_PRODUCT="Fedora"
 REDHAT_BUGZILLA_PRODUCT_VERSION=%{bug_version}
 REDHAT_SUPPORT_PRODUCT="Fedora"
@@ -1185,6 +1205,10 @@ cat >> %{buildroot}%{_rpmconfigdir}/macros.d/macros.dist << EOF
 %%fc%{dist_version}                1
 %%dist                %%{!?distprefix0:%%{?distprefix}}%%{expand:%%{lua:for i=0,9999 do print("%%{?distprefix" .. i .."}") end}}.fc%%{fedora}%%{?with_bootstrap:%{__bootstrap}}
 %endif
+%%dist_vendor         %{dist_vendor}
+%%dist_name           %{dist_name}
+%%dist_home_url       %{dist_home_url}
+%%dist_bug_report_url %{dist_bug_report_url}
 EOF
 
 # Install licenses

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10  9:35 [rpms/fedora-release] f45: macros: add new distribution-specific macros for package configurations Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox