bitbake: layerindexlib: Initial layer index processing module implementation

The layer index module is expected to be used by various parts of the system
in order to access a layerindex-web (such as layers.openembedded.org) and
perform basic processing on the information, such as dependency scanning.

Along with the layerindex implementation are associated tests.  The tests
properly honor BB_SKIP_NETTESTS='yes' to prevent test failures.

Tests Implemented:
   - Branch, LayerItem, LayerBranch, LayerDependency, Recipe, Machine and
      Distro objects
   - LayerIndex setup using the layers.openembedded.org restapi
   - LayerIndex storing and retrieving from a file
   - LayerIndex verify dependency resolution ordering
   - LayerIndex setup using simulated cooker data

(Bitbake rev: fd0ee6c10dbb5592731e56f4c592fe687682a3e6)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mark Hatle 2018-07-23 22:29:11 -04:00 committed by Richard Purdie
parent 0dea950931
commit 1ac19d1bf1
17 changed files with 2866 additions and 1 deletions

View File

@ -22,6 +22,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib
import unittest
try:
import bb
import layerindexlib
except RuntimeError as exc:
sys.exit(str(exc))
@ -31,7 +32,10 @@ tests = ["bb.tests.codeparser",
"bb.tests.event",
"bb.tests.fetch",
"bb.tests.parse",
"bb.tests.utils"]
"bb.tests.utils",
"layerindexlib.tests.layerindexobj",
"layerindexlib.tests.restapi",
"layerindexlib.tests.cooker"]
for t in tests:
t = '.'.join(t.split('.')[:3])

View File

