/// Sbuild binary package building /// Call 'sbuild' with the dsc file to build the package with unshare use crate::context; use std::error::Error; pub fn build( package: &str, _version: &str, arch: &str, series: &str, build_root: &str, cross: bool, ) -> Result<(), Box> { let ctx = context::current(); let mut cmd = ctx.command("sbuild"); cmd.current_dir(format!("{}/{}", build_root, package)); cmd.arg("--chroot-mode=unshare"); cmd.arg("--no-clean-source"); if cross { cmd.arg(format!("--host={}", arch)); } else { cmd.arg(format!("--arch={}", arch)); } cmd.arg(format!("--dist={}", series)); // Add output directory argument cmd.arg(format!("--build-dir={}", build_root)); let status = cmd.status()?; if !status.success() { return Err(format!("sbuild failed with status: {}", status).into()); } Ok(()) }