Skip to contentSkip to conversation

scripts/oe-setup-builddir: Add option to force TEMPLATECONF on existing configs

PATCH In review Talel BELHAJSALEM 3 participants 4 messages Sep 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/oe-setup-builddir: Add option to force TEMPLATECONF on existing configs

Since we cannot force overriding of the config samples created based on TEMPALTECONF variable, and that's because it may remove any custom configuration done on local.conf or bblayers.conf, and that's also because TEMPALTECONF is, usually, used to create new builds.

But, when the developer wants to recreate the build after changing the sample files, the developer must remove the files manually.

I think introducing another variable FORCE_TEMPLATECONF can help when override is wanted.

---
 scripts/oe-setup-builddir | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/oe-setup-builddir +3 -3
index 678aeac4be..3bd3df0930 100755
@@ -64,7 +64,7 @@ unset SHOWYPDOC
 if [ -z "$OECORELOCALCONF" ]; then
     OECORELOCALCONF="$OEROOT/meta/conf/templates/default/local.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/local.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/local.conf file. This configuration file has therefore been
 created for you from $OECORELOCALCONF
@@ -79,7 +79,7 @@ fi
 if [ -z "$OECORELAYERCONF" ]; then
     OECORELAYERCONF="$OEROOT/meta/conf/templates/default/bblayers.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/bblayers.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/bblayers.conf file. This configuration file has therefore been
 created for you from $OECORELAYERCONF
@@ -101,7 +101,7 @@ fi
 if [ -z "$OECORENOTESCONF" ]; then
     OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt"
 fi
-if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ]; then
+if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     [ ! -r "$OECORENOTESCONF" ] || cp "$OECORENOTESCONF" "$BUILDDIR/conf/conf-notes.txt"
 fi
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 37 lines · BELHADJ SALEM Talel

Since we cannot force overriding of the config samples created based on TEMPALTECONF variable, and that's because it may remove any custom configuration done on local.conf or bblayers.conf, and that's also because TEMPALTECONF is, usually, used to create new builds.

But, when the developer wants to recreate the build after changing the sample files, the developer must remove the files manually.

I think introducing another variable FORCE_TEMPLATECONF can help when override is wanted.

---
 scripts/oe-setup-builddir | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/oe-setup-builddir +2 -2
index 678aeac4be..3bd3df0930 100755
@@ -64,7 +64,7 @@ unset SHOWYPDOC
 if [ -z "$OECORELOCALCONF" ]; then
     OECORELOCALCONF="$OEROOT/meta/conf/templates/default/local.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/local.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/local.conf file. This configuration file has therefore been
 created for you from $OECORELOCALCONF
@@ -79,7 +79,7 @@ fi
 if [ -z "$OECORELAYERCONF" ]; then
     OECORELAYERCONF="$OEROOT/meta/conf/templates/default/bblayers.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/bblayers.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/bblayers.conf file. This configuration file has therefore been
 created for you from $OECORELAYERCONF

scripts/oe-setup-builddir fi · line 106

Quoted 7 lines
scripts/oe-setup-builddir +1 -1
@@ -101,7 +101,7 @@ fi
 if [ -z "$OECORENOTESCONF" ]; then
     OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt"
 fi
-if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ]; then
+if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     [ ! -r "$OECORENOTESCONF" ] || cp "$OECORENOTESCONF" "$BUILDDIR/conf/conf-notes.txt"
 fi

Surely if you want to replace the files you'd just delete them? Adding an obscure variable to do that isn't discoverable for most people or easier?

OE-Core patches need to go to the openembedded-core list too.

Cheers,

Richard

#2 lore raw
In reply to Talel BELHAJSALEM

But is it really that difficult to remove the files? Adding variables needs documentation, and tests, and adds complexity, and this one in particular can be easily avoided.

Alex

Quoted 58 lines · BELHADJ SALEM Talel

Since we cannot force overriding of the config samples created based on TEMPALTECONF variable, and that's because it may remove any custom configuration done on local.conf or bblayers.conf, and that's also because TEMPALTECONF is, usually, used to create new builds.

But, when the developer wants to recreate the build after changing the sample files, the developer must remove the files manually.

I think introducing another variable FORCE_TEMPLATECONF can help when override is wanted.

---
 scripts/oe-setup-builddir | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/oe-setup-builddir +3 -4
index 678aeac4be..3bd3df0930 100755
@@ -64,7 +64,7 @@ unset SHOWYPDOC
 if [ -z "$OECORELOCALCONF" ]; then
     OECORELOCALCONF="$OEROOT/meta/conf/templates/default/local.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/local.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/local.conf file. This configuration file has therefore been
 created for you from $OECORELOCALCONF