@ -0,0 +1,28 @@
The layerindexlib module is designed to permit programs to work directly
with layer index information. (See layers.openembedded.org...)
The layerindexlib module includes a plugin interface that is used to extend
the basic functionality. There are two primary plugins available: restapi
and cooker.
The restapi plugin works with a web based REST Api compatible with the
layerindex-web project, as well as the ability to store and retried a
the information for one or more files on the disk.
The cooker plugin works by reading the information from the current build
project and processing it as if it were a layer index.
TODO:
__init__.py:
Implement local on-disk caching (using the rest api store/load)
Implement layer index style query operations on a combined index
common.py:
Stop network access if BB_NO_NETWORK or allowed hosts is restricted
cooker.py:
Cooker - Implement recipe parsing

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,341 @@
# Copyright (C) 2016-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import logging
import json
from collections import OrderedDict, defaultdict
from urllib.parse import unquote, urlparse
import layerindexlib
import layerindexlib.plugin
logger = logging.getLogger('BitBake.layerindexlib.cooker')
import bb.utils
def plugin_init(plugins):
return CookerPlugin()
class CookerPlugin(layerindexlib.plugin.IndexPlugin):
def __init__(self):
self.type = "cooker"
self.server_connection = None
self.ui_module = None
self.server = None
def _run_command(self, command, path, default=None):
try:
result, _ = bb.process.run(command, cwd=path)
result = result.strip()
except bb.process.ExecutionError:
result = default
return result
def _handle_git_remote(self, remote):
if "://" not in remote:
if ':' in remote:
# This is assumed to be ssh
remote = "ssh://" + remote
else:
# This is assumed to be a file path
remote = "file://" + remote
return remote
def _get_bitbake_info(self):
"""Return a tuple of bitbake information"""
# Our path SHOULD be .../bitbake/lib/layerindex/cooker.py
bb_path = os.path.dirname(__file__) # .../bitbake/lib/layerindex/cooker.py
bb_path = os.path.dirname(bb_path) # .../bitbake/lib/layerindex
bb_path = os.path.dirname(bb_path) # .../bitbake/lib
bb_path = os.path.dirname(bb_path) # .../bitbake
bb_path = self._run_command('git rev-parse --show-toplevel', os.path.dirname(__file__), default=bb_path)
bb_branch = self._run_command('git rev-parse --abbrev-ref HEAD', bb_path, default="<unknown>")
bb_rev = self._run_command('git rev-parse HEAD', bb_path, default="<unknown>")
for remotes in self._run_command('git remote -v', bb_path, default="").split("\n"):
remote = remotes.split("\t")[1].split(" ")[0]
if "(fetch)" == remotes.split("\t")[1].split(" ")[1]:
bb_remote = self._handle_git_remote(remote)
break
else:
bb_remote = self._handle_git_remote(bb_path)
return (bb_remote, bb_branch, bb_rev, bb_path)
def _load_bblayers(self, branches=None):
"""Load the BBLAYERS and related collection information"""
d = self.layerindex.data
if not branches:
raise LayerIndexFetchError("No branches specified for _load_bblayers!")
index = layerindexlib.LayerIndexObj()
branchId = 0
index.branches = {}
layerItemId = 0
index.layerItems = {}
layerBranchId = 0
index.layerBranches = {}
bblayers = d.getVar('BBLAYERS').split()
if not bblayers:
# It's blank! Nothing to process...
return index
collections = d.getVar('BBFILE_COLLECTIONS')
layerconfs = d.varhistory.get_variable_items_files('BBFILE_COLLECTIONS', d)
bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()}
(_, bb_branch, _, _) = self._get_bitbake_info()
for branch in branches:
branchId += 1
index.branches[branchId] = layerindexlib.Branch(index, None)
index.branches[branchId].define_data(branchId, branch, bb_branch)
for entry in collections.split():
layerpath = entry
if entry in bbfile_collections:
layerpath = bbfile_collections[entry]
layername = d.getVar('BBLAYERS_LAYERINDEX_NAME_%s' % entry) or os.path.basename(layerpath)
layerversion = d.getVar('LAYERVERSION_%s' % entry) or ""
layerurl = self._handle_git_remote(layerpath)
layersubdir = ""
layerrev = "<unknown>"
layerbranch = "<unknown>"
if os.path.isdir(layerpath):
layerbasepath = self._run_command('git rev-parse --show-toplevel', layerpath, default=layerpath)
if os.path.abspath(layerpath) != os.path.abspath(layerbasepath):
layersubdir = os.path.abspath(layerpath)[len(layerbasepath) + 1:]
layerbranch = self._run_command('git rev-parse --abbrev-ref HEAD', layerpath, default="<unknown>")
layerrev = self._run_command('git rev-parse HEAD', layerpath, default="<unknown>")
for remotes in self._run_command('git remote -v', layerpath, default="").split("\n"):
remote = remotes.split("\t")[1].split(" ")[0]
if "(fetch)" == remotes.split("\t")[1].split(" ")[1]:
layerurl = self._handle_git_remote(remote)
break
layerItemId += 1
index.layerItems[layerItemId] = layerindexlib.LayerItem(index, None)
index.layerItems[layerItemId].define_data(layerItemId, layername, description=layerpath, vcs_url=layerurl)
for branchId in index.branches:
layerBranchId += 1
index.layerBranches[layerBranchId] = layerindexlib.LayerBranch(index, None)
index.layerBranches[layerBranchId].define_data(layerBranchId, entry, layerversion, layerItemId, branchId,
vcs_subdir=layersubdir, vcs_last_rev=layerrev, actual_branch=layerbranch)
return index
def load_index(self, url, load):
"""
Fetches layer information from a build configuration.
The return value is a dictionary containing API,
layer, branch, dependency, recipe, machine, distro, information.
url type should be 'cooker'.
url path is ignored
"""
up = urlparse(url)
if up.scheme != 'cooker':
raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url)
d = self.layerindex.data
params = self.layerindex._parse_params(up.params)
# Only reason to pass a branch is to emulate them...
if 'branch' in params:
branches = params['branch'].split(',')
else:
branches = ['HEAD']
logger.debug(1, "Loading cooker data branches %s" % branches)
index = self._load_bblayers(branches=branches)
index.config = {}
index.config['TYPE'] = self.type
index.config['URL'] = url
if 'desc' in params:
index.config['DESCRIPTION'] = unquote(params['desc'])
else:
index.config['DESCRIPTION'] = 'local'
if 'cache' in params:
index.config['CACHE'] = params['cache']
index.config['BRANCH'] = branches
# ("layerDependencies", layerindexlib.LayerDependency)
layerDependencyId = 0
if "layerDependencies" in load:
index.layerDependencies = {}
for layerBranchId in index.layerBranches:
branchName = index.layerBranches[layerBranchId].branch.name
collection = index.layerBranches[layerBranchId].collection
def add_dependency(layerDependencyId, index, deps, required):
try:
depDict = bb.utils.explode_dep_versions2(deps)
except bb.utils.VersionStringException as vse:
bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (c, str(vse)))
for dep, oplist in list(depDict.items()):
# We need to search ourselves, so use the _ version...
depLayerBranch = index.find_collection(dep, branches=[branchName])
if not depLayerBranch:
# Missing dependency?!
logger.error('Missing dependency %s (%s)' % (dep, branchName))
continue
# We assume that the oplist matches...
layerDependencyId += 1
layerDependency = layerindexlib.LayerDependency(index, None)
layerDependency.define_data(id=layerDependencyId,
required=required, layerbranch=layerBranchId,
dependency=depLayerBranch.layer_id)
logger.debug(1, '%s requires %s' % (layerDependency.layer.name, layerDependency.dependency.name))
index.add_element("layerDependencies", [layerDependency])
return layerDependencyId
deps = d.getVar("LAYERDEPENDS_%s" % collection)
if deps:
layerDependencyId = add_dependency(layerDependencyId, index, deps, True)
deps = d.getVar("LAYERRECOMMENDS_%s" % collection)
if deps:
layerDependencyId = add_dependency(layerDependencyId, index, deps, False)
# Need to load recipes here (requires cooker access)
recipeId = 0
## TODO: NOT IMPLEMENTED
# The code following this is an example of what needs to be
# implemented. However, it does not work as-is.
if False and 'recipes' in load:
index.recipes = {}
ret = self.ui_module.main(self.server_connection.connection, self.server_connection.events, config_params)
all_versions = self._run_command('allProviders')
all_versions_list = defaultdict(list, all_versions)
for pn in all_versions_list:
for ((pe, pv, pr), fpath) in all_versions_list[pn]:
realfn = bb.cache.virtualfn2realfn(fpath)
filepath = os.path.dirname(realfn[0])
filename = os.path.basename(realfn[0])
# This is all HORRIBLY slow, and likely unnecessary
#dscon = self._run_command('parseRecipeFile', fpath, False, [])
#connector = myDataStoreConnector(self, dscon.dsindex)
#recipe_data = bb.data.init()
#recipe_data.setVar('_remote_data', connector)
#summary = recipe_data.getVar('SUMMARY')
#description = recipe_data.getVar('DESCRIPTION')
#section = recipe_data.getVar('SECTION')
#license = recipe_data.getVar('LICENSE')
#homepage = recipe_data.getVar('HOMEPAGE')
#bugtracker = recipe_data.getVar('BUGTRACKER')
#provides = recipe_data.getVar('PROVIDES')
layer = bb.utils.get_file_layer(realfn[0], self.config_data)
depBranchId = collection_layerbranch[layer]
recipeId += 1
recipe = layerindexlib.Recipe(index, None)
recipe.define_data(id=recipeId,
filename=filename, filepath=filepath,
pn=pn, pv=pv,
summary=pn, description=pn, section='?',
license='?', homepage='?', bugtracker='?',
provides='?', bbclassextend='?', inherits='?',
blacklisted='?', layerbranch=depBranchId)
index = addElement("recipes", [recipe], index)
# ("machines", layerindexlib.Machine)
machineId = 0
if 'machines' in load:
index.machines = {}
for layerBranchId in index.layerBranches:
# load_bblayers uses the description to cache the actual path...
machine_path = index.layerBranches[layerBranchId].getDescription()
machine_path = os.path.join(machine_path, 'conf/machine')
if os.path.isdir(machine_path):
for (dirpath, _, filenames) in os.walk(machine_path):
# Ignore subdirs...
if not dirpath.endswith('conf/machine'):
continue
for fname in filenames:
if fname.endswith('.conf'):
machineId += 1
machine = layerindexlib.Machine(index, None)
machine.define_data(id=machineId, name=fname[:-5],
description=fname[:-5],
layerbranch=collection_layerbranch[entry])
index.add_element("machines", [machine])
# ("distros", layerindexlib.Distro)
distroId = 0
if 'distros' in load:
index.distros = {}
for layerBranchId in index.layerBranches:
# load_bblayers uses the description to cache the actual path...
distro_path = index.layerBranches[layerBranchId].getDescription()
distro_path = os.path.join(distro_path, 'conf/distro')
if os.path.isdir(distro_path):
for (dirpath, _, filenames) in os.walk(distro_path):
# Ignore subdirs...
if not dirpath.endswith('conf/distro'):
continue
for fname in filenames:
if fname.endswith('.conf'):
distroId += 1
distro = layerindexlib.Distro(index, None)
distro.define_data(id=distroId, name=fname[:-5],
description=fname[:-5],
layerbranch=collection_layerbranch[entry])
index.add_element("distros", [distro])
return index

