From 28f5bc15b4183624aa010af3e4bd82ac6a54ba0e Mon Sep 17 00:00:00 2001 From: lod Date: Sun, 26 Nov 2023 15:41:48 +0100 Subject: [PATCH] use associative array and for loops to init submoduls --- PKGBUILD | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 7484cf5..cbddb9f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -53,29 +53,21 @@ prepare() { patch ./tools/build-companion.sh < $srcdir/install.patch patch ./companion/src/CMakeLists.txt < $srcdir/remove-ssl-check.patch - cd $_pkgbase/companion/src/thirdparty/ - git submodule init - git config submodule.yaml-cpp.url $srcdir/yaml-cpp - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/ - git submodule init - git config submodule.AccessDenied.url $srcdir/AccessDenied - git config submodule.FreeRTOS-Kernel.url $srcdir/FreeRTOS - git config submodule.libopenui.url $srcdir/libopenui - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/ - git submodule init - git config submodule.FreeRTOS-Kernel-Community-Supported-Ports.url $srcdir/Community-Supported-Ports - git config submodule.FreeRTOS-Kernel-Partner-Supported-Ports.url $srcdir/FreeRTOS-Kernel-Partner-Supported-Ports - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/libopenui/thirdparty/ - git submodule init - git config submodule.lvgl.url $srcdir/lvgl - git config submodule.stb.url $srcdir/stb - git submodule update --init + declare -A submodules=( + ["$_pkgbase/companion/src/thirdparty/"]="yaml-cpp" + ["$_pkgbase/radio/src/thirdparty/"]="AccessDenied FreeRTOS-Kernel libopenui" + ["$_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/"]="FreeRTOS-Kernel-Community-Supported-Ports FreeRTOS-Kernel-Partner-Supported-Ports" + ["$_pkgbase/radio/src/thirdparty/libopenui/thirdparty/"]="lvgl stb" + ) + + for path in "${!submodules[@]}"; do + cd $path + git submodule init + for module in ${submodules[$path]}; do + git config submodule.$module.url $srcdir/$module + done + git submodule update --init + done } build() {