wrap around dpkg-buildpackage
This commit is contained in:
26
src/build.rs
Normal file
26
src/build.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
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", "-d"])
|
||||
.status()?;
|
||||
|
||||
if !status.success() {
|
||||
return Err(format!("dpkg-buildpackage failed with status: {}", status).into());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// We are not testing the build part, as for now this is just a wrapper
|
||||
// around dpkg-buildpackage.
|
||||
}
|
||||
Reference in New Issue
Block a user