View File

@ -0,0 +1,60 @@
# Copyright (C) 2016-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# The file contains:
# LayerIndex exceptions
# Plugin base class
# Utility Functions for working on layerindex data
import argparse
import logging
import os
import bb.msg
logger = logging.getLogger('BitBake.layerindexlib.plugin')
class LayerIndexPluginException(Exception):
"""LayerIndex Generic Exception"""
def __init__(self, message):
self.msg = message
Exception.__init__(self, message)
def __str__(self):
return self.msg
class LayerIndexPluginUrlError(LayerIndexPluginException):
"""Exception raised when a plugin does not support a given URL type"""
def __init__(self, plugin, url):
msg = "%s does not support %s:" % (plugin, url)
self.plugin = plugin
self.url = url
LayerIndexPluginException.__init__(self, msg)
class IndexPlugin():
def __init__(self):
self.type = None
def init(self, layerindex):
self.layerindex = layerindex
def plugin_type(self):
return self.type
def load_index(self, uri):
raise NotImplementedError('load_index is not implemented')
def store_index(self, uri, index):
raise NotImplementedError('store_index is not implemented')

View File

@ -0,0 +1,398 @@
# Copyright (C) 2016-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import logging
import json
from urllib.parse import unquote
from urllib.parse import urlparse
import layerindexlib
import layerindexlib.plugin
logger = logging.getLogger('BitBake.layerindexlib.restapi')
def plugin_init(plugins):
return RestApiPlugin()
class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
def __init__(self):
self.type = "restapi"
def load_index(self, url, load):
"""
Fetches layer information from a local or remote layer index.
The return value is a LayerIndexObj.
url is the url to the rest api of the layer index, such as:
http://layers.openembedded.org/layerindex/api/
Or a local file...
"""
up = urlparse(url)
if up.scheme == 'file':
return self.load_index_file(up, url, load)
if up.scheme == 'http' or up.scheme == 'https':
return self.load_index_web(up, url, load)
raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url)
def load_index_file(self, up, url, load):
"""
Fetches layer information from a local file or directory.
The return value is a LayerIndexObj.
ud is the parsed url to the local file or directory.
"""
if not os.path.exists(up.path):
raise FileNotFoundError(up.path)
index = layerindexlib.LayerIndexObj()
index.config = {}
index.config['TYPE'] = self.type
index.config['URL'] = url
params = self.layerindex._parse_params(up.params)
if 'desc' in params:
index.config['DESCRIPTION'] = unquote(params['desc'])
else:
index.config['DESCRIPTION'] = up.path
if 'cache' in params:
index.config['CACHE'] = params['cache']
if 'branch' in params:
branches = params['branch'].split(',')
index.config['BRANCH'] = branches
else:
branches = ['*']
def load_cache(path, index, branches=[]):
logger.debug(1, 'Loading json file %s' % path)
with open(path, 'rt', encoding='utf-8') as f:
pindex = json.load(f)
# Filter the branches on loaded files...
newpBranch = []
for branch in branches:
if branch != '*':
if 'branches' in pindex:
for br in pindex['branches']:
if br['name'] == branch:
newpBranch.append(br)
else:
if 'branches' in pindex:
for br in pindex['branches']:
newpBranch.append(br)
if newpBranch:
index.add_raw_element('branches', layerindexlib.Branch, newpBranch)
else:
logger.debug(1, 'No matching branches (%s) in index file(s)' % branches)
# No matching branches.. return nothing...
return
for (lName, lType) in [("layerItems", layerindexlib.LayerItem),
("layerBranches", layerindexlib.LayerBranch),
("layerDependencies", layerindexlib.LayerDependency),
("recipes", layerindexlib.Recipe),
("machines", layerindexlib.Machine),
("distros", layerindexlib.Distro)]:
if lName in pindex:
index.add_raw_element(lName, lType, pindex[lName])
if not os.path.isdir(up.path):
load_cache(up.path, index, branches)
return index
logger.debug(1, 'Loading from dir %s...' % (up.path))
for (dirpath, _, filenames) in os.walk(up.path):
for filename in filenames:
if not filename.endswith('.json'):
continue
fpath = os.path.join(dirpath, filename)
load_cache(fpath, index, branches)
return index
def load_index_web(self, up, url, load):
"""
Fetches layer information from a remote layer index.
The return value is a LayerIndexObj.
ud is the parsed url to the rest api of the layer index, such as:
http://layers.openembedded.org/layerindex/api/
"""
def _get_json_response(apiurl=None, username=None, password=None, retry=True):
assert apiurl is not None
logger.debug(1, "fetching %s" % apiurl)
up = urlparse(apiurl)
username=up.username
password=up.password
# Strip username/password and params
if up.port:
up_stripped = up._replace(params="", netloc="%s:%s" % (up.hostname, up.port))
else:
up_stripped = up._replace(params="", netloc=up.hostname)
res = self.layerindex._fetch_url(up_stripped.geturl(), username=username, password=password)
try:
parsed = json.loads(res.read().decode('utf-8'))
except ConnectionResetError:
if retry:
logger.debug(1, "%s: Connection reset by peer. Retrying..." % url)
parsed = _get_json_response(apiurl=up_stripped.geturl(), username=username, password=password, retry=False)
logger.debug(1, "%s: retry successful.")
else:
raise LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl)
return parsed
index = layerindexlib.LayerIndexObj()
index.config = {}
index.config['TYPE'] = self.type
index.config['URL'] = url
params = self.layerindex._parse_params(up.params)
if 'desc' in params:
index.config['DESCRIPTION'] = unquote(params['desc'])
else:
index.config['DESCRIPTION'] = up.hostname
if 'cache' in params:
index.config['CACHE'] = params['cache']
if 'branch' in params:
branches = params['branch'].split(',')
index.config['BRANCH'] = branches
else:
branches = ['*']
try:
index.apilinks = _get_json_response(apiurl=url, username=up.username, password=up.password)
except Exception as e:
raise layerindexlib.LayerIndexFetchError(url, e)
# Local raw index set...
pindex = {}
# Load all the requested branches at the same time time,
# a special branch of '*' means load all branches
filter = ""
if "*" not in branches:
filter = "?filter=name:%s" % "OR".join(branches)
logger.debug(1, "Loading %s from %s" % (branches, index.apilinks['branches']))
# The link won't include username/password, so pull it from the original url
pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter,
username=up.username, password=up.password)
if not pindex['branches']:
logger.debug(1, "No valid branches (%s) found at url %s." % (branch, url))
return index
index.add_raw_element("branches", layerindexlib.Branch, pindex['branches'])
# Load all of the layerItems (these can not be easily filtered)
logger.debug(1, "Loading %s from %s" % ('layerItems', index.apilinks['layerItems']))
# The link won't include username/password, so pull it from the original url
pindex['layerItems'] = _get_json_response(index.apilinks['layerItems'],
username=up.username, password=up.password)
if not pindex['layerItems']:
logger.debug(1, "No layers were found at url %s." % (url))
return index
index.add_raw_element("layerItems", layerindexlib.LayerItem, pindex['layerItems'])
# From this point on load the contents for each branch. Otherwise we
# could run into a timeout.
for branch in index.branches:
filter = "?filter=branch__name:%s" % index.branches[branch].name
logger.debug(1, "Loading %s from %s" % ('layerBranches', index.apilinks['layerBranches']))
# The link won't include username/password, so pull it from the original url
pindex['layerBranches'] = _get_json_response(index.apilinks['layerBranches'] + filter,
username=up.username, password=up.password)
if not pindex['layerBranches']:
logger.debug(1, "No valid layer branches (%s) found at url %s." % (branches or "*", url))
return index
index.add_raw_element("layerBranches", layerindexlib.LayerBranch, pindex['layerBranches'])
# Load the rest, they all have a similar format
# Note: the layer index has a few more items, we can add them if necessary
# in the future.
filter = "?filter=layerbranch__branch__name:%s" % index.branches[branch].name
for (lName, lType) in [("layerDependencies", layerindexlib.LayerDependency),
("recipes", layerindexlib.Recipe),
("machines", layerindexlib.Machine),
("distros", layerindexlib.Distro)]:
if lName not in load:
continue
logger.debug(1, "Loading %s from %s" % (lName, index.apilinks[lName]))
# The link won't include username/password, so pull it from the original url
pindex[lName] = _get_json_response(index.apilinks[lName] + filter,
username=up.username, password=up.password)
index.add_raw_element(lName, lType, pindex[lName])
return index
def store_index(self, url, index):
"""
Store layer information into a local file/dir.
The return value is a dictionary containing API,
layer, branch, dependency, recipe, machine, distro, information.
ud is a parsed url to a directory or file. If the path is a
directory, we will split the files into one file per layer.
If the path is to a file (exists or not) the entire DB will be
dumped into that one file.
"""
up = urlparse(url)
if up.scheme != 'file':
raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url)
logger.debug(1, "Storing to %s..." % up.path)
try:
layerbranches = index.layerBranches
except KeyError:
logger.error('No layerBranches to write.')
return
def filter_item(layerbranchid, objects):
filtered = []
for obj in getattr(index, objects, None):
try:
if getattr(index, objects)[obj].layerbranch_id == layerbranchid:
filtered.append(getattr(index, objects)[obj]._data)
except AttributeError:
logger.debug(1, 'No obj.layerbranch_id: %s' % objects)
# No simple filter method, just include it...
try:
filtered.append(getattr(index, objects)[obj]._data)
except AttributeError:
logger.debug(1, 'No obj._data: %s %s' % (objects, type(obj)))
filtered.append(obj)
return filtered
# Write out to a single file.
# Filter out unnecessary items, then sort as we write for determinism
if not os.path.isdir(up.path):
pindex = {}
pindex['branches'] = []
pindex['layerItems'] = []
pindex['layerBranches'] = []
for layerbranchid in layerbranches:
if layerbranches[layerbranchid].branch._data not in pindex['branches']:
pindex['branches'].append(layerbranches[layerbranchid].branch._data)
if layerbranches[layerbranchid].layer._data not in pindex['layerItems']:
pindex['layerItems'].append(layerbranches[layerbranchid].layer._data)
if layerbranches[layerbranchid]._data not in pindex['layerBranches']:
pindex['layerBranches'].append(layerbranches[layerbranchid]._data)
for entry in index._index:
# Skip local items, apilinks and items already processed
if entry in index.config['local'] or \
entry == 'apilinks' or \
entry == 'branches' or \
entry == 'layerBranches' or \
entry == 'layerItems':
continue
if entry not in pindex:
pindex[entry] = []
pindex[entry].extend(filter_item(layerbranchid, entry))
bb.debug(1, 'Writing index to %s' % up.path)
with open(up.path, 'wt') as f:
json.dump(layerindexlib.sort_entry(pindex), f, indent=4)
return
# Write out to a directory one file per layerBranch
# Prepare all layer related items, to create a minimal file.
# We have to sort the entries as we write so they are deterministic
for layerbranchid in layerbranches:
pindex = {}
for entry in index._index:
# Skip local items, apilinks and items already processed
if entry in index.config['local'] or \
entry == 'apilinks' or \
entry == 'branches' or \
entry == 'layerBranches' or \
entry == 'layerItems':
continue
pindex[entry] = filter_item(layerbranchid, entry)
# Add the layer we're processing as the first one...
pindex['branches'] = [layerbranches[layerbranchid].branch._data]
pindex['layerItems'] = [layerbranches[layerbranchid].layer._data]
pindex['layerBranches'] = [layerbranches[layerbranchid]._data]
# We also need to include the layerbranch for any dependencies...
for layerdep in pindex['layerDependencies']:
layerdependency = layerindexlib.LayerDependency(index, layerdep)
layeritem = layerdependency.dependency
layerbranch = layerdependency.dependency_layerBranch
# We need to avoid duplicates...
if layeritem._data not in pindex['layerItems']:
pindex['layerItems'].append(layeritem._data)
if layerbranch._data not in pindex['layerBranches']:
pindex['layerBranches'].append(layerbranch._data)
# apply mirroring adjustments here....
fname = index.config['DESCRIPTION'] + '__' + pindex['branches'][0]['name'] + '__' + pindex['layerItems'][0]['name']
fname = fname.translate(str.maketrans('/ ', '__'))
fpath = os.path.join(up.path, fname)
bb.debug(1, 'Writing index to %s' % fpath + '.json')
with open(fpath + '.json', 'wt') as f:
json.dump(layerindexlib.sort_entry(pindex), f, indent=4)