@@ -79,7 +79,7 @@ fi
 if [ -z "$OECORELAYERCONF" ]; then
     OECORELAYERCONF="$OEROOT/meta/conf/templates/default/bblayers.conf.sample"
 fi
-if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/bblayers.conf" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     cat <<EOM
 You had no conf/bblayers.conf file. This configuration file has therefore been
 created for you from $OECORELAYERCONF
@@ -101,7 +101,7 @@ fi
 if [ -z "$OECORENOTESCONF" ]; then
     OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt"
 fi
-if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ]; then
+if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ] || [ -n "$FORCE_TEMPLATECONF" ]; then
     [ ! -r "$OECORENOTESCONF" ] || cp "$OECORENOTESCONF" "$BUILDDIR/conf/conf-notes.txt"
 fi
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13162): https://lists.yoctoproject.org/g/poky/message/13162
Mute This Topic: https://lists.yoctoproject.org/mt/101554603/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

I, totally agree with you, I did thought about adding the variable to the documentation page, but I forgot that developers can easily forget about it since they do not dig into the documentation well, but if you forget to set the variable, the script will behave the same way, hince [ -n ] option.

So, only who knows about the variable will use it correctly and explicitly. This is maybe the last argument that I have for introducing this new variable.

What do you think?

Kind regards
Talel

Quoted 82 lines · Alexander Kanavin

But is it really that difficult to remove the files? Adding variables needs documentation, and tests, and adds complexity, and this one in particular can be easily avoided.

Alex

Quoted 2 lines · BELHADJ SALEM Talel

Since we cannot force overriding of the config samples created based on

TEMPALTECONF variable,

Quoted 1 line

and that's because it may remove any custom configuration done on

local.conf or bblayers.conf,

Quoted 1 line

and that's also because TEMPALTECONF is, usually, used to create new

builds.

Quoted 2 lines

But, when the developer wants to recreate the build after changing the

sample files, the developer

Quoted 3 lines

must remove the files manually.

I think introducing another variable FORCE_TEMPLATECONF can help when

override is wanted.

scripts/oe-setup-builddir unset SHOWYPDOC · line 65

Quoted 13 lines
---
 scripts/oe-setup-builddir | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/oe-setup-builddir +0 -0
index 678aeac4be..3bd3df0930 100755
@@ -64,7 +64,7 @@ unset SHOWYPDOC
 if [ -z "$OECORELOCALCONF" ]; then
 

OECORELOCALCONF="$OEROOT/meta/conf/templates/default/local.conf.sample"

scripts/oe-setup-builddir unset SHOWYPDOC

Quoted 3 lines
scripts/oe-setup-builddir +1 -1
 fi
-if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/local.conf" ] || [ -n "$FORCE_TEMPLATECONF"

]; then

scripts/oe-setup-builddir unset SHOWYPDOC · line 69

Quoted 2 lines
scripts/oe-setup-builddir +0 -0
     cat <<EOM
 You had no conf/local.conf file. This configuration file has therefore

been

scripts/oe-setup-builddir fi · line 80

Quoted 4 lines
scripts/oe-setup-builddir +0 -0
 created for you from $OECORELOCALCONF
@@ -79,7 +79,7 @@ fi
 if [ -z "$OECORELAYERCONF" ]; then
 

OECORELAYERCONF="$OEROOT/meta/conf/templates/default/bblayers.conf.sample"

scripts/oe-setup-builddir fi

Quoted 3 lines
scripts/oe-setup-builddir +1 -1
 fi
-if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
+if [ ! -r "$BUILDDIR/conf/bblayers.conf" ] || [ -n

"$FORCE_TEMPLATECONF" ]; then

scripts/oe-setup-builddir fi · line 84

Quoted 2 lines
scripts/oe-setup-builddir +0 -0
     cat <<EOM
 You had no conf/bblayers.conf file. This configuration file has

therefore been

scripts/oe-setup-builddir fi · line 104

Quoted 7 lines
scripts/oe-setup-builddir +1 -1
 created for you from $OECORELAYERCONF
@@ -101,7 +101,7 @@ fi
 if [ -z "$OECORENOTESCONF" ]; then
     OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt"
 fi
-if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ]; then
+if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ] || [ -n

"$FORCE_TEMPLATECONF" ]; then

scripts/oe-setup-builddir fi · line 105

Quoted 1 line
scripts/oe-setup-builddir +0 -0
     [ ! -r "$OECORENOTESCONF" ] || cp "$OECORENOTESCONF"

"$BUILDDIR/conf/conf-notes.txt"

Quoted 9 lines
scripts/oe-setup-builddir +0 -1
 fi
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13162):

https://lists.yoctoproject.org/g/poky/message/13162

Quoted 3 lines

Mute This Topic: https://lists.yoctoproject.org/mt/101554603/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-