layerindex-web/layerindex/layerconfparse.py
Paul Eggleton 05f3bccbc6 update_layer: fix regressions in missing layer detection
If a layer is removed by its subdirectory being deleted then we want to
pick up on that and produce an appropriate error message - so let the
layer_update code do the checking out and verifying things are correct
before trying to parse layer.conf.

This also fixes --nocheckout still checking out a branch.

Additionally, drop some code that gets the layerbranch which we just
retrieved a few lines above.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-07 16:39:38 +13:00

48 lines
1.3 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):
# 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()