2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-24 00:34:02 +00:00

fix(xcat-core): naming util-linux-extra stops the Genesis build on jammy

REQUIRED_PACKAGES named util-linux-extra for every release. focal and jammy
have no such package -- apt reports "Candidate: (none)" -- so apt-get install
exits non-zero and, under set -euo pipefail, the build stops before dracut
runs. hwclock is in util-linux there, which is essential and already present.

optional_packages() keeps a package only where apt has a candidate for it, and
util-linux-extra goes through it. The unconditional list keeps isc-dhcp-client
and ifenslave, which every release has and neither of which the build root
carries by itself.

The call to verify-genesis-payload goes with it. That script is added by the
genesis payload branch, not this one, so the line stopped the build at the
point it was meant to guard.

Also corrects the plan count and a dereference in the test committed before
this one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-09-16 18:03:52 -03:00
parent ea2b86adef
commit eb37cd6e20
2 changed files with 18 additions and 11 deletions
+15 -6
View File
@@ -30,15 +30,29 @@ REQUIRED_PACKAGES="
nfs-common rpcbind pciutils usbutils parted
dosfstools e2fsprogs lvm2 mdadm net-tools
bc psmisc rsync wget cpio
isc-dhcp-client ifenslave util-linux-extra
isc-dhcp-client ifenslave
dpkg-dev debhelper fakeroot devscripts vim-tiny
"
if [ "$BUILDARCH" = "amd64" ]; then
REQUIRED_PACKAGES="$REQUIRED_PACKAGES dmidecode efibootmgr"
fi
# Keep only the packages this release actually has. hwclock moved out of util-linux into
# util-linux-extra, so focal and jammy have no such package and naming it there fails the
# whole install. util-linux only Suggests it, and --no-install-recommends is passed, so the
# releases that did split it must name it.
optional_packages() {
local package
for package in "$@"; do
if apt-cache show "$package" >/dev/null 2>&1; then
echo "$package"
fi
done
}
echo "Installing build dependencies..."
apt-get update -qq
REQUIRED_PACKAGES="$REQUIRED_PACKAGES $(optional_packages util-linux-extra)"
apt-get install -y --no-install-recommends $REQUIRED_PACKAGES
# Set up dracut module
@@ -142,11 +156,6 @@ fi
echo "Adding kernel $KERNEL_IMAGE"
cp "$KERNEL_IMAGE" "$GENESIS_ROOT/kernel"
# dracut_install reports a missing command and returns, so a hole reaches the .deb with
# nothing in the log but one line. Read the commands back from the module and check them
# against the payload, the way xCAT-genesis-base.spec does for EL.
bash "$DIR/verify-genesis-payload" --commands-from "$DRACUTMODDIR/module-setup.sh" "$GENESIS_FS"
find "$GENESIS_TMPDIR" -type c -delete
# Stage for dpkg-buildpackage
+3 -5
View File
@@ -20,7 +20,7 @@ my $builder = repo_path('xCAT-genesis-builder/builddeb-genesis-base');
my $module = repo_path('xCAT-genesis-builder/dracut_105/ubuntu/module-setup.sh');
plan skip_all => 'builddeb-genesis-base not found' unless -f $builder;
plan skip_all => 'ubuntu module-setup.sh not found' unless -f $module;
plan tests => 10;
plan tests => 9;
# Mandatory commands a minimal Ubuntu server root does NOT already provide, and the package
# that supplies each one on every release xCAT builds for.
@@ -58,11 +58,9 @@ ok(!scalar(grep { $_ eq 'util-linux-extra' } @packages),
# What the script does instead: keep a package only where apt has a candidate for it.
{
my @present = optional_packages($builder, 'util-linux-extra', 0);
my @absent = optional_packages($builder, 'util-linux-extra', 1);
is_deeply(\@present, ['util-linux-extra'],
is_deeply(optional_packages($builder, 'util-linux-extra', 0), ['util-linux-extra'],
'a release that carries util-linux-extra installs it');
is_deeply(\@absent, [],
is_deeply(optional_packages($builder, 'util-linux-extra', 1), [],
'a release without it installs nothing in its place');
}