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 <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87823
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Felix Singer 2025-05-25 12:33:30 +02:00 committed by Matt DeVillier
commit 7cbbf786cc

View file

@ -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