From 2707bff4ebeec5f1fa2ad2c9b0ccfc8b440bac16 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Fri, 9 Sep 2022 00:44:35 -0700 Subject: [PATCH] begin conforming RL8 to RL9 setup --- SPECS/rocky-release.spec | 165 ++++++++++++++++++++++++++++++--------- 1 file changed, 126 insertions(+), 39 deletions(-) diff --git a/SPECS/rocky-release.spec b/SPECS/rocky-release.spec index ebd1937..b9b23f4 100644 --- a/SPECS/rocky-release.spec +++ b/SPECS/rocky-release.spec @@ -1,3 +1,13 @@ +# Note to packagers/builders: +# +# If you wish to build the LookAhead or Beta variant of this package, make sure +# that you are setting --with=rlbeta or --with=rllookahead on your mock +# command. See the README for more information. + +%bcond_with rlbeta +%bcond_with rllookahead +%bcond_with rloverride + %define debug_package %{nil} # Product information @@ -10,13 +20,62 @@ %define distro_code Green Obsidian %define major 8 %define minor 7 -%define rocky_rel 1.1 -%define upstream_rel %{major}.%{minor} +%define rocky_rel 1%{?rllh:.%{rllh}}%{!?rllh:.1} %define rpm_license BSD-3-Clause +%define dist .el%{major} +%define home_url https://rockylinux.org/ +%define bug_url https://bugs.rockylinux.org/ +%define debug_url https://debuginfod.rockylinux.org/ +%define dist_vendor RESF + +%define contentdir pub/rocky +%define sigcontent pub/sig +%define rlosid rocky + +%define os_bug_name Rocky-Linux-%{major} + +################################################################################ +# Rocky LookAhead Section +# +# Reset defines for LookAhead variant. Default is stable if 0 or undefined. +%if %{with rllookahead} +%define minor 8 +%define contentdir pub/rocky-lh +%define rltype -lookahead +%define rlstatement LookAhead +%endif +# End Rocky LookAhead Section +################################################################################ + +################################################################################ +# Rocky Beta Section +# +# Reset defines for Beta variant. Default is stable if 0 or undefined. +# We do NOT override the minor version number here. +%if %{with rlbeta} +%define contentdir pub/rocky-beta +%define rltype -beta +%define rlstatement Beta +%endif +# End Rocky Beta Section +################################################################################ + +################################################################################ +# Rocky Override Section +# +# Resets only the dist tag for the override package. All this does is ensure +# that only the rhel macros and settings are provided - This is useful in the +# case of a build that cannot be properly debranded (eg dotnet). +%if %{with rloverride} +%define dist .el%{major}.override +%define rlosid rhel +%endif +# End Rocky Override Section +################################################################################ %define base_release_version %{major} -%define full_release_version %{major} %define dist_release_version %{major} +%define full_release_version %{major}.%{minor} %ifarch ppc64le %define tuned_profile :server @@ -25,43 +84,49 @@ # Avoids a weird anaconda problem %global __requires_exclude_from %{_libexecdir} -Name: rocky-release -Version: %{major}.%{minor} -Release: %{rocky_rel}.el8 +# conditional section for future use + +Name: rocky-release%{?rltype} +Version: %{full_release_version} +Release: %{rocky_rel}%{dist} Summary: %{distro_name} release files +Group: System Environment/Base License: %{rpm_license} URL: https://rockylinux.org BuildArch: noarch -# What do we provide? +# What do we provide? Some of these needs are a necesity (think comps and +# groups) and things like EPEL need it. Provides: rocky-release = %{version}-%{release} -Provides: rocky-release(upstream) = %{upstream_rel} +Provides: rocky-release(upstream) = %{full_release_version} Provides: redhat-release = %{version}-%{release} Provides: system-release = %{version}-%{release} Provides: system-release(releasever) = %{major} Provides: centos-release = %{version}-%{release} -Provides: centos-release(upstream) = %{upstream_rel} +Provides: centos-release(upstream) = %{full_release_version} ## Required by libdnf Provides: base-module(platform:el%{major}) ## This makes lorax/pungi/anaconda happy -Provides: rocky-release-eula -Provides: redhat-release-eula -Provides: centos-release-eula +Provides: rocky-release-eula = %{version}-%{release} +Provides: redhat-release-eula = %{version}-%{release} +Provides: centos-release-eula = %{version}-%{release} # What are our requirements? Requires: rocky-repos(%{major}) -# GPG Keys +# GPG Keys (100-199) Source101: RPM-GPG-KEY-rockyofficial Source102: RPM-GPG-KEY-rockytesting -# Release Sources +# Release Sources (200-499) Source200: EULA Source201: LICENSE Source202: Contributors Source203: COMMUNITY-CHARTER + +# !! Stable !! Source300: 85-display-manager.preset Source301: 90-default.preset Source302: 99-default-disable.preset @@ -89,25 +154,32 @@ Source1300: rocky.1.gz %description %{distro_name} release files. -%package -n rocky-repos +%package -n rocky-repos%{?rltype} Summary: %{distro_name} Package Repositories License: %{rpm_license} -Provides: rocky-repos(%{major}) = %{upstream_rel} -Requires: system-release = %{upstream_rel} -Requires: rocky-gpg-keys +Provides: system-repos = %{version}-%{release} +Provides: rocky-repos(%{major}) = %{full_release_version} +Requires: system-release = %{version}-%{release} +Requires: rocky-gpg-keys%{?rltype} Conflicts: %{name} < 8.0 -%description -n rocky-repos +%description -n rocky-repos%{?rltype} %{distro_name} package repository files for yum/dnf -%package -n rocky-gpg-keys +%package -n rocky-gpg-keys%{?rltype} Summary: Rocky RPM GPG Keys Conflicts: %{name} < 8.0 -%description -n rocky-gpg-keys +%description -n rocky-gpg-keys%{?rltype} This package provides the RPM signature keys for Rocky. %prep +%if %{with rllookahead} && %{with rlbeta} +echo "!! WARNING !!" +echo "Both LookAhead and Beta were enabled. This is not supported." +echo "As a result: BUILD FAILED." +exit 1 +%endif echo Good. %build @@ -117,10 +189,11 @@ echo Good. # copy license and contributors doc here for %%license and %%doc macros cp %{SOURCE201} %{SOURCE202} %{SOURCE203} . -# create /etc/system-release and /etc/redhat-release +################################################################################ +# system-release data install -d -m 0755 %{buildroot}%{_sysconfdir} -echo "%{distro_name} release %{version} (%{distro_code})" > %{buildroot}%{_sysconfdir}/rocky-release -echo "Derived from Red Hat Enterprise Linux %{version}" > %{buildroot}%{_sysconfdir}/rocky-release-upstream +echo "%{distro_name} release %{full_release_version}%{?rlstatement: %{rlstatement}} (%{distro_code})" > %{buildroot}%{_sysconfdir}/rocky-release +echo "Derived from Red Hat Enterprise Linux %{full_release_version}" > %{buildroot}%{_sysconfdir}/rocky-release-upstream ln -s rocky-release %{buildroot}%{_sysconfdir}/system-release ln -s rocky-release %{buildroot}%{_sysconfdir}/redhat-release ln -s rocky-release %{buildroot}%{_sysconfdir}/centos-release @@ -131,27 +204,28 @@ install -p -m 0644 %{SOURCE1300} %{buildroot}%{_mandir}/man1/ install -d -m 0755 %{buildroot}%{_prefix}/lib cat > %{buildroot}%{_prefix}/lib/os-release << EOF NAME="%{distro_name}" -VERSION="%{major}.%{minor} (%{distro_code})" -ID="rocky" +VERSION="%{full_release_version} (%{distro_code})" +ID="%{rlosid}" ID_LIKE="rhel centos fedora" -VERSION_ID="%{major}.%{minor}" +VERSION_ID="%{full_release_version}" PLATFORM_ID="platform:el%{major}" -PRETTY_NAME="%{distro_name} %{major}.%{minor} (%{distro_code})" +PRETTY_NAME="%{distro_name} %{full_release_version}%{?rlstatement: %{rlstatement}} (%{distro_code})" ANSI_COLOR="0;32" -CPE_NAME="cpe:/o:rocky:rocky:%{base_release_version}:GA" -HOME_URL="https://rockylinux.org/" -BUG_REPORT_URL="https://bugs.rockylinux.org/" -ROCKY_SUPPORT_PRODUCT="%{distro_name}" -ROCKY_SUPPORT_PRODUCT_VERSION="%{major}" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:rocky:rocky:%{major}:GA" +HOME_URL="%{home_url}" +BUG_REPORT_URL="%{bug_url}" +ROCKY_SUPPORT_PRODUCT="%{os_bug_name}" +ROCKY_SUPPORT_PRODUCT_VERSION="%{full_release_version}%{?rlstatement:-%{rlstatement}}" REDHAT_SUPPORT_PRODUCT="%{distro_name}" -REDHAT_SUPPORT_PRODUCT_VERSION="%{major}" +REDHAT_SUPPORT_PRODUCT_VERSION="%{full_release_version}%{?rlstatement: %{rlstatement}}" EOF # Create the symlink for /etc/os-release ln -s ../usr/lib/os-release %{buildroot}%{_sysconfdir}/os-release # write cpe to /etc/system/release-cpe -echo "cpe:/o:rocky:rocky:%{base_release_version}:GA" > %{buildroot}%{_sysconfdir}/system-release-cpe +echo "cpe:/o:rocky:rocky:%{major}:GA" > %{buildroot}%{_sysconfdir}/system-release-cpe # create /etc/issue and /etc/issue.net echo '\S' > %{buildroot}%{_sysconfdir}/issue @@ -170,8 +244,14 @@ cat > %{buildroot}%{_sysconfdir}/rpm/macros.dist << EOF %%centos_ver %{major} %%centos %{major} %%rhel %{major} -%%dist %%{!?distprefix0:%%{?distprefix}}%%{expand:%%{lua:for i=0,9999 do print("%%{?distprefix" .. i .."}") end}}.el%{major}%%{?with_bootstrap:%{__bootstrap}} +%%dist %%{!?distprefix0:%%{?distprefix}}%%{expand:%%{lua:for i=0,9999 do print("%%{?distprefix" .. i .."}") end}}.el%{major}%%{?distsuffix}%%{?with_bootstrap:%{__bootstrap}} %%el%{major} 1 + +%%dist_vendor %{dist_vendor} +%%dist_name %{distro} +%%dist_home_url %{home_url} +%%dist_bug_report_url %{bug_url} +%%dist_debuginfod_url %{debug_url} EOF # Data directory @@ -179,7 +259,11 @@ install -d -m 0755 %{buildroot}%{_datadir}/rocky-release ln -s rocky-release %{buildroot}%{_datadir}/redhat-release install -p -m 0644 %{SOURCE200} %{buildroot}%{_datadir}/rocky-release/ -# systemd presets +# end system-release data +################################################################################ + +################################################################################ +# systemd section install -d -m 0755 %{buildroot}%{_prefix}/lib/systemd/system-preset/ install -m 0644 %{SOURCE300} %{buildroot}/%{_prefix}/lib/systemd/system-preset/ install -m 0644 %{SOURCE301} %{buildroot}/%{_prefix}/lib/systemd/system-preset/ @@ -187,8 +271,9 @@ install -m 0644 %{SOURCE302} %{buildroot}/%{_prefix}/lib/systemd/system-preset/ # dnf stuff install -d -m 0755 %{buildroot}%{_sysconfdir}/dnf/vars -echo "pub/rocky" > %{buildroot}%{_sysconfdir}/dnf/vars/contentdir -echo "pub/sig" > %{buildroot}%{_sysconfdir}/dnf/vars/sigcontentdir +echo "%{contentdir}" > %{buildroot}%{_sysconfdir}/dnf/vars/contentdir +echo "%{sigcontent}" > %{buildroot}%{_sysconfdir}/dnf/vars/sigcontentdir +echo "%{?rltype}" > %{buildroot}%{_sysconfdir}/dnf/vars/rltype echo "%{major}-stream" > %{buildroot}%{_sysconfdir}/dnf/vars/stream # Copy out GPG keys @@ -196,6 +281,7 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/pki/rpm-gpg install -p -m 0644 %{SOURCE101} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/ install -p -m 0644 %{SOURCE102} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/ + # Copy our yum repos install -d -m 0755 %{buildroot}%{_sysconfdir}/yum.repos.d install -p -m 0644 %{SOURCE1200} %{buildroot}%{_sysconfdir}/yum.repos.d/ @@ -236,6 +322,7 @@ install -p -m 0644 %{SOURCE1226} %{buildroot}%{_sysconfdir}/yum.repos.d/ %config(noreplace) %{_sysconfdir}/yum.repos.d/Rocky-*.repo %config(noreplace) %{_sysconfdir}/dnf/vars/contentdir %config(noreplace) %{_sysconfdir}/dnf/vars/sigcontentdir +%config(noreplace) %{_sysconfdir}/dnf/vars/rltype %config(noreplace) %{_sysconfdir}/dnf/vars/stream %files -n rocky-gpg-keys