feat: add support for Mercurial (hg) source handling in mod.rs

- Implemented `split_hg_url` to parse Mercurial URLs and revisions.
- Added `checkout_hg` function to clone Mercurial repositories.
- Integrated Mercurial handling into the `prepare_one` function to support resuming builds.
- Added tests for `split_hg_url` to ensure correct parsing of URLs and revisions.

---

feat: introduce legacy STARBUILD conversion support in starbuild.rs

- Created `ConvertedStarbuild` and `ParsedStarbuild` structs to manage conversion data.
- Implemented `convert_starbuild_file` to parse STARBUILD files and generate package specifications.
- Added functions to handle parsing of various STARBUILD constructs, including dependencies and build phases.
- Developed a build script generator for STARBUILD, supporting custom install functions.
- Included tests to validate conversion of single and multi-output STARBUILD files.
This commit is contained in:
2026-03-23 15:13:07 -05:00
parent 19da5b960c
commit fd7873995a
10 changed files with 1653 additions and 9 deletions
+101
View File
@@ -1544,6 +1544,107 @@ pub fn spec_to_minimal_toml(spec: &PackageSpec) -> anyhow::Result<String> {
root.insert("dependencies".into(), Value::Table(dep_tbl));
}
if !spec.package_dependencies.is_empty() {
let mut outputs_tbl = Table::new();
for (pkg_name, deps) in &spec.package_dependencies {
let mut dep_tbl = Table::new();
if !deps.build.is_empty() {
dep_tbl.insert(
"build".into(),
Value::Array(
deps.build
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !deps.runtime.is_empty() {
dep_tbl.insert(
"runtime".into(),
Value::Array(
deps.runtime
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !deps.test.is_empty() {
dep_tbl.insert(
"test".into(),
Value::Array(deps.test.iter().map(|s| Value::String(s.clone())).collect()),
);
}
if !deps.optional.is_empty() {
dep_tbl.insert(
"optional".into(),
Value::Array(
deps.optional
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !dep_tbl.is_empty() {
outputs_tbl.insert(pkg_name.clone(), Value::Table(dep_tbl));
}
}
if !outputs_tbl.is_empty() {
root.insert("package_dependencies".into(), Value::Table(outputs_tbl));
}
}
if !spec.package_alternatives.is_empty() {
let mut outputs_tbl = Table::new();
for (pkg_name, alternatives) in &spec.package_alternatives {
let mut alt_tbl = Table::new();
if !alternatives.provides.is_empty() {
alt_tbl.insert(
"provides".into(),
Value::Array(
alternatives
.provides
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !alternatives.conflicts.is_empty() {
alt_tbl.insert(
"conflicts".into(),
Value::Array(
alternatives
.conflicts
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !alternatives.replaces.is_empty() {
alt_tbl.insert(
"replaces".into(),
Value::Array(
alternatives
.replaces
.iter()
.map(|s| Value::String(s.clone()))
.collect(),
),
);
}
if !alt_tbl.is_empty() {
outputs_tbl.insert(pkg_name.clone(), Value::Table(alt_tbl));
}
}
if !outputs_tbl.is_empty() {
root.insert("package_alternatives".into(), Value::Table(outputs_tbl));
}
}
Ok(toml::to_string_pretty(&Value::Table(root))?)
}