samples: rework show-tuple
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Mon May 07 21:37:59 2012 +0200 (2012-05-07)
changeset 29821e35d2fa54d7
parent 2981 80151a249b85
child 2983 f80b978b443b
samples: rework show-tuple

Now that we are using defconfig files, the samples do not contain
the full configuration, so we can not simply parse them to show
their content.

Instead, we must fake recalling a sample, and parse the generated
.config file.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
samples/samples.mk
scripts/showSamples.sh
     1.1 --- a/samples/samples.mk	Mon May 07 00:27:05 2012 +0200
     1.2 +++ b/samples/samples.mk	Mon May 07 21:37:59 2012 +0200
     1.3 @@ -36,13 +36,18 @@
     1.4  # Print the details of current configuration
     1.5  PHONY += show-config
     1.6  show-config: .config
     1.7 -	@export current_tuple=$(shell $(MAKE) -rf "$(CT_NG)" show-tuple );  \
     1.8 -	$(CT_LIB_DIR)/scripts/showSamples.sh -v current
     1.9 +	@cp .config .config.sample
    1.10 +	@$(CT_LIB_DIR)/scripts/showSamples.sh -v current
    1.11 +	@rm -f .config.sample
    1.12  
    1.13  # Prints the details of a sample
    1.14  PHONY += $(patsubst %,show-%,$(CT_SAMPLES))
    1.15 -$(patsubst %,show-%,$(CT_SAMPLES)):
    1.16 +$(patsubst %,show-%,$(CT_SAMPLES)): config_files
    1.17 +	@KCONFIG_CONFIG=$$(pwd)/.config.sample	\
    1.18 +	    $(CONF) --defconfig=$(call sample_dir,$(patsubst show-%,%,$(@)))/crosstool.config \
    1.19 +	            $(KCONFIG_TOP) >/dev/null
    1.20  	@$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
    1.21 +	@rm -f .config.sample
    1.22  
    1.23  # Prints the details of all samples
    1.24  PHONY += show-all
     2.1 --- a/scripts/showSamples.sh	Mon May 07 00:27:05 2012 +0200
     2.2 +++ b/scripts/showSamples.sh	Mon May 07 21:37:59 2012 +0200
     2.3 @@ -14,7 +14,7 @@
     2.4  export GREP_OPTIONS=
     2.5  
     2.6  # Dump a single sample
     2.7 -# Note: we can quite safely used the non-mangled .config.2
     2.8 +# Note: we use the specific .config.sample config file
     2.9  dump_single_sample() {
    2.10      local verbose=0
    2.11      local complibs
    2.12 @@ -25,9 +25,8 @@
    2.13      case "${sample}" in
    2.14          current)
    2.15              sample_type="l"
    2.16 -            sample="${current_tuple}"
    2.17 +            sample="$( ${CT_NG} show-tuple )"
    2.18              width="${#sample}"
    2.19 -            . $(pwd)/.config
    2.20              ;;
    2.21          *)  if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
    2.22                  sample_top="${CT_TOP_DIR}"
    2.23 @@ -36,9 +35,9 @@
    2.24                  sample_top="${CT_LIB_DIR}"
    2.25                  sample_type="G"
    2.26              fi
    2.27 -            . "${sample_top}/samples/${sample}/crosstool.config"
    2.28              ;;
    2.29      esac
    2.30 +    . $(pwd)/.config.sample
    2.31      if [ -z "${wiki}" ]; then
    2.32          t_width=14
    2.33          printf "%-*s  [%s" ${width} "${sample}" "${sample_type}"