Refactor repository detection

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2023-11-14 15:25:52 +00:00
parent c1750bb23d
commit e58128e2ba

View File

@ -22,25 +22,22 @@ EOF
exit exit
fi fi
# Detect whether we are in one of Mbed TLS or TF-PSA-Crypto and exit if not in_mbedtls_repo () {
if [ -d library -a -d include -a -d tests ]; then :; test -d include -a -d library -a -d programs -a -d tests
elif [ -d core -a -d include -a -d tests ]; then :; }
in_tf_psa_crypto_repo () {
test -d include -a -d core -a -d drivers -a -d programs -a -d tests
}
if in_mbedtls_repo; then
library_dir='library'
elif in_tf_psa_crypto_repo; then
library_dir='core'
else else
echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2 echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2
exit 1 exit 1
fi fi
# Now we know we are in one of Mbed TLS or TF-PSA-Crypto, determine which one
in_mbedtls_build_dir () {
test -d library
}
if in_mbedtls_build_dir; then
library_dir='library'
else
library_dir='core'
fi
UPDATE= UPDATE=
LIST= LIST=
while getopts lu OPTLET; do while getopts lu OPTLET; do