Merge branch 'same-lock' into 'master'

Fix to make cookbook.lock more consistent

See merge request redox-os/redox!2218
This commit is contained in:
Jeremy Soller 2026-07-08 06:00:24 -06:00
commit fe03a4d56a
2 changed files with 30 additions and 2 deletions

View File

@ -720,7 +720,13 @@ fn parse_args(args: Vec<String>) -> Result<(CliConfig, CliCommand, Vec<CookRecip
recipes = recipes_flatten_package_names(recipes);
for recipe in recipes.iter_mut() {
if let Some(special_rule) = special_rules.get(&recipe.name) {
if let Some(special_rule) =
special_rules.get(recipe.canon_recipe_name().without_prefix())
{
if recipe.name.is_host() && special_rule == "binary" {
// host recipe binaries is currently not supported
continue;
}
recipe.apply_filesystem_config(&special_rule)?;
continue;
}
@ -1042,7 +1048,8 @@ fn handle_change_rule(
if is_capture_rev && !matches!(recipe.recipe.source, Some(SourceRecipe::Git { .. })) {
continue;
}
let recipe_name = recipe.name.without_prefix();
let recipe_name = recipe.canon_recipe_name();
let recipe_name = recipe_name.without_prefix();
let mut recipe_lock = lock.get(recipe_name).cloned().unwrap_or_default();
let cached = if is_change_rule {
if config.unset {

View File

@ -540,6 +540,27 @@ impl CookRecipe {
}
None
}
/// Get the name for recipe that is used as the build source
pub fn canon_recipe_name(&self) -> PackageName {
// TODO: I hope nobody is nesting same_as...
if let Some(SourceRecipe::SameAs { same_as }) = &self.recipe.source {
if let Some(name) = Path::new(&same_as)
.file_name()
.and_then(|p| p.to_str())
.and_then(|p| PackageName::new(p).ok())
{
return name;
} else {
eprintln!(
"canon_recipe_name(): the same_as path for recipe {} is not valid",
self.name.as_str()
)
}
}
self.name.clone()
}
}
// TODO: Wrap these vectors in a struct