Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#3637 from zmrow/ebc_src_bin
Browse files Browse the repository at this point in the history
Remove conditional compilation from `early-boot-config`
  • Loading branch information
sam-berning authored Apr 5, 2024
2 parents aef8fdf + e38f848 commit 0b8f499
Show file tree
Hide file tree
Showing 107 changed files with 2,034 additions and 1,065 deletions.
30 changes: 30 additions & 0 deletions packages/early-boot-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "early-boot-config"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

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

[package.metadata.build-package]
source-groups = [
"early-boot-config/early-boot-config",
"early-boot-config/early-boot-config-provider",

"early-boot-config/user-data-providers/ec2-identity-doc",
"early-boot-config/user-data-providers/ec2-imds",
"early-boot-config/user-data-providers/local-defaults",
"early-boot-config/user-data-providers/local-file",
"early-boot-config/user-data-providers/local-overrides",
"early-boot-config/user-data-providers/vmware-cd-rom",
"early-boot-config/user-data-providers/vmware-guestinfo",
]

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

# RPM Requires
[dependencies]
File renamed without changes.
155 changes: 155 additions & 0 deletions packages/early-boot-config/early-boot-config.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
%global _cross_first_party 1
%undefine _debugsource_packages

Name: %{_cross_os}early-boot-config
Version: 0.0
Release: 0%{?dist}
Summary: early-boot-config
License: Apache-2.0 OR MIT
URL: https://github.com/bottlerocket-os/bottlerocket

Source100: early-boot-config.service

BuildRequires: %{_cross_os}glibc-devel

%description
%{summary}.

%package -n %{_cross_os}early-boot-config-local
Summary: local-provider

%description -n %{_cross_os}early-boot-config-local
%{summary}.

%package -n %{_cross_os}early-boot-config-aws
Summary: early-boot-config package for AWS
Requires: %{name}
Requires: %{_cross_os}early-boot-config-local

%description -n %{_cross_os}early-boot-config-aws
%{summary}.

%ifarch x86_64
%package -n %{_cross_os}early-boot-config-vmware
Summary: early-boot-config package for vmware
Requires: %{name}
Requires: %{_cross_os}early-boot-config-local

%description -n %{_cross_os}early-boot-config-vmware
%{summary}.
%endif

%package -n %{_cross_os}early-boot-config-metal
Summary: early-boot-config package for metal
Requires: %{name}
Requires: %{_cross_os}early-boot-config-local

%description -n %{_cross_os}early-boot-config-metal
%{summary}.

%prep
%setup -T -c
%cargo_prep

%build
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p early-boot-config \
-p ec2-identity-doc-user-data-provider \
-p ec2-imds-user-data-provider \
-p local-defaults-user-data-provider \
-p local-file-user-data-provider \
-p local-overrides-user-data-provider \
%ifarch x86_64
-p vmware-cd-rom-user-data-provider \
-p vmware-guestinfo-user-data-provider \
%endif
%{nil}

%global cargo_outdir %{getenv:HOME}/.cache/%{__cargo_target}/release
%global early_boot_config_bindir %{_cross_libexecdir}/early-boot-config/bin
%global early_boot_config_provider_dir %{_cross_libexecdir}/early-boot-config/data-providers.d

%install
install -d %{buildroot}%{_cross_bindir}
install -p -m 0755 %{cargo_outdir}/early-boot-config %{buildroot}%{_cross_bindir}

install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 %{S:100} %{buildroot}%{_cross_unitdir}

install -d %{buildroot}%{early_boot_config_bindir}
install -p -m 0755 \
%{cargo_outdir}/ec2-identity-doc-user-data-provider \
%{cargo_outdir}/ec2-imds-user-data-provider \
%{cargo_outdir}/local-defaults-user-data-provider \
%{cargo_outdir}/local-file-user-data-provider \
%{cargo_outdir}/local-overrides-user-data-provider \
%{buildroot}%{early_boot_config_bindir}

%ifarch x86_64
install -p -m 0755 \
%{cargo_outdir}/vmware-cd-rom-user-data-provider \
%{cargo_outdir}/vmware-guestinfo-user-data-provider \
%{buildroot}%{early_boot_config_bindir}
%endif

install -d %{buildroot}%{early_boot_config_provider_dir}

ln -rs \
%{buildroot}%{early_boot_config_bindir}/ec2-identity-doc-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/30-ec2-identity-doc

ln -rs \
%{buildroot}%{early_boot_config_bindir}/ec2-imds-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/40-ec2-imds

ln -rs \
%{buildroot}%{early_boot_config_bindir}/local-defaults-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/10-local-defaults

ln -rs \
%{buildroot}%{early_boot_config_bindir}/local-file-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/20-local-user-data

ln -rs \
%{buildroot}%{early_boot_config_bindir}/local-overrides-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/99-local-overrides

