diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-07-02 13:57:17 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-07-10 13:53:59 +0200 |
commit | a49969a3cc4854e3c1729bafb8b71dbed67d47cf (patch) | |
tree | b53db8d4c9501e44977f4eabbeac356707fdd114 | |
parent | a835af354d8b2413744dd54f18db4fc72b288daa (diff) | |
download | ptxdist-a49969a3cc4854e3c1729bafb8b71dbed67d47cf.tar.gz ptxdist-a49969a3cc4854e3c1729bafb8b71dbed67d47cf.tar.xz |
improve dependency handling
Check the content of make and in files for packages in addition to the
package options to trigger the prepare stage.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-x | bin/ptxdist | 1 | ||||
-rw-r--r-- | rules/post/ptxd_make_world_common.make | 1 | ||||
-rw-r--r-- | rules/post/ptxd_make_world_prepare.make | 9 | ||||
-rw-r--r-- | scripts/kconfig/conf.c | 10 | ||||
-rw-r--r-- | scripts/lib/ptxd_lib_cfgchg.sh | 91 | ||||
-rw-r--r-- | scripts/lib/ptxd_lib_dgen.awk | 27 | ||||
-rw-r--r-- | scripts/lib/ptxd_lib_dgen.sh | 4 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_prepare.sh | 25 | ||||
-rw-r--r-- | scripts/ptx-modifications/0001-conf-add-an-option-to-output-the-dependency-informat.patch | 14 |
9 files changed, 82 insertions, 100 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index 7df1384f3..f8d9a7270 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -789,7 +789,6 @@ check_compiler() { # check_deps() { ptxd_dgen || ptxd_bailout "error in dgen" - ptxd_cfgchg || ptxd_bailout "error in cfgchg" } diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make index 9ab4faf9f..c992db27d 100644 --- a/rules/post/ptxd_make_world_common.make +++ b/rules/post/ptxd_make_world_common.make @@ -80,6 +80,7 @@ world/env/impl = \ pkg_srcs="$(call ptx/escape,$($(1)_SOURCES))" \ pkg_md5="$(call ptx/escape,$($(1)_MD5))" \ pkg_url="$(call ptx/escape,$($(1)_URL))" \ + pkg_cfghash="$(call ptx/escape,$($(1)_CFGHASH))" \ \ pkg_dir="$(call ptx/escape,$($(1)_DIR))" \ pkg_subdir="$(call ptx/escape,$($(1)_SUBDIR))" \ diff --git a/rules/post/ptxd_make_world_prepare.make b/rules/post/ptxd_make_world_prepare.make index f88c75c03..248282c4d 100644 --- a/rules/post/ptxd_make_world_prepare.make +++ b/rules/post/ptxd_make_world_prepare.make @@ -8,6 +8,15 @@ # see the README file. # +world/cfghash = \ + +$(call world/env, $1) \ + ptxd_make_world_cfghash + +$(STATEDIR)/%.cfghash: + @$(call targetinfo) + @$(call world/cfghash, $(PTX_MAP_TO_PACKAGE_$(basename $(*)))) + @$(call touch) + $(STATEDIR)/%.prepare: @$(call targetinfo) @$(call world/prepare, $(PTX_MAP_TO_PACKAGE_$(*))) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 2fedd45e8..50e059e6b 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -452,6 +452,7 @@ static void create_dep_output() { int i; bool hit; + const char *filename; struct symbol *sym; struct property *prop; @@ -460,12 +461,17 @@ static void create_dep_output() continue; hit = 0; + filename = NULL; for (prop = sym->prop; prop; prop = prop->next) { - if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) { + if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) hit=1; + if (prop->type == P_SYMBOL) + filename = prop->menu->file->name; + if (filename && hit) break; - } } + if (filename) + printf("SOURCE:%s:%s\n", sym->name, filename); if (!hit) continue; printf("DEP:%s", sym->name); diff --git a/scripts/lib/ptxd_lib_cfgchg.sh b/scripts/lib/ptxd_lib_cfgchg.sh deleted file mode 100644 index 4e8e72098..000000000 --- a/scripts/lib/ptxd_lib_cfgchg.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2009 by Marc Kleine-Budde <mkl@pengutronix.de> -# -# See CREDITS for details about who has contributed to this project. -# -# For further information about the PTXdist project and license conditions -# see the README file. -# - -ptxd_cfgchg_generate() -{ - gawk ' - BEGIN { - FS = "=\"|\"|=| is not set"; - } - - $1 ~ /^PTX_MAP_TO_package/ { - pkg = gensub(/PTX_MAP_TO_package_/, "", "g", $1); -# print pkg, $2; - - pkgs[pkg] = $2; - - next; - } - - $1 ~ /^[-\+](|# )PTXCONF/ { - opt = gensub(/[-\+](|# )PTXCONF_/, "", "g", $1); - - if (opt ~ /.*_VERSION$/) - ver_changed = 1; - else - ver_changed = 0; - - do { - if (opt in pkgs) { - if (ver_changed) - pkgs_ver_changed[opt] = pkgs[opt]; - else - pkgs_opt_changed[opt] = pkgs[opt]; - break; - } - } while (sub(/_+[^_]+$/, "", opt)); - } - - END { - for (pkg in pkgs_ver_changed) { - printf "'"${STATEDIR}/"'" pkgs_ver_changed[pkg] ".extract\0"; - } - - for (pkg in pkgs_opt_changed) { - printf "'"${STATEDIR}/"'" pkgs_opt_changed[pkg] ".prepare\0"; - printf "'"${STATEDIR}/"'" pkgs_opt_changed[pkg] ".xpkg.map\0"; - } - } - - ' \ - "${PTX_MAP_ALL}" \ - - -} - - -ptxd_cfgchg() -{ - local cfg_old_tmp="${PTXDIST_TEMPDIR}/ptxconfig-diff.old" - local cfg_orig_tmp="${PTXDIST_TEMPDIR}/ptxconfig-diff.orig" - - for cfg in PTXDIST_PTXCONFIG PTXDIST_PLATFORMCONFIG; do - local cfg_orig="${!cfg}" - if [ \! -e "${cfg_orig}" ]; then - continue - fi - - local cfg_default="${cfg}_DEFAULT" - local cfg_old="${STATEDIR}/${!cfg_default#${PTXDIST_WORKSPACE}/}.deps_old" - - if [ -e "${cfg_old}" ]; then - grep -v '^# ' "${cfg_orig}" >> "${cfg_orig_tmp}" - grep -v '^# ' "${cfg_old}" >> "${cfg_old_tmp}" - fi - - install -m644 "${cfg_orig}" "${cfg_old}" || return - done - if [ -f "${cfg_orig_tmp}" ]; then - sort -u "${cfg_old_tmp}" -o "${cfg_old_tmp}" - sort -u "${cfg_orig_tmp}" -o "${cfg_orig_tmp}" - diff -u "${cfg_old_tmp}" "${cfg_orig_tmp}" | \ - ptxd_cfgchg_generate | \ - xargs -0 -r rm -f -- - fi -} diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk index aa38eadfb..93f72d3c6 100644 --- a/scripts/lib/ptxd_lib_dgen.awk +++ b/scripts/lib/ptxd_lib_dgen.awk @@ -78,6 +78,20 @@ $0 ~ /^include[[:space:]]+\/.*\.make$/ { } +function dump_file(src, dst) { + if (!src) + return + + old_RS = RS + RS = "^$" + getline tmp < src + print tmp >> dst + RS = old_RS + close(src) + close(dst) +} + + # # parse "PACKAGES-$(PTXCONF_PKG) += pkg" lines, i.e. rules-files from # rules/*.make. Setup mapping between upper and lower case pkg names @@ -100,6 +114,7 @@ $1 ~ /^[A-Z_]*PACKAGES-/ { exit 1 } + PKG_to_makefile[this_PKG] = FILENAME; PKG_to_pkg[this_PKG] = this_pkg; pkg_to_PKG[this_pkg] = this_PKG; # make sure each file is only included once @@ -168,6 +183,12 @@ $1 ~ /^PTX_MAP_._DEP/ { next; } +$1 ~ /^PTX_MAP_._SOURCE/ { + this_PKG = gensub(/PTX_MAP_._SOURCE_/, "", "g", $1); + if (this_PKG in PKG_to_pkg) + PKG_to_infile[this_PKG] = $2; + next; +} # # parse the ptx- and platformconfig @@ -316,6 +337,7 @@ function write_deps_pkg_active(this_PKG, this_pkg, prefix) { print "$(STATEDIR)/" this_pkg ".extract: " "$(STATEDIR)/" this_pkg ".get" > DGEN_DEPS_POST; print "$(STATEDIR)/" this_pkg ".extract.post: " "$(STATEDIR)/" this_pkg ".extract" > DGEN_DEPS_POST; print "$(STATEDIR)/" this_pkg ".prepare: " "$(STATEDIR)/" this_pkg ".extract.post" > DGEN_DEPS_POST; + print "$(STATEDIR)/" this_pkg ".prepare: " "$(STATEDIR)/" this_pkg ".$(" this_PKG "_CFGHASH).cfghash" > DGEN_DEPS_POST; print "$(STATEDIR)/" this_pkg ".tags: " "$(STATEDIR)/" this_pkg ".prepare" > DGEN_DEPS_POST; print "$(STATEDIR)/" this_pkg ".compile: " "$(STATEDIR)/" this_pkg ".prepare" > DGEN_DEPS_POST; print "$(STATEDIR)/" this_pkg ".install: " "$(STATEDIR)/" this_pkg ".compile" > DGEN_DEPS_POST; @@ -470,6 +492,11 @@ END { } else write_deps_pkg_active_image(this_PKG, this_pkg, this_pkg_prefix) + + if (this_PKG in PKG_to_infile) + dump_file(PKG_to_infile[this_PKG], PTXDIST_TEMPDIR "/pkghash-" this_PKG); + if (this_PKG in PKG_to_makefile) + dump_file(PKG_to_makefile[this_PKG], PTXDIST_TEMPDIR "/pkghash-" this_PKG); } close(PKG_HASHFILE); diff --git a/scripts/lib/ptxd_lib_dgen.sh b/scripts/lib/ptxd_lib_dgen.sh index 63e3288be..ed8d42d3d 100644 --- a/scripts/lib/ptxd_lib_dgen.sh +++ b/scripts/lib/ptxd_lib_dgen.sh @@ -38,9 +38,9 @@ ptxd_dgen_configdeps() { { PTXDIST_DEP_TARGET="build" ptxd_kconfig_dep_all "${config[@]}" \ - | sed -ne "s~DEP:\([^:]*\):\(.*\)~PTX_MAP_B_DEP_\1=\2~p" + | sed -ne "s~\([A-Z]*\):\([^:]*\):\(.*\)~PTX_MAP_B_\1_\2=\3~p" PTXDIST_DEP_TARGET="run" ptxd_kconfig_dep_all "${config[@]}" \ - | sed -ne "s~DEP:\([^:]*\):\(.*\)~PTX_MAP_R_DEP_\1=\2~p" + | sed -ne "s~\([A-Z]*\):\([^:]*\):\(.*\)~PTX_MAP_R_\1_\2=\3~p" } > "${PTX_MAP_DEPS}.tmp" check_pipe_status || return } diff --git a/scripts/lib/ptxd_make_world_prepare.sh b/scripts/lib/ptxd_make_world_prepare.sh index fc343061b..59131d225 100644 --- a/scripts/lib/ptxd_make_world_prepare.sh +++ b/scripts/lib/ptxd_make_world_prepare.sh @@ -8,6 +8,31 @@ # see the README file. # +ptxd_make_world_cfghash() +{ + local -a hashes + local hash h + + ptxd_make_world_init || return + + hashes=( "${ptx_state_dir}/${pkg_label}."*".cfghash" ) + hash="${ptx_state_dir}/${pkg_label}.${pkg_cfghash}.cfghash" + + if [ ${hashes[0]} = "${ptx_state_dir}/${pkg_label}.*.cfghash" ]; then + hashes=() + fi + if [ ${#hashes[@]} -gt 1 ]; then + ptxd_warning "more than one cfghash found!" + fi + for h in "${hashes[@]}"; do + if [ "${h}" != "${hash}" ]; then + echo -e "Configuration changed! Reconfiguring...\n" + fi + rm "${h}" || break + done +} +export -f ptxd_make_world_cfghash + # # perform sanity check # diff --git a/scripts/ptx-modifications/0001-conf-add-an-option-to-output-the-dependency-informat.patch b/scripts/ptx-modifications/0001-conf-add-an-option-to-output-the-dependency-informat.patch index 2508b93f9..7e725330b 100644 --- a/scripts/ptx-modifications/0001-conf-add-an-option-to-output-the-dependency-informat.patch +++ b/scripts/ptx-modifications/0001-conf-add-an-option-to-output-the-dependency-informat.patch @@ -4,8 +4,8 @@ Subject: [PATCH] conf: add an option to output the dependency information Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> --- - scripts/kconfig/conf.c | 41 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) + scripts/kconfig/conf.c | 47 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 47 insertions(+) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 866369f10ff8..46c6e1bb5910 100644 @@ -27,6 +27,7 @@ index 866369f10ff8..46c6e1bb5910 100644 +{ + int i; + bool hit; ++ const char *filename; + struct symbol *sym; + struct property *prop; + @@ -35,12 +36,17 @@ index 866369f10ff8..46c6e1bb5910 100644 + continue; + + hit = 0; ++ filename = NULL; + for (prop = sym->prop; prop; prop = prop->next) { -+ if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) { ++ if (prop->type == P_SELECT && expr_calc_value(prop->visible.expr)) + hit=1; ++ if (prop->type == P_SYMBOL) ++ filename = prop->menu->file->name; ++ if (filename && hit) + break; -+ } + } ++ if (filename) ++ printf("SOURCE:%s:%s\n", sym->name, filename); + if (!hit) + continue; + printf("DEP:%s", sym->name); |