diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-07-25 11:39:07 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-09-21 14:56:51 +0200 |
commit | 8b02c5438c89174df03a00206f86403625ee97ac (patch) | |
tree | 4149355a3c5aaae8bc8b27b4246e3e4a7d61aaa6 | |
parent | 3b7733a0d45561032f5c62790d5c7c171074b2ed (diff) | |
download | ptxdist-8b02c5438c89174df03a00206f86403625ee97ac.tar.gz ptxdist-8b02c5438c89174df03a00206f86403625ee97ac.tar.xz |
ptxd_make_world_kconfig: add helper to create and save .config
The helper handle layers correctly and will merge the config from a base
layer with a delta config if necessary.
A delta config is generated or updated if a base layer config exists.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | rules/post/ptxd_make_world_common.make | 1 | ||||
-rw-r--r-- | rules/post/ptxd_make_world_kconfig.make | 15 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_kconfig.sh | 59 |
3 files changed, 69 insertions, 6 deletions
diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make index 2b40ecb96..d5a9f6ebb 100644 --- a/rules/post/ptxd_make_world_common.make +++ b/rules/post/ptxd_make_world_common.make @@ -77,6 +77,7 @@ world/env/impl = \ pkg_pkg="$(call ptx/escape,$($(1)))" \ pkg_version="$(call ptx/escape,$($(1)_VERSION))" \ pkg_config="$(call ptx/escape,$($(1)_CONFIG))" \ + pkg_ref_config="$(call ptx/escape,$($(1)_REF_CONFIG))" \ pkg_path="$(call ptx/escape,$($(1)_PATH))" \ pkg_src="$(call ptx/escape,$($(1)_SOURCE))" \ pkg_srcs="$(call ptx/escape,$($(1)_SOURCES))" \ diff --git a/rules/post/ptxd_make_world_kconfig.make b/rules/post/ptxd_make_world_kconfig.make index 7d1861836..382e6bd9c 100644 --- a/rules/post/ptxd_make_world_kconfig.make +++ b/rules/post/ptxd_make_world_kconfig.make @@ -16,4 +16,19 @@ world/kconfig = \ ptx_config_target=$(strip $(2)) \ ptxd_make_world_kconfig +# +# provide the .config file for kconfig +# +world/kconfig-setup = \ + $(call world/env, $(1)) \ + ptx_config_mode=$(strip $(2)) \ + ptxd_make_world_kconfig_setup + +# +# update the package config file from .config +# +world/kconfig-sync = \ + $(call world/env, $(1)) \ + ptxd_make_world_kconfig_sync + # vim: syntax=make diff --git a/scripts/lib/ptxd_make_world_kconfig.sh b/scripts/lib/ptxd_make_world_kconfig.sh index 719947de7..6d1e8b45e 100644 --- a/scripts/lib/ptxd_make_world_kconfig.sh +++ b/scripts/lib/ptxd_make_world_kconfig.sh @@ -8,23 +8,70 @@ # see the README file. # +ptxd_make_kconfig_setup() { + if [ -n "${ref_file_dotconfig}" ]; then + file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config && + relative_ref_file_dotconfig="${relative_file_dotconfig}" + fi && + ptxd_normalize_config && + ptxd_kconfig_setup_config "${ptx_config_mode}" "${pkg_build_dir}/.config" \ + "${relative_file_dotconfig}" "${file_dotconfig}" "${relative_ref_file_dotconfig}" +} +export -f ptxd_make_kconfig_setup + +ptxd_make_world_kconfig_setup() { + ptxd_make_world_init || return + + if [ -z "${ptx_config_mode}" ]; then + case "${pkg_stage}" in + *config) ptx_config_mode=update ;; + *) ptx_config_mode=run ;; + esac + fi + + local file_dotconfig="${pkg_config}" + local ref_file_dotconfig="${pkg_ref_config}" + ptxd_make_kconfig_setup +} +export -f ptxd_make_world_kconfig_setup + +ptxd_make_kconfig_sync() { + if [ -n "${ref_file_dotconfig}" ]; then + file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config && + relative_ref_file_dotconfig="${relative_file_dotconfig}" + fi && + ptxd_normalize_config && + ptxd_kconfig_sync_config update "${pkg_build_dir}/.config" \ + "${relative_file_dotconfig}" "${relative_ref_file_dotconfig}" +} +export -f ptxd_make_kconfig_sync + +ptxd_make_world_kconfig_sync() { + ptxd_make_world_init || return + + local file_dotconfig="${pkg_config}" + local ref_file_dotconfig="${pkg_ref_config}" + ptxd_make_kconfig_sync +} +export -f ptxd_make_world_kconfig_sync + # # run kconfig and update the config file # @$1: the kconfig target (e.g. menuconfig, oldconfig, ...) # ptxd_make_kconfig() { - if [ -e "${pkg_config}" ]; then - cp "${pkg_config}" .config - fi && + local file_dotconfig="${pkg_config}" + local ref_file_dotconfig="${pkg_ref_config}" + local ptx_config_mode=run + + ptxd_make_kconfig_setup && ptxd_eval \ "${pkg_path}" \ "${pkg_env}" \ "${pkg_conf_env}" \ make "${1}" \ "${pkg_conf_opt}" && - if ! diff -q -I "# [^C]" .config "${pkg_config}" > /dev/null 2>&1; then - cp .config "${pkg_config}" - fi + ptxd_make_kconfig_sync } export -f ptxd_make_kconfig |