%ifarch x86_64
ln -rs \
%{buildroot}%{early_boot_config_bindir}/vmware-cd-rom-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/30-vmware-cd-rom

ln -rs \
%{buildroot}%{early_boot_config_bindir}/vmware-guestinfo-user-data-provider \
%{buildroot}%{early_boot_config_provider_dir}/40-vmware-guestinfo
%endif

%files
%{_cross_bindir}/early-boot-config
%{_cross_unitdir}/early-boot-config.service
%dir %{early_boot_config_provider_dir}

%files -n %{_cross_os}early-boot-config-local
%{early_boot_config_bindir}/local-defaults-user-data-provider
%{early_boot_config_bindir}/local-file-user-data-provider
%{early_boot_config_bindir}/local-overrides-user-data-provider
%{early_boot_config_provider_dir}/10-local-defaults
%{early_boot_config_provider_dir}/20-local-user-data
%{early_boot_config_provider_dir}/99-local-overrides

%files -n %{_cross_os}early-boot-config-aws
%{early_boot_config_bindir}/ec2-identity-doc-user-data-provider
%{early_boot_config_bindir}/ec2-imds-user-data-provider
%{early_boot_config_provider_dir}/30-ec2-identity-doc
%{early_boot_config_provider_dir}/40-ec2-imds

%ifarch x86_64
%files -n %{_cross_os}early-boot-config-vmware
%{early_boot_config_bindir}/vmware-cd-rom-user-data-provider
%{early_boot_config_bindir}/vmware-guestinfo-user-data-provider
%{early_boot_config_provider_dir}/30-vmware-cd-rom
%{early_boot_config_provider_dir}/40-vmware-guestinfo
%endif

# There are no metal-specific providers, just dependencies like the local file providers.
%files -n %{_cross_os}early-boot-config-metal
22 changes: 5 additions & 17 deletions packages/os/os.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Source19: host-containers-toml

# 1xx sources: systemd units
Source100: apiserver.service
Source101: early-boot-config.service
Source102: sundog.service
Source103: storewolf.service
Source105: settings-applier.service
Expand Down Expand Up @@ -87,7 +86,6 @@ Requires: %{_cross_os}bootstrap-containers
Requires: %{_cross_os}bork
Requires: %{_cross_os}corndog
Requires: %{_cross_os}certdog
Requires: %{_cross_os}early-boot-config
Requires: %{_cross_os}ghostdog
Requires: %{_cross_os}host-containers
Requires: %{_cross_os}logdog
Expand Down Expand Up @@ -136,11 +134,6 @@ Summary: Bottlerocket API client
%description -n %{_cross_os}apiclient
%{summary}.

%package -n %{_cross_os}early-boot-config
Summary: Bottlerocket userdata configuration system
%description -n %{_cross_os}early-boot-config
%{summary}.

%package -n %{_cross_os}netdog
Summary: Bottlerocket network configuration helper
%if %{with systemd_networkd}
Expand Down Expand Up @@ -336,7 +329,6 @@ static_pid="$!"
echo "** Output from non-static builds:"
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p apiserver \
-p early-boot-config \
-p netdog \
-p sundog \
-p schnauzer \
Expand Down Expand Up @@ -377,7 +369,7 @@ fi
install -d %{buildroot}%{_cross_bindir}
for p in \
apiserver \
early-boot-config netdog sundog schnauzer schnauzer-v2 bork \
netdog sundog schnauzer schnauzer-v2 bork \
corndog thar-be-settings thar-be-updates host-containers \
storewolf settings-committer \
migrator prairiedog certdog \
Expand Down Expand Up @@ -470,10 +462,10 @@ install -p -m 0644 %{S:5} %{S:6} %{S:7} %{S:8} %{S:14} %{S:15} %{S:16} %{S:17} %

install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 \
%{S:100} %{S:101} %{S:102} %{S:103} %{S:105} \
%{S:106} %{S:107} %{S:110} %{S:111} %{S:112} \
%{S:113} %{S:114} %{S:118} %{S:119} %{S:122} \
%{S:123} \
%{S:100} %{S:102} %{S:103} %{S:105} \
%{S:106} %{S:107} %{S:110} %{S:111} \
%{S:112} %{S:113} %{S:114} %{S:118} \
%{S:119} %{S:122} %{S:123} \
%{buildroot}%{_cross_unitdir}

%if %{with systemd_networkd}
Expand Down Expand Up @@ -538,10 +530,6 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
%files -n %{_cross_os}apiclient
%{_cross_bindir}/apiclient

%files -n %{_cross_os}early-boot-config
%{_cross_bindir}/early-boot-config
%{_cross_unitdir}/early-boot-config.service

%files -n %{_cross_os}netdog
%{_cross_bindir}/netdog
%{_cross_tmpfilesdir}/netdog.conf
Expand Down
107 changes: 99 additions & 8 deletions sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b8f499

Please sign in to comment.