layerindex-web/layerindex/layerconfparse.py
Liam R. Howlett 540336edde layerindex: Detect dependencies from layer.conf files
Read dependencies from layer.conf and try to create the LayerDependency
entry by looking up the correct database object.  Dependencies are found
by layer name only - no collection support.  layer.conf parsing is
handled by the bitbake code.

Once all layers are added, the dependencies have to be rechecked in case
the layers are not added in order.

Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com>
2016-10-18 16:42:16 +13:00

51 lines
1.4 KiB
Python

# Utility functions for parsing layer.conf using bitbake within layerindex-web
#
# Copyright (C) 2016 Wind River Systems
# Author: Liam R. Howlett <liam.howlett@windriver.com>
#
# Licensed under the MIT license, see COPYING.MIT for details
#
import sys
import os
import os.path
import utils
import tempfile
import re
class LayerConfParse:
def __init__(self, enable_tracking=False, logger=None, bitbakepath=None, tinfoil=None):
import settings
self.logger = logger
if not bitbakepath:
fetchdir = settings.LAYER_FETCH_DIR
bitbakepath = os.path.join(fetchdir, 'bitbake')
self.bbpath = bitbakepath
# Set up BBPATH.
os.environ['BBPATH'] = str("%s" % self.bbpath)
self.tinfoil = tinfoil
if not self.tinfoil:
self.tinfoil = utils.setup_tinfoil(self.bbpath, enable_tracking)
self.config_data_copy = bb.data.createCopy(self.tinfoil.config_data)
def parse_layer(self, layerbranch, layerdir):
utils.checkout_layer_branch(layerbranch, layerdir, self.logger)
# This is not a valid layer, parsing will cause exception.
if not utils.is_layer_valid(layerdir):
return None
utils.parse_layer_conf(layerdir, self.config_data_copy, logger=self.logger)
return self.config_data_copy
def shutdown(self):
self.tinfoil.shutdown()