[bitbake-devel] [PATCH] Allow layers to be added relative to topdir.

Jeremy Puhlman jpuhlman at mvista.com
Tue Oct 10 21:47:17 UTC 2017


From: "Jeremy A. Puhlman" <jpuhlman at mvista.com>

Use case:
Some users place their projects and their layers under source control.
If absolute paths are used for the layers, the bblayers file is invalid
when checked out on another system. If the layers are checked in
relative to the project, then the project can be used anywhere.

If LAYERS_RELATIVE is set in the bblayers.conf file, each layer is added
relative to TOPDIR.

Signed-off-by: Jeremy Puhlman <jpuhlman at mvista.com>
---
 lib/bblayers/action.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py
index b1326e5..4dc6622 100644
--- a/lib/bblayers/action.py
+++ b/lib/bblayers/action.py
@@ -38,7 +38,9 @@ class ActionPlugin(LayerPlugin):
         tempdir = tempfile.mkdtemp()
         backup = tempdir + "/bblayers.conf.bak"
         shutil.copy2(bblayers_conf, backup)
-
+        if self.tinfoil.config_data.getVar('LAYERS_RELATIVE'):
+            topdir = self.tinfoil.config_data.getVar('TOPDIR')
+            layerdir = os.path.join("${TOPDIR}", os.path.relpath(layerdir,topdir))
         try:
             notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdir, None)
             if not (args.force or notadded):
-- 
2.6.2




More information about the bitbake-devel mailing list