deb: pass the build context explicitly instead of swapping the global
build_binary_package installed its ephemeral chroot context into the process-global manager and read it back with context::current(), ignoring its ctx parameter: two concurrent builds would re-point each other's global and each drop would clean up whichever chroot was current at the time. The guard now keeps the Arc of the context it created (parented directly on the base context, not on a config-name lookup), exposes it via context(), and Drop cleans up exactly that context and restores the exact handle that was current at creation, so overlapping builds no longer cross-destroy each other.
This commit is contained in:
+10
-7
@@ -134,14 +134,17 @@ async fn build_binary_package_impl(
|
||||
None
|
||||
};
|
||||
|
||||
let result = async {
|
||||
// Get the build context - either the ephemeral context or the base context
|
||||
let build_ctx = if mode == BuildMode::Local {
|
||||
context::current()
|
||||
} else {
|
||||
base_ctx.clone()
|
||||
};
|
||||
// Determine the build context explicitly: for Local builds it is the
|
||||
// ephemeral context the guard just created (taken from the guard itself,
|
||||
// never from the process-global, which concurrent builds may have
|
||||
// re-pointed at their own chroot); otherwise the base context is used
|
||||
// directly.
|
||||
let build_ctx = match guard.as_ref() {
|
||||
Some(g) => g.context(),
|
||||
None => base_ctx.clone(),
|
||||
};
|
||||
|
||||
let result = async {
|
||||
// Prepare build directory
|
||||
let build_root = build_ctx.create_temp_dir()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user