Skip to content

Commit

Permalink
add settings-defaults package
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Jun 6, 2024
1 parent 3ba6c68 commit 2a08b95
Show file tree
Hide file tree
Showing 2 changed files with 381 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/settings-defaults/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "settings-defaults"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
source-groups = [
"settings-defaults"
]

# RPM BuildRequires
[build-dependencies]
glibc = { path = "../glibc" }

# RPM Requires
[dependencies]
360 changes: 360 additions & 0 deletions packages/settings-defaults/settings-defaults.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
%global _cross_first_party 1
%undefine _debugsource_packages

%global cargo_clean %{__cargo_cross_env} %{__cargo} clean

%global _cross_defaultsdir %{_cross_datadir}/storewolf

Name: %{_cross_os}settings-defaults
Version: 0.0
Release: 0%{?dist}
Summary: Settings defaults
License: Apache-2.0 OR MIT
URL: https://github.com/bottlerocket-os/bottlerocket
BuildRequires: %{_cross_os}glibc-devel

Requires: %{_cross_os}settings-defaults(any)
Requires: (%{_cross_os}settings-defaults(aws-dev) if %{_cross_os}variant(aws-dev))
Requires: (%{_cross_os}settings-defaults(aws-ecs-1) if %{_cross_os}variant(aws-ecs-1))
Requires: (%{_cross_os}settings-defaults(aws-ecs-1-nvidia) if %{_cross_os}variant(aws-ecs-1-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-ecs-2) if %{_cross_os}variant(aws-ecs-2))
Requires: (%{_cross_os}settings-defaults(aws-ecs-2-nvidia) if %{_cross_os}variant(aws-ecs-2-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.23) if %{_cross_os}variant(aws-k8s-1.23))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.23-nvidia) if %{_cross_os}variant(aws-k8s-1.23-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.24) if %{_cross_os}variant(aws-k8s-1.24))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.24-nvidia) if %{_cross_os}variant(aws-k8s-1.24-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.25) if %{_cross_os}variant(aws-k8s-1.25))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.25-nvidia) if %{_cross_os}variant(aws-k8s-1.25-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.26) if %{_cross_os}variant(aws-k8s-1.26))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.26-nvidia) if %{_cross_os}variant(aws-k8s-1.26-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.27) if %{_cross_os}variant(aws-k8s-1.27))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.27-nvidia) if %{_cross_os}variant(aws-k8s-1.27-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.28) if %{_cross_os}variant(aws-k8s-1.28))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.28-nvidia) if %{_cross_os}variant(aws-k8s-1.28-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.29) if %{_cross_os}variant(aws-k8s-1.29))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.29-nvidia) if %{_cross_os}variant(aws-k8s-1.29-nvidia))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.30) if %{_cross_os}variant(aws-k8s-1.30))
Requires: (%{_cross_os}settings-defaults(aws-k8s-1.30-nvidia) if %{_cross_os}variant(aws-k8s-1.30-nvidia))
Requires: (%{_cross_os}settings-defaults(metal-dev) if %{_cross_os}variant(metal-dev))
Requires: (%{_cross_os}settings-defaults(metal-k8s-1.27) if %{_cross_os}variant(metal-k8s-1.27))
Requires: (%{_cross_os}settings-defaults(metal-k8s-1.28) if %{_cross_os}variant(metal-k8s-1.28))
Requires: (%{_cross_os}settings-defaults(metal-k8s-1.29) if %{_cross_os}variant(metal-k8s-1.29))
Requires: (%{_cross_os}settings-defaults(metal-k8s-1.30) if %{_cross_os}variant(metal-k8s-1.30))
Requires: (%{_cross_os}settings-defaults(vmware-dev) if %{_cross_os}variant(vmware-dev))
Requires: (%{_cross_os}settings-defaults(vmware-k8s-1.27) if %{_cross_os}variant(vmware-k8s-1.27))
Requires: (%{_cross_os}settings-defaults(vmware-k8s-1.28) if %{_cross_os}variant(vmware-k8s-1.28))
Requires: (%{_cross_os}settings-defaults(vmware-k8s-1.29) if %{_cross_os}variant(vmware-k8s-1.29))
Requires: (%{_cross_os}settings-defaults(vmware-k8s-1.30) if %{_cross_os}variant(vmware-k8s-1.30))

