Skip to contentSkip to conversation

Allow layers to be added relative to topdir.

PATCH In review Jeremy Puhlman 2 participants 3 messages Oct 10, 2017 – Oct 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow layers to be added relative to topdir.

From: "Jeremy A. Puhlman" <[email protected]>

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.

---
 lib/bblayers/action.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bblayers/action.py +3 -1
index b1326e5..4dc6622 100644
@@ -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):
Signature · 1 line
2.6.2
#1 lore raw

I see no need for this patch:

TOPDIR := '${@os.path.dirname(os.path.dirname(FILE))}' BBPATH = '${TOPDIR}'
BBFILES = ''

BBLAYERS = '\
    ${TOPDIR}/poky/meta-yocto-bsp \
    ${TOPDIR}/poky/meta-yocto \
    ${TOPDIR}/poky/meta \
    ${TOPDIR}/meta-oe/meta-oe \

'

Quoted 42 lines · Jeremy Puhlman

From: "Jeremy A. Puhlman" <[email protected]>

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.

---
 lib/bblayers/action.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bblayers/action.py +3 -1
index b1326e5..4dc6622 100644
@@ -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

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 11 lines · Christopher Larson

I see no need for this patch:

TOPDIR := '${@os.path.dirname(os.path.dirname(FILE))}' BBPATH = '${TOPDIR}'
BBFILES = ''
BBLAYERS = '\
    ${TOPDIR}/poky/meta-yocto-bsp \
    ${TOPDIR}/poky/meta-yocto \
    ${TOPDIR}/poky/meta \
    ${TOPDIR}/meta-oe/meta-oe \
'

Yes. You can manually modify the file. However if you use bitbake-layers layerindex-fetch or bitbake layer-add, it is always absolute. OTOH, you could make the same argument for not needing "bitbake-layers add-layers "since you can also manually modify the file.

Quoted 59 lines · On Tue, Oct 10, 2017 at 2:47 PM, Jeremy Puhlman <[email protected]…

From: "Jeremy A. Puhlman" <[email protected] <mailto:[email protected]>>

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.

<mailto:[email protected]>>
---
 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

--
_______________________________________________
bitbake-devel mailing list
[email protected]
<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/bitbake-devel
<http://lists.openembedded.org/mailman/listinfo/bitbake-devel>

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
Signature · 2 lines
Jeremy A. Puhlman
[email protected]