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:
2026-02-25 16:49:36 -06:00
parent 9953d4b2ee
commit d9a30f5d56
13 changed files with 168 additions and 94 deletions
+7 -7
View File
@@ -83,13 +83,13 @@ pub fn register_package(db_path: &Path, spec: &PackageSpec, destdir: &Path) -> R
params![file],
|row| row.get(0),
);
if let Ok(owner) = owner_res {
if owner != spec.package.name {
if is_auto_removable_path(file) {
auto_conflicts.push((file.clone(), owner));
} else {
fatal_conflicts.push((file.clone(), owner));
}
if let Ok(owner) = owner_res
&& owner != spec.package.name
{
if is_auto_removable_path(file) {
auto_conflicts.push((file.clone(), owner));
} else {
fatal_conflicts.push((file.clone(), owner));
}
}
}
+11 -11
View File
@@ -1019,11 +1019,11 @@ pub fn sync_mirrors(
.with_context(|| format!("Failed to fetch updates for {}", url))?;
// Try to fast-forward HEAD to origin/HEAD by resetting to FETCH_HEAD if present
if let Ok(fetch_head) = repo.find_reference("FETCH_HEAD") {
if let Some(oid) = fetch_head.target() {
let obj = repo.find_object(oid, None)?;
repo.reset(&obj, ResetType::Hard, None)?;
}
if let Ok(fetch_head) = repo.find_reference("FETCH_HEAD")
&& let Some(oid) = fetch_head.target()
{
let obj = repo.find_object(oid, None)?;
repo.reset(&obj, ResetType::Hard, None)?;
}
}
@@ -1055,7 +1055,7 @@ pub fn mirrors_status(
return Ok(());
}
for (name, _url) in mirrors {
for name in mirrors.keys() {
let target = base.join(name);
crate::log_info!("--- {} ---", name);
if !target.exists() {
@@ -1080,11 +1080,11 @@ pub fn mirrors_status(
// Commit time (seconds since epoch) if available
let mut commit_time = String::new();
if let Some(oid) = oid {
if let Ok(commit) = repo.find_commit(oid) {
let t = commit.time().seconds();
commit_time = format!("{}", t);
}
if let Some(oid) = oid
&& let Ok(commit) = repo.find_commit(oid)
{
let t = commit.time().seconds();
commit_time = format!("{}", t);
}
// Dirty status