From 78eda30a2d898490c8bfc10a063356355279ae9f Mon Sep 17 00:00:00 2001 From: Sofia Boldyreva Date: Mon, 3 Feb 2025 16:27:02 +0100 Subject: [PATCH] Initial commit --- config.yaml | 107 ++++++++++++++++++++++++++++++++++ files/almalinux_debrand.patch | 47 +++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 config.yaml create mode 100644 files/almalinux_debrand.patch diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..4161071 --- /dev/null +++ b/config.yaml @@ -0,0 +1,107 @@ +actions: + - replace: + - target: "spec" + find: | + %if !%{use_container_plugin} + Obsoletes: subscription-manager-plugin-container <= %{version} + %endif + replace: | + %if !%{use_container_plugin} + 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 + + count: 1 + - target: "spec" + find: "to manage subscriptions and yum repositories from the Red Hat entitlement" + replace: "to manage subscriptions and yum repositories from the EL entitlement" + count: 1 + - target: "spec" + find: "This package provides a plugin to interact with repositories from the Red Hat" + replace: "This package provides a plugin to interact with repositories from an" + count: 1 + - target: "spec" + find: "from the Red Hat entitlement platform; contains subscription-manager and" + replace: "from an entitlement platform; contains subscription-manager and" + count: 1 + - target: "spec" + find: "Summary: A Python library to communicate with a Red Hat Unified Entitlement Platform" + replace: "Summary: A Python library to communicate with Unified Entitlement Platform" + count: 1 + - target: "spec" + find: "A small library for communicating with the REST interface of a Red Hat Unified" + replace: "A small library for communicating with the REST interface of Unified" + count: 1 + - target: "spec" + find: | + # fake out the redhat.repo file + %if %{use_dnf} + mkdir %{buildroot}%{_sysconfdir}/yum.repos.d + touch %{buildroot}%{_sysconfdir}/yum.repos.d/redhat.repo + %endif + replace: | + # 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 + count: 1 + - target: "spec" + find: | + mkdir %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com + install -m 644 %{_builddir}/%{buildsubdir}/src/content_plugins/redhat-entitlement-authority.pem %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + replace: | + %if %{undefined almalinux_ver} + mkdir %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com + install -m 644 %{_builddir}/%{buildsubdir}/src/content_plugins/redhat-entitlement-authority.pem %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + %endif + count: 1 + - target: "spec" + find: | + # fix timestamps on our byte compiled files so they match across arches + find %{buildroot} -name \*.py* -exec touch -r %{SOURCE0} '{}' \; + replace: | + # 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 + count: 1 + - target: "spec" + find: | + # 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 + replace: | + %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 + count: 1 + + - modify_release: + - suffix: ".alma.2" + enabled: true + + - changelog_entry: + - name: "Eduard Abdullin" + email: "eabdullin@almalinux.org" + line: + - "Debrand for AlmaLinux" + + - add_files: + - type: "patch" + name: "almalinux_debrand.patch" + number: 100 diff --git a/files/almalinux_debrand.patch b/files/almalinux_debrand.patch new file mode 100644 index 0000000..21e0ac7 --- /dev/null +++ b/files/almalinux_debrand.patch @@ -0,0 +1,47 @@ +diff -aruN subscription-manager-1.29.37/etc-conf/syspurpose/valid_fields.json subscription-manager-1.29.37.alma/etc-conf/syspurpose/valid_fields.json +--- subscription-manager-1.29.37/etc-conf/syspurpose/valid_fields.json 2023-08-23 07:18:22 ++++ subscription-manager-1.29.37.alma/etc-conf/syspurpose/valid_fields.json 2023-10-09 23:38:40 +@@ -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 -aruN subscription-manager-1.29.37/src/subscription_manager/repofile.py subscription-manager-1.29.37.alma/src/subscription_manager/repofile.py +--- subscription-manager-1.29.37/src/subscription_manager/repofile.py 2023-08-23 07:18:22 ++++ subscription-manager-1.29.37.alma/src/subscription_manager/repofile.py 2023-10-09 23:38:48 +@@ -375,11 +375,7 @@ + """ + Try to create new repo file. + """ +- 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: str) -> str: + return content +diff -aruN subscription-manager-1.29.37/src/subscription_manager/repolib.py subscription-manager-1.29.37.alma/src/subscription_manager/repolib.py +--- subscription-manager-1.29.37/src/subscription_manager/repolib.py 2023-08-23 07:18:22 ++++ subscription-manager-1.29.37.alma/src/subscription_manager/repolib.py 2023-10-09 23:38:57 +@@ -92,7 +92,7 @@ + def warning_message(enabled_yum_plugins: List[str]) -> str: + 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)