Previously, the paths "meta/conf" and "meta-poky/conf" were hardcoded
as invalid paths for templates. However, this is suboptimal for other
distros that are setup similarly to Poky. Instead, add support for a
new variable INVALID_TEMPLATECONFS, which takes a list of invalid
paths.  It is expected that this variable is set in the .templateconf
file together with the default value for TEMPLATECONF, typically at
the same time that TEMPLATECONF is updated to match the new
requirements.

Signed-off-by: Peter Kjellerstedt <[email protected]>
---
 scripts/oe-setup-builddir | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 225919be92..c1148daf4f 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -34,14 +34,19 @@ chmod -st "$BUILDDIR/conf" 2>/dev/null || echo "WARNING: 
unable to chmod $BUILDD
 
 cd "$BUILDDIR" || die "Failed to change directory to $BUILDDIR!"
 
-if [ -z "$TEMPLATECONF" ] && [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
-    TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg")
-    # The following two are no longer valid; unsetting them will automatically 
get them replaced
-    # with correct ones.
-    if [ "$TEMPLATECONF" = meta/conf ] || [ "$TEMPLATECONF" = meta-poky/conf 
]; then
-        unset TEMPLATECONF
-        rm "$BUILDDIR/conf/templateconf.cfg"
-    fi
+TEMPLATECONF_CFG="$BUILDDIR/conf/templateconf.cfg"
+if [ -z "$TEMPLATECONF" ] && [ -f "$TEMPLATECONF_CFG" ]; then
+    TEMPLATECONF=$(cat "$TEMPLATECONF_CFG")
+    # Unset TEMPLATECONF if it is set to a known invalid value to have it
+    # automatically replaced with a correct one.
+    for dir in $INVALID_TEMPLATECONFS; do
+        if [ "$TEMPLATECONF" = "$dir" ]; then
+           echo "WARNING: Removing $TEMPLATECONF_CFG as it contained the 
invalid value '$TEMPLATECONF'"
+           unset TEMPLATECONF
+           rm "$TEMPLATECONF_CFG"
+          break;
+        fi
+    done
 fi
 
 . "$OEROOT/.templateconf"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#170977): 
https://lists.openembedded.org/g/openembedded-core/message/170977
Mute This Topic: https://lists.openembedded.org/mt/93847437/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to