From 79f3e1634328756ea0f29bdb9f2f06803cb16dd2 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Tue, 7 Jul 2026 16:43:38 +0700 Subject: [PATCH] Fix to make cookbook.lock more consistent --- src/bin/repo.rs | 11 +++++++++-- src/recipe.rs | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 7c01c3247..435d3a398 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -720,7 +720,13 @@ fn parse_args(args: Vec) -> Result<(CliConfig, CliCommand, Vec 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