mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-25 09:14:05 +00:00
edfe6a8840
build-ubunturepo guarded builds with a single host-global, fail-fast lock at /var/lock/xcatbld.lock (`flock -n`). Two builds on one host -- e.g. the devel and stable Ubuntu CD lanes on xcat-master-ub -- therefore collided on that one lock and the loser exited 1 with "Can't get lock ...", failing the whole pipeline, even though each lane builds from its own checkout into its own DEST and they share nothing. build-ubunturepo builds its packages in-place in its own source checkout (it rewrites debian/changelog and debian/control, drops *.orig.tar.gz at the checkout root and runs dpkg-buildpackage inside the package dirs), so the resource two concurrent builds actually contend for is the checkout, not the host. Key the lock on the checkout path ($curdir): builds of the SAME checkout still fail-fast (they would corrupt each other in-place), while builds of DISTINCT checkouts get distinct locks and run in parallel. The lock file stays on the local /var/lock (reliable flock, unlike the NFS/virtiofs checkout) and the source tree is left byte-pristine. Add xCAT-test/unit/build_ubunturepo_lock.t, which extracts the lock block from the script verbatim and asserts: the lock path is /var/lock/xcatbld-<hash-of-checkout>.lock and deterministic per checkout; a second build of the same checkout fails fast; two distinct checkouts acquire their locks concurrently. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>