Message ID | 20230324145958.278236-1-throos@amazon.de |
---|---|
State | New |
Headers | show |
Series | change the default behavior of bitbake-layers and oe-setup-builddir to rel paths | expand |
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 On Fri 24. Mar 2023 at 16.00, Thomas Roos via lists.openembedded.org <throos=amazon.de@lists.openembedded.org> wrote: > From: Thomas Roos <throos@amazon.de> > > 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@amazon.de> > --- > 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 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#179040): > https://lists.openembedded.org/g/openembedded-core/message/179040 > Mute This Topic: https://lists.openembedded.org/mt/97825329/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Also, this will break build templates, as they can’t contain paths relative to build dirs. Alex On Fri 24. Mar 2023 at 16.00, Thomas Roos via lists.openembedded.org <throos=amazon.de@lists.openembedded.org> wrote: > From: Thomas Roos <throos@amazon.de> > > 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@amazon.de> > --- > 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 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#179040): > https://lists.openembedded.org/g/openembedded-core/message/179040 > Mute This Topic: https://lists.openembedded.org/mt/97825329/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
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