%description
%{summary}.

%package aws-dev
Summary: Settings defaults for the aws-dev variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-dev)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-dev
%{summary}.

%package aws-ecs-1
Summary: Settings defaults for the aws-ecs-1 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-ecs-1)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-ecs-1
%{summary}.

%package aws-ecs-1-nvidia
Summary: Settings defaults for the aws-ecs-1-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-ecs-1-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-ecs-1-nvidia
%{summary}.

%package aws-ecs-2
Summary: Settings defaults for the aws-ecs-2 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-ecs-2)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-ecs-2
%{summary}.

%package aws-ecs-2-nvidia
Summary: Settings defaults for the aws-ecs-2-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-ecs-2-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-ecs-2-nvidia
%{summary}.

%package aws-k8s-1.24
Summary: Settings defaults for the aws-k8s-1.24 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.23)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.24)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.24
%{summary}.

%package aws-k8s-1.24-nvidia
Summary: Settings defaults for the aws-k8s-1.24-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.23-nvidia)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.24-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.24-nvidia
%{summary}.

%package aws-k8s-1.25
Summary: Settings defaults for the aws-k8s-1.25 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.25)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.25
%{summary}.

%package aws-k8s-1.25-nvidia
Summary: Settings defaults for the aws-k8s-1.25-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.25-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.25-nvidia
%{summary}.

%package aws-k8s-1.26
Summary: Settings defaults for the aws-k8s-1.26 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.26)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.26
%{summary}.

%package aws-k8s-1.26-nvidia
Summary: Settings defaults for the aws-k8s-1.26-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.26-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.26-nvidia
%{summary}.

%package aws-k8s-1.30
Summary: Settings defaults for the aws-k8s-1.30 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.27)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.28)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.29)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.30)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.30
%{summary}.

%package aws-k8s-1.30-nvidia
Summary: Settings defaults for the aws-k8s-1.30-nvidia variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.27-nvidia)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.28-nvidia)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.29-nvidia)
Provides: %{_cross_os}settings-defaults(aws-k8s-1.30-nvidia)
Conflicts: %{_cross_os}settings-defaults(any)

%description aws-k8s-1.30-nvidia
%{summary}.

%package vmware-dev
Summary: Settings defaults for the vmware-dev variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(vmware-dev)
Conflicts: %{_cross_os}settings-defaults(any)

%description vmware-dev
%{summary}.

%package vmware-k8s-1.30
Summary: Settings defaults for the vmware-k8s-1.30 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(vmware-k8s-1.27)
Provides: %{_cross_os}settings-defaults(vmware-k8s-1.28)
Provides: %{_cross_os}settings-defaults(vmware-k8s-1.29)
Provides: %{_cross_os}settings-defaults(vmware-k8s-1.30)
Conflicts: %{_cross_os}settings-defaults(any)

%description vmware-k8s-1.30
%{summary}.

%package metal-dev
Summary: Settings defaults for the metal-dev variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(metal-dev)
Conflicts: %{_cross_os}settings-defaults(any)

%description metal-dev
%{summary}.

%package metal-k8s-1.30
Summary: Settings defaults for the metal-k8s-1.30 variant
Provides: %{_cross_os}settings-defaults(any)
Provides: %{_cross_os}settings-defaults(metal-k8s-1.27)
Provides: %{_cross_os}settings-defaults(metal-k8s-1.28)
Provides: %{_cross_os}settings-defaults(metal-k8s-1.29)
Provides: %{_cross_os}settings-defaults(metal-k8s-1.30)
Conflicts: %{_cross_os}settings-defaults(any)

%description metal-k8s-1.30
%{summary}.

%prep
%setup -T -c
%cargo_prep

%build
declare -a projects
for defaults in \
aws-dev \
aws-ecs-1 \
aws-ecs-1-nvidia \
aws-ecs-2 \
aws-ecs-2-nvidia \
aws-k8s-1.24 \
aws-k8s-1.24-nvidia \
aws-k8s-1.25 \
aws-k8s-1.25-nvidia \
aws-k8s-1.26 \
aws-k8s-1.26-nvidia \
aws-k8s-1.30 \
aws-k8s-1.30-nvidia \
metal-dev \
metal-k8s-1.30 \
vmware-dev \
vmware-k8s-1.30 \
;
do
projects+=( "-p" "settings-defaults-$(echo "${defaults}" | sed -e 's,\.,_,g')" )
done

