From cb99adc240c887b3ae6da4e342ede11469631ff9 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Fri, 29 Dec 2023 17:50:32 +0100 Subject: [PATCH] Bugfix USERPATCHES not working properly --- lib/functions/cli/entrypoint.sh | 3 ++- lib/functions/general/extensions.sh | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/functions/cli/entrypoint.sh b/lib/functions/cli/entrypoint.sh index a1ca193835c7..0ad7182292aa 100644 --- a/lib/functions/cli/entrypoint.sh +++ b/lib/functions/cli/entrypoint.sh @@ -84,7 +84,8 @@ function cli_entrypoint() { # Also form here, UUID will be generated, output created, logging enabled, etc. # Init basic dirs. - declare -g -r DEST="${SRC}/output" USERPATCHES_PATH="${SRC}"/userpatches # DEST is the main output dir, and USERPATCHES_PATH is the userpatches dir. read-only. + declare -g -r DEST="${SRC}/output" # DEST is the main output dir + [[ -z ${USERPATCHES_PATH} ]] && USERPATCHES_PATH="${SRC}"/userpatches # USERPATCHES_PATH is the userpatches dir. read-only. mkdir -p "${DEST}" "${USERPATCHES_PATH}" # Create output and userpatches directory if not already there display_alert "Output directory created! DEST:" "${DEST}" "debug" diff --git a/lib/functions/general/extensions.sh b/lib/functions/general/extensions.sh index da28c135dcdd..23cff83fde11 100644 --- a/lib/functions/general/extensions.sh +++ b/lib/functions/general/extensions.sh @@ -432,7 +432,7 @@ function write_hook_point_metadata() { # can be called by board, family, config or user to make sure an extension is included. # single argument is the extension name. -# will look for it in /userpatches/extensions first. +# will look for it in ${USERPATCHES_PATH}/extensions first. # if not found there will look in /extensions # if not found will exit 17 function enable_extension() { @@ -442,9 +442,9 @@ function enable_extension() { if [[ "${SHOW_DEBUG}" == "yes" ]]; then stacktrace="${ENABLE_EXTENSION_TRACE_HINT}$(get_extension_hook_stracktrace "${BASH_SOURCE[*]}" "${BASH_LINENO[*]}")" - display_alert "Enabling extension" "${extension_name} :: added by ${stacktrace}" "debug" + display_alert "Enabling extension $USERPATCHES_PATH sd" "${extension_name} :: added by ${stacktrace}" "debug" else - [[ "${enable_extension_quiet:-no}" != "yes" ]] && display_alert "Enabling extension" "${extension_name}" "" + [[ "${enable_extension_quiet:-no}" != "yes" ]] && display_alert "Enabling extension ddf $USERPATCHES_PATH" "${extension_name}" "" fi # first a check, has the extension manager already initialized? then it is too late to enable_extension(). bail. @@ -464,7 +464,7 @@ function enable_extension() { enable_extension_recurse_counter=$((enable_extension_recurse_counter + 1)) # there are many opportunities here. too many, actually. let userpatches override just some functions, etc. - for extension_base_path in "${SRC}/userpatches/extensions" "${SRC}/extensions"; do + for extension_base_path in "${USERPATCHES_PATH}/extensions" "${SRC}/extensions"; do extension_dir="${extension_base_path}/${extension_name}" extension_file_in_dir="${extension_dir}/${extension_name}.sh" extension_floating_file="${extension_base_path}/${extension_name}.sh" @@ -526,7 +526,7 @@ function enable_extension() { # The reasoning is simple: during Dockerfile build, we wanna have all the hostdeps defined, even if we're not gonna use them. function enable_all_extensions_builtin_and_user() { declare -a extension_list=() - declare -a ext_dirs=("${SRC}/extensions" "${SRC}/userpatches/extensions") + declare -a ext_dirs=("${SRC}/extensions" "${USERPATCHES_PATH}/extensions") declare -a ignore_extensions=("sample-extension") # Extensions are files of the format /extension_name.sh or /extension_name/extension_name.sh