Because of a copy-and-paste from the script build_tools/download_externals, the script build_tools/list_valid_installed_externals got its local variables. However in the latter, three variables were not used actually. Change-Id: I252de5a98c17ea54459174875357c22c2eebe8d5
67 lines
1.6 KiB
Bash
Executable file
67 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
if [[ ( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} > 1 ) || ${BASH_VERSINFO[0]} > 4 ]] ; then
|
|
shopt -s compat41
|
|
fi
|
|
set -e
|
|
|
|
ASTTOPDIR=${ASTTOPDIR:-.}
|
|
export make=`sed -n -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`
|
|
|
|
getvar() {
|
|
$make --quiet --no-print-directory -f- <<EOF
|
|
include ${ASTTOPDIR}/makeopts
|
|
all:
|
|
@echo "\$($1)"
|
|
EOF
|
|
}
|
|
|
|
|
|
XMLSTARLET=`getvar XMLSTARLET`
|
|
ASTMODDIR=`getvar ASTMODDIR`
|
|
HOST_CPU=`getvar HOST_CPU`
|
|
|
|
tmpdir=$(mktemp -d)
|
|
if [[ -z "${tmpdir}" ]] ; then
|
|
echo "${module_name}: Unable to create temporary directory."
|
|
exit 1
|
|
fi
|
|
trap "rm -rf ${tmpdir}" EXIT
|
|
|
|
if [[ -z "${ASTMODDIR}" ]] ; then
|
|
echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${XMLSTARLET}" = ":" ]] ; then
|
|
echo "${module_name}: The externals downloader requires xmlstarlet to be installed."
|
|
exit 1
|
|
fi
|
|
|
|
version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
|
|
if [[ ! ${version} =~ ^(GIT-)?([^.-]+)[.-].* ]] ; then
|
|
echo "${module_name}: Couldn't parse version ${version}"
|
|
exit 1
|
|
fi
|
|
major_version=${BASH_REMATCH[2]}.0
|
|
|
|
if [[ "${HOST_CPU}" = "x86_64" ]] ; then
|
|
host_bits=64
|
|
else
|
|
host_bits=32
|
|
fi
|
|
|
|
names=""
|
|
for manifest in ${DESTDIR}${ASTMODDIR}/*.manifest.xml ; do
|
|
if [ ! -f "$manifest" ] ; then
|
|
break
|
|
fi
|
|
package_version=$(${XMLSTARLET} sel -t -v "/package/@version" ${manifest})
|
|
package_major_version=${package_version%_*}
|
|
package_arch=$(${XMLSTARLET} sel -t -v "/package/@arch" ${manifest})
|
|
if [[ "$package_major_version" = "$major_version" && "${package_arch}" = "x86_${host_bits}" ]] ; then
|
|
names+=$(${XMLSTARLET} sel -t -m "//file[@executable = 'yes']" -v "concat(@name, ' ')" ${manifest})
|
|
fi
|
|
done
|
|
echo $names
|