From patchwork Mon Nov 30 15:28:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 106524 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.34604.1796052545270592196 for ; Mon, 30 Nov 2026 07:29:05 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=a5a5KiwG; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a214c5c4c0so103348575e9.3 for ; Mon, 30 Nov 2026 07:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1796052543; x=1796657343; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=48bECXtVgSYZbKZIKYfGJ23wMtcS3Z5i+l56CyYcMoo=; b=a5a5KiwGcO2xV6mZkcZOlGTCfOHgL0CPeDL/kCIDYPIZOPJXGHigNVfT7L8hV2qIST Sup2JV5v8QHjIZZiL3w4IgnhYWQw/Vmb0jK49oCi5mGXGjwyYNXwaT7+7RWbPkMADAXe bJtCyk3M3YDsMZk9l0zQOIbU6PpYV48LDYclE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796052543; x=1796657343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=48bECXtVgSYZbKZIKYfGJ23wMtcS3Z5i+l56CyYcMoo=; b=XG7QafW5WjFrTiBbMHrdn8iavs4NYQXb3ywH0c1kD2GfvNyKRbRRLR5lJgcrbZzu1H l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G1EDUj2kuY5AQGkPwaDNkq/D6M/HQ== X-Received: by 2002:a05:600c:3ba9:b0:4a2:1050:aff with SMTP id 5b1f17b1804b1-4bb8881c741mr797157565e9.6.1796052543420; Mon, 30 Nov 2026 07:29:03 -0800 (PST) Return-Path: Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:2444:81bb:2aff:8d84]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6baa397asm66033172f8f.48.2026.11.30.07.29.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 07:29:01 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 11/17] layerindexlib/cooker: Switch to Use layerdata data struture Date: Mon, 30 Nov 2026 15:28:41 +0000 Message-ID: <20261130152847.3472849-11-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261130152847.3472849-1-richard.purdie@linuxfoundation.org> References: <20261130152847.3472849-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 15:29:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/20500 Update to use the new layerdata structure after the layer changes. Update the test layers to match the new format. Signed-off-by: Richard Purdie --- lib/layerindexlib/cooker.py | 31 +++++++------------ lib/layerindexlib/tests/cooker.py | 15 ++++++++- .../tests/testdata/layer1/conf/layer.conf | 13 ++------ .../tests/testdata/layer2/conf/layer.conf | 23 +++++--------- .../tests/testdata/layer3/conf/layer.conf | 18 +++-------- .../tests/testdata/layer4/conf/layer.conf | 23 ++++---------- 6 files changed, 47 insertions(+), 76 deletions(-) diff --git a/lib/layerindexlib/cooker.py b/lib/layerindexlib/cooker.py index 82d77335f9a..0af92eec51b 100644 --- a/lib/layerindexlib/cooker.py +++ b/lib/layerindexlib/cooker.py @@ -93,9 +93,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): # It's blank! Nothing to process... return index - collections = d.getVar('BBFILE_COLLECTIONS') - layerconfs = d.varhistory.get_variable_items_files('BBFILE_COLLECTIONS') - bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()} + layerdata = d.getVar('layerdata', False) or {} (_, bb_branch, _, _) = self._get_bitbake_info() @@ -104,13 +102,11 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): 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] + for entry, layer in layerdata.items(): + layerpath = layer.path layername = d.getVar('BBLAYERS_LAYERINDEX_NAME_%s' % entry) or os.path.basename(layerpath) - layerversion = d.getVar('LAYERVERSION_%s' % entry) or "" + layerversion = layer.version or "" layerurl = self._handle_git_remote(layerpath) layersubdir = "" @@ -164,6 +160,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url) d = self.layerindex.data + layerdata = d.getVar('layerdata', False) or {} params = self.layerindex._parse_params(up.params) @@ -199,12 +196,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): 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' % (collection, str(vse))) - + def add_dependency(layerDependencyId, index, depDict, required): for dep, oplist in list(depDict.items()): # We need to search ourselves, so use the _ version... depLayerBranch = index.find_collection(dep, branches=[branchName]) @@ -225,13 +217,12 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): return layerDependencyId - deps = d.getVar("LAYERDEPENDS_%s" % collection) - if deps: - layerDependencyId = add_dependency(layerDependencyId, index, deps, True) + layer = layerdata.get(collection) + if layer and layer.depends: + layerDependencyId = add_dependency(layerDependencyId, index, layer.depends, True) - deps = d.getVar("LAYERRECOMMENDS_%s" % collection) - if deps: - layerDependencyId = add_dependency(layerDependencyId, index, deps, False) + if layer and layer.recommends: + layerDependencyId = add_dependency(layerDependencyId, index, layer.recommends, False) # Need to load recipes here (requires cooker access) recipeId = 0 diff --git a/lib/layerindexlib/tests/cooker.py b/lib/layerindexlib/tests/cooker.py index 5ddf89aa211..04c5483783e 100644 --- a/lib/layerindexlib/tests/cooker.py +++ b/lib/layerindexlib/tests/cooker.py @@ -5,6 +5,7 @@ import os import bb +import bb.cookerdata import layerindexlib from layerindexlib.tests.common import LayersTest @@ -26,8 +27,20 @@ class LayerIndexCookerTest(LayersTest): self.d.setVar('BBPATH', new_bbpath) self.d = bb.parse.handle("%s/conf/bblayers.conf" % new_bbpath, self.d, True) + layerdata = {} for layer in self.d.getVar('BBLAYERS').split(): - self.d = bb.parse.handle("%s/conf/layer.conf" % layer, self.d, True) + ld = bb.parse.handle("%s/conf/layer.conf" % layer, self.d.createCopy(), True) + layername = ld.getVar('LAYERNAME') + layerdata[layername] = bb.cookerdata.Layer( + path=layer, + version=ld.getVar('LAYERVERSION') or "1", + depends=bb.utils.explode_dep_versions2(ld.getVar('LAYERDEPENDS') or ""), + recommends=bb.utils.explode_dep_versions2(ld.getVar('LAYERRECOMMENDS') or ""), + ) + indexname = ld.getVar('BBLAYERS_LAYERINDEX_NAME_%s' % layername) + if indexname: + self.d.setVar('BBLAYERS_LAYERINDEX_NAME_%s' % layername, indexname) + self.d.setVar('layerdata', layerdata) self.layerindex = layerindexlib.LayerIndex(self.d) self.layerindex.load_layerindex('cooker://', load=['layerDependencies']) diff --git a/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf b/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf index 966d5319596..dbabd91e6c5 100644 --- a/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf +++ b/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf @@ -1,17 +1,10 @@ -# 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" +LAYERNAME = "core" 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" +LAYERVERSION = "11" +LAYERSERIES_COMPAT = "sumo" BBLAYERS_LAYERINDEX_NAME_core = "openembedded-core" diff --git a/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf b/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf index 7569d1c2172..cea7d19d950 100644 --- a/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf +++ b/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf @@ -1,20 +1,13 @@ -# 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" +LAYERNAME = "networking-layer" # This should only be incremented on significant changes that will # cause compatibility issues with other layers -LAYERVERSION_networking-layer = "1" +LAYERVERSION = "1" + +LAYERDEPENDS = "core" +LAYERDEPENDS += "openembedded-layer" +LAYERDEPENDS += "meta-python" -LAYERDEPENDS_networking-layer = "core" -LAYERDEPENDS_networking-layer += "openembedded-layer" -LAYERDEPENDS_networking-layer += "meta-python" +LAYERSERIES_COMPAT = "sumo" -LAYERSERIES_COMPAT_networking-layer = "sumo" +BBLAYERS_LAYERINDEX_NAME_networking-layer = "networking-layer" diff --git a/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf b/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf index 7089071faf6..af089a7ca11 100644 --- a/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf +++ b/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf @@ -1,19 +1,11 @@ -# 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" +LAYERNAME = "meta-python" # This should only be incremented on significant changes that will # cause compatibility issues with other layers -LAYERVERSION_meta-python = "1" +LAYERVERSION = "1" -LAYERDEPENDS_meta-python = "core openembedded-layer" +LAYERDEPENDS = "core openembedded-layer" -LAYERSERIES_COMPAT_meta-python = "sumo" +LAYERSERIES_COMPAT = "sumo" -LICENSE_PATH += "${LAYERDIR}/licenses" +BBLAYERS_LAYERINDEX_NAME_meta-python = "meta-python" diff --git a/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf b/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf index 6649ee02081..974ebac002f 100644 --- a/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf +++ b/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf @@ -1,22 +1,11 @@ -# 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" +LAYERNAME = "openembedded-layer" # This should only be incremented on significant changes that will # cause compatibility issues with other layers -LAYERVERSION_openembedded-layer = "1" +LAYERVERSION = "1" + +LAYERDEPENDS = "core" -LAYERDEPENDS_openembedded-layer = "core" +LAYERSERIES_COMPAT = "sumo" -LAYERSERIES_COMPAT_openembedded-layer = "sumo" +BBLAYERS_LAYERINDEX_NAME_openembedded-layer = "openembedded-layer"