Skip to content

Commit ac7d1fc

Browse files
fix: local.conf is overwritten on script invocation
Users expect local.conf to remain unchanged after it is created, as this file is intended for their own custom modifications. To support this behavior, the configuration generated from the kas configuration files can be written to auto.conf instead of local.conf. Signed-off-by: Abin Joseph <abinjose@qti.qualcomm.com>
1 parent b2810a5 commit ac7d1fc

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

setup-environment

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ for key, value in env_vars.items():
110110

111111
cleanup() {
112112
[ -f .config.yaml ] && rm .config.yaml
113-
unset MACHINE DISTRO KERNEL CONFIG_FILES SKIP_SETUP
113+
[ -d "$KAS_BUILD_DIR" ] && rm -r "$KAS_BUILD_DIR"
114+
unset MACHINE DISTRO KERNEL CONFIG_FILES SKIP_SETUP KAS_BUILD_DIR
114115
}
115116

116117
init_env() {
@@ -130,6 +131,16 @@ init_env() {
130131
CONFIG_FILES="$CONFIG_FILES:$KERNEL"
131132
fi
132133

134+
# Temporary build directory should be in the same path
135+
# to ensure bblayers.conf relative referencing is consistent
136+
KAS_BUILD_DIR="$(mktemp -d -p "$PWD")" || \
137+
{
138+
cleanup
139+
echo "ERROR: Failure while setting up temporary directory"
140+
return 1
141+
}
142+
export KAS_BUILD_DIR
143+
133144
# invoking kas shell should auto-generate BitBake configuration
134145
# based on the kas local_conf_header
135146
echo "INFO: Setting up bitbake configuration."
@@ -167,6 +178,16 @@ init_env() {
167178
return 1
168179
}
169180

181+
mkdir -p build/conf
182+
# local.conf should be reserved for user specific changes.
183+
# Use auto.conf for auto-generated configuration.
184+
cp "$KAS_BUILD_DIR/conf/local.conf" build/conf/auto.conf
185+
cp "$KAS_BUILD_DIR/conf/bblayers.conf" build/conf/bblayers.conf
186+
187+
# create local.conf to avoid auto-generated file from oe-init-build-env
188+
# existing local.conf file shouldn't be affected
189+
touch build/conf/local.conf
190+
170191
echo "INFO: Cleaning up temporary contents."
171192
cleanup
172193

0 commit comments

Comments
 (0)