This commit is contained in:
14
src/deb.rs
14
src/deb.rs
@@ -2,7 +2,7 @@ use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn build_binary_package(cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
||||
pub fn build_binary_package(arch: Option<&str>, series: Option<&str>, cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
||||
let cwd = cwd.unwrap_or_else(|| Path::new("."));
|
||||
|
||||
// Parse changelog to get package name and version
|
||||
@@ -19,7 +19,17 @@ pub fn build_binary_package(cwd: Option<&Path>) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
println!("Building {} using sbuild...", dsc_path.display());
|
||||
|
||||
let status = Command::new("sbuild").arg(dsc_path).status()?;
|
||||
let mut status = Command::new("sbuild");
|
||||
if let Some(arch) = arch {
|
||||
status.arg(format!("--arch={}", arch));
|
||||
}
|
||||
if let Some(series) = series {
|
||||
status.arg(format!("--dist={}", series));
|
||||
}
|
||||
|
||||
let status = status
|
||||
.arg(dsc_path)
|
||||
.status()?;
|
||||
|
||||
if !status.success() {
|
||||
return Err(format!("sbuild failed with status: {}", status).into());
|
||||
|
||||
Reference in New Issue
Block a user