From 0c0426b5df7b24586019691221760f0f55ba5910 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: May 20 2021 00:01:05 +0000 Subject: Enable PowerTools repo in %post This is needed by some EPEL RPMs and potentially some Hyperscale RPMs as well; flip this on if it is disabled. We can safely assume this is running on CentOS Stream (there's an explicit `Requires:` on `centos-stream-release`), and we check that the repo file exists, and make sure it only contains `_one_` `enabled=` line before modifying. ``` [vagrant@localhost ~]$ dnf repolist enabled repo id repo name appstream CentOS Stream 8 - AppStream baseos CentOS Stream 8 - BaseOS centos-hyperscale CentOS Stream 8 - Hyperscale epel Extra Packages for Enterprise Linux 8 - x86_64 epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 extras CentOS Stream 8 - Extras [vagrant@localhost ~]$ sudo dnf install /vagrant/centos-release-hyperscale-4-2.e l8.noarch.rpm Last metadata expiration check: 0:03:52 ago on Wed 19 May 2021 11:40:35 PM UTC. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Upgrading: centos-release-hyperscale noarch 4-2.el8 @commandline 9.6 k Transaction Summary ================================================================================ Upgrade 1 Package Total size: 9.6 k Is this ok [y/N]: y Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Upgrading : centos-release-hyperscale-4-2.el8.noarch 1/2 Running scriptlet: centos-release-hyperscale-4-2.el8.noarch 1/2 Cleanup : centos-release-hyperscale-4-1.el8.noarch 2/2 Verifying : centos-release-hyperscale-4-2.el8.noarch 1/2 Verifying : centos-release-hyperscale-4-1.el8.noarch 2/2 Upgraded: centos-release-hyperscale-4-2.el8.noarch Complete! [vagrant@localhost ~]$ dnf repolist enabled repo id repo name appstream CentOS Stream 8 - AppStream baseos CentOS Stream 8 - BaseOS centos-hyperscale CentOS Stream 8 - Hyperscale epel Extra Packages for Enterprise Linux 8 - x86_64 epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 extras CentOS Stream 8 - Extras powertools CentOS Stream 8 - PowerTools ``` Signed-off-by: Michel Alexandre Salim --- diff --git a/SPECS/centos-release-hyperscale.spec b/SPECS/centos-release-hyperscale.spec index 887f3b1..e47fb7f 100644 --- a/SPECS/centos-release-hyperscale.spec +++ b/SPECS/centos-release-hyperscale.spec @@ -1,8 +1,8 @@ Summary: CentOS Hyperscale SIG main repo configs Name: centos-release-hyperscale Version: 4 -Release: 1%{?dist} -License: GPL +Release: 2%{?dist} +License: GPLv2 URL: http://wiki.centos.org/SpecialInterestGroup/Hyperscale Source0: RPM-GPG-KEY-CentOS-SIG-HyperScale Source1: CentOS-Stream-Hyperscale.repo @@ -47,6 +47,15 @@ install -d %{buildroot}%{_sysconfdir}/yum.repos.d install -p -m 644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \ %{buildroot}%{_sysconfdir}/yum.repos.d +%post +POWERTOOLS_REPO=/etc/yum.repos.d/CentOS-Stream-PowerTools.repo +if [ -f "${POWERTOOLS_REPO}" ] \ + && [ $(grep -c '^enabled=.$' "${POWERTOOLS_REPO}") -eq 1 ] \ + && [ $(grep -c '^enabled=0$' "${POWERTOOLS_REPO}") -eq 1 ]; +then + sed -i 's/^enabled=0$/enabled=1/g' "${POWERTOOLS_REPO}" +fi + %files %defattr(-,root,root) %{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-HyperScale @@ -64,6 +73,10 @@ install -p -m 644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \ %config(noreplace) %{_sysconfdir}/yum.repos.d/CentOS-Stream-Hyperscale-Spin.repo %changelog +* Wed May 19 2021 Michel Alexandre Salim - 4-2 +- Trigger enabling powertools repo on package installations and upgrades +- Fix license declaration; match centos-stream-repos + * Mon May 17 2021 Davide Cavalca - 4-1 - Add subpackages for hotfixes and spin repo configs - Require epel-release for hotfixes