Vendor gdisk until we are ready to move to sfdisk

gdisk is being removed in CentOS Stream 10. In order to not have to
maintain gdisk only for Ignition in CentOS Stream 10, we are migrating
ignition from gdisk to sfdisk. This is migration is not ready yet but we
want to remove gdisk from CentOS Stream 10 as soon as possible thus we
are removing the dependency here and vendoring gdisk in this package
instead.

Install sgdisk to /usr/libexec/ignition-sgdisk. We will include a dracut
module that will install in the PATH only in the initramfs.

Bump gdisk to 1.0.10 to fix build failures, matching what is currently
in Fedora 40.

Resolves: RHEL-56080
This commit is contained in:
Timothée Ravier 2024-08-22 12:35:59 +02:00
parent 98036e4780
commit 6e48bd528c
3 changed files with 45 additions and 2 deletions

1
.gitignore vendored
View File

@ -63,3 +63,4 @@
/ignition-2.16.1.tar.gz
/ignition-2.16.2.tar.gz
/ignition-2.17.0.tar.gz
/gptfdisk-*.tar.gz

View File

@ -10,6 +10,11 @@
%global ignedgecommit a3a8f0abb2a1c7fc1c9e5d0e7a3e8830b2e2d766
%global ignedgeshortcommit %(c=%{ignedgecommit}; echo ${c:0:7})
%if 0%{?rhel} && 0%{?rhel} == 10
# For vendored gdisk
%global gdiskversion 1.0.10
%endif
# https://github.com/coreos/ignition
%global goipath github.com/coreos/ignition
%global gomodulesmode GO111MODULE=on
@ -22,14 +27,17 @@ Version: 2.17.0
%global dracutlibdir %{_prefix}/lib/dracut
Name: ignition
Release: 6%{?dist}
Release: 7%{?dist}
Summary: First boot installer and configuration tool
# Upstream license specification: Apache-2.0
License: Apache-2.0
# gdisk: GPLv2
License: Apache-2.0 AND GPLv2
URL: %{gourl}
Source0: %{gosource}
Source1: https://github.com/fedora-iot/ignition-edge/archive/%{ignedgecommit}/ignition-edge-%{ignedgeshortcommit}.tar.gz
# For vendored gdisk
Source2: http://downloads.sourceforge.net/gptfdisk/gptfdisk-%{gdiskversion}.tar.gz
BuildRequires: libblkid-devel
BuildRequires: systemd-rpm-macros
@ -42,6 +50,15 @@ Requires: dosfstools
Requires: dracut
Requires: dracut-network
%if 0%{?rhel} && 0%{?rhel} == 10
# For vendored gdisk
BuildRequires: gcc-c++
BuildRequires: libuuid-devel
BuildRequires: make
BuildRequires: ncurses-devel
BuildRequires: popt-devel
%endif
# Generated by `go-mods-to-bundled-provides.py | sort`
Provides: bundled(golang(cloud.google.com/go/compute/metadata)) = 0.2.3
Provides: bundled(golang(cloud.google.com/go/storage)) = 1.35.1
@ -240,6 +257,11 @@ This package contains the grub2 config which is compatable with bootupd.
tar xvf %{SOURCE1}
%if 0%{?rhel} && 0%{?rhel} == 10
# Prep vendored gdisk
tar xvf %{SOURCE2}
%endif
%build
export LDFLAGS="-X github.com/coreos/ignition/v2/internal/version.Raw=%{version} -X github.com/coreos/ignition/v2/internal/distro.selinuxRelabel=true "
%if 0%{?rhel} && 0%{?rhel} <= 8
@ -275,6 +297,12 @@ echo "Building Windows ignition-validate..."
GOARCH=amd64 GOOS=windows %gocrossbuild -o ./ignition-validate-x86_64-pc-windows-gnu.exe validate/main.go
%endif
%if 0%{?rhel} && 0%{?rhel} == 10
# Build vendored gdisk
cd gptfdisk-%{gdiskversion}
make CXXFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64" LDFLAGS="%{build_ldflags}"
%endif
%install
# dracut modules
install -d -p %{buildroot}/%{dracutlibdir}/modules.d
@ -309,6 +337,13 @@ install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition
%make_install -C ignition-edge-%{ignedgecommit}
%if 0%{?rhel} && 0%{?rhel} == 10
# Install vendored gdisk
cd gptfdisk-%{gdiskversion}
install -D -p -m 0755 sgdisk %{buildroot}%{_libexecdir}/ignition-sgdisk
install -D -p -m 644 COPYING %{buildroot}%{_datadir}/licenses/gdisk/COPYING
%endif
%if %{with check}
%check
# Exclude the blackbox tests
@ -322,6 +357,9 @@ install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition
%{_unitdir}/ignition-delete-config.service
%{_libexecdir}/ignition-apply
%{_libexecdir}/ignition-rmcfg
# Vendored gdisk
%{_libexecdir}/ignition-sgdisk
%{_datadir}/licenses/gdisk/COPYING
%files validate
%doc README.md
@ -360,6 +398,9 @@ install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition
%{_libdir}/bootupd/grub2-static/configs.d/ignition.cfg
%changelog
* Thu Aug 22 2024 Timothée Ravier <tim@siosm.fr> - 2.17.0-7
- Vendor gdisk
* Thu Aug 22 2024 Timothée Ravier <tim@siosm.fr> - 2.17.0-6
- Remove gdisk require to prepare for the sfdisk migration

View File

@ -1,2 +1,3 @@
SHA512 (gptfdisk-1.0.10.tar.gz) = 76764e176cd92470648a1d7a8d2570ebc41005204e73b0f2dd5a7aff2fc1981d3bec61a3bd68b855cc3474bcb7cf49c1cb2ea25843d4e7945bef7648d548383d
SHA512 (ignition-2.17.0.tar.gz) = cfbe1ec0fbeee66e568b2943a6893d11f3965867f85dc4005b3dc10299f314bf7e64141c68867a8422dfd911534011a714631c78921abebbaaa0d9705cb5a336
SHA512 (ignition-edge-a3a8f0a.tar.gz) = ef04cd411752f1b48fdb64ae8e45a2234b635a19ead82483cb33e246697e6ae639f6036030e7647913f5f589532f3d015bcc81848db50ebe8800242f6f23230a