# Output is written to an unpredictable directory name, so clean it up first to
# avoid reusing any cached artifacts.
%cargo_clean --manifest-path %{_builddir}/sources/Cargo.toml \
"${projects[@]}" \
%{nil}

%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
"${projects[@]}" \
%{nil}

%install
install -d %{buildroot}%{_cross_defaultsdir}
install -d %{buildroot}%{_cross_tmpfilesdir}

for defaults in \
aws-dev \
aws-ecs-1 \
aws-ecs-1-nvidia \
aws-ecs-2 \
aws-ecs-2-nvidia \
aws-k8s-1.24 \
aws-k8s-1.24-nvidia \
aws-k8s-1.25 \
aws-k8s-1.25-nvidia \
aws-k8s-1.26 \
aws-k8s-1.26-nvidia \
aws-k8s-1.30 \
aws-k8s-1.30-nvidia \
metal-dev \
metal-k8s-1.30 \
vmware-dev \
vmware-k8s-1.30 \
;
do
crate="$(echo "${defaults}" | sed -e 's,\.,_,g')"
for f in $(find "${HOME}/.cache" -name "settings-defaults-${crate}.toml") ; do
install -p -m 0644 "${f}" "%{buildroot}%{_cross_defaultsdir}/${defaults}.toml"
done
echo \
"L+ /etc/storewolf/defaults.toml - - - - %{_cross_defaultsdir}/${defaults}.toml" > \
"%{buildroot}%{_cross_tmpfilesdir}/storewolf-defaults-${defaults}.conf"
done

%files
%dir %{_cross_defaultsdir}

%files aws-dev
%{_cross_defaultsdir}/aws-dev.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-dev.conf

%files aws-ecs-1
%{_cross_defaultsdir}/aws-ecs-1.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-ecs-1.conf

%files aws-ecs-1-nvidia
%{_cross_defaultsdir}/aws-ecs-1-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-ecs-1-nvidia.conf

%files aws-ecs-2
%{_cross_defaultsdir}/aws-ecs-2.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-ecs-2.conf

%files aws-ecs-2-nvidia
%{_cross_defaultsdir}/aws-ecs-2-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-ecs-2-nvidia.conf

%files aws-k8s-1.24
%{_cross_defaultsdir}/aws-k8s-1.24.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.24.conf

%files aws-k8s-1.24-nvidia
%{_cross_defaultsdir}/aws-k8s-1.24-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.24-nvidia.conf

%files aws-k8s-1.25
%{_cross_defaultsdir}/aws-k8s-1.25.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.25.conf

%files aws-k8s-1.25-nvidia
%{_cross_defaultsdir}/aws-k8s-1.25-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.25-nvidia.conf

%files aws-k8s-1.26
%{_cross_defaultsdir}/aws-k8s-1.26.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.26.conf

%files aws-k8s-1.26-nvidia
%{_cross_defaultsdir}/aws-k8s-1.26-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.26-nvidia.conf

%files aws-k8s-1.30
%{_cross_defaultsdir}/aws-k8s-1.30.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.30.conf

%files aws-k8s-1.30-nvidia
%{_cross_defaultsdir}/aws-k8s-1.30-nvidia.toml
%{_cross_tmpfilesdir}/storewolf-defaults-aws-k8s-1.30-nvidia.conf

%files metal-dev
%{_cross_defaultsdir}/metal-dev.toml
%{_cross_tmpfilesdir}/storewolf-defaults-metal-dev.conf

%files metal-k8s-1.30
%{_cross_defaultsdir}/metal-k8s-1.30.toml
%{_cross_tmpfilesdir}/storewolf-defaults-metal-k8s-1.30.conf

%files vmware-dev
%{_cross_defaultsdir}/vmware-dev.toml
%{_cross_tmpfilesdir}/storewolf-defaults-vmware-dev.conf

%files vmware-k8s-1.30
%{_cross_defaultsdir}/vmware-k8s-1.30.toml
%{_cross_tmpfilesdir}/storewolf-defaults-vmware-k8s-1.30.conf

0 comments on commit 2a08b95

Please sign in to comment.