Fix update script to handle includes from other directories

Set BBPATH so that files from the layer can be found when recipes use
include/require pointing to files with a specific path, or use
inherit to inherit a class in the layer.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-02-24 21:10:37 +00:00
parent 6c12135117
commit f3174e16f6

View File

@ -75,10 +75,10 @@ def split_path(subdir_start, recipe_path):
return (None, None) return (None, None)
def update_recipe_file(bbhandler, path, recipe): def update_recipe_file(data, path, recipe):
fn = str(os.path.join(path, recipe.filename)) fn = str(os.path.join(path, recipe.filename))
try: try:
envdata = bb.cache.Cache.loadDataFull(fn, [], bbhandler.config_data) envdata = bb.cache.Cache.loadDataFull(fn, [], data)
envdata.setVar('SRCPV', 'X') envdata.setVar('SRCPV', 'X')
recipe.pn = envdata.getVar("PN", True) recipe.pn = envdata.getVar("PN", True)
recipe.pv = envdata.getVar("PV", True) recipe.pv = envdata.getVar("PV", True)
@ -226,6 +226,10 @@ def main():
if layer.vcs_last_rev != topcommit.hexsha or options.reload: if layer.vcs_last_rev != topcommit.hexsha or options.reload:
logger.info("Collecting data for layer %s" % layer.name) logger.info("Collecting data for layer %s" % layer.name)
# Ensure we have BBPATH set so that files from this layer can be included
config_data_copy = bb.data.createCopy(tinfoil.config_data)
config_data_copy.setVar('BBPATH', str(':'.join([layerdir, config_data_copy.getVar('BBPATH', True)])))
if layer.vcs_last_rev and not options.reload: if layer.vcs_last_rev and not options.reload:
try: try:
diff = repo.commit(layer.vcs_last_rev).diff(topcommit) diff = repo.commit(layer.vcs_last_rev).diff(topcommit)
@ -257,7 +261,7 @@ def main():
recipe.layer = layer recipe.layer = layer
recipe.filename = filename recipe.filename = filename
recipe.filepath = filepath recipe.filepath = filepath
update_recipe_file(tinfoil, os.path.join(layerdir, filepath), recipe) update_recipe_file(config_data_copy, os.path.join(layerdir, filepath), recipe)
recipe.save() recipe.save()
for d in diff.iter_change_type('M'): for d in diff.iter_change_type('M'):
@ -267,7 +271,7 @@ def main():
results = layerrecipes.filter(filepath=filepath).filter(filename=filename)[:1] results = layerrecipes.filter(filepath=filepath).filter(filename=filename)[:1]
if results: if results:
recipe = results[0] recipe = results[0]
update_recipe_file(tinfoil, os.path.join(layerdir, filepath), recipe) update_recipe_file(config_data_copy, os.path.join(layerdir, filepath), recipe)
recipe.save() recipe.save()
else: else:
# Collect recipe data from scratch # Collect recipe data from scratch
@ -279,7 +283,7 @@ def main():
recipe.layer = layer recipe.layer = layer
recipe.filename = f recipe.filename = f
recipe.filepath = os.path.relpath(root, layerdir) recipe.filepath = os.path.relpath(root, layerdir)
update_recipe_file(tinfoil, root, recipe) update_recipe_file(config_data_copy, root, recipe)
recipe.save() recipe.save()
# Save repo info # Save repo info