mkproject.sh: prepare framework to blacklist platforms

This allows to blacklist platforms not officially supported in a DEY
release. It only works at help-level, you can actually create projects
for any platform whose config files exist, but the help of the mkproject
command will only show the officially supported platforms.

At the moment the BLACKLIST variable is not filled. This will be done in
the release branch.

https://jira.digi.com/browse/DEL-1073

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2014-06-17 10:49:44 +02:00
parent c91898e4b1
commit 616940ec5d
1 changed files with 20 additions and 5 deletions

View File

@ -27,17 +27,20 @@ MKP_NONE="\033[0m"
# Path to platform config files # Path to platform config files
MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/meta-digi/sdk/config" MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/meta-digi/sdk/config"
# Blacklist platforms (not officially supported in a DEY release)
MKP_BLACKLIST_PLATFORMS=""
## Local functions ## Local functions
usage() { usage() {
cat <<EOF cat <<EOF
Usage: source ${MKP_SCRIPTNAME} [OPTIONS] Usage: source ${MKP_SCRIPTNAME} [OPTIONS]
-l list available platforms -l list supported platforms
-p <platform> select platform for the project -p <platform> select platform for the project
-v <variant> select platform variant -v <variant> select platform variant
Available platforms: ${MKP_AVAILABLE_PLATFORMS} Supported platforms: $(display_supported_platforms)
See platform include files for supported variant names: See platform include files for supported variant names:
@ -61,6 +64,18 @@ check_selected_platform() {
return 1 return 1
} }
# Filter available platforms through the blacklist
display_supported_platforms() {
local MKP_SUPPORTED_PLATFORMS=""
for i in ${MKP_AVAILABLE_PLATFORMS}; do
if echo "${MKP_BLACKLIST_PLATFORMS}" | grep -qsv "${i}"; then
MKP_SUPPORTED_PLATFORMS="${MKP_SUPPORTED_PLATFORMS:+${MKP_SUPPORTED_PLATFORMS} }${i}"
fi
done
echo "${MKP_SUPPORTED_PLATFORMS}"
unset MKP_SUPPORTED_PLATFORMS
}
do_mkproject() { do_mkproject() {
export TEMPLATECONF="${TEMPLATECONF:-${MKP_CONFIGPATH}/${MKP_PLATFORM}}" export TEMPLATECONF="${TEMPLATECONF:-${MKP_CONFIGPATH}/${MKP_PLATFORM}}"
source ${MKP_SCRIPTPATH}/sources/poky/oe-init-build-env . source ${MKP_SCRIPTPATH}/sources/poky/oe-init-build-env .
@ -112,7 +127,7 @@ if [ "${BASH_SOURCE}" = "${0}" ]; then
elif [ ${#} -eq 0 ] ; then elif [ ${#} -eq 0 ] ; then
usage usage
elif [ -n "${MKP_LIST_PLATFORMS}" ]; then elif [ -n "${MKP_LIST_PLATFORMS}" ]; then
echo ${MKP_AVAILABLE_PLATFORMS} display_supported_platforms
elif [ -z "${MKP_PLATFORM}" ]; then elif [ -z "${MKP_PLATFORM}" ]; then
error "-p option is required" error "-p option is required"
elif ! check_selected_platform; then elif ! check_selected_platform; then
@ -122,6 +137,6 @@ else
fi fi
# clean-up all variables (so the script can be re-sourced) # clean-up all variables (so the script can be re-sourced)
unset MKP_AVAILABLE_PLATFORMS MKP_GREEN MKP_LIST_PLATFORMS MKP_NONE \ unset MKP_AVAILABLE_PLATFORMS MKP_BLACKLIST_PLATFORMS MKP_GREEN MKP_LIST_PLATFORMS \
MKP_OLD_PROJECT MKP_PLATFORM MKP_PROJECTPATH MKP_RED MKP_SCRIPTNAME \ MKP_NONE MKP_OLD_PROJECT MKP_PLATFORM MKP_PROJECTPATH MKP_RED MKP_SCRIPTNAME \
MKP_SCRIPTPATH MKP_VARIANT MKP_SCRIPTPATH MKP_VARIANT