summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-01 17:10:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-08 11:15:47 +0000
commitd0ea143156f2808ab684b3d73fec039d2a62f229 (patch)
tree96b32157efd3c604be9fc0c2b872a17f67530832 /bitbake/lib
parent42e8b2682f56f450c1258956213198052d6bcb96 (diff)
downloadpoky-d0ea143156f2808ab684b3d73fec039d2a62f229.tar.gz
bitbake: cookerdata: Ensure layers use LAYERSERIES_COMPAT fairly
Some layers think they're going to be 'clever' and copy the values from another layer, e.g. using ${LAYERSERIES_COMPAT_core}. The whole point of this mechanism is to make it clear which releases a layer supports and show when a layer master branch is bitrotting and is unmaintained. Therefore add some code to avoid people doing this. I wish we didn't have to but... (Bitbake rev: 6709aedccbb2e7ddbb1b2e7e4893481a7b536436) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cookerdata.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 28cb59d83a..59ecbec69d 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -383,6 +383,8 @@ class CookerDataBuilder(object):
383 parselog.critical("Please check BBLAYERS in %s" % (layerconf)) 383 parselog.critical("Please check BBLAYERS in %s" % (layerconf))
384 raise bb.BBHandledException() 384 raise bb.BBHandledException()
385 385
386 layerseries = None
387 compat_entries = {}
386 for layer in layers: 388 for layer in layers:
387 parselog.debug2("Adding layer %s", layer) 389 parselog.debug2("Adding layer %s", layer)
388 if 'HOME' in approved and '~' in layer: 390 if 'HOME' in approved and '~' in layer:
@@ -395,8 +397,27 @@ class CookerDataBuilder(object):
395 data.expandVarref('LAYERDIR') 397 data.expandVarref('LAYERDIR')
396 data.expandVarref('LAYERDIR_RE') 398 data.expandVarref('LAYERDIR_RE')
397 399
400 # Sadly we can't have nice things.
401 # Some layers think they're going to be 'clever' and copy the values from
402 # another layer, e.g. using ${LAYERSERIES_COMPAT_core}. The whole point of
403 # this mechanism is to make it clear which releases a layer supports and
404 # show when a layer master branch is bitrotting and is unmaintained.
405 # We therefore avoid people doing this here.
406 collections = (data.getVar('BBFILE_COLLECTIONS') or "").split()
407 for c in collections:
408 compat_entry = data.getVar("LAYERSERIES_COMPAT_%s" % c)
409 if compat_entry:
410 compat_entries[c] = set(compat_entry.split())
411 data.delVar("LAYERSERIES_COMPAT_%s" % c)
412 if not layerseries:
413 layerseries = set((data.getVar("LAYERSERIES_CORENAMES") or "").split())
414 if layerseries:
415 data.delVar("LAYERSERIES_CORENAMES")
416
398 data.delVar('LAYERDIR_RE') 417 data.delVar('LAYERDIR_RE')
399 data.delVar('LAYERDIR') 418 data.delVar('LAYERDIR')
419 for c in compat_entries:
420 data.setVar("LAYERSERIES_COMPAT_%s" % c, compat_entries[c])
400 421
401 bbfiles_dynamic = (data.getVar('BBFILES_DYNAMIC') or "").split() 422 bbfiles_dynamic = (data.getVar('BBFILES_DYNAMIC') or "").split()
402 collections = (data.getVar('BBFILE_COLLECTIONS') or "").split() 423 collections = (data.getVar('BBFILE_COLLECTIONS') or "").split()
@@ -415,13 +436,15 @@ class CookerDataBuilder(object):
415 if invalid: 436 if invalid:
416 bb.fatal("BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not:\n %s" % "\n ".join(invalid)) 437 bb.fatal("BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not:\n %s" % "\n ".join(invalid))
417 438
418 layerseries = set((data.getVar("LAYERSERIES_CORENAMES") or "").split())
419 collections_tmp = collections[:] 439 collections_tmp = collections[:]
420 for c in collections: 440 for c in collections:
421 collections_tmp.remove(c) 441 collections_tmp.remove(c)
422 if c in collections_tmp: 442 if c in collections_tmp:
423 bb.fatal("Found duplicated BBFILE_COLLECTIONS '%s', check bblayers.conf or layer.conf to fix it." % c) 443 bb.fatal("Found duplicated BBFILE_COLLECTIONS '%s', check bblayers.conf or layer.conf to fix it." % c)
424 compat = set((data.getVar("LAYERSERIES_COMPAT_%s" % c) or "").split()) 444
445 compat = set()
446 if c in compat_entries:
447 compat = compat_entries[c]
425 if compat and not layerseries: 448 if compat and not layerseries:
426 bb.fatal("No core layer found to work with layer '%s'. Missing entry in bblayers.conf?" % c) 449 bb.fatal("No core layer found to work with layer '%s'. Missing entry in bblayers.conf?" % c)
427 if compat and not (compat & layerseries): 450 if compat and not (compat & layerseries):
@@ -430,6 +453,8 @@ class CookerDataBuilder(object):
430 elif not compat and not data.getVar("BB_WORKERCONTEXT"): 453 elif not compat and not data.getVar("BB_WORKERCONTEXT"):
431 bb.warn("Layer %s should set LAYERSERIES_COMPAT_%s in its conf/layer.conf file to list the core layer names it is compatible with." % (c, c)) 454 bb.warn("Layer %s should set LAYERSERIES_COMPAT_%s in its conf/layer.conf file to list the core layer names it is compatible with." % (c, c))
432 455
456 data.setVar("LAYERSERIES_CORENAMES", " ".join(layerseries))
457
433 if not data.getVar("BBPATH"): 458 if not data.getVar("BBPATH"):
434 msg = "The BBPATH variable is not set" 459 msg = "The BBPATH variable is not set"
435 if not layerconf: 460 if not layerconf: