build: scripts/target_config_check.sh: output all relevant errors

Don't stop after the first error, as later error messages may make the
cause of the error much clearer in some cases.
This commit is contained in:
Matthias Schiffer 2017-05-02 17:05:55 +02:00
parent 8180a9868a
commit afc2e0c03d
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -9,6 +9,8 @@ packages=$2
output= output=
ret=0
LEDE_CONFIG_TARGET="${LEDE_TARGET//-/_}" LEDE_CONFIG_TARGET="${LEDE_TARGET//-/_}"
@ -22,6 +24,17 @@ END_MAKE
} }
fail() {
local message="$1"
if [ $ret -eq 0 ]; then
ret=1
echo "Configuration failed:" >&2
fi
echo " * $message" >&2
}
check_config() { check_config() {
grep -q "$1" lede/.config grep -q "$1" lede/.config
} }
@ -31,8 +44,7 @@ check_package() {
local value="$2" local value="$2"
if ! check_config "^CONFIG_PACKAGE_${package}=${value}"; then if ! check_config "^CONFIG_PACKAGE_${package}=${value}"; then
echo "Configuration failed: unable to enable package '${package}'" >&2 fail "unable to enable package '${package}'"
exit 1
fi fi
} }
@ -43,8 +55,7 @@ config() {
local config="$1" local config="$1"
if ! check_config "^${config}\$"; then if ! check_config "^${config}\$"; then
echo "Configuration failed: unable to set '${config}'" >&2 fail "unable to set '${config}'"
exit 1
fi fi
} }
@ -58,8 +69,7 @@ device() {
fi fi
if ! check_config "CONFIG_TARGET_DEVICE_${LEDE_CONFIG_TARGET}_DEVICE_${profile}=y"; then if ! check_config "CONFIG_TARGET_DEVICE_${LEDE_CONFIG_TARGET}_DEVICE_${profile}=y"; then
echo "Configuration failed: unable to enable device '${profile}'" >&2 fail "unable to enable device '${profile}'"
exit 1
fi fi
for package in $(site_packages "$output"); do for package in $(site_packages "$output"); do
@ -99,3 +109,5 @@ check_devices
for package in $packages; do for package in $packages; do
check_package "$package" 'y' check_package "$package" 'y'
done done
exit $ret