diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 8a939da3f..82664f14a 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -497,6 +497,7 @@ fn parse_args(args: Vec) -> anyhow::Result<(CliConfig, CliCommand, Vec Result, PackageError> { let mut packages = Self::new_recursive( names, @@ -399,6 +405,24 @@ impl CookRecipe { } } + if flatten_opt_package { + let old_packages = packages; + packages = Vec::new(); + let mut packages_set = BTreeSet::new(); + for mut package in old_packages { + let is_host = package.name.is_host(); + let mut name = package.name.with_suffix(None); + if is_host { + name = name.with_host(); + } + if !packages_set.contains(name.as_str()) { + packages_set.insert(name.to_string()); + package.name = name; + packages.push(package); + } + } + } + Ok(packages) }