Skip to content

Commit

Permalink
Fixes #36579 - Split the installer into multiple subpackages
Browse files Browse the repository at this point in the history
This creates separate RPMs for each scenario. This allows the user to
install just a single scenario and never use the --scenario parameter.

Packages created:

foreman-installer-scenario-$scenario
  foreman/katello/foreman-proxy-content scenarios
foreman-installer-common
  Puppet modules, Hiera data and other shared files
foreman-installer
  Transitional package that requires foreman-installer-scenario-foreman
  for a smooth migration
  • Loading branch information
ekohl committed Jul 11, 2023
1 parent aa8bc56 commit 7989af7
Showing 1 changed file with 101 additions and 69 deletions.
170 changes: 101 additions & 69 deletions packages/foreman/foreman-installer/foreman-installer.spec
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
%global configdir %{_datadir}/%{name}/config
%global parser_cache %{_datadir}/%{name}/parser_cache
%global scenariodir %{_sysconfdir}/%{name}/scenarios.d

%global release 1
%global prereleasesource develop
%global prerelease %{?prereleasesource}
Expand All @@ -7,44 +11,80 @@ Epoch: 1
Version: 3.8.0
Release: %{?prerelease:0.}%{release}%{?prerelease:.}%{?prerelease}%{?nightly}%{?dist}
Summary: Puppet-based installer for The Foreman
Group: Applications/System
License: GPLv3+ and ASL 2.0
URL: https://theforeman.org
Source0: https://downloads.theforeman.org/%{name}/%{name}-%{version}%{?prerelease:-}%{?prerelease}.tar.bz2

BuildArch: noarch

Requires: curl
Requires: hostname
Requires: puppet-agent >= 7.0.0
Requires: rubygem(kafo) >= 6.5.0
Requires: rubygem(kafo) < 8.0.0
Requires: ruby(release)
# As a migration foreman-installer ensures the foreman scenario is installed
Requires: %{name}-scenario-foreman = %{epoch}:%{version}-%{release}

BuildRequires: asciidoc
BuildRequires: puppet-agent >= 7.0.0
BuildRequires: rubygem(rake)
BuildRequires: rubygem(kafo) >= 6.5.0
BuildRequires: rubygem(kafo) < 8.0.0
BuildRequires: puppet-agent-puppet-strings >= 1.2.0
BuildRequires: puppet-agent >= 6.15.0
BuildRequires: puppet-agent-puppet-strings < 5
BuildRequires: puppet-agent-puppet-strings >= 1.2.0
BuildRequires: rubygem(kafo) < 8.0.0
BuildRequires: rubygem(kafo) >= 6.5.0
BuildRequires: rubygem(rake)

%description
Complete installer for The Foreman life-cycle management system based on Puppet.

%package katello
Summary: Katello installer bits
Group: Applications/System
Provides: katello-installer-base < 3.11.0-1
Obsoletes: katello-installer-base < 3.11.0-1
%package common
Summary: Common installer bits

Requires: curl
Requires: hostname
Requires: puppet-agent >= 6.15.0
Requires: ruby(release)
Requires: rubygem(kafo) < 8.0.0
Requires: rubygem(kafo) >= 6.5.0
Requires: which

Requires: %{name} = %{epoch}:%{version}-%{release}
%description common
The common parts to all installer scenarios.

%package katello-common
Summary: Common Katello installer bits

Requires: %{name}-common = %{epoch}:%{version}-%{release}
Requires: openssl
Requires: katello-certs-tools
Requires: which

%description katello-common
All the parts needed for both both the Katello and Foreman Proxy Content
scenarios.

%package katello
Summary: Deprecated package that installs both Katello scenarios

Requires: foreman-installer-scenario-katello = %{epoch}:%{version}-%{release}
Requires: foreman-installer-scenario-foreman-proxy-content = %{epoch}:%{version}-%{release}

%description katello
Various scenarios and tools for the Katello ecosystem
Transitional meta package

%package scenario-foreman
Summary: Foreman scenario
Requires: foreman-installer-common = %{epoch}:%{version}-%{release}

%description scenario-foreman
Foreman

%package scenario-katello
Summary: Foreman and Katello scenario
Requires: foreman-installer-katello-common = %{epoch}:%{version}-%{release}

%description scenario-katello
Foreman with Katello.

