# HG changeset patch # User "Yann E. MORIN" # Date 1358811158 -3600 # Node ID 9b991363c01c72bda0909639534e932979353075 # Parent 15f57d843296e244487ac0845a73247f9d6749b8 samples: check if update is needed Add a ct-ng action to check if samples needs being updated. This will be usefull when the config options change. Signed-off-by: "Yann E. MORIN" diff -r 15f57d843296 -r 9b991363c01c ct-ng.comp --- a/ct-ng.comp Tue Jan 22 00:34:15 2013 +0100 +++ b/ct-ng.comp Tue Jan 22 00:32:38 2013 +0100 @@ -9,6 +9,7 @@ samples=$( "${COMP_WORDS[0]}" list-samples-short 2>/dev/null ) show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;') build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;') + check_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1check-/g;') steps=$(${COMP_WORDS[0]} list-steps 2>/dev/null |awk '$1 == "-" { print $2; }') start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;') @@ -17,14 +18,15 @@ actions='help menuconfig oldconfig saveconfig extractconfig defconfig savedefconfig build build. build-all build-all. - wiki-samples list-samples list-samples-short list-steps + wiki-samples list-samples list-samples-short check-samples + list-steps show-tuple show-all show-config clean distclean updatetools tarball version' vars="RESTART= STOP= PREFIX= V= DEFCONFIG=" - ct_ng_opts="${samples} ${show_samples} ${build_samples} + ct_ng_opts="${samples} ${show_samples} ${build_samples} ${check_samples} ${steps} ${start_steps} ${stop_steps} ${actions} ${vars}" diff -r 15f57d843296 -r 9b991363c01c samples/samples.mk --- a/samples/samples.mk Tue Jan 22 00:34:15 2013 +0100 +++ b/samples/samples.mk Tue Jan 22 00:32:38 2013 +0100 @@ -79,6 +79,22 @@ printf "%s\n" "$${s}"; \ done +# Check one sample +PHONY += $(patsubst %,check-%,$(CT_SAMPLES)) +$(patsubst %,check-%,$(CT_SAMPLES)): config_files + @export KCONFIG_CONFIG=$$(pwd)/.config.sample; \ + CT_NG_SAMPLE=$(call sample_dir,$(patsubst check-%,%,$(@)))/crosstool.config; \ + $(CONF) --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) >/dev/null; \ + $(CONF) --savedefconfig=$$(pwd)/.defconfig $(KCONFIG_TOP) >/dev/null; \ + old_sha1=$$( sha1sum "$${CT_NG_SAMPLE}" |cut -d ' ' -f 1 ); \ + new_sha1=$$( sha1sum .defconfig |cut -d ' ' -f 1 ); \ + if [ $${old_sha1} != $${new_sha1} ]; then \ + echo "$(patsubst check-%,%,$(@)) needs update"; \ + fi + @rm -f .config.sample* .defconfig + +check-samples: $(patsubst %,check-%,$(CT_SAMPLES)) + PHONY += wiki-samples wiki-samples: wiki-samples-pre $(patsubst %,wiki-%,$(CT_SAMPLES)) wiki-samples-post