deb: cross-compilation, ephemeral contexts, local builds
All checks were successful
CI / build (push) Successful in 7m18s
All checks were successful
CI / build (push) Successful in 7m18s
Multiple changes: - New contexts (schroot, unshare) - Cross-building quirks, with ephemeral contexts and repositories management - Contexts with parents, global context manager, better lifetime handling - Local building of binary packages - Pull: pulling dsc files by default - Many small bugfixes and changes Co-authored-by: Valentin Haudiquet <valentin.haudiquet@canonical.com> Co-committed-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
This commit was merged in pull request #1.
This commit is contained in:
35
src/deb/sbuild.rs
Normal file
35
src/deb/sbuild.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
/// 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<dyn Error>> {
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user