exp: cross #3
This commit is contained in:
@@ -4,7 +4,7 @@ mod sbuild;
|
||||
|
||||
use crate::context;
|
||||
use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn build_binary_package(
|
||||
arch: Option<&str>,
|
||||
@@ -47,9 +47,9 @@ pub fn build_binary_package(
|
||||
|
||||
// Run sbuild
|
||||
if cross {
|
||||
local::build(cwd, &package, &version, arch, series, &build_root, cross)?;
|
||||
local::build(&package, &version, arch, series, &build_root, cross)?;
|
||||
} else {
|
||||
sbuild::build(cwd, &package, &version, arch, series, &build_root, cross)?;
|
||||
sbuild::build(&package, &version, arch, series, &build_root, cross)?;
|
||||
}
|
||||
|
||||
// Retrieve artifacts
|
||||
@@ -66,5 +66,25 @@ pub fn build_binary_package(
|
||||
}
|
||||
}
|
||||
|
||||
if cross {
|
||||
cross::clean_native_context()?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn find_dsc_file(
|
||||
build_root: &str,
|
||||
package: &str,
|
||||
version: &str,
|
||||
) -> Result<PathBuf, Box<dyn Error>> {
|
||||
// Strip epoch from version (e.g., "1:2.3.4-5" -> "2.3.4-5")
|
||||
let version_without_epoch = version.split_once(':').map(|(_, v)| v).unwrap_or(version);
|
||||
let dsc_name = format!("{}_{}.dsc", package, version_without_epoch);
|
||||
let dsc_path = PathBuf::from(build_root).join(&dsc_name);
|
||||
|
||||
if !dsc_path.exists() {
|
||||
return Err(format!("Could not find .dsc file at {}", dsc_path.display()).into());
|
||||
}
|
||||
Ok(dsc_path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user