Date
1 - 3 of 3
[PATCH] change the default behavior of bitbake-layers and oe-setup-builddir to rel paths
Thomas Roos
From: Thomas Roos <throos@...>
This patch will use the $TOPDIR variable to create layer entries in bblayers.conf.
Instead of an absolute path this will create an relative path to $TOPDIR, which will
allow to move the bblayers.conf to different paths without modification of it.
Signed-off-by: Thomas Roos <throos@...>
---
bitbake/lib/bblayers/action.py | 4 +++-
scripts/oe-setup-builddir | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index 0d7fd6edd1..bd13e15a2f 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -26,7 +26,7 @@ def plugin_init(plugins):
class ActionPlugin(LayerPlugin):
def do_add_layer(self, args):
"""Add one or more layers to bblayers.conf."""
- layerdirs = [os.path.abspath(ldir) for ldir in args.layerdir]
+ layerdirs = [os.path.relpath(ldir, findTopdir()) for ldir in args.layerdir]
for layerdir in layerdirs:
if not os.path.exists(layerdir):
@@ -38,6 +38,8 @@ class ActionPlugin(LayerPlugin):
sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir)
return 1
+ layerdirs = [os.path.join('${TOPDIR}', ldir) for ldir in args.layerdir]
+
bblayers_conf = os.path.join(findTopdir(),'conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
sys.stderr.write("Unable to find bblayers.conf\n")
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 89ae30f609..65a77b76fd 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -92,8 +92,9 @@ EOM
# bitbake without the init script after the first run.
# ##COREBASE## is deprecated as its meaning was inconsistent, but continue
# to replace it for compatibility.
- sed -e "s|##OEROOT##|$OEROOT|g" \
- -e "s|##COREBASE##|$OEROOT|g" \
+ LAYERPATH='${TOPDIR}'/$(realpath --relative-to=$BUILDDIR $OEROOT)
+ sed -e "s|##OEROOT##|$LAYERPATH|"g \
+ -e "s|##COREBASE##|$LAYERPATH|"g \
"$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
SHOWYPDOC=yes
fi
--
2.34.1
Amazon Web Services EMEA SARL
38 avenue John F. Kennedy, L-1855 Luxembourg
Sitz der Gesellschaft: L-1855 Luxemburg
eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284
Amazon Web Services EMEA SARL, Niederlassung Deutschland
Marcel-Breuer-Str. 12, D-80807 Muenchen
Sitz der Zweigniederlassung: Muenchen
eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094
This patch will use the $TOPDIR variable to create layer entries in bblayers.conf.
Instead of an absolute path this will create an relative path to $TOPDIR, which will
allow to move the bblayers.conf to different paths without modification of it.
Signed-off-by: Thomas Roos <throos@...>
---
bitbake/lib/bblayers/action.py | 4 +++-
scripts/oe-setup-builddir | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index 0d7fd6edd1..bd13e15a2f 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -26,7 +26,7 @@ def plugin_init(plugins):
class ActionPlugin(LayerPlugin):
def do_add_layer(self, args):
"""Add one or more layers to bblayers.conf."""
- layerdirs = [os.path.abspath(ldir) for ldir in args.layerdir]
+ layerdirs = [os.path.relpath(ldir, findTopdir()) for ldir in args.layerdir]
for layerdir in layerdirs:
if not os.path.exists(layerdir):
@@ -38,6 +38,8 @@ class ActionPlugin(LayerPlugin):
sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir)
return 1
+ layerdirs = [os.path.join('${TOPDIR}', ldir) for ldir in args.layerdir]
+
bblayers_conf = os.path.join(findTopdir(),'conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
sys.stderr.write("Unable to find bblayers.conf\n")
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 89ae30f609..65a77b76fd 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -92,8 +92,9 @@ EOM
# bitbake without the init script after the first run.
# ##COREBASE## is deprecated as its meaning was inconsistent, but continue
# to replace it for compatibility.
- sed -e "s|##OEROOT##|$OEROOT|g" \
- -e "s|##COREBASE##|$OEROOT|g" \
+ LAYERPATH='${TOPDIR}'/$(realpath --relative-to=$BUILDDIR $OEROOT)
+ sed -e "s|##OEROOT##|$LAYERPATH|"g \
+ -e "s|##COREBASE##|$LAYERPATH|"g \
"$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
SHOWYPDOC=yes
fi
--
2.34.1
Amazon Web Services EMEA SARL
38 avenue John F. Kennedy, L-1855 Luxembourg
Sitz der Gesellschaft: L-1855 Luxemburg
eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284
Amazon Web Services EMEA SARL, Niederlassung Deutschland
Marcel-Breuer-Str. 12, D-80807 Muenchen
Sitz der Zweigniederlassung: Muenchen
eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094
Alexander Kanavin
Build directories are not meant to be relocatable, and will likely break in all kinds of ways if you try. Can you explain the use case?
Alex
From: Thomas Roos <throos@...>
This patch will use the $TOPDIR variable to create layer entries in bblayers.conf.
Instead of an absolute path this will create an relative path to $TOPDIR, which will
allow to move the bblayers.conf to different paths without modification of it.
Signed-off-by: Thomas Roos <throos@...>
---
bitbake/lib/bblayers/action.py | 4 +++-
scripts/oe-setup-builddir | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index 0d7fd6edd1..bd13e15a2f 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -26,7 +26,7 @@ def plugin_init(plugins):
class ActionPlugin(LayerPlugin):
def do_add_layer(self, args):
"""Add one or more layers to bblayers.conf."""
- layerdirs = [os.path.abspath(ldir) for ldir in args.layerdir]
+ layerdirs = [os.path.relpath(ldir, findTopdir()) for ldir in args.layerdir]
for layerdir in layerdirs:
if not os.path.exists(layerdir):
@@ -38,6 +38,8 @@ class ActionPlugin(LayerPlugin):
sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir)
return 1
+ layerdirs = [os.path.join('${TOPDIR}', ldir) for ldir in args.layerdir]
+
bblayers_conf = os.path.join(findTopdir(),'conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
sys.stderr.write("Unable to find bblayers.conf\n")
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 89ae30f609..65a77b76fd 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -92,8 +92,9 @@ EOM
# bitbake without the init script after the first run.
# ##COREBASE## is deprecated as its meaning was inconsistent, but continue
# to replace it for compatibility.
- sed -e "s|##OEROOT##|$OEROOT|g" \
- -e "s|##COREBASE##|$OEROOT|g" \
+ LAYERPATH='${TOPDIR}'/$(realpath --relative-to=$BUILDDIR $OEROOT)
+ sed -e "s|##OEROOT##|$LAYERPATH|"g \
+ -e "s|##COREBASE##|$LAYERPATH|"g \
"$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
SHOWYPDOC=yes
fi
--
2.34.1
Amazon Web Services EMEA SARL
38 avenue John F. Kennedy, L-1855 Luxembourg
Sitz der Gesellschaft: L-1855 Luxemburg
eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284
Amazon Web Services EMEA SARL, Niederlassung Deutschland
Marcel-Breuer-Str. 12, D-80807 Muenchen
Sitz der Zweigniederlassung: Muenchen
eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094
Alexander Kanavin
Also, this will break build templates, as they can’t contain paths relative to build dirs.
Alex
From: Thomas Roos <throos@...>
This patch will use the $TOPDIR variable to create layer entries in bblayers.conf.
Instead of an absolute path this will create an relative path to $TOPDIR, which will
allow to move the bblayers.conf to different paths without modification of it.
Signed-off-by: Thomas Roos <throos@...>
---
bitbake/lib/bblayers/action.py | 4 +++-
scripts/oe-setup-builddir | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bblayers/action.py b/bitbake/lib/bblayers/action.py
index 0d7fd6edd1..bd13e15a2f 100644
--- a/bitbake/lib/bblayers/action.py
+++ b/bitbake/lib/bblayers/action.py
@@ -26,7 +26,7 @@ def plugin_init(plugins):
class ActionPlugin(LayerPlugin):
def do_add_layer(self, args):
"""Add one or more layers to bblayers.conf."""
- layerdirs = [os.path.abspath(ldir) for ldir in args.layerdir]
+ layerdirs = [os.path.relpath(ldir, findTopdir()) for ldir in args.layerdir]
for layerdir in layerdirs:
if not os.path.exists(layerdir):
@@ -38,6 +38,8 @@ class ActionPlugin(LayerPlugin):
sys.stderr.write("Specified layer directory %s doesn't contain a conf/layer.conf file\n" % layerdir)
return 1
+ layerdirs = [os.path.join('${TOPDIR}', ldir) for ldir in args.layerdir]
+
bblayers_conf = os.path.join(findTopdir(),'conf', 'bblayers.conf')
if not os.path.exists(bblayers_conf):
sys.stderr.write("Unable to find bblayers.conf\n")
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 89ae30f609..65a77b76fd 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -92,8 +92,9 @@ EOM
# bitbake without the init script after the first run.
# ##COREBASE## is deprecated as its meaning was inconsistent, but continue
# to replace it for compatibility.
- sed -e "s|##OEROOT##|$OEROOT|g" \
- -e "s|##COREBASE##|$OEROOT|g" \
+ LAYERPATH='${TOPDIR}'/$(realpath --relative-to=$BUILDDIR $OEROOT)
+ sed -e "s|##OEROOT##|$LAYERPATH|"g \
+ -e "s|##COREBASE##|$LAYERPATH|"g \
"$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
SHOWYPDOC=yes
fi
--
2.34.1
Amazon Web Services EMEA SARL
38 avenue John F. Kennedy, L-1855 Luxembourg
Sitz der Gesellschaft: L-1855 Luxemburg
eingetragen im Luxemburgischen Handelsregister unter R.C.S. B186284
Amazon Web Services EMEA SARL, Niederlassung Deutschland
Marcel-Breuer-Str. 12, D-80807 Muenchen
Sitz der Zweigniederlassung: Muenchen
eingetragen im Handelsregister des Amtsgerichts Muenchen unter HRB 242240, USt-ID DE317013094