From 2e3eef2867d6de5697b8bd5a13135610e1a32f4d Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 29 Jul 2026 09:51:26 -0300 Subject: [PATCH] fix(xcat-core): clean mock buildroot before each build (--init), not reuse-dirty buildrpms.pl built every package with mock -N (--no-clean), reusing the per-package - chroot across runs for flat disk. But a build aborted or killed mid-flight leaves that chroot half-initialised with a corrupt rpmdb; the NEXT run reused it and failed (cannot open Packages database .../usr/lib/sysimage/rpm), producing an incomplete core (e.g. missing xCAT-test) that fails the deploy-time completeness gate. Re-init the buildroot (mock --init) right before building each package, after the diskcache skip so it only runs when actually building. --init restores from mock's root-cache tarball (cheap) so disk stays flat and builds stay fast; -N is kept on the srpm/binary calls so they still reuse the freshly initialised root within the run. This stabilises builds against corrupt state left by any previous failed/aborted build. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- buildrpms.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/buildrpms.pl b/buildrpms.pl index b3909ed7a..264a4adba 100755 --- a/buildrpms.pl +++ b/buildrpms.pl @@ -482,6 +482,16 @@ sub buildspkgs { say "Building $diskcache"; + # Clean-before-start: re-init the buildroot from mock's root cache so a corrupt or + # half-built chroot left behind by a PREVIOUS aborted/failed run cannot poison this + # build (this is what caused "cannot open Packages database ... /usr/lib/sysimage/rpm" + # -> missing rpm -> incomplete core). Cheap: --init restores from the cached root + # tarball rather than a full dnf bootstrap, and the -N below then reuses THIS freshly + # initialised root for both the srpm and the binary rebuild within this run. We reach + # here only when actually building (past the diskcache skip), so flat-disk reuse across + # runs is preserved -- we just guarantee a known-good starting point each time. + sh_retry(qq(mock -r $chroot @{[ join " ", @opts ]} --init)); + sh_retry(<<"EOF"); mock -r $chroot \\ -N \\