View File

@ -0,0 +1,43 @@
# Copyright (C) 2017-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
import tempfile
import os
import bb
import logging
class LayersTest(unittest.TestCase):
def setUp(self):
self.origdir = os.getcwd()
self.d = bb.data.init()
# At least one variable needs to be set
self.d.setVar('DL_DIR', os.getcwd())
if os.environ.get("BB_SKIP_NETTESTS") == "yes":
self.d.setVar('BB_NO_NETWORK', '1')
self.tempdir = tempfile.mkdtemp()
self.logger = logging.getLogger("BitBake")
def tearDown(self):
os.chdir(self.origdir)
if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes":
print("Not cleaning up %s. Please remove manually." % self.tempdir)
else:
bb.utils.prunedir(self.tempdir)

View File

@ -0,0 +1,123 @@
# Copyright (C) 2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
import tempfile
import os
import bb
import layerindexlib
from layerindexlib.tests.common import LayersTest
import logging
class LayerIndexCookerTest(LayersTest):
def setUp(self):
LayersTest.setUp(self)
# Note this is NOT a comprehensive test of cooker, as we can't easily
# configure the test data. But we can emulate the basics of the layer.conf
# files, so that is what we will do.
new_topdir = os.path.join(os.path.dirname(__file__), "testdata")
new_bbpath = os.path.join(new_topdir, "build")
self.d.setVar('TOPDIR', new_topdir)
self.d.setVar('BBPATH', new_bbpath)
self.d = bb.parse.handle("%s/conf/bblayers.conf" % new_bbpath, self.d, True)
for layer in self.d.getVar('BBLAYERS').split():
self.d = bb.parse.handle("%s/conf/layer.conf" % layer, self.d, True)
self.layerindex = layerindexlib.LayerIndex(self.d)
self.layerindex.load_layerindex('cooker://', load=['layerDependencies'])
def test_layerindex_is_empty(self):
self.assertFalse(self.layerindex.is_empty(), msg="Layerindex is not empty!")
def test_dependency_resolution(self):
# Verify depth first searching...
(dependencies, invalidnames) = self.layerindex.find_dependencies(names=['meta-python'])
first = True
for deplayerbranch in dependencies:
layerBranch = dependencies[deplayerbranch][0]
layerDeps = dependencies[deplayerbranch][1:]
if not first:
continue
first = False
# Top of the deps should be openembedded-core, since everything depends on it.
self.assertEqual(layerBranch.layer.name, "openembedded-core", msg='Top dependency not openembedded-core')
# meta-python should cause an openembedded-core dependency, if not assert!
for dep in layerDeps:
if dep.layer.name == 'meta-python':
break
else:
self.assertTrue(False, msg='meta-python was not found')
# Only check the first element...
break
else:
if first:
# Empty list, this is bad.
self.assertTrue(False, msg='Empty list of dependencies')
# Last dep should be the requested item
layerBranch = dependencies[deplayerbranch][0]
self.assertEqual(layerBranch.layer.name, "meta-python", msg='Last dependency not meta-python')
def test_find_collection(self):
def _check(collection, expected):
self.logger.debug(1, "Looking for collection %s..." % collection)
result = self.layerindex.find_collection(collection)
if expected:
self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection)
else:
self.assertIsNone(result, msg="Found %s when it should be there" % collection)
tests = [ ('core', True),
('openembedded-core', False),
('networking-layer', True),
('meta-python', True),
('openembedded-layer', True),
('notpresent', False) ]
for collection,result in tests:
_check(collection, result)
def test_find_layerbranch(self):
def _check(name, expected):
self.logger.debug(1, "Looking for layerbranch %s..." % name)
result = self.layerindex.find_layerbranch(name)
if expected:
self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection)
else:
self.assertIsNone(result, msg="Found %s when it should be there" % collection)
tests = [ ('openembedded-core', True),
('core', False),
('networking-layer', True),
('meta-python', True),
('openembedded-layer', True),
('notpresent', False) ]
for collection,result in tests:
_check(collection, result)

