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:
@@ -162,7 +162,13 @@ impl ContextManager {
|
||||
}
|
||||
|
||||
/// Set current context, without modifying configuration
|
||||
pub fn set_current_ephemeral(&self, context: Context) {
|
||||
///
|
||||
/// Accepts either an owned [`Context`] or an already-shared
|
||||
/// `Arc<Context>`: callers that keep their own handle to the context
|
||||
/// they install (e.g. [`crate::deb::ephemeral::EphemeralContextGuard`])
|
||||
/// pass the Arc so they can restore exactly this context afterwards
|
||||
/// instead of relying on whatever happens to be current at that time.
|
||||
pub fn set_current_ephemeral(&self, context: impl Into<Arc<Context>>) {
|
||||
*self.context.write().unwrap() = context.into();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user