From 616940ec5d1b1b7f365e1922dcc49a9b89b0cb24 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Tue, 17 Jun 2014 10:49:44 +0200 Subject: [PATCH] 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 --- sdk/mkproject.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index ffdc15279..ed135bd92 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -27,17 +27,20 @@ MKP_NONE="\033[0m" # Path to platform config files MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/meta-digi/sdk/config" +# Blacklist platforms (not officially supported in a DEY release) +MKP_BLACKLIST_PLATFORMS="" + ## Local functions usage() { cat < select platform for the project -v select platform variant -Available platforms: ${MKP_AVAILABLE_PLATFORMS} +Supported platforms: $(display_supported_platforms) See platform include files for supported variant names: @@ -61,6 +64,18 @@ check_selected_platform() { 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() { export TEMPLATECONF="${TEMPLATECONF:-${MKP_CONFIGPATH}/${MKP_PLATFORM}}" source ${MKP_SCRIPTPATH}/sources/poky/oe-init-build-env . @@ -112,7 +127,7 @@ if [ "${BASH_SOURCE}" = "${0}" ]; then elif [ ${#} -eq 0 ] ; then usage elif [ -n "${MKP_LIST_PLATFORMS}" ]; then - echo ${MKP_AVAILABLE_PLATFORMS} + display_supported_platforms elif [ -z "${MKP_PLATFORM}" ]; then error "-p option is required" elif ! check_selected_platform; then @@ -122,6 +137,6 @@ else fi # clean-up all variables (so the script can be re-sourced) -unset MKP_AVAILABLE_PLATFORMS MKP_GREEN MKP_LIST_PLATFORMS MKP_NONE \ - MKP_OLD_PROJECT MKP_PLATFORM MKP_PROJECTPATH MKP_RED MKP_SCRIPTNAME \ +unset MKP_AVAILABLE_PLATFORMS MKP_BLACKLIST_PLATFORMS MKP_GREEN MKP_LIST_PLATFORMS \ + MKP_NONE MKP_OLD_PROJECT MKP_PLATFORM MKP_PROJECTPATH MKP_RED MKP_SCRIPTNAME \ MKP_SCRIPTPATH MKP_VARIANT