init.sh: Refactor image version handling in the build script

- Introduced DEFAULT_IMAGE_VERSION and COMPATIBLE_IMAGE_VERSIONS for
  flexible version management.
- Mapped multiple compatible versions to a single configuration block
  to avoid duplication.
- Ensured IMAGE_VERSION adjusts dynamically based on user input,
  with validation against COMPATIBLE_IMAGE_VERSIONS.
- Streamlined environment variable naming and organized source
  layer configuration.
- Added conditional execution for Python2 layer fetching based on the
  presence of PYTHON2_SRCREV.

This commit improves the script's maintainability and robustness by clarifying version management and optimizing configuration handling.
This commit is contained in:
2024-05-12 17:44:48 +02:00
parent dc119f2cab
commit bd4394002a
2 changed files with 59 additions and 36 deletions

View File

@@ -345,6 +345,9 @@ function create_local_config () {
# add layer entries into bblayer.conf
set_file_entry $BBLAYER_CONF_FILE "generated" '# auto generated entries by init script'
if [[ -z "$PYTHON2_SRCREV" ]]; then
PYTHON2_LAYER_NAME=""
fi
LAYER_LIST=" $TUXBOX_LAYER_NAME $META_MACHINE_LAYER $OE_LAYER_NAME/meta-oe $OE_LAYER_NAME/meta-networking $PYTHON2_LAYER_NAME $QT5_LAYER_NAME "
for LL in $LAYER_LIST ; do
if set_file_entry $BBLAYER_CONF_FILE $LL 'BBLAYERS += " '$BUILD_ROOT_DIR'/'$LL' "' == 1;then