Skip to contentSkip to conversation

oe-setup-builddir: Keep templateconf.cfg relative if $TEMPLATECONF is

PATCH New Peter Kjellerstedt 1 participant 2 messages Sep 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 oe-setup-builddir: Keep templateconf.cfg relative if $TEMPLATECONF is

Before commit 7b96dc80 (scripts/oe-setup-builddir: write to conf/templateconf.cfg after the build is set up), the path written to templateconf.cfg was relative if $TEMPLATECONF was relative, but afterwards it became absolute.

Restore the original behavior of saving the relative path to templateconf.cfg.

---

These two patches are intended to be applied on top of the three I sent earlier today.

And in case anyone wonders, yes, I occasionally move entire build trees (typically from my SSD to my HDD) so I would prefer the path in templateconf.cfg to remain relative.

 scripts/oe-setup-builddir | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/oe-setup-builddir +5 -2
index b06880c9cb..201cea30bf 100755
@@ -46,7 +46,10 @@ fi
 
 . "$OEROOT/.templateconf"
 
-# 
+# Keep the original TEMPLATECONF before possibly prefixing it with $OEROOT below.
+ORG_TEMPLATECONF=$TEMPLATECONF
+
+#
 # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
 #
 if [ -n "$TEMPLATECONF" ]; then
@@ -131,5 +134,5 @@ fi
 unset OECORENOTESCONF
 
 if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
-    echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
+    echo "$ORG_TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
 fi
#1 lore raw

PATCH 2/2 oe-setup-builddir: Always update templateconf.cfg

The intent of the templateconf.cfg file is to cache the value of $TEMPLATECONF. To do this, it needs to be updated in case TEMPLATECONF is manually specified.

Before, the following commands:

TEMPLATECONF=foo . oe-init-build-env
TEMPLATECONF=bar . oe-init-build-env
. oe-init-build-env

would cause the templates in foo to be used for the last source of oe-init-build-env, while afterwards, bar is used as expected.

---

Of course, re-sourcing oe-init-build-env with different values for TEMPLATECONF only has a real effect if any of the generated files have been removed, but that is a different story.

 scripts/oe-setup-builddir | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
scripts/oe-setup-builddir +1 -3
index 201cea30bf..72113c37b8 100755
@@ -133,6 +133,4 @@ fi
 [ ! -r "$OECORENOTESCONF" ] || cat "$OECORENOTESCONF"
 unset OECORENOTESCONF
 
-if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
-    echo "$ORG_TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
-fi
+echo "$ORG_TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"