kas-container: track repo dir when using menu cmd
When using the kas menu command, we need to track the repository location outside of the kas container as well. This is required to prepare the environment for a later kas-container build, as the repo path inside the container is different from the outside one. For that, the location of KAS_REPO_DIR is passed via an env-var into the container. There, this value is picked up by the menu plugin and written to the .config.yaml file as `_source_host_dir`. When running kas-container build, we check if the .config.yaml file contains this node and set the KAS_REPO_DIR accordingly. The schema is extended accordingly. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> [Jan: rework _source_dir_host extraction to make it usable for menu as well] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
committed by
Jan Kiszka
parent
e274886ab0
commit
e9032bc278
@@ -373,11 +373,28 @@ else
|
||||
KAS_REPO_DIR=$(pwd)
|
||||
fi
|
||||
|
||||
SOURCE_DIR_HOST=$(
|
||||
grep -e "^_source_dir_host: " "${KAS_WORK_DIR}/.config.yaml" 2>/dev/null | \
|
||||
sed 's/_source_dir_host:[ ]\+//')
|
||||
if [ -n "${SOURCE_DIR_HOST}" ]; then
|
||||
KAS_REPO_DIR="${SOURCE_DIR_HOST}"
|
||||
fi
|
||||
|
||||
if [ "${KAS_CMD}" = "menu" ]; then
|
||||
if [ -z "${KAS_FIRST_FILE}" ]; then
|
||||
KAS_FIRST_FILE="Kconfig"
|
||||
fi
|
||||
|
||||
# When using the menu plugin, we need to track the KAS_REPO_DIR outside
|
||||
# of the container to later allow a simple `kas-container build`. For
|
||||
# that, we tell the kas menu plugin via an env-var about the location
|
||||
# on the host. This data is then added to the .config.yaml where it can
|
||||
# be evaluated by the next invocation of kas-container.
|
||||
|
||||
if ! [ "$(realpath -qe "${KAS_REPO_DIR}")" = "$(realpath -qe "${KAS_WORK_DIR}")" ]; then
|
||||
set -- "$@" -e _KAS_REPO_DIR_HOST="$(readlink -fv "${KAS_REPO_DIR}")"
|
||||
fi
|
||||
|
||||
BUILD_SYSTEM=$(tr '\n' '\f' 2>/dev/null < ${KAS_FIRST_FILE} | \
|
||||
sed -e 's/\(.*\fconfig KAS_BUILD_SYSTEM\f\(.*\)\|.*\)/\2/' \
|
||||
-e 's/\f\([[:alpha:]].*\|$\)//' \
|
||||
|
Reference in New Issue
Block a user