%package scenario-foreman-proxy-content
Summary: Foreman Proxy Content scenario
Requires: foreman-installer-katello-common = %{epoch}:%{version}-%{release}

%description scenario-foreman-proxy-content
A content proxy for Katello.

%prep
%setup -q -n %{name}-%{version}%{?prerelease:-}%{?prerelease}
Expand All @@ -66,72 +106,64 @@ rake install \
SYSCONFDIR=%{buildroot}%{_sysconfdir} \
--trace

%post
%post scenario-foreman
foreman-installer --scenario foreman --migrations-only > /dev/null

%post katello
foreman-installer --scenario foreman-proxy-content --migrations-only > /dev/null
%post scenario-katello
foreman-installer --scenario katello --migrations-only > /dev/null

%pretrans katello
# RPM can't change a directory into a symlink
# https://bugzilla.redhat.com/show_bug.cgi?id=447156
for scenario in foreman-proxy-content katello ; do
MIGRATIONS=%{_sysconfdir}/%{name}/scenarios.d/$scenario.migrations
if [ -d $MIGRATIONS ] && [ ! -L $MIGRATIONS ] ; then
mv $MIGRATIONS/.applied %{_sysconfdir}/%{name}/scenarios.d/$scenario-migrations-applied
rm -rf $MIGRATIONS
fi
done

%files
%post scenario-foreman-proxy-content
foreman-installer --scenario foreman-proxy-content --migrations-only > /dev/null

%files common
%defattr(-,root,root,-)
%doc README.*
%license LICENSE
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/custom-hiera.yaml
%dir %{_sysconfdir}/%{name}/scenarios.d
%{_sysconfdir}/%{name}/scenarios.d/foreman.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/foreman-migrations-applied
%dir %{scenariodir}
%{_sbindir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man8

# katello files
%exclude %{_datadir}/%{name}/config/foreman-proxy-content*
%exclude %{_datadir}/%{name}/config/katello*
%exclude %{_datadir}/%{name}/katello-certs
%exclude %{_datadir}/%{name}/parser_cache/foreman-proxy-certs.yaml
%exclude %{_datadir}/%{name}/parser_cache/foreman-proxy-content.yaml
%exclude %{_datadir}/%{name}/parser_cache/katello.yaml

%files katello
# common
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/checks
%dir %{_datadir}/%{name}/config
%{_datadir}/%{name}/config/config_header.txt
%{_datadir}/%{name}/config/foreman-hiera.yaml
%{_datadir}/%{name}/config/foreman.hiera
%{_datadir}/%{name}/hooks
%{_datadir}/%{name}/modules
%{_datadir}/%{name}/VERSION
%dir %{parser_cache}
%{_mandir}/man8/%{name}.8*

%files katello-common
%{_sbindir}/katello-certs-check

# foreman-proxy-content scenario
%{_datadir}/%{name}/config/foreman-proxy-content*
%{_datadir}/%{name}/parser_cache/foreman-proxy-content.yaml
%{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content-migrations-applied

# katello scenario
%{_datadir}/%{name}/config/katello*
%{_datadir}/%{name}/parser_cache/katello.yaml
%{_sysconfdir}/%{name}/scenarios.d/katello.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/katello.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/katello-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/katello-migrations-applied
%files scenario-foreman
%{configdir}/foreman.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-answers.yaml
%config(noreplace) %{scenariodir}/foreman-migrations-applied
%{parser_cache}/foreman.yaml

%files scenario-katello
%{configdir}/katello.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/katello.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/katello-answers.yaml
%config(noreplace) %{scenariodir}/katello-migrations-applied
%{parser_cache}/katello.yaml

# foreman-proxy-certs-generate
%{_datadir}/%{name}/katello-certs
%{_datadir}/%{name}/parser_cache/foreman-proxy-certs.yaml
%{parser_cache}/foreman-proxy-certs.yaml
%{_sbindir}/foreman-proxy-certs-generate

%files scenario-foreman-proxy-content
%{configdir}/foreman-proxy-content.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-proxy-content.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-proxy-content-answers.yaml
%config(noreplace) %{scenariodir}/foreman-proxy-content-migrations-applied
%{parser_cache}/foreman-proxy-content.yaml

%changelog
* Tue May 23 2023 Ewoud Kohl van Wijngaarden <[email protected]> - 1:3.8.0-0.1.develop
- Bump version to 3.8-develop
Expand Down

0 comments on commit 7989af7

Please sign in to comment.