From 5bd29d448a31c132afd6fc0127029e246759b87b Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 27 Mar 2020 15:51:02 -0700 Subject: toaster: fix for import build directory with var refs in BBLAYERS Update importing a build directory to support where bblayers.conf sets BBLAYERS to a value that includes a variable reference e.g.: BBLAYERS = "${TOPDIR}/../meta \ ${TOPDIR}/../meta-selftest" [YOCTO #13707] Signed-off-by: Paul Eggleton Signed-off-by: David Reyna Signed-off-by: Richard Purdie --- lib/toaster/toastermain/management/commands/buildimport.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/toaster/toastermain/management/commands/buildimport.py b/lib/toaster/toastermain/management/commands/buildimport.py index 7718caa57..59da6ff7a 100644 --- a/lib/toaster/toastermain/management/commands/buildimport.py +++ b/lib/toaster/toastermain/management/commands/buildimport.py @@ -114,6 +114,15 @@ class Command(BaseCommand): help='command (configure,reconfigure,import)', ) + def get_var(self, varname): + value = self.vars.get(varname, '') + if value: + varrefs = re.findall('\${([^}]*)}', value) + for ref in varrefs: + if ref in self.vars: + value = value.replace('${%s}' % ref, self.vars[ref]) + return value + # Extract the bb variables from a conf file def scan_conf(self,fn): vars = self.vars @@ -241,7 +250,7 @@ class Command(BaseCommand): # Apply table of all layer versions def extract_bblayers(self): # set up the constants - bblayer_str = self.vars['BBLAYERS'] + bblayer_str = self.get_var('BBLAYERS') TOASTER_DIR = os.environ.get('TOASTER_DIR') INSTALL_CLONE_PREFIX = os.path.dirname(TOASTER_DIR) + "/" TOASTER_CLONE_PREFIX = TOASTER_DIR + "/_toaster_clones/" @@ -421,6 +430,7 @@ class Command(BaseCommand): # Scan the project's conf files (if any) def scan_conf_variables(self,project_path): + self.vars['TOPDIR'] = project_path # scan the project's settings, add any new layers or variables if os.path.isfile("%s/conf/local.conf" % project_path): self.scan_conf("%s/conf/local.conf" % project_path) -- cgit 1.2.3-korg