From e415540e20de8813197a983bd9e545886f5b73d3 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 17 May 2022 22:07:00 +0300 Subject: [PATCH] AlmaLinux changes --- SOURCES/subscription-manager-debrand.patch | 22 ++++++++ ...scription-manager-remove-redhat.repo.patch | 16 ++++++ SOURCES/use-almalinux-syspurposes.patch | 20 ++++++++ SPECS/subscription-manager.spec | 50 ++++++++++++++++--- 4 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 SOURCES/subscription-manager-debrand.patch create mode 100644 SOURCES/subscription-manager-remove-redhat.repo.patch create mode 100644 SOURCES/use-almalinux-syspurposes.patch diff --git a/SOURCES/subscription-manager-debrand.patch b/SOURCES/subscription-manager-debrand.patch new file mode 100644 index 0000000..cad4db3 --- /dev/null +++ b/SOURCES/subscription-manager-debrand.patch @@ -0,0 +1,22 @@ +diff -Naur subscription-manager-1.27.18.orig/etc-conf/subscription-manager-cockpit.desktop.in subscription-manager-1.27.18.debrand/etc-conf/subscription-manager-cockpit.desktop.in +--- subscription-manager-1.27.18.orig/etc-conf/subscription-manager-cockpit.desktop.in 2021-02-18 05:55:39.035895432 +0300 ++++ subscription-manager-1.27.18.debrand/etc-conf/subscription-manager-cockpit.desktop.in 2021-03-24 00:43:45.609663355 +0300 +@@ -1,5 +1,5 @@ + [Desktop Entry] +-_Name=Red Hat Subscription Manager ++_Name=Subscription Manager + Icon=subscription-manager + Type=Application + TryExec=/usr/libexec/cockpit-desktop +diff -Naur subscription-manager-1.27.18.orig/src/subscription_manager/repolib.py subscription-manager-1.27.18.debrand/src/subscription_manager/repolib.py +--- subscription-manager-1.27.18.orig/src/subscription_manager/repolib.py 2021-02-18 05:55:38.973062531 +0300 ++++ subscription-manager-1.27.18.debrand/src/subscription_manager/repolib.py 2021-03-24 00:44:17.617615991 +0300 +@@ -87,7 +87,7 @@ + @staticmethod + def warning_message(enabled_yum_plugins): + message = _('The yum/dnf plugins: %s were automatically enabled for the benefit of ' +- 'Red Hat Subscription Management. If not desired, use ' ++ 'Subscription Management. If not desired, use ' + '"subscription-manager config --rhsm.auto_enable_yum_plugins=0" to ' + 'block this behavior.') % ', '.join(enabled_yum_plugins) + return message diff --git a/SOURCES/subscription-manager-remove-redhat.repo.patch b/SOURCES/subscription-manager-remove-redhat.repo.patch new file mode 100644 index 0000000..0001d86 --- /dev/null +++ b/SOURCES/subscription-manager-remove-redhat.repo.patch @@ -0,0 +1,16 @@ +diff -Nurp subscription-manager-1.27.11.orig/src/subscription_manager/repofile.py subscription-manager-1.27.11/src/subscription_manager/repofile.py +--- subscription-manager-1.27.11.orig/src/subscription_manager/repofile.py 2020-07-28 11:06:10.000000000 -0500 ++++ subscription-manager-1.27.11/src/subscription_manager/repofile.py 2020-08-05 16:48:00.911709258 -0500 +@@ -368,11 +368,7 @@ class RepoFileBase(object): + Try to create new repo file. + :return: None + """ +- self.create_dir_path() +- if self.path_exists(self.path) or not self.manage_repos: +- return +- with open(self.path, 'w') as f: +- f.write(self.REPOFILE_HEADER) ++ pass + + def fix_content(self, content): + return content diff --git a/SOURCES/use-almalinux-syspurposes.patch b/SOURCES/use-almalinux-syspurposes.patch new file mode 100644 index 0000000..2cfced4 --- /dev/null +++ b/SOURCES/use-almalinux-syspurposes.patch @@ -0,0 +1,20 @@ +diff --git a/etc-conf/syspurpose/valid_fields.json b/etc-conf/syspurpose/valid_fields.json +index 1ac7ea0e..305ec4b9 100644 +--- a/etc-conf/syspurpose/valid_fields.json ++++ b/etc-conf/syspurpose/valid_fields.json +@@ -1,12 +1,10 @@ + { + "role": [ +- "Red Hat Enterprise Linux Server", +- "Red Hat Enterprise Linux Workstation", +- "Red Hat Enterprise Linux Compute Node" ++ "AlmaLinux Server", ++ "AlmaLinux Workstation", ++ "AlmaLinux Compute Node" + ], + "service_level_agreement": [ +- "Premium", +- "Standard", + "Self-Support" + ], + "usage": [ diff --git a/SPECS/subscription-manager.spec b/SPECS/subscription-manager.spec index b1571cc..fb606ca 100644 --- a/SPECS/subscription-manager.spec +++ b/SPECS/subscription-manager.spec @@ -2,6 +2,7 @@ # but the same versions apply at the moment. %global has_ostree 0%{?suse_version} == 0 %global use_inotify 1 +%global dist %{?dist}.alma # Plugin for container (docker, podman) is not supported on RHEL %if 0%{?rhel} @@ -27,7 +28,7 @@ %global use_dnf (0%{?fedora} || (0%{?rhel})) %global create_libdnf_rpm (0%{?fedora} || 0%{?rhel} > 8) -%global use_cockpit 0%{?fedora} || 0%{?rhel} +%global use_cockpit 0 %global python_sitearch %python3_sitearch %global python_sitelib %python3_sitelib @@ -133,6 +134,12 @@ Source0: %{name}-%{version}.tar.gz Source1: %{name}-cockpit-%{version}.tar.gz %endif +# AlmaLinux patches +Patch100: use-almalinux-syspurposes.patch +Patch101: subscription-manager-remove-redhat.repo.patch +Patch102: subscription-manager-debrand.patch + + # Especially for the OpenSuse Build Service we need to have another lint config %if 0%{?suse_version} Source2: subscription-manager-rpmlintrc @@ -236,6 +243,12 @@ Obsoletes: rhsm-gtk <= %{version}-%{release} Obsoletes: subscription-manager-plugin-container <= %{version} %endif +# AlmaLinux do not provide the following packages no more +Obsoletes: subscription-manager-cockpit +Obsoletes: subscription-manager-initial-setup-addon +Obsoletes: rhsm-gtk +Obsoletes: rhsm-icons + %if %{use_dnf} %if %{create_libdnf_rpm} # The libdnf plugin is in separate RPM, but shubscription-manager should be dependent @@ -251,7 +264,7 @@ Obsoletes: %{py_package_prefix}-syspurpose <= %{version} %description The Subscription Manager package provides programs and libraries to allow users -to manage subscriptions and yum repositories from the Red Hat entitlement +to manage subscriptions and yum repositories from the EL entitlement platform. @@ -348,7 +361,7 @@ the remote in the currently deployed .origin file. %package -n %{rhsm_package_name} -Summary: A Python library to communicate with a Red Hat Unified Entitlement Platform +Summary: A Python library to communicate with Unified Entitlement Platform %if 0%{?suse_version} Group: Development/Libraries/Python %else @@ -372,13 +385,13 @@ Provides: python-rhsm = %{version}-%{release} Obsoletes: python-rhsm <= 1.20.3-1 %description -n %{rhsm_package_name} -A small library for communicating with the REST interface of a Red Hat Unified +A small library for communicating with the REST interface of Unified Entitlement Platform. This interface is used for the management of system entitlements, certificates, and access to content. %package -n subscription-manager-rhsm-certificates -Summary: Certificates required to communicate with a Red Hat Unified Entitlement Platform +Summary: Certificates required to communicate with Unified Entitlement Platform %if 0%{?suse_version} Group: Development/Libraries/Python %else @@ -389,7 +402,7 @@ Obsoletes: python-rhsm-certificates <= 1.20.3-1 %description -n subscription-manager-rhsm-certificates This package contains certificates required for communicating with the REST interface -of a Red Hat Unified Entitlement Platform, used for the management of system entitlements +of Unified Entitlement Platform, used for the management of system entitlements and to receive access to content. %if %use_cockpit @@ -411,7 +424,7 @@ Subscription Manager Cockpit UI %if %{use_rhsm_icons} %package -n rhsm-icons -Summary: Icons for Red Hat Subscription Management client tools +Summary: Icons for Subscription Management client tools License: GPLv2 BuildArch: noarch @@ -426,7 +439,7 @@ Conflicts: subscription-manager-cockpit < 1.26.7 %description -n rhsm-icons This package contains the desktop icons for the graphical interfaces provided for management -of Red Hat subscriptions: subscription-manager-gui, subscription-manager-cockpit-plugin. +of subscriptions: subscription-manager-gui, subscription-manager-cockpit-plugin. %endif @@ -450,6 +463,9 @@ cloud metadata and signatures. %prep %setup -q +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 %build make -f Makefile VERSION=%{version}-%{release} CFLAGS="%{optflags}" \ @@ -501,7 +517,9 @@ desktop-file-validate %{buildroot}/usr/share/applications/subscription-manager-c # fake out the redhat.repo file %if %{use_dnf} mkdir %{buildroot}%{_sysconfdir}/yum.repos.d + %if %{undefined almalinux_ver} touch %{buildroot}%{_sysconfdir}/yum.repos.d/redhat.repo + %endif %endif # fake out the certificate directories @@ -511,13 +529,19 @@ mkdir -p %{buildroot}%{_sysconfdir}/pki/entitlement %if %{use_container_plugin} # Setup cert directories for the container plugin: mkdir -p %{buildroot}%{_sysconfdir}/docker/certs.d/ +%if %{undefined almalinux_ver} mkdir %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com install -m 644 %{_builddir}/%{buildsubdir}/etc-conf/redhat-entitlement-authority.pem %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt %endif +%endif +%if %{undefined almalinux_ver} mkdir -p %{buildroot}%{_sysconfdir}/etc/rhsm/ca install -m 644 %{_builddir}/%{buildsubdir}/etc-conf/redhat-entitlement-authority.pem %{buildroot}/%{_sysconfdir}/rhsm/ca/redhat-entitlement-authority.pem install -m 644 %{_builddir}/%{buildsubdir}/etc-conf/redhat-uep.pem %{buildroot}/%{_sysconfdir}/rhsm/ca/redhat-uep.pem +%else +rm %{buildroot}/%{_sysconfdir}/rhsm/ca/redhat-entitlement-authority.pem +%endif %if %use_cockpit # install cockpit dist targz @@ -526,6 +550,9 @@ install -m 644 %{_builddir}/%{buildsubdir}/etc-conf/redhat-uep.pem %{buildroot}/ # fix timestamps on our byte compiled files so they match across arches find %{buildroot} -name \*.py* -exec touch -r %{SOURCE0} '{}' \; +%if %{defined almalinux_ver} +sed -e '/^enabled=/ s/1/0/' -i %{buildroot}%{_sysconfdir}/dnf/plugins/subscription-manager.conf +%endif %if !0%{?suse_version} %py_byte_compile %{__python3} %{buildroot}%{rhsm_plugins_dir}/ @@ -718,10 +745,12 @@ find %{buildroot} -name \*.py* -exec touch -r %{SOURCE0} '{}' \; %{python_sitearch}/subscription_manager/plugin/container/__pycache__ %{python_sitearch}/subscription_manager/plugin/container/*.py* +%if %{undefined almalinux_ver} # Copying Red Hat CA cert into each directory: %attr(755,root,root) %dir %{_sysconfdir}/docker/certs.d/cdn.redhat.com %attr(644,root,root) %{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt %endif +%endif %if %has_ostree %files -n subscription-manager-plugin-ostree @@ -768,8 +797,10 @@ find %{buildroot} -name \*.py* -exec touch -r %{SOURCE0} '{}' \; %attr(755,root,root) %dir %{_sysconfdir}/rhsm %attr(755,root,root) %dir %{_sysconfdir}/rhsm/ca +%if %{undefined almalinux_ver} %attr(644,root,root) %{_sysconfdir}/rhsm/ca/redhat-entitlement-authority.pem %attr(644,root,root) %{_sysconfdir}/rhsm/ca/redhat-uep.pem +%endif %if %use_cockpit %files -n subscription-manager-cockpit @@ -866,6 +897,9 @@ rmdir %{python_sitearch}/subscription_manager-*-*.egg-info --ignore-fail-on-non- rm -f /var/lib/rhsm/cache/rhsm_icon.json %changelog +* Tue May 17 2022 Eduard Abdullin - 1.29.26-3.alma +- Debrand for AlmaLinux + * Wed Apr 13 2022 Christopher Snyder 1.29.26-3 - refresh: clear also the release status (ptoscano@redhat.com) - 2073551: clear the release cache on release change (ptoscano@redhat.com)