From a502cccf64dac0b85d2f508f9b1e79dff7830ae7 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 28 Feb 2025 19:54:43 +0100 Subject: [PATCH 1/3] spec: Remove a condition that's always false The DNF plugin is never built on Fedora. Therefore, it's pointless to check for Fedora when building it. In the past, the DNF plugin used to be built on Fedora 29 to 32, and the libdnf plugin used to be built on Fedora 33 onwards. That's why it made sense to check for Fedora for the DNF plugin. However, that's no longer the case. Fallout from a0468a45999bc9cf988a59470219f4da73f0dfaa --- subscription-manager.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subscription-manager.spec b/subscription-manager.spec index a4e7afcb70..3538b39394 100644 --- a/subscription-manager.spec +++ b/subscription-manager.spec @@ -258,7 +258,7 @@ e.g. microdnf. %package -n dnf-plugin-subscription-manager Summary: Subscription Manager plugins for DNF -%if (0%{?fedora} || 0%{?rhel}) +%if 0%{?rhel} BuildRequires: cmake BuildRequires: gcc BuildRequires: json-c-devel From c8190e9874d6e135f6d2dc09753ad65d56518fae Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 14 Feb 2025 15:12:12 +0100 Subject: [PATCH 2/3] spec: Avoid DNF warnings on traditional Fedora hosts and DNF on atomics It will be good to make it easier to have gratis, self-supported Red Hat Enterprise Linux OCI containers on Fedora Silverblue and Workstation through the RHEL Developer Suite subscription [1]. This includes Toolbx containers created with: $ toolbox create --distro rhel --release 9.5 However, when subscription-manager was installed on a Fedora host with DNF4, the subscription-manager DNF plugin printed some spurious warning messages that users didn't like because it made them think that something is wrong. eg., when the host is unregistered: $ sudo dnf update Updating Subscription Management repositories. Unable to read consumer identity This system is not registered with an entitlement server. You can use subscription-manager to register. Last metadata expiration check: ... Or, when the host has been registered: $ sudo dnf update Updating Subscription Management repositories. This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions. Last metadata expiration check: ... These warnings have no relevance in Fedora, because the purpose of using subscription-manager(8) on a Fedora host is to access RHEL content in OCI containers. There is no need for RHEL content on the Fedora host itself. Note that these warnings aren't visible on Fedora hosts with DNF5 because the subscription-manager plugin doesn't work with it. Secondly, until now, subscription-manager had %{_bindir}/dnf-3 and %{_bindir}/dnf4 in its dependency chain. This meant that installing subscription-manager on Fedora Silverblue pulled them in, even though those executables shouldn't be present on Silverblue because they don't work there. Both these problems can be addressed by disabling the DNF and libdnf plugins on Fedora. [1] https://developers.redhat.com/blog/2016/03/31/no-cost-rhel-developer-subscription-now-available https://bugzilla.redhat.com/show_bug.cgi?id=2246833 https://bugzilla.redhat.com/show_bug.cgi?id=2262228 --- subscription-manager.spec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/subscription-manager.spec b/subscription-manager.spec index 3538b39394..28440636bc 100644 --- a/subscription-manager.spec +++ b/subscription-manager.spec @@ -6,8 +6,10 @@ # Plugin for container (docker, podman) is not supported on RHEL %if 0%{?rhel} %global use_container_plugin 0 +%global use_dnf 1 %else %global use_container_plugin 1 +%global use_dnf 0 %endif %global dmidecode_arches %{ix86} x86_64 aarch64 @@ -23,8 +25,7 @@ %global use_inotify 0 %endif -%global use_dnf (0%{?fedora} || (0%{?rhel})) -%global create_libdnf_rpm (0%{?fedora} || 0%{?rhel} > 8) +%global create_libdnf_rpm (0%{?rhel} > 8) %global python_sitearch %python3_sitearch %global python_sitelib %python3_sitelib @@ -96,7 +97,7 @@ Name: subscription-manager Version: 1.30.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tools and libraries for subscription and repository management %if 0%{?suse_version} Group: Productivity/Networking/System @@ -161,6 +162,7 @@ Requires: platform-python-setuptools %endif %if %{use_dnf} + %if %{create_libdnf_rpm} Requires: python3-dnf Requires: python3-dnf-plugins-core @@ -174,6 +176,12 @@ Obsoletes: dnf-plugin-subscription-manager < 1.29.0 %else Requires: dnf-plugin-subscription-manager = %{version}-%{release} %endif + +%else + +Obsoletes: dnf-plugin-subscription-manager < 1.30.5-2 +Obsoletes: libdnf-plugin-subscription-manager < 1.30.5-2 + %endif %if %use_inotify From 682e5d9fd7e8d15c251657bac4caf263b433ef33 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Mon, 3 Mar 2025 20:18:25 +0100 Subject: [PATCH 3/3] spec: Make the Fedora build flags more explicit than non-RHEL A lot of different downstream distributions are supported by subscription-manager.spec. For example, Fedora, RHEL and the SUSE family. Representing Fedora as merely non-RHEL can lead to surprises when dealing with RHEL clones or other Fedora derivatives, or when refactoring the code. It's better to be explicit about Fedora because the build flags were carefully and consciously chosen for it, and any inadvertent change would be harmful. --- subscription-manager.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subscription-manager.spec b/subscription-manager.spec index 28440636bc..d7ce946da8 100644 --- a/subscription-manager.spec +++ b/subscription-manager.spec @@ -7,6 +7,9 @@ %if 0%{?rhel} %global use_container_plugin 0 %global use_dnf 1 +%elif 0%{?fedora} +%global use_container_plugin 1 +%global use_dnf 0 %else %global use_container_plugin 1 %global use_dnf 0