From 7cbbf786cc2d513bc742f46ae7028d3fc5bd2192 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sun, 25 May 2025 12:33:30 +0200 Subject: [PATCH] update_submodules: Use relative paths to submodules There doesn't seem to be much reason to use absolute paths to the submodules, other than that it's not needed to change to the original directory. In preparation for CB:87824, make use of relative paths and change to the original directory at the start of each iteration. Change-Id: Ic74b589d933e6acd882fb9a09461bf7c01952a6f Signed-off-by: Felix Singer Reviewed-on: https://review.coreboot.org/c/coreboot/+/87823 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- util/scripts/update_submodules | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/scripts/update_submodules b/util/scripts/update_submodules index fccc3f6ae2..7d36549c4d 100755 --- a/util/scripts/update_submodules +++ b/util/scripts/update_submodules @@ -65,7 +65,7 @@ get_args() { exit 0 ;; -R | --repo) - submodule_dirs=("$(readlink -f "${1}")") + submodule_dirs="${1}" shift if [[ ! -d "${submodule_dirs[0]}" ]]; then echo "Error: ${submodule_dirs[0]} is not valid." @@ -92,12 +92,15 @@ main() { get_args "$@" if (( ${#submodule_dirs[@]} == 0 )); then - readarray -t submodule_dirs < <(git submodule foreach pwd | grep -v "Entering") + readarray -t submodule_dirs < <(git submodule status | cut -d ' ' -f 3) fi for submodule in "${submodule_dirs[@]}"; do + cd "${TOP}" + echo "" echo "Checking submodule ${submodule}" + if ! cd "$submodule"; then echo "Error: could not cd to $submodule" exit 1