mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-09-12 04:26:25 +00:00
fix(xcat-dep): scrub the shared genesis mock chroot before each build
The xCAT-genesis-base build runs buildrpms.pl without a per-run --mock-uniqueext, so its mock chroot (xCAT-genesis-base-<target>) is shared across CD runs. mock only scrubs a chroot on a SUCCESSFUL build, so a killed or failFast-interrupted prior run leaves the chroot stunted (missing /bin/sh), and mock REUSES that corpse on the next run, which then dies with FileNotFoundError: '/bin/sh' during genesis -- failing an otherwise-healthy build until an operator manually scrubs the chroot. Scrub the genesis chroot before building it: a lock-safe, best-effort 'mock --scrub=chroot --scrub=bootstrap' (skipped if a concurrent build holds the lock, a no-op on the first run before the config exists). Any corpse from an interrupted run is dropped and mock recreates the chroot fresh from the cached root, so an interrupted build can no longer poison the next one. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
+9
-1
@@ -520,7 +520,15 @@ if (!$skip_build) {
|
||||
# buildrpms.pl's rpmdev-setuptree only runs during env setup, not per build, so create the
|
||||
# rpmbuild tree ourselves for this per-target HOME (else $HOME/rpmbuild/SOURCES is missing).
|
||||
my $mktree = join(' ', map { sh_quote("$genesis_home/rpmbuild/$_") } qw(SOURCES SPECS BUILD BUILDROOT RPMS SRPMS));
|
||||
my $cmd = "mkdir -p $mktree && HOME=" . sh_quote($genesis_home) . ' ' . join(' ',
|
||||
# The genesis chroot (xCAT-genesis-base-<target>) is SHARED across runs -- buildrpms.pl builds it
|
||||
# without a per-run --mock-uniqueext. mock's post-build scrub only runs on SUCCESS, so a killed
|
||||
# or failFast-interrupted prior run leaves the chroot stunted (missing /bin/sh), and mock REUSES
|
||||
# the corpse on the next run -> "FileNotFoundError: '/bin/sh'". Scrub it FIRST (lock-safe -- mock
|
||||
# refuses if a concurrent build holds it -- and best-effort: a no-op on the first run before the
|
||||
# config exists) so mock recreates the chroot fresh from the cached root (fast, no re-bootstrap).
|
||||
my $genesis_scrub = "{ mock -r " . sh_quote("xCAT-genesis-base-$target")
|
||||
. " --scrub=chroot --scrub=bootstrap >/dev/null 2>&1 || true; }";
|
||||
my $cmd = "mkdir -p $mktree && $genesis_scrub && HOME=" . sh_quote($genesis_home) . ' ' . join(' ',
|
||||
'perl', sh_quote("$xcat_src/buildrpms.pl"),
|
||||
'--package', 'xCAT-genesis-base',
|
||||
'--target', sh_quote($target),
|
||||
|
||||
Reference in New Issue
Block a user