Run cargo fetch on fetch

This commit is contained in:
Wildan M 2025-11-17 07:11:58 +07:00
parent 35d0495769
commit 4493fcb0a8
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79

View File

@ -306,6 +306,14 @@ pub fn fetch(recipe_dir: &Path, recipe: &Recipe, logger: &PtyOut) -> Result<Path
}
}
if let BuildKind::Cargo {
package_path,
cargoflags: _,
} = &recipe.build.kind
{
fetch_cargo(&source_dir, package_path.as_ref(), logger)?;
}
Ok(source_dir)
}
@ -382,6 +390,31 @@ pub(crate) fn fetch_extract_tar(
Ok(())
}
pub(crate) fn fetch_cargo(
recipe_dir: &PathBuf,
package_path: Option<&String>,
logger: &PtyOut,
) -> Result<(), String> {
let mut target_dir = recipe_dir.clone();
if let Some(package_path) = package_path {
target_dir = target_dir.join(package_path);
}
let mut command = if is_redox() {
Command::new("cargo")
} else {
let cookbook_redoxer = Path::new("target/release/cookbook_redoxer")
.canonicalize()
.unwrap_or(PathBuf::from("/bin/false"));
Command::new(&cookbook_redoxer)
};
command.arg("fetch");
command.arg("--manifest-path");
command.arg(target_dir.join("Cargo.toml").into_os_string());
run_command(command, logger)?;
Ok(())
}
pub(crate) fn fetch_is_patches_newer(
recipe_dir: &Path,
patches: &Vec<String>,