sandbox,deb,test: fold the unshare driver into Unshare

Unshare now owns its chroot driver directly: command wrappers, path
mapping, overlay staging and teardown no longer go through Context or
ContextDriver. Host is the base for every bootstrap, and deb and test
pass Arc<dyn Sandbox> end to end.

apt, build and the unit tests use Host instead of a local Context. The
context module, its manager, drivers and persisted configuration are
deleted. test_support::wrap_driver is replaced by the exec test sink.
This commit is contained in:
vhaudiquet committed 2026-11-24 18:35:17 +01:00
1 parent 7c689e8c39
commit d5bf2ceeb3
27 files changed
+507 -3286

No files matched your search

+6 -12
View File
@@ -4,13 +4,12 @@ pub(crate) mod local;
/// host-tree snapshot/sync that keeps build artifacts alive across attempts
pub mod session;
use crate::context::{Context, ContextConfig};
use crate::logfmt::{
AptInstallClassifier, AptUpdateClassifier, Classifier, GenericClassifier, MakeClassifier,
MmdebstrapClassifier, QuiltClassifier,
};
use crate::report::{BuildTarget, BuildView, TargetKind};
use crate::sandbox::{PutOutcome, ReuseState, Sandbox, SandboxExt, StageOptions, Unshare};
use crate::sandbox::{Host, PutOutcome, ReuseState, Sandbox, SandboxExt, StageOptions, Unshare};
use std::error::Error;
use std::path::{Path, PathBuf};
use std::sync::Arc;
@@ -447,7 +446,7 @@ async fn build_binary_package_impl(
} else {
None
};
let base_ctx = Arc::new(Context::new(ContextConfig::Local)?);
let base_ctx = Arc::new(Host::new());
// Identify the target in the live view once the changelog is parsed, so
// even the chroot download output is attributed and tee'd
@@ -1237,13 +1236,9 @@ mod tests {
/// is_dir answer through the path mapping, no namespace privileges
/// needed.
fn unshare_test_context(chroot_root: &Path) -> Arc<dyn Sandbox> {
let base = Context::new(crate::context::ContextConfig::Local).unwrap();
Arc::new(Context::with_parent(
crate::context::ContextConfig::Unshare {
path: chroot_root.to_string_lossy().to_string(),
parent: None,
},
Arc::new(base),
Arc::new(crate::sandbox::unshare::UnshareDriver::new(
chroot_root.to_path_buf(),
Arc::new(Host::new()),
))
}
@@ -1366,8 +1361,7 @@ mod tests {
log::info!("Successfully pulled package {}", package);
// Resolve the package directory through a local sandbox.
let ctx_sandbox: Arc<dyn Sandbox> =
Arc::new(Context::new(crate::context::ContextConfig::Local).unwrap());
let ctx_sandbox: Arc<dyn Sandbox> = Arc::new(Host::new());
// Change directory to the package directory
let cwd = crate::deb::find_package_directory(