From eb37cd6e204f6f2d124b6fbea12437c3dc5a5815 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:03:52 -0300 Subject: [PATCH] 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> --- xCAT-genesis-builder/builddeb-genesis-base | 21 +++++++++++++++------ xCAT-test/unit/genesis_ubuntu_build_root.t | 8 +++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/xCAT-genesis-builder/builddeb-genesis-base b/xCAT-genesis-builder/builddeb-genesis-base index 5c4091a69..0195f672d 100755 --- a/xCAT-genesis-builder/builddeb-genesis-base +++ b/xCAT-genesis-builder/builddeb-genesis-base @@ -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 diff --git a/xCAT-test/unit/genesis_ubuntu_build_root.t b/xCAT-test/unit/genesis_ubuntu_build_root.t index 3486094d8..fb598ccd9 100755 --- a/xCAT-test/unit/genesis_ubuntu_build_root.t +++ b/xCAT-test/unit/genesis_ubuntu_build_root.t @@ -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'); }