View File

@ -0,0 +1,226 @@
# Copyright (C) 2017-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
import tempfile
import os
import bb
from layerindexlib.tests.common import LayersTest
import logging
class LayerIndexObjectsTest(LayersTest):
def setUp(self):
from layerindexlib import LayerIndexObj, Branch, LayerItem, LayerBranch, LayerDependency, Recipe, Machine, Distro
LayersTest.setUp(self)
self.index = LayerIndexObj()
branchId = 0
layerItemId = 0
layerBranchId = 0
layerDependencyId = 0
recipeId = 0
machineId = 0
distroId = 0
self.index.branches = {}
self.index.layerItems = {}
self.index.layerBranches = {}
self.index.layerDependencies = {}
self.index.recipes = {}
self.index.machines = {}
self.index.distros = {}
branchId += 1
self.index.branches[branchId] = Branch(self.index)
self.index.branches[branchId].define_data(branchId,
'test_branch', 'bb_test_branch')
self.index.branches[branchId].lockData()
layerItemId +=1
self.index.layerItems[layerItemId] = LayerItem(self.index)
self.index.layerItems[layerItemId].define_data(layerItemId,
'test_layerItem', vcs_url='git://git_test_url/test_layerItem')
self.index.layerItems[layerItemId].lockData()
layerBranchId +=1
self.index.layerBranches[layerBranchId] = LayerBranch(self.index)
self.index.layerBranches[layerBranchId].define_data(layerBranchId,
'test_collection', '99', layerItemId,
branchId)
recipeId += 1
self.index.recipes[recipeId] = Recipe(self.index)
self.index.recipes[recipeId].define_data(recipeId, 'test_git.bb',
'recipes-test', 'test', 'git',
layerBranchId)
machineId += 1
self.index.machines[machineId] = Machine(self.index)
self.index.machines[machineId].define_data(machineId,
'test_machine', 'test_machine',
layerBranchId)
distroId += 1
self.index.distros[distroId] = Distro(self.index)
self.index.distros[distroId].define_data(distroId,
'test_distro', 'test_distro',
layerBranchId)
layerItemId +=1
self.index.layerItems[layerItemId] = LayerItem(self.index)
self.index.layerItems[layerItemId].define_data(layerItemId, 'test_layerItem 2',
vcs_url='git://git_test_url/test_layerItem')
layerBranchId +=1
self.index.layerBranches[layerBranchId] = LayerBranch(self.index)
self.index.layerBranches[layerBranchId].define_data(layerBranchId,
'test_collection_2', '72', layerItemId,
branchId, actual_branch='some_other_branch')
layerDependencyId += 1
self.index.layerDependencies[layerDependencyId] = LayerDependency(self.index)
self.index.layerDependencies[layerDependencyId].define_data(layerDependencyId,
layerBranchId, 1)
layerDependencyId += 1
self.index.layerDependencies[layerDependencyId] = LayerDependency(self.index)
self.index.layerDependencies[layerDependencyId].define_data(layerDependencyId,
layerBranchId, 1, required=False)
def test_branch(self):
branch = self.index.branches[1]
self.assertEqual(branch.id, 1)
self.assertEqual(branch.name, 'test_branch')
self.assertEqual(branch.short_description, 'test_branch')
self.assertEqual(branch.bitbake_branch, 'bb_test_branch')
def test_layerItem(self):
layerItem = self.index.layerItems[1]
self.assertEqual(layerItem.id, 1)
self.assertEqual(layerItem.name, 'test_layerItem')
self.assertEqual(layerItem.summary, 'test_layerItem')
self.assertEqual(layerItem.description, 'test_layerItem')
self.assertEqual(layerItem.vcs_url, 'git://git_test_url/test_layerItem')
self.assertEqual(layerItem.vcs_web_url, None)
self.assertIsNone(layerItem.vcs_web_tree_base_url)
self.assertIsNone(layerItem.vcs_web_file_base_url)
self.assertIsNotNone(layerItem.updated)
layerItem = self.index.layerItems[2]
self.assertEqual(layerItem.id, 2)
self.assertEqual(layerItem.name, 'test_layerItem 2')
self.assertEqual(layerItem.summary, 'test_layerItem 2')
self.assertEqual(layerItem.description, 'test_layerItem 2')
self.assertEqual(layerItem.vcs_url, 'git://git_test_url/test_layerItem')
self.assertIsNone(layerItem.vcs_web_url)
self.assertIsNone(layerItem.vcs_web_tree_base_url)
self.assertIsNone(layerItem.vcs_web_file_base_url)
self.assertIsNotNone(layerItem.updated)
def test_layerBranch(self):
layerBranch = self.index.layerBranches[1]
self.assertEqual(layerBranch.id, 1)
self.assertEqual(layerBranch.collection, 'test_collection')
self.assertEqual(layerBranch.version, '99')
self.assertEqual(layerBranch.vcs_subdir, '')
self.assertEqual(layerBranch.actual_branch, 'test_branch')
self.assertIsNotNone(layerBranch.updated)
self.assertEqual(layerBranch.layer_id, 1)
self.assertEqual(layerBranch.branch_id, 1)
self.assertEqual(layerBranch.layer, self.index.layerItems[1])
self.assertEqual(layerBranch.branch, self.index.branches[1])
layerBranch = self.index.layerBranches[2]
self.assertEqual(layerBranch.id, 2)
self.assertEqual(layerBranch.collection, 'test_collection_2')
self.assertEqual(layerBranch.version, '72')
self.assertEqual(layerBranch.vcs_subdir, '')
self.assertEqual(layerBranch.actual_branch, 'some_other_branch')
self.assertIsNotNone(layerBranch.updated)
self.assertEqual(layerBranch.layer_id, 2)
self.assertEqual(layerBranch.branch_id, 1)
self.assertEqual(layerBranch.layer, self.index.layerItems[2])
self.assertEqual(layerBranch.branch, self.index.branches[1])
def test_layerDependency(self):
layerDependency = self.index.layerDependencies[1]
self.assertEqual(layerDependency.id, 1)
self.assertEqual(layerDependency.layerbranch_id, 2)
self.assertEqual(layerDependency.layerbranch, self.index.layerBranches[2])
self.assertEqual(layerDependency.layer_id, 2)
self.assertEqual(layerDependency.layer, self.index.layerItems[2])
self.assertTrue(layerDependency.required)
self.assertEqual(layerDependency.dependency_id, 1)
self.assertEqual(layerDependency.dependency, self.index.layerItems[1])
self.assertEqual(layerDependency.dependency_layerBranch, self.index.layerBranches[1])
layerDependency = self.index.layerDependencies[2]
self.assertEqual(layerDependency.id, 2)
self.assertEqual(layerDependency.layerbranch_id, 2)
self.assertEqual(layerDependency.layerbranch, self.index.layerBranches[2])
self.assertEqual(layerDependency.layer_id, 2)
self.assertEqual(layerDependency.layer, self.index.layerItems[2])
self.assertFalse(layerDependency.required)
self.assertEqual(layerDependency.dependency_id, 1)
self.assertEqual(layerDependency.dependency, self.index.layerItems[1])
self.assertEqual(layerDependency.dependency_layerBranch, self.index.layerBranches[1])
def test_recipe(self):
recipe = self.index.recipes[1]
self.assertEqual(recipe.id, 1)
self.assertEqual(recipe.layerbranch_id, 1)
self.assertEqual(recipe.layerbranch, self.index.layerBranches[1])
self.assertEqual(recipe.layer_id, 1)
self.assertEqual(recipe.layer, self.index.layerItems[1])
self.assertEqual(recipe.filename, 'test_git.bb')
self.assertEqual(recipe.filepath, 'recipes-test')
self.assertEqual(recipe.fullpath, 'recipes-test/test_git.bb')
self.assertEqual(recipe.summary, "")
self.assertEqual(recipe.description, "")
self.assertEqual(recipe.section, "")
self.assertEqual(recipe.pn, 'test')
self.assertEqual(recipe.pv, 'git')
self.assertEqual(recipe.license, "")
self.assertEqual(recipe.homepage, "")
self.assertEqual(recipe.bugtracker, "")
self.assertEqual(recipe.provides, "")
self.assertIsNotNone(recipe.updated)
self.assertEqual(recipe.inherits, "")
def test_machine(self):
machine = self.index.machines[1]
self.assertEqual(machine.id, 1)
self.assertEqual(machine.layerbranch_id, 1)
self.assertEqual(machine.layerbranch, self.index.layerBranches[1])
self.assertEqual(machine.layer_id, 1)
self.assertEqual(machine.layer, self.index.layerItems[1])
self.assertEqual(machine.name, 'test_machine')
self.assertEqual(machine.description, 'test_machine')
self.assertIsNotNone(machine.updated)
def test_distro(self):
distro = self.index.distros[1]
self.assertEqual(distro.id, 1)
self.assertEqual(distro.layerbranch_id, 1)
self.assertEqual(distro.layerbranch, self.index.layerBranches[1])
self.assertEqual(distro.layer_id, 1)
self.assertEqual(distro.layer, self.index.layerItems[1])
self.assertEqual(distro.name, 'test_distro')
self.assertEqual(distro.description, 'test_distro')
self.assertIsNotNone(distro.updated)

