From c218f591ade6d1fabebc9c42bf0ab75d770551fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Fri, 9 Nov 2018 11:44:24 +0100 Subject: [PATCH] common-helpers.inc: Add GetBitbakeEnvVar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- scripts/include/common-helpers.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/include/common-helpers.inc b/scripts/include/common-helpers.inc index d5612bc..3ecd910 100644 --- a/scripts/include/common-helpers.inc +++ b/scripts/include/common-helpers.inc @@ -89,4 +89,14 @@ CheckPrerequisite() { fi } - +# GetBitbakeEnvVar starts bitbake -e and extracts environment variable. +# Bitbake Variable is stored in BitbakeEnvVar +GetBitbakeEnvVar() { + if [ "x`which bitbake 2>/dev/null`" = "x" ] ; then + ErrorOut "Bitbake not found! Script can only run in build environment." + fi + EvalExAuto "BitbakeEnvVar=`bitbake -e | grep ^${1}=`" "Run bitbake -e" + if [ -n "${BitbakeEnvVar}" ]; then + BitbakeEnvVar=`echo ${BitbakeEnvVar=} | sed -e s:${1}=::` + fi +}