From 902b3c26c752aece62aac3feda5a7c0c6d995d3d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 14 Apr 2010 14:30:09 -0700 Subject: Add a hack to avoid the req that all vars using LAYERDIR be immediately expanded See the comment in the code for details. Signed-off-by: Chris Larson --- lib/bb/cooker.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 32b64ea9e..940eebee0 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -534,11 +534,25 @@ class BBCooker: layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() + data = bb.data.createCopy(data) for layer in layers: bb.msg.debug(2, bb.msg.domain.Parsing, "Adding layer %s" % layer) bb.data.setVar('LAYERDIR', layer, data) data = bb.parse.handle(os.path.join(layer, "conf", "layer.conf"), data) + # XXX: Hack, relies on the local keys of the datasmart + # instance being stored in the 'dict' attribute and makes + # assumptions about how variable expansion works, but + # there's no better way to force an expansion of a single + # variable across the datastore today, and this at least + # lets us reference LAYERDIR without having to immediately + # eval all our variables that use it. + for key in data.dict: + if key != "_data": + value = data.getVar(key, False) + if "${LAYERDIR}" in value: + data.setVar(key, value.replace("${LAYERDIR}", layer)) + bb.data.delVar('LAYERDIR', data) if not data.getVar("BBPATH", True): -- cgit 1.2.3-korg