mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-07-09 21:18:41 +08:00
Query deps for push
This commit is contained in:
parent
6b119b9083
commit
c059f13e4f
@ -99,7 +99,10 @@ impl CliCommand {
|
|||||||
*self == CliCommand::Tree || *self == CliCommand::Find
|
*self == CliCommand::Tree || *self == CliCommand::Find
|
||||||
}
|
}
|
||||||
pub fn is_building(&self) -> bool {
|
pub fn is_building(&self) -> bool {
|
||||||
*self == CliCommand::Fetch || *self == CliCommand::Cook || *self == CliCommand::Tree
|
*self == CliCommand::Fetch || *self == CliCommand::Cook
|
||||||
|
}
|
||||||
|
pub fn is_pushing(&self) -> bool {
|
||||||
|
*self == CliCommand::Push || *self == CliCommand::Tree
|
||||||
}
|
}
|
||||||
pub fn is_cleaning(&self) -> bool {
|
pub fn is_cleaning(&self) -> bool {
|
||||||
*self == CliCommand::Clean || *self == CliCommand::Unfetch
|
*self == CliCommand::Clean || *self == CliCommand::Unfetch
|
||||||
@ -454,7 +457,7 @@ fn parse_args(args: Vec<String>) -> anyhow::Result<(CliConfig, CliCommand, Vec<C
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if command.is_building() {
|
if command.is_building() || (command.is_pushing() && config.with_package_deps) {
|
||||||
if config.with_package_deps {
|
if config.with_package_deps {
|
||||||
recipe_names = CookRecipe::get_package_deps_recursive(&recipe_names, true)
|
recipe_names = CookRecipe::get_package_deps_recursive(&recipe_names, true)
|
||||||
.context("failed get package deps")?;
|
.context("failed get package deps")?;
|
||||||
@ -587,7 +590,8 @@ fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> anyhow::Result<
|
|||||||
recipes.iter().map(|r| (&r.name, r)).collect();
|
recipes.iter().map(|r| (&r.name, r)).collect();
|
||||||
let mut total_size: u64 = 0;
|
let mut total_size: u64 = 0;
|
||||||
let mut visited: HashSet<PackageName> = HashSet::new();
|
let mut visited: HashSet<PackageName> = HashSet::new();
|
||||||
let num_roots = recipes.len();
|
let roots: Vec<&CookRecipe> = recipes.iter().filter(|r| !r.is_deps).collect();
|
||||||
|
let num_roots = roots.len();
|
||||||
PUSH_SYSROOT_DIR.set(config.sysroot_dir.clone()).unwrap();
|
PUSH_SYSROOT_DIR.set(config.sysroot_dir.clone()).unwrap();
|
||||||
let handle_push_inner = move |package_name: &PackageName,
|
let handle_push_inner = move |package_name: &PackageName,
|
||||||
_prefix: &str,
|
_prefix: &str,
|
||||||
@ -628,7 +632,7 @@ fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> anyhow::Result<
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if config.with_package_deps {
|
if config.with_package_deps {
|
||||||
for (i, root) in recipes.iter().enumerate() {
|
for (i, root) in roots.iter().enumerate() {
|
||||||
walk_tree_entry(
|
walk_tree_entry(
|
||||||
&root.name,
|
&root.name,
|
||||||
&recipe_map,
|
&recipe_map,
|
||||||
@ -640,7 +644,7 @@ fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> anyhow::Result<
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i, root) in recipes.iter().enumerate() {
|
for (i, root) in roots.iter().enumerate() {
|
||||||
let archive_path = config
|
let archive_path = config
|
||||||
.repo_dir
|
.repo_dir
|
||||||
.join(target())
|
.join(target())
|
||||||
|
|||||||
@ -54,12 +54,9 @@ pub fn walk_tree_entry(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let package_dir = &cook_recipe.dir;
|
let package_dir = &cook_recipe.dir;
|
||||||
let pkg_path = create_target_dir(package_dir)
|
let target_dir = create_target_dir(package_dir).map_err(|e| anyhow!(e))?;
|
||||||
.map_err(|e| anyhow!(e))?
|
let pkg_path = target_dir.join("stage.pkgar");
|
||||||
.join("stage.pkgar");
|
let pkg_toml = target_dir.join("stage.toml");
|
||||||
let pkg_toml = create_target_dir(package_dir)
|
|
||||||
.map_err(|e| anyhow!(e))?
|
|
||||||
.join("stage.toml");
|
|
||||||
|
|
||||||
let deduped = visited.contains(package_name);
|
let deduped = visited.contains(package_name);
|
||||||
let entry = match (std::fs::metadata(&pkg_path), deduped) {
|
let entry = match (std::fs::metadata(&pkg_path), deduped) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user