From 488a6d1fc7c32d7b3de69f532d23074a25f2040f Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:54:27 -0300 Subject: [PATCH] test(xcat-core): a prerelease version keeps every package out of every suite deb_belongs_to_dist reads any trailing ~word in a package version as the codename the deb was built for. Debian uses ~ for a prerelease, and --release takes whatever the caller gives it, so `--release 1~rc1` puts one in every package name: xcat-client_2.19.0-1~rc1_all.deb noble=0 focal=0 The deb is then published into no suite at all, with --genesis nowhere in the command, and the run still reports how many packages it published. Only the Genesis image is built per codename, so only it can be excluded by one. The new cases assert a prerelease version reaches every suite, that a Genesis SCRIPTS deb is not treated as the image, and that the image itself is still confined to its own suite when its version carries both. The second half asserts genesis_dists(), which does not exist yet: a plain --genesis run takes the release list the rest of the build uses, and focal is on it. focal ships debhelper 12.10 -- measured on the focal management node -- against the package's debhelper-compat (= 13), so sbuild stops on the build dependencies and the run ends on its first release. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/unit/genesis_deb_per_codename.t | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/xCAT-test/unit/genesis_deb_per_codename.t b/xCAT-test/unit/genesis_deb_per_codename.t index ee11fa987..9b732500d 100644 --- a/xCAT-test/unit/genesis_deb_per_codename.t +++ b/xCAT-test/unit/genesis_deb_per_codename.t @@ -69,6 +69,40 @@ if (XCAT::BuildUtils->can('deb_belongs_to_dist')) { 'a deb with no codename in its version reaches every suite'); ok(XCAT::BuildUtils::deb_belongs_to_dist('xcat_2.19.0-snap1_amd64.deb', 'resolute'), 'an architecture deb reaches every suite'); + + # A `~` in a version is not a codename. Debian uses it for a prerelease, and --release + # takes whatever the caller gives it, so `--release 1~rc1` puts one in every package + # name. Reading it as a codename drops the whole build from every suite, and the run + # still reports the packages it published. + for my $dist (qw(focal jammy noble resolute)) { + ok(XCAT::BuildUtils::deb_belongs_to_dist('xcat-client_2.19.0-1~rc1_all.deb', $dist), + "a prerelease version reaches $dist"); + } + ok(XCAT::BuildUtils::deb_belongs_to_dist('xcat-genesis-scripts-amd64_2.19.0-1~rc1_amd64.deb', 'noble'), + 'a prerelease Genesis SCRIPTS deb reaches every suite: only the image is per codename'); + + # And the rule the exclusion exists for still holds under a prerelease version. + ok(XCAT::BuildUtils::deb_belongs_to_dist('xcat-genesis-base-amd64_2.19.0-1~rc1~noble_amd64.deb', 'noble'), + 'a prerelease Genesis image reaches its own suite'); + ok(!XCAT::BuildUtils::deb_belongs_to_dist('xcat-genesis-base-amd64_2.19.0-1~rc1~noble_amd64.deb', 'jammy'), + 'and no other'); +} + +# --- the releases a Genesis image can be built on ------------------------------------------ +# A plain --genesis run takes the release list the rest of the build uses. focal is on it and +# cannot build the package: it ships debhelper 12.10 and xCAT-genesis-base declares +# debhelper-compat (= 13), so sbuild stops on the build dependencies before dracut runs and +# the run ends on its first release. +ok(XCAT::BuildUtils->can('genesis_dists'), + 'XCAT::BuildUtils says which releases a Genesis image can be built on'); +if (XCAT::BuildUtils->can('genesis_dists')) { + is_deeply([ XCAT::BuildUtils::genesis_dists(XCAT::BuildUtils::default_dists()) ], + [qw(jammy noble resolute)], + 'the default plan leaves out the release whose chroot cannot build the package'); + is_deeply([ XCAT::BuildUtils::genesis_dists(qw(jammy noble)) ], [qw(jammy noble)], + 'a list with none of them is unchanged'); + is_deeply([ XCAT::BuildUtils::genesis_dists('focal') ], [], + 'a list of only that release plans nothing'); } # --- the log guard ---------------------------------------------------------------------