1
0
Fork 0

download_and_compile.sh: recap unmatched optional pkg alternatives at the end

This way, unmatched optional package alternatives are clearly visible,
on stdout and in the log file -> should ease troubleshooting.
This commit is contained in:
Florent Rougon 2017-10-03 07:58:31 +02:00
parent f1e8e8b4a2
commit 480f8bbb68

View file

@ -26,6 +26,7 @@ VERSION="$(echo "$script_blob_id" | sed 's@\$Id: *\([0-9a-f]\+\) *@\1@')"
# Then remove the trailing '$' # Then remove the trailing '$'
VERSION="${VERSION%\$}" VERSION="${VERSION%\$}"
PROGNAME=$(basename "$0")
FGVERSION="release/$(git ls-remote --heads https://git.code.sf.net/p/flightgear/flightgear|grep '\/release\/'|cut -f4 -d'/'|sort -t . -k 1,1n -k2,2n -k3,3n|tail -1)" FGVERSION="release/$(git ls-remote --heads https://git.code.sf.net/p/flightgear/flightgear|grep '\/release\/'|cut -f4 -d'/'|sort -t . -k 1,1n -k2,2n -k3,3n|tail -1)"
####################################################### #######################################################
@ -54,6 +55,8 @@ BUILD_TYPE="RelWithDebInfo"
SG_CMAKEARGS="" SG_CMAKEARGS=""
FG_CMAKEARGS="" FG_CMAKEARGS=""
declare -a UNMATCHED_OPTIONAL_PKG_ALTERNATIVES
while getopts "shc:p:a:d:r:j:O:ib:" OPTION; do while getopts "shc:p:a:d:r:j:O:ib:" OPTION; do
case $OPTION in case $OPTION in
s) STABLE="STABLE" ;; s) STABLE="STABLE" ;;
@ -192,7 +195,7 @@ function _mandatory_pkg_alternative(){
# If available, add a non-virtual package matching one of the given regexps. # If available, add a non-virtual package matching one of the given regexps.
# #
# Returning 0 or 1 on success to indicate whether a match was found could be # Returning 0 or 1 on success to indicate whether a match was found could be
# done, but must would need to be specifically handled at the calling site, # done, but would need to be specifically handled at the calling site,
# since the script is run under 'set -e' regime. # since the script is run under 'set -e' regime.
function _optional_pkg_alternative(){ function _optional_pkg_alternative(){
local pkg local pkg
@ -212,6 +215,8 @@ function _optional_pkg_alternative(){
else else
echo "No match found for the optional package alternative, continuing" \ echo "No match found for the optional package alternative, continuing" \
"anyway." "anyway."
# "$*" so that we only add one element to the array in this line
UNMATCHED_OPTIONAL_PKG_ALTERNATIVES+=("$*")
fi fi
return 0 return 0
@ -905,6 +910,24 @@ if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="TERRAGEARGUI"' ]]; then
echo "./TerraGUI \$@" >> run_terrageargui.sh echo "./TerraGUI \$@" >> run_terrageargui.sh
fi fi
# Print optional package alternatives that didn't match (this helps with
# troubleshooting)
if [[ ${#UNMATCHED_OPTIONAL_PKG_ALTERNATIVES[@]} -gt 0 ]]; then
echo | tee -a "$LOGFILE"
printf "The following optional package alternative(s) didn't match:\n\n" \
| tee -a "$LOGFILE"
for alt in "${UNMATCHED_OPTIONAL_PKG_ALTERNATIVES[@]}"; do
printf " %s\n" "$alt" | tee -a "$LOGFILE"
done
printf "\nThis could explain missing optional features in FlightGear or \
other software\ninstalled by $PROGNAME.\n" | tee -a "$LOGFILE"
else
printf "All optional package alternatives have found a matching package.\n" \
| tee -a "$LOGFILE"
fi
echo "" echo ""
echo "download_and_compile.sh has finished to work" echo "download_and_compile.sh has finished to work"