mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-25 14:24:18 +08:00
Flat out package names when building
This commit is contained in:
parent
a7b7b9e589
commit
bd78177329
@ -497,6 +497,7 @@ fn parse_args(args: Vec<String>) -> anyhow::Result<(CliConfig, CliCommand, Vec<C
|
||||
!command.is_pushing(),
|
||||
// In CliCommand::Cook, is_deps==true will make it skip checking source
|
||||
command.is_pushing() || !config.with_package_deps,
|
||||
true,
|
||||
)?
|
||||
} else {
|
||||
recipe_names
|
||||
|
||||
@ -194,7 +194,7 @@ pub fn build(
|
||||
&recipe.build.dev_dependencies[..],
|
||||
]
|
||||
.concat();
|
||||
let build_deps = CookRecipe::get_build_deps_recursive(&build_deps, false, false)
|
||||
let build_deps = CookRecipe::get_build_deps_recursive(&build_deps, false, false, false)
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
for dependency in build_deps.iter() {
|
||||
let (_, pkgar, _) = dependency.stage_paths();
|
||||
|
||||
@ -297,6 +297,7 @@ impl CookRecipe {
|
||||
}
|
||||
|
||||
let mut recipes = Vec::new();
|
||||
let mut recipes_set = BTreeSet::new();
|
||||
for name in names {
|
||||
let recipe = Self::from_name(name.clone())?;
|
||||
|
||||
@ -317,7 +318,8 @@ impl CookRecipe {
|
||||
})?;
|
||||
|
||||
for dependency in dependencies {
|
||||
if !recipes.contains(&dependency) {
|
||||
if !recipes_set.contains(&dependency.name) {
|
||||
recipes_set.insert(dependency.name.clone());
|
||||
recipes.push(dependency);
|
||||
}
|
||||
}
|
||||
@ -340,7 +342,8 @@ impl CookRecipe {
|
||||
})?;
|
||||
|
||||
for dependency in dependencies {
|
||||
if !recipes.contains(&dependency) {
|
||||
if !recipes_set.contains(&dependency.name) {
|
||||
recipes_set.insert(dependency.name.clone());
|
||||
recipes.push(dependency);
|
||||
}
|
||||
}
|
||||
@ -363,13 +366,15 @@ impl CookRecipe {
|
||||
})?;
|
||||
|
||||
for dependency in dependencies {
|
||||
if !recipes.contains(&dependency) {
|
||||
if !recipes_set.contains(&dependency.name) {
|
||||
recipes_set.insert(dependency.name.clone());
|
||||
recipes.push(dependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if collect_self && !recipes.contains(&recipe) {
|
||||
if collect_self && !recipes_set.contains(&recipe.name) {
|
||||
recipes_set.insert(recipe.name.clone());
|
||||
recipes.push(recipe);
|
||||
}
|
||||
}
|
||||
@ -381,6 +386,7 @@ impl CookRecipe {
|
||||
names: &[PackageName],
|
||||
include_dev: bool,
|
||||
mark_is_deps: bool,
|
||||
flatten_opt_package: bool,
|
||||
) -> Result<Vec<Self>, 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)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user