Files
pkh/src/build.rs
Valentin Haudiquet b3365afe5b
All checks were successful
CI / build (push) Successful in 7m21s
docs: added documentation, enforced documentation
2026-01-01 18:37:40 +01:00

27 lines
670 B
Rust

use std::error::Error;
use std::path::Path;
use std::process::Command;
/// Build a Debian source package (to a .dsc)
pub fn build_source_package(cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
let cwd = cwd.unwrap_or_else(|| Path::new("."));
let status = Command::new("dpkg-buildpackage")
.current_dir(cwd)
.args(["-S", "-I", "-i", "-nc", "-d"])
.status()?;
if !status.success() {
return Err(format!("dpkg-buildpackage failed with status: {}", status).into());
}
Ok(())
}
#[cfg(test)]
mod tests {
// We are not testing the build part, as for now this is just a wrapper
// around dpkg-buildpackage.
}