From 4115fcc933dd7a06ef4430e1c398293b438c8e45 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 21 Apr 2021 22:53:02 +0200 Subject: [PATCH] Ports: Build ports only once when running build_all.sh Previously we'd end up building some ports multiple times, e.g. as a dependency for another port. This changes the build_all.sh script so that it builds ports only once. --- Ports/.port_include.sh | 7 +++++-- Ports/build_all.sh | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index 0f6e2b084c..aac65135b7 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -346,6 +346,9 @@ do_uninstall() { echo "Uninstalling $port!" uninstall } +do_showdepends() { + echo -n $depends +} do_all() { do_installdepends do_fetch @@ -361,7 +364,7 @@ parse_arguments() { do_all else case "$1" in - fetch|patch|configure|build|install|installdepends|clean|clean_dist|clean_all|uninstall) + fetch|patch|configure|build|install|installdepends|clean|clean_dist|clean_all|uninstall|showdepends) do_$1 ;; --auto) @@ -373,7 +376,7 @@ parse_arguments() { parse_arguments $@ ;; *) - >&2 echo "I don't understand $1! Supported arguments: fetch, patch, configure, build, install, installdepends, clean, clean_dist, clean_all, uninstall." + >&2 echo "I don't understand $1! Supported arguments: fetch, patch, configure, build, install, installdepends, clean, clean_dist, clean_all, uninstall, showdepends." exit 1 ;; esac diff --git a/Ports/build_all.sh b/Ports/build_all.sh index 4eedfbc6f8..26770a3736 100755 --- a/Ports/build_all.sh +++ b/Ports/build_all.sh @@ -26,11 +26,31 @@ case "$2" in esac some_failed=false +built_ports="" for file in *; do if [ -d $file ]; then pushd $file > /dev/null port=$(basename $file) + port_built=0 + for built_port in $built_ports; do + if [ "$built_port" = "$port" ]; then + port_built=1 + break + fi + done + if [ $port_built -eq 1 ]; then + echo "Already built $port as a dependency." + popd > /dev/null + continue + fi + if ! [ -f package.sh ]; then + echo "ERROR: Skipping $port because its package.sh script is missing." + popd > /dev/null + continue + fi + built_ports="$built_ports $port $(./package.sh showdepends) " + if [ "$clean" == true ]; then if [ "$verbose" == true ]; then ./package.sh clean_all