feat: add metapackage build support and fail-fast custom scripts
- add BuildType::Meta handling in builder and interactive spec output - allow metapackage specs without sources and expose is_metapackage() - avoid build deps in install planning for metapackages - run custom non-function build.sh scripts with `sh -e` to stop on first failure - add regression test for custom script fail-fast behavior - apply small cleanup refactors (let-chains/iterator simplifications)
This commit is contained in:
+12
-12
@@ -112,9 +112,9 @@ fn extract_tar_gz(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -157,9 +157,9 @@ fn extract_tar_xz(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -202,9 +202,9 @@ fn extract_tar_bz2(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -246,9 +246,9 @@ fn extract_tar(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -290,9 +290,9 @@ fn extract_zip(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -335,9 +335,9 @@ fn extract_tar_zst(path: &Path, dest: &Path) -> Result<()> {
|
||||
// preserve the top-level folder (move the directory itself under dest)
|
||||
fs::create_dir_all(dest)?;
|
||||
let dest_top = dest.join(top_name);
|
||||
if fs::rename(&top[0].path(), &dest_top).is_err() {
|
||||
if fs::rename(top[0].path(), &dest_top).is_err() {
|
||||
copy_dir_recursive_local(&top[0].path(), &dest_top)?;
|
||||
fs::remove_dir_all(&top[0].path())?;
|
||||
fs::remove_dir_all(top[0].path())?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
+8
-8
@@ -39,10 +39,10 @@ pub fn copy_manual_sources(spec: &PackageSpec, cache_dir: &Path, build_dir: &Pat
|
||||
|
||||
for manual in &spec.manual_sources {
|
||||
let mut local_entries: Vec<String> = Vec::new();
|
||||
if let Some(file) = manual.file.as_ref() {
|
||||
if !file.trim().is_empty() {
|
||||
local_entries.push(file.clone());
|
||||
}
|
||||
if let Some(file) = manual.file.as_ref()
|
||||
&& !file.trim().is_empty()
|
||||
{
|
||||
local_entries.push(file.clone());
|
||||
}
|
||||
local_entries.extend(
|
||||
manual
|
||||
@@ -53,10 +53,10 @@ pub fn copy_manual_sources(spec: &PackageSpec, cache_dir: &Path, build_dir: &Pat
|
||||
);
|
||||
|
||||
let mut url_entries: Vec<String> = Vec::new();
|
||||
if let Some(url) = manual.url.as_ref() {
|
||||
if !url.trim().is_empty() {
|
||||
url_entries.push(url.clone());
|
||||
}
|
||||
if let Some(url) = manual.url.as_ref()
|
||||
&& !url.trim().is_empty()
|
||||
{
|
||||
url_entries.push(url.clone());
|
||||
}
|
||||
url_entries.extend(manual.urls.iter().filter(|s| !s.trim().is_empty()).cloned());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user