2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-09-12 04:26:25 +00:00

fix(xcat-dep): finalize cross-arch genesis in both directions

PR #62 review #2: finalize_xcat_dep() discovered OS dirs by grepping for an
x86_64 subdir under the x86_64 repo, so a ppc64le-only <os> (an rh<N> that built
for ppc but has no x86_64 sibling) was never iterated -- finalize never
cross-populated that cell's x86_64 genesis and still exited 0.

Discover the union of <os> dirs from both arch repos and require both arch peers
for every one, so an x86_64-only AND a ppc64le-only cell both die with a named
error instead of passing unnoticed. Add a symmetric fixture for the ppc64le-only
case (mirrors the existing x86_64-only peer test).

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-08-21 18:50:45 -03:00
parent 5addcaa976
commit cbb9f4ebfa
2 changed files with 22 additions and 6 deletions
+14 -6
View File
@@ -287,15 +287,23 @@ sub finalize_xcat_dep {
print_step('Finalize xcat-dep: cross-arch genesis-base provisioning (issue #7610)');
print "x86_64-repo: $x86_64_repo\n";
print "ppc64le-repo: $ppc64le_repo\n";
my @osdirs = grep { -d "$_/x86_64" } glob("$x86_64_repo/*");
# Discover the UNION of OS dirs from BOTH arch repos. Anchoring discovery on x86_64 alone let a
# ppc64le-only <os> (an rh<N> that built for ppc but not x86_64) slip through unseen -- finalize
# then never cross-populated that cell's x86_64 genesis and still exited 0 (PR #62 review). Both
# arch peers are required for every discovered <os> below, so the check is now symmetric.
my %os;
$os{ basename($_) } = 1 for grep { -d "$_/x86_64" } glob("$x86_64_repo/*");
$os{ basename($_) } = 1 for grep { -d "$_/ppc64le" } glob("$ppc64le_repo/*");
my $pairs = 0;
for my $p (sort @osdirs) {
my $osdir = basename($p);
for my $osdir (sort keys %os) {
my $x86dir = "$x86_64_repo/$osdir/x86_64";
my $ppcdir = "$ppc64le_repo/$osdir/ppc64le";
# Require the peer repo itself: in the CD both arches build every EL, so a missing
# ppc64le peer for an x86_64 OS means an incomplete input, not something to skip past
# (skipping would leave that OS's x86_64 repo without the ppc64 genesis and still exit 0).
# Both arch peers must exist: in the CD both arches build every EL, so a one-arch <os> is an
# incomplete input, not something to skip past (skipping would leave a cell without the
# foreign-arch genesis and still exit 0). Symmetric -- catches an x86_64-only AND a
# ppc64le-only <os>.
die "FATAL: [finalize] $osdir: no x86_64 peer repo at $x86dir\n"
. " (both arches must build every EL before finalize)\n" if !-d $x86dir;
die "FATAL: [finalize] $osdir: no ppc64le peer repo at $ppcdir\n"
. " (both arches must build every EL before finalize)\n" if !-d $ppcdir;
# Require the expected inputs: each arch's build must have produced its OWN genesis rpm
+8
View File
@@ -176,6 +176,14 @@ SPEC
my $ok3 = eval { quiet { finalize_xcat_dep("$tmp3/x", "$tmp3/p") }; 1 };
ok(!$ok3, 'finalize dies when an x86_64 OS has no ppc64le peer repo (no silent skip)');
like($@, qr/no ppc64le peer repo/, 'finalize error names the missing peer');
# Symmetric (PR #62 review #2): a ppc64le-ONLY <os> (no x86_64 sibling) must ALSO be caught --
# the old x86_64-anchored discovery skipped it entirely and exited 0.
my $tmp4 = tempdir(CLEANUP => 1);
make_path("$tmp4/p/rh9/ppc64le"); # ppc64le OS present, but NO x86_64 peer dir at all
my $ok4 = eval { quiet { finalize_xcat_dep("$tmp4/x", "$tmp4/p") }; 1 };
ok(!$ok4, 'finalize dies when a ppc64le OS has no x86_64 peer repo (was silently skipped)');
like($@, qr/no x86_64 peer repo/, 'finalize error names the missing x86_64 peer');
}
# ---- restamp_release_line: CD --build-number Release stamping (PR #62 review point 1) ----------