From f24f27c9590534b5b7dce0cf63f190427f3d1c4c Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 21 Jun 2026 16:51:41 +0700 Subject: [PATCH] cookbook: Pass --all to reference all recipes built --- src/bin/repo.rs | 51 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 4acea93af..39901f8e5 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -4,7 +4,7 @@ use cookbook::cook::cook_build::{build, get_stage_dirs, remove_stage_dir}; use cookbook::cook::fetch::{FetchResult, fetch, fetch_offline}; use cookbook::cook::fs::{ create_dir, create_target_dir, get_git_commit_date, get_git_head_rev, get_git_rev_before_date, - remove_all, run_command, + read_toml, remove_all, run_command, }; use cookbook::cook::package::{package, package_handle_push}; use cookbook::cook::pty::{PtyOut, UnixSlavePty, flush_pty, setup_pty, write_to_pty}; @@ -24,7 +24,7 @@ use ratatui::text::{Line, Span, Text}; use ratatui::widgets::{Block, Borders, Clear, List, ListItem, ListState, Paragraph, Wrap}; use redox_installer::PackageConfig; use std::borrow::Cow; -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::io::{Read, Write, stderr, stdin, stdout}; use std::path::PathBuf; use std::process::Command; @@ -515,30 +515,41 @@ fn parse_args(args: Vec) -> Result<(CliConfig, CliCommand, Vec staged_pkg::list(""), + false => { + // get the list from repo/TARGET/repo.toml + let repo_toml_path = config.repo_dir.join(redoxer::target()).join("repo.toml"); + if !repo_toml_path.is_file() { + bail_options_err!( + "The repository is not found: {}", + repo_toml_path.display() + ); + }; + let repos: pkg::Repository = read_toml(&repo_toml_path)?; + repos + .packages + .keys() + .filter_map(|n| staged_pkg::find(n).map(|s| s.to_path_buf())) + .collect::>() + } + }; + let all_recipes_path = match &config.category { - None => staged_pkg::list(""), - Some(prefix) => staged_pkg::list("") + None => all_recipes_path, + Some(prefix) => all_recipes_path .into_iter() .filter(|p| p.starts_with(prefix)) .collect(), }; + if all_recipes_path.is_empty() { + bail_options_err!( + "No recipes found from the combination.\n\ + Try pass both --all and --category=name" + ); + } + for path in all_recipes_path { // TODO: Allow selecting recipes from category as host? let recipe = CookRecipe::from_path(&path, !command.is_cleaning(), false)?;