layerindex-web/layerindex/layerconfparse.py
Meh Mbeh Ida Delphine 2314fb2811 Add SPDX license headers to layerindex-web source files
Added SPDX identifiers to all .py files except those in migrations directory.

Fixes: [YOCTO #13527]

Signed-off-by: Meh Mbeh Ida Delphine <idadelm@gmail.com>
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
2021-04-21 08:22:51 +12:00

55 lines
1.6 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
#
# SPDX-License-Identifier: MIT
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
from layerindex.models import LayerItem
bitbakeitem = LayerItem()
bitbakeitem.vcs_url = settings.BITBAKE_REPO_URL
bitbakepath = os.path.join(fetchdir, bitbakeitem.get_fetch_dir())
if getattr(settings, 'BITBAKE_PATH', ''):
bitbakepath = os.path.join(bitbakepath, settings.BITBAKE_PATH)
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, 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()