mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-03 16:06:59 +00:00
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 <pkg>-<target><ext> 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>
This commit is contained in:
@@ -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 \\
|
||||
|
||||
Reference in New Issue
Block a user