Introduce the notion of a 'sample comment'.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Oct 14 21:30:27 2008 +0000 (2008-10-14)
changeset 935e175e3538310
parent 934 e2f4be0feb9d
child 936 1f0324a7201a
Introduce the notion of a 'sample comment'.

- presence of the sample's reported.by file is now mandatory.
- when saving a sample, reporter name & URL are queried, to avoid operator forget about creating the reported.by file.
- when saving a sample, one can store a few-liner comment.
- when recalling a sample, the reporter name, URL and comment (if present) are printed.
- update the powerpc-e500v2-linux-gnuspe sample to include Nate's comment (from his original mail).
- update all samples that were missing the reported.by file.

/trunk/scripts/saveSample.sh | 46 35 11 0 ++++++++++++++++++------
/trunk/scripts/showSamples.sh | 12 6 6 0 +++---
/trunk/samples/powerpc-e500v2-linux-gnuspe/reported.by | 15 15 0 0 ++++++++
/trunk/samples/samples.mk | 22 17 5 0 +++++++++--
4 files changed, 73 insertions(+), 22 deletions(-)
samples/arm-unknown-eabi/reported.by
samples/arm-unknown-elf/reported.by
samples/arm-unknown-linux-uclibc/reported.by
samples/arm-unknown-linux-uclibcgnueabi/reported.by
samples/armeb-unknown-linux-gnu/reported.by
samples/armeb-unknown-linux-gnueabi/reported.by
samples/armeb-unknown-linux-uclibc/reported.by
samples/armeb-unknown-linux-uclibcgnueabi/reported.by
samples/i586-geode-linux-uclibc/reported.by
samples/i686-nptl-linux-gnu/reported.by
samples/ia64-unknown-linux-gnu/reported.by
samples/mips-unknown-linux-uclibc/reported.by
samples/powerpc-e500v2-linux-gnuspe/reported.by
samples/samples.mk
samples/x86_64-unknown-linux-uclibc/reported.by
scripts/saveSample.sh
scripts/showSamples.sh
     1.1 --- a/samples/powerpc-e500v2-linux-gnuspe/reported.by	Tue Oct 14 20:06:37 2008 +0000
     1.2 +++ b/samples/powerpc-e500v2-linux-gnuspe/reported.by	Tue Oct 14 21:30:27 2008 +0000
     1.3 @@ -1,2 +1,17 @@
     1.4  reporter_name="Nate CASE"
     1.5  reporter_url="http://sourceware.org/ml/crossgcc/2008-10/msg00016.html"
     1.6 +reporter_comment="This is a sample config file for Freescale e500v2 processors (e.g.,
     1.7 +MPC8548, MPC8572).  It uses eglibc (for e500/SPE patches) and a recent
     1.8 +gcc (4.3.1, for e500v2 DPFP support) and will generate appropriate
     1.9 +dual-precision floating point instructions by default.
    1.10 +
    1.11 +Note: If building a Linux kernel with this toolchain, you will want to
    1.12 +make sure -mno-spe AND -mspe=no are passed to gcc to prevent SPE
    1.13 +ABI/instructions from getting into the kernel (which is currently
    1.14 +unsupported).  At this time, the kernel build system only passes
    1.15 +-mno-spe by default (this should be fixed soon hopefully).
    1.16 +
    1.17 +A binutils snapshot is used to fix a bug present in 2.18 preventing
    1.18 +U-Boot from being compiled (CodeSourcery issue #2297: internal.h
    1.19 +(ELF_IS_SECTION_IN_SEGMENT): Adjust to cope with segments at the end of
    1.20 +memory)."
     2.1 --- a/samples/samples.mk	Tue Oct 14 20:06:37 2008 +0000
     2.2 +++ b/samples/samples.mk	Tue Oct 14 21:30:27 2008 +0000
     2.3 @@ -35,18 +35,30 @@
     2.4  $(CT_SAMPLES):
     2.5  	@cp $(call sample_dir,$@)/crosstool.config .config
     2.6  	@$(MAKE) -rf $(CT_NG) oldconfig
     2.7 +	@echo
     2.8 +	@echo  '***********************************************************'
     2.9 +	@echo
    2.10 +	@( . $(call sample_dir,$@)/reported.by;                                     \
    2.11 +	   echo "Initially reported by: $${reporter_name:-Yann E. MORIN}";          \
    2.12 +	   echo "URL: $${reporter_url:-http://ymorin.is-a-geek.org/}";              \
    2.13 +	   if [ -n "$${reporter_comment}" ]; then                                   \
    2.14 +	     echo  ;                                                                \
    2.15 +	     echo  "Comment:";                                                      \
    2.16 +	     printf "$${reporter_comment}\n";                                       \
    2.17 +	   fi;                                                                      \
    2.18 +	   echo  ;                                                                  \
    2.19 +	   echo  '***********************************************************';     \
    2.20 +	 )
    2.21  	@if grep -E '^CT_EXPERIMENTAL=y$$' .config >/dev/null 2>&1; then        \
    2.22 -	   echo  '';                                                            \
    2.23 -	   echo  '***********************************************************'; \
    2.24 -	   echo  '';                                                            \
    2.25 +	   echo  ;                                                              \
    2.26  	   echo  'WARNING! This sample may enable experimental features.';      \
    2.27  	   echo  '         Please be sure to review the configuration prior';   \
    2.28  	   echo  '         to building and using your toolchain!';              \
    2.29  	   echo  'Now, you have been warned!';                                  \
    2.30 -	   echo  '';                                                            \
    2.31 +	   echo  ;                                                              \
    2.32  	   echo  '***********************************************************'; \
    2.33 -	   echo  '';                                                            \
    2.34  	 fi
    2.35 +	@echo
    2.36  	@echo  'Now configured for "$@"'
    2.37  
    2.38  # The 'sample_dir' function prints the directory in which the sample is,
     3.1 --- a/scripts/saveSample.sh	Tue Oct 14 20:06:37 2008 +0000
     3.2 +++ b/scripts/saveSample.sh	Tue Oct 14 21:30:27 2008 +0000
     3.3 @@ -5,8 +5,11 @@
     3.4  
     3.5  # What we need to save:
     3.6  #  - the .config file
     3.7 -#  - the kernel .config file if specified
     3.8  #  - the uClibc .config file if uClibc selected
     3.9 +#  - info about who reported the sample
    3.10 +
    3.11 +# We'll need the stdout later, save it
    3.12 +exec 7>&1
    3.13  
    3.14  . "${CT_LIB_DIR}/scripts/functions"
    3.15  
    3.16 @@ -15,8 +18,8 @@
    3.17  rm -f "${tmp_log_file}"
    3.18  
    3.19  # Parse the configuration file
    3.20 -CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_DIR}/.config"
    3.21 -. "${CT_TOP_DIR}/.config"
    3.22 +CT_TestOrAbort "Configuration file not found. Please create one." -f .config
    3.23 +. .config
    3.24  
    3.25  # Do not use a progress bar
    3.26  unset CT_LOG_PROGRESS_BAR
    3.27 @@ -29,7 +32,7 @@
    3.28  
    3.29  # Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
    3.30  # re-parse them:
    3.31 -. "${CT_TOP_DIR}/.config"
    3.32 +. .config
    3.33  
    3.34  # Override log options
    3.35  unset CT_LOG_PROGRESS_BAR CT_LOG_ERROR CT_LOG_INFO CT_LOG_EXTRA CT_LOG_DEBUG LOG_ALL
    3.36 @@ -37,8 +40,8 @@
    3.37  CT_LOG_LEVEL_MAX="WARN"
    3.38  
    3.39  # Create the sample directory
    3.40 -if [ ! -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ]; then
    3.41 -    mkdir -p "${CT_TOP_DIR}/samples/${CT_TARGET}"
    3.42 +if [ ! -d "samples/${CT_TARGET}" ]; then
    3.43 +    mkdir -p "samples/${CT_TARGET}"
    3.44  fi
    3.45  
    3.46  # Save the crosstool-NG config file
    3.47 @@ -46,8 +49,8 @@
    3.48         -e 's|^# CT_LOG_TO_FILE is not set$|CT_LOG_TO_FILE=y|;'              \
    3.49         -e 's|^# CT_LOG_FILE_COMPRESS is not set$|CT_LOG_FILE_COMPRESS=y|;'  \
    3.50         -e 's|^(CT_LOCAL_TARBALLS_DIR)=.*|\1="${HOME}/src"|;'                \
    3.51 -    <"${CT_TOP_DIR}/.config"                                                \
    3.52 -    >"${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    3.53 +    <.config                                                                \
    3.54 +    >"samples/${CT_TARGET}/crosstool.config"
    3.55  
    3.56  # Function to copy a file to the sample directory
    3.57  # Needed in case the file is already there (think of a previously available sample)
    3.58 @@ -71,12 +74,33 @@
    3.59  # Save the uClibc .config file
    3.60  if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
    3.61      # We save the file, and then point the saved sample to this file
    3.62 -    CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    3.63 +    CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    3.64      sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
    3.65 -        "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    3.66 +        "samples/${CT_TARGET}/crosstool.config"
    3.67  else
    3.68      # remove any dangling files
    3.69 -    for f in "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
    3.70 +    for f in "samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
    3.71          if [ -f "${f}" ]; then rm -f "${f}"; fi
    3.72      done
    3.73  fi
    3.74 +
    3.75 +# Restore stdout now, to be interactive
    3.76 +exec >&7
    3.77 +
    3.78 +# Fill-in the reported-by info
    3.79 +[ -f "samples/${CT_TARGET}/reported.by" ] && . "samples/${CT_TARGET}/reported.by"
    3.80 +old_name="${reporter_name}"
    3.81 +old_url="${reporter_url}"
    3.82 +read -p "Reporter name [${reporter_name}]: " reporter_name
    3.83 +read -p "Reporter URL [${reporter_url}]: " reporter_url
    3.84 +if [ -n "${reporter_comment}" ]; then
    3.85 +  echo "Old comment if you need to copy-paste:"
    3.86 +  printf "${reporter_comment}"
    3.87 +fi
    3.88 +echo "Reporter comment (Ctrl-D to finish):"
    3.89 +reporter_comment=$(cat)
    3.90 +
    3.91 +( echo "reporter_name=\"${reporter_name:=${old_name}}\""
    3.92 +  echo "reporter_url=\"${reporter_url:=${old_url}}\""
    3.93 +  printf "reporter_comment=\"${reporter_comment}\"\n"
    3.94 +) >"samples/${CT_TARGET}/reported.by"
     4.1 --- a/scripts/showSamples.sh	Tue Oct 14 20:06:37 2008 +0000
     4.2 +++ b/scripts/showSamples.sh	Tue Oct 14 21:30:27 2008 +0000
     4.3 @@ -83,17 +83,17 @@
     4.4          [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ", Objective-C++"
     4.5          [ -n "${CT_CC_LANG_OTHERS}"     ] && printf "\\\\\\\\ Others: ${CT_CC_LANG_OTHERS}"
     4.6          printf "  "
     4.7 -        if [ -f "${sample_top}/samples/${sample}/reported.by" ]; then
     4.8 -            ( . "${sample_top}/samples/${sample}/reported.by"
     4.9 +        ( . "${sample_top}/samples/${sample}/reported.by"
    4.10 +          if [ -n "${reporter_name}" ]; then
    4.11                if [ -n "${reporter_url}" ]; then
    4.12                    printf "|  [[${reporter_url}|${reporter_name}]]  "
    4.13                else
    4.14                    printf "|  ${reporter_name}  "
    4.15                fi
    4.16 -            )
    4.17 -        else
    4.18 -            printf "|  [[http://ymorin.is-a-geek.org/|YEM]]  "
    4.19 -        fi
    4.20 +          else
    4.21 +              printf "|  [[http://ymorin.is-a-geek.org/|YEM]]  "
    4.22 +          fi
    4.23 +        )
    4.24          sample_updated=$(date -u "+%Y%m%d"                                                  \
    4.25                                -d "$(LC_ALL=C svn info ${sample_top}/samples/${sample}       \
    4.26                                      |GREP_OPTIONS= egrep '^Last Changed Date:'              \