diff --git a/mk/repo.mk b/mk/repo.mk index 5785b7e86..646e5ebea 100644 --- a/mk/repo.mk +++ b/mk/repo.mk @@ -67,7 +67,7 @@ endif # Find recipe for one or more targets separated by comma find.%: $(FSTOOLS_TAG) FORCE ifeq ($(PODMAN_BUILD),1) - $(PODMAN_RUN) make $@ + @$(PODMAN_RUN) make $@ else @$(REPO_BIN) find $(foreach f,$(subst $(comma), ,$*),$(f)) endif diff --git a/scripts/executables.sh b/scripts/executables.sh index f3d4d7c10..f52d34c5a 100755 --- a/scripts/executables.sh +++ b/scripts/executables.sh @@ -37,7 +37,7 @@ done if [ -z "$recipes" ] then - recipes="$(target/release/list_recipes)" + recipes="$(target/release/repo repo-list --all-compiled --display=path)" fi for recipe in $recipes @@ -45,7 +45,7 @@ do if [[ "$recipe" == *\/* ]] then recipe_name="$(basename $recipe)" - recipe_path="recipes/$recipe" + recipe_path="$recipe" else recipe_name="$recipe" recipe_path="$(target/release/repo find $recipe_name)" diff --git a/scripts/open-recipe.sh b/scripts/open-recipe.sh new file mode 100755 index 000000000..3a693893d --- /dev/null +++ b/scripts/open-recipe.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# This script open the recipe configuration files with chosen EDITOR env, or chosen by "open" cli. + +# This script must be launched outside podman + +EDITOR=${EDITOR:-open} + +$EDITOR $(make find.$1)/recipe.toml diff --git a/scripts/pkg-size.sh b/scripts/pkg-size.sh index 6e95f47c0..0993885c1 100755 --- a/scripts/pkg-size.sh +++ b/scripts/pkg-size.sh @@ -1,30 +1,13 @@ #!/usr/bin/env bash -# This script show the package size of the recipes ("stage.pkgar" and "stage.tar.gz") +# This script show all or some package size of the recipes ("stage.pkgar") # It must be used by package maintainers to enforce the library linking size policy -if [ $# = 0 ] -then - find recipes \( -name stage.pkgar -o -name stage.tar.gz \) -exec ls -hs {} \; - exit 0 -fi +# This script must be inside podman `make env` -for recipe in $@ +RECIPES=$(target/release/repo cook-list ${*:---all-compiled} --display=csv | grep ",Built" | sort -t ',' -k 3 -V | cut -d ',' -f2) +TARGET=$(target/release/cookbook_redoxer --target) +for recipe in $RECIPES do - if [ "$recipe" = "-h" ] || [ "$recipe" = "--help" ] - then - echo "Usage: $0 [recipe] ..." - echo " For the recipe(s), prints the size of 'stage.pkgar' and 'stage.tar.gz'." - echo " If no recipe is given, then all packages are listed." - exit 0 - fi - - recipe_paths=$(find recipes -name $recipe) - for recipe_path in $recipe_paths - do - if [ -f "$recipe_path/recipe.toml" ] || [ -f "$recipe_path/recipe.sh" ] - then - find "$recipe_path" \( -name stage.pkgar -o -name stage.tar.gz \) -exec ls -hs {} \; - fi - done -done \ No newline at end of file + ls -hs "$recipe/target/$TARGET/stage.pkgar" +done diff --git a/scripts/print-recipe.sh b/scripts/print-recipe.sh index 43312b056..b90cffb99 100755 --- a/scripts/print-recipe.sh +++ b/scripts/print-recipe.sh @@ -2,4 +2,4 @@ # This script print the recipe configuration -cat $(target/release/repo find "$1")/recipe.* +cat $(make find.$1)/recipe.toml diff --git a/scripts/recipe-path.sh b/scripts/recipe-path.sh index f31332547..2cdcec449 100755 --- a/scripts/recipe-path.sh +++ b/scripts/recipe-path.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash -FIND_RECIPE="find recipes -maxdepth 4 -name" +# Return list of paths from recipes -for recipe in $* -do - ${FIND_RECIPE} "${recipe}" -done +IFS="," +make "find.$*" diff --git a/scripts/relibc-doc.sh b/scripts/relibc-doc.sh index dda8b1cdf..479598432 100755 --- a/scripts/relibc-doc.sh +++ b/scripts/relibc-doc.sh @@ -3,5 +3,6 @@ # This script generates build/relibc-doc and build/relibc-doc.tar.gz rm -rf build/relibc-doc build/relibc-doc.tar.gz -make ri.relibc-doc DESTDIR=./build/relibc-doc +mkdir -p build/relibc-doc +make ri.relibc-doc DESTDIR=./build/relibc-doc CI=1 tar -czvf ./build/relibc-doc.tar.gz ./build/relibc-doc/usr/share/doc/relibc/ diff --git a/scripts/show-package.sh b/scripts/show-package.sh index 516f4ec2e..dd7b161d7 100755 --- a/scripts/show-package.sh +++ b/scripts/show-package.sh @@ -11,7 +11,7 @@ then exit 1 fi -find_recipe="target/release/find_recipe" +find_recipe="target/release/repo" if [ ! -x "$find_recipe" ] then echo "$find_recipe not found." @@ -21,6 +21,6 @@ fi for recipe in $* do - recipe_dir="$("$find_recipe" "$recipe")" + recipe_dir="$("$find_recipe" find "$recipe")" ls -1 "$recipe_dir/target"/*/{stage,sysroot} done diff --git a/scripts/unused-libs.sh b/scripts/unused-libs.sh new file mode 100755 index 000000000..7558b1c39 --- /dev/null +++ b/scripts/unused-libs.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# This script show all unused packages in given category, or "wip/libs" by default. + +# This script must be inside podman `make env` + +CATEGORY=${1:-wip/libs} + +target/release/repo cook-list --all --display=csv | grep ",$" | grep ",recipes/$CATEGORY" | cut -d ',' -f2 diff --git a/src/bin/cookbook_redoxer.rs b/src/bin/cookbook_redoxer.rs index 01bfbb159..7c9580252 100644 --- a/src/bin/cookbook_redoxer.rs +++ b/src/bin/cookbook_redoxer.rs @@ -14,5 +14,10 @@ fn main() { } } } - redoxer::main(&args); + match args[1].as_str() { + "--target" => println!("{}", redoxer::target()), + "--gnu-target" => println!("{}", redoxer::gnu_target()), + "--host-target" => println!("{}", redoxer::host_target()), + _ => redoxer::main(&args), + } } diff --git a/src/bin/repo/main.rs b/src/bin/repo/main.rs index b1d3789cb..1854e4ba0 100644 --- a/src/bin/repo/main.rs +++ b/src/bin/repo/main.rs @@ -173,9 +173,9 @@ impl FromStr for CliCommand { "clean" => Ok(CliCommand::Clean), "clean-target" => Ok(CliCommand::CleanTarget), "push" => Ok(CliCommand::Push), - "repo-tree" => Ok(CliCommand::RepoList), - "push-tree" => Ok(CliCommand::PushList), - "cook-tree" => Ok(CliCommand::CookList), + "repo-list" => Ok(CliCommand::RepoList), + "push-list" => Ok(CliCommand::PushList), + "cook-list" => Ok(CliCommand::CookList), // alias for scripts "find" => Ok(CliCommand::RepoList), "capture-rev" => Ok(CliCommand::CaptureRev), @@ -195,9 +195,9 @@ impl ToString for CliCommand { CliCommand::Clean => "clean".to_string(), CliCommand::CleanTarget => "clean-target".to_string(), CliCommand::Push => "push".to_string(), - CliCommand::PushList => "push-tree".to_string(), - CliCommand::CookList => "cook-tree".to_string(), - CliCommand::RepoList => "repo-tree".to_string(), + CliCommand::PushList => "push-list".to_string(), + CliCommand::CookList => "cook-list".to_string(), + CliCommand::RepoList => "repo-list".to_string(), CliCommand::CaptureRev => "capture-rev".to_string(), CliCommand::ChangeRule => "change-rule".to_string(), CliCommand::ChangeRuleLocal => "change-rule-local".to_string(), diff --git a/src/cook/tree.rs b/src/cook/tree.rs index 0fefc6f9f..05fa4f042 100644 --- a/src/cook/tree.rs +++ b/src/cook/tree.rs @@ -197,6 +197,11 @@ pub fn walk_tree_entry( data: &mut TreeData, op: fn(TreeItem) -> Result, ) -> Result<()> { + // To avoid confusion + if package_name.is_host() { + return Ok(()); + } + let cook_recipe = match recipe_map.get(package_name) { Some(r) => r, None => {