Make minor fixes to output_env.sh after review

A number of clean-up improvements following review.
 * removal of redundant `` quotes
 * removal of non-portable echo "\n", in favour of additional echo commands
 * change to use of uname to detemine if the platform is Linux or not
 * revised formatting of output
 * change to dpkg-query from dpkg to find installed libasan variants

Co-Authored-By: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Simon Butcher <simon.butcher@arm.com>
This commit is contained in:
Simon Butcher 2020-02-27 12:58:27 +00:00
parent 07d5a47bd8
commit 7bfeb66d1a

View file

@ -26,11 +26,11 @@ print_version()
VARIANT=$1 VARIANT=$1
shift shift
if [ ! -z $VARIANT ]; then if [ -n "$VARIANT" ]; then
VARIANT=" ($VARIANT)" VARIANT=" ($VARIANT)"
fi fi
if ! `type "$BIN" > /dev/null 2>&1`; then if ! type "$BIN" > /dev/null 2>&1; then
echo " * ${BIN##*/}$VARIANT: Not found." echo " * ${BIN##*/}$VARIANT: Not found."
return 0 return 0
fi fi
@ -48,8 +48,10 @@ print_version()
echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} " echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
} }
echo "Platform:\n" echo "** Platform:"
if `type "lsb_release" > /dev/null 2>&1`; then echo
if [ `uname -s` = "Linux" ]; then
echo "Linux variant" echo "Linux variant"
lsb_release -d -c lsb_release -d -c
else else
@ -59,8 +61,10 @@ fi
echo echo
print_version "uname" "-a" "" print_version "uname" "-a" ""
echo "\n" echo
echo "Tool Versions:\n" echo
echo "** Tool Versions:"
echo
if [ "${RUN_ARMCC:-1}" -ne 0 ]; then if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
: "${ARMC5_CC:=armcc}" : "${ARMC5_CC:=armcc}"
@ -131,14 +135,14 @@ fi
echo echo
echo " * Installed asan versions:" echo " * Installed asan versions:"
if `hash dpkg > /dev/null 2>&1` && `dpkg --get-selections|grep libasan > /dev/null` ; then if type dpkg-query >/dev/null 2>/dev/null; then
dpkg -s libasan5 2> /dev/null | grep -i version if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
dpkg -s libasan4 2> /dev/null | grep -i version awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
dpkg -s libasan3 2> /dev/null | grep -i version grep .
dpkg -s libasan2 2> /dev/null | grep -i version then
dpkg -s libasan1 2> /dev/null | grep -i version echo " No asan versions installed."
dpkg -s libasan0 2> /dev/null | grep -i version fi
else else
echo " Either dpkg not present or no asan versions installed." echo " Unable to determine the asan version without dpkg."
fi fi
echo echo