View File

@ -0,0 +1,174 @@
# Copyright (C) 2017-2018 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
import tempfile
import os
import bb
import layerindexlib
from layerindexlib.tests.common import LayersTest
import logging
class LayerIndexWebRestApiTest(LayersTest):
if os.environ.get("BB_SKIP_NETTESTS") == "yes":
print("Unset BB_SKIP_NETTESTS to run network tests")
else:
def setUp(self):
LayersTest.setUp(self)
self.layerindex = layerindexlib.LayerIndex(self.d)
self.layerindex.load_layerindex('http://layers.openembedded.org/layerindex/api/;branch=sumo', load=['layerDependencies'])
def test_layerindex_is_empty(self):
self.assertFalse(self.layerindex.is_empty(), msg="Layerindex is empty")
def test_layerindex_store_file(self):
self.layerindex.store_layerindex('file://%s/file.json' % self.tempdir, self.layerindex.indexes[0])
self.assertTrue(os.path.isfile('%s/file.json' % self.tempdir), msg="Temporary file was not created by store_layerindex")
reload = layerindexlib.LayerIndex(self.d)
reload.load_layerindex('file://%s/file.json' % self.tempdir)
self.assertFalse(reload.is_empty(), msg="Layerindex is empty")
# Calculate layerItems in original index that should NOT be in reload
layerItemNames = []
for itemId in self.layerindex.indexes[0].layerItems:
layerItemNames.append(self.layerindex.indexes[0].layerItems[itemId].name)
for layerBranchId in self.layerindex.indexes[0].layerBranches:
layerItemNames.remove(self.layerindex.indexes[0].layerBranches[layerBranchId].layer.name)
for itemId in reload.indexes[0].layerItems:
self.assertFalse(reload.indexes[0].layerItems[itemId].name in layerItemNames, msg="Item reloaded when it shouldn't have been")
# Compare the original to what we wrote...
for type in self.layerindex.indexes[0]._index:
if type == 'apilinks' or \
type == 'layerItems' or \
type in self.layerindex.indexes[0].config['local']:
continue
for id in getattr(self.layerindex.indexes[0], type):
self.logger.debug(1, "type %s" % (type))
self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number not in reloaded index")
self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id]))
self.assertEqual(getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id], msg="Reloaded contents different")
def test_layerindex_store_split(self):
self.layerindex.store_layerindex('file://%s' % self.tempdir, self.layerindex.indexes[0])
reload = layerindexlib.LayerIndex(self.d)
reload.load_layerindex('file://%s' % self.tempdir)
self.assertFalse(reload.is_empty(), msg="Layer index is empty")
for type in self.layerindex.indexes[0]._index:
if type == 'apilinks' or \
type == 'layerItems' or \
type in self.layerindex.indexes[0].config['local']:
continue
for id in getattr(self.layerindex.indexes[0] ,type):
self.logger.debug(1, "type %s" % (type))
self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number missing from reloaded data")
self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id]))
self.assertEqual(getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id], msg="reloaded data does not match original")
def test_dependency_resolution(self):
# Verify depth first searching...
(dependencies, invalidnames) = self.layerindex.find_dependencies(names=['meta-python'])
first = True
for deplayerbranch in dependencies:
layerBranch = dependencies[deplayerbranch][0]
layerDeps = dependencies[deplayerbranch][1:]
if not first:
continue
first = False
# Top of the deps should be openembedded-core, since everything depends on it.
self.assertEqual(layerBranch.layer.name, "openembedded-core", msg='OpenEmbedded-Core is no the first dependency')
# meta-python should cause an openembedded-core dependency, if not assert!
for dep in layerDeps:
if dep.layer.name == 'meta-python':
break
else:
self.logger.debug(1, "meta-python was not found")
self.assetTrue(False)
# Only check the first element...
break
else:
# Empty list, this is bad.
self.logger.debug(1, "Empty list of dependencies")
self.assertIsNotNone(first, msg="Empty list of dependencies")
# Last dep should be the requested item
layerBranch = dependencies[deplayerbranch][0]
self.assertEqual(layerBranch.layer.name, "meta-python", msg="Last dependency not meta-python")
def test_find_collection(self):
def _check(collection, expected):
self.logger.debug(1, "Looking for collection %s..." % collection)
result = self.layerindex.find_collection(collection)
if expected:
self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection)
else:
self.assertIsNone(result, msg="Found %s when it shouldn't be there" % collection)
tests = [ ('core', True),
('openembedded-core', False),
('networking-layer', True),
('meta-python', True),
('openembedded-layer', True),
('notpresent', False) ]
for collection,result in tests:
_check(collection, result)
def test_find_layerbranch(self):
def _check(name, expected):
self.logger.debug(1, "Looking for layerbranch %s..." % name)
for index in self.layerindex.indexes:
for layerbranchid in index.layerBranches:
self.logger.debug(1, "Present: %s" % index.layerBranches[layerbranchid].layer.name)
result = self.layerindex.find_layerbranch(name)
if expected:
self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection)
else:
self.assertIsNone(result, msg="Found %s when it shouldn't be there" % collection)
tests = [ ('openembedded-core', True),
('core', False),
('meta-networking', True),
('meta-python', True),
('meta-oe', True),
('notpresent', False) ]
for collection,result in tests:
_check(collection, result)

View File

@ -0,0 +1,11 @@
This test data is used to verify the 'cooker' module of the layerindex.
The module consists of a faux project bblayers.conf with four layers defined.
layer1 - openembedded-core
layer2 - networking-layer
layer3 - meta-python
layer4 - openembedded-layer (meta-oe)
Since we do not have a fully populated cooker, we use this to test the
basic index generation, and not any deep recipe based contents.

View File

@ -0,0 +1,15 @@
LAYERSERIES_CORENAMES = "sumo"
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "7"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
${TOPDIR}/layer1 \
${TOPDIR}/layer2 \
${TOPDIR}/layer3 \
${TOPDIR}/layer4 \
"

View File

@ -0,0 +1,17 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb"
BBFILE_COLLECTIONS += "core"
BBFILE_PATTERN_core = "^${LAYERDIR}/"
BBFILE_PRIORITY_core = "5"
LAYERSERIES_CORENAMES = "sumo"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_core = "11"
LAYERSERIES_COMPAT_core = "sumo"
BBLAYERS_LAYERINDEX_NAME_core = "openembedded-core"

View File

@ -0,0 +1,20 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have a packages directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "networking-layer"
BBFILE_PATTERN_networking-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_networking-layer = "5"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_networking-layer = "1"
LAYERDEPENDS_networking-layer = "core"
LAYERDEPENDS_networking-layer += "openembedded-layer"
LAYERDEPENDS_networking-layer += "meta-python"
LAYERSERIES_COMPAT_networking-layer = "sumo"

View File

@ -0,0 +1,19 @@
# We might have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
BBFILE_COLLECTIONS += "meta-python"
BBFILE_PATTERN_meta-python := "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-python = "7"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_meta-python = "1"
LAYERDEPENDS_meta-python = "core openembedded-layer"
LAYERSERIES_COMPAT_meta-python = "sumo"
LICENSE_PATH += "${LAYERDIR}/licenses"

View File

@ -0,0 +1,22 @@
# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "openembedded-layer"
BBFILE_PATTERN_openembedded-layer := "^${LAYERDIR}/"
# Define the priority for recipes (.bb files) from this layer,
# choosing carefully how this layer interacts with all of the
# other layers.
BBFILE_PRIORITY_openembedded-layer = "6"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_openembedded-layer = "1"
LAYERDEPENDS_openembedded-layer = "core"
LAYERSERIES_COMPAT_openembedded-layer = "sumo"