If a config is found in a base layer then this is used to calculate the
diff. So the ref config is only used if no lower layer has a config.

Improve the package-info output to take this into account:
 - print the ref config only if it is actually used
 - otherwise print the used base config from a lower layer

Signed-off-by: Michael Olbrich <[email protected]>
---

On Tue, Apr 27, 2021 at 01:49:04PM +0200, Roland Hieber wrote:
> Michael, do you have an idea how to improve this?

What about this?

Michael

 scripts/lib/ptxd_make_world_kconfig.sh      |  9 +++++++--
 scripts/lib/ptxd_make_world_package_info.sh | 18 +++++++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/ptxd_make_world_kconfig.sh 
b/scripts/lib/ptxd_make_world_kconfig.sh
index 52005191633b..0aea5316856b 100644
--- a/scripts/lib/ptxd_make_world_kconfig.sh
+++ b/scripts/lib/ptxd_make_world_kconfig.sh
@@ -16,12 +16,17 @@ ptxd_make_world_kconfig_mode() {
 }
 export -f ptxd_make_world_kconfig_mode
 
-ptxd_make_kconfig_setup() {
+ptxd_make_kconfig_init() {
     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_normalize_config
+}
+export -f ptxd_make_kconfig_init
+
+ptxd_make_kconfig_setup() {
+    ptxd_make_kconfig_init &&
     ptxd_kconfig_setup_config "${ptx_config_mode}" "${pkg_build_dir}/.config" \
        "${relative_file_dotconfig}" "${file_dotconfig}" 
"${relative_ref_file_dotconfig}"
     if [ ${?} -ne 0 ]; then
diff --git a/scripts/lib/ptxd_make_world_package_info.sh 
b/scripts/lib/ptxd_make_world_package_info.sh
index 4d17f3d2c976..48b7b21dacc1 100644
--- a/scripts/lib/ptxd_make_world_package_info.sh
+++ b/scripts/lib/ptxd_make_world_package_info.sh
@@ -7,6 +7,8 @@
 #
 
 ptxd_make_world_package_info() {
+    local last_config base_config ref_config
+
     # use patchin_init for  pkg_patch_dir
     ptxd_make_world_patchin_init || return
     do_echo() {
@@ -26,8 +28,22 @@ ptxd_make_world_package_info() {
     do_echo "image:" "$(ptxd_print_path "${image_image}")"
     echo
 
+    if [ -n "${pkg_config}" ]; then
+       local file_dotconfig="${pkg_config}"
+       local ref_file_dotconfig="${pkg_ref_config}"
+       ptxd_make_kconfig_init
+       ptxd_kconfig_find_config "update" "${relative_file_dotconfig}" 
"${relative_ref_file_dotconfig}"
+       if [ "${base_config}" = "${pkg_ref_config}" ]; then
+           base_config=
+       fi
+       if [ -z "${base_config}" ]; then
+           ref_config="${pkg_ref_config}"
+       fi
+    fi
+
     do_echo "config:" "$(ptxd_print_path "${pkg_config}")"
-    do_echo "ref config:" "$(ptxd_print_path "${pkg_ref_config}")"
+    do_echo "base config:" "$(ptxd_print_path "${base_config}")"
+    do_echo "ref config:" "$(ptxd_print_path "${ref_config}")"
     do_echo "${pkg_config}"
 
     do_echo "license:" "${pkg_license}"
-- 
2.29.2


_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to