scripts/showSamples.sh
changeset 3012 95173b196a88
parent 2982 1e35d2fa54d7
child 3022 8c8041e70203
     1.1 --- a/scripts/showSamples.sh	Mon May 07 21:37:59 2012 +0200
     1.2 +++ b/scripts/showSamples.sh	Mon Jul 23 22:02:23 2012 +0200
     1.3 @@ -9,6 +9,7 @@
     1.4  
     1.5  [ "$1" = "-v" ] && opt="$1" && shift
     1.6  [ "$1" = "-w" ] && opt="$1" && shift
     1.7 +[ "$1" = "-W" ] && opt="$1" && shift
     1.8  
     1.9  # GREP_OPTIONS screws things up.
    1.10  export GREP_OPTIONS=
    1.11 @@ -17,16 +18,15 @@
    1.12  # Note: we use the specific .config.sample config file
    1.13  dump_single_sample() {
    1.14      local verbose=0
    1.15 +    local wiki=0
    1.16      local complibs
    1.17      [ "$1" = "-v" ] && verbose=1 && shift
    1.18      [ "$1" = "-w" ] && wiki=1 && shift
    1.19 -    local width="$1"
    1.20 -    local sample="$2"
    1.21 +    local sample="$1"
    1.22      case "${sample}" in
    1.23          current)
    1.24              sample_type="l"
    1.25              sample="$( ${CT_NG} show-tuple )"
    1.26 -            width="${#sample}"
    1.27              ;;
    1.28          *)  if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
    1.29                  sample_top="${CT_TOP_DIR}"
    1.30 @@ -38,20 +38,20 @@
    1.31              ;;
    1.32      esac
    1.33      . $(pwd)/.config.sample
    1.34 -    if [ -z "${wiki}" ]; then
    1.35 -        t_width=14
    1.36 -        printf "%-*s  [%s" ${width} "${sample}" "${sample_type}"
    1.37 -        [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf " "
    1.38 -        [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " "
    1.39 -        echo "]"
    1.40 +    if [ ${wiki} -eq 0 ]; then
    1.41 +        width=14
    1.42 +        printf "[%s" "${sample_type}"
    1.43 +        [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf "."
    1.44 +        [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf "."
    1.45 +        printf "]   %s\n" "${sample}"
    1.46          if [ ${verbose} -ne 0 ]; then
    1.47              case "${CT_TOOLCHAIN_TYPE}" in
    1.48                  cross)  ;;
    1.49                  canadian)
    1.50 -                    printf "    %-*s : %s\n" ${t_width} "Host" "${CT_HOST}"
    1.51 +                    printf "    %-*s : %s\n" ${width} "Host" "${CT_HOST}"
    1.52                      ;;
    1.53              esac
    1.54 -            printf "    %-*s : %s\n" ${t_width} "OS" "${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
    1.55 +            printf "    %-*s : %s\n" ${width} "OS" "${CT_KERNEL}${CT_KERNEL_VERSION:+-}${CT_KERNEL_VERSION}"
    1.56              if [    -n "${CT_GMP}"              \
    1.57                   -o -n "${CT_MPFR}"             \
    1.58                   -o -n "${CT_PPL}"              \
    1.59 @@ -65,7 +65,7 @@
    1.60                   -o -n "${CT_MPC_TARGET}"       \
    1.61                   -o -n "${CT_LIBELF_TARGET}"    \
    1.62                 ]; then
    1.63 -                printf "    %-*s :" ${t_width} "Companion libs"
    1.64 +                printf "    %-*s :" ${width} "Companion libs"
    1.65                  complibs=1
    1.66              fi
    1.67              [ -z "${CT_GMP}"    -a -z "${CT_GMP_TARGET}"    ] || printf " gmp-%s"       "${CT_GMP_VERSION}"
    1.68 @@ -75,8 +75,8 @@
    1.69              [ -z "${CT_MPC}"    -a -z "${CT_MPC_TARGET}"    ] || printf " mpc-%s"       "${CT_MPC_VERSION}"
    1.70              [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s"    "${CT_LIBELF_VERSION}"
    1.71              [ -z "${complibs}"  ] || printf "\n"
    1.72 -            printf  "    %-*s : %s\n" ${t_width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
    1.73 -            printf  "    %-*s : %s" ${t_width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
    1.74 +            printf  "    %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
    1.75 +            printf  "    %-*s : %s" ${width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
    1.76              [ "${CT_CC_LANG_CXX}" = "y"     ] && printf ",C++"
    1.77              [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
    1.78              [ "${CT_CC_LANG_JAVA}" = "y"    ] && printf ",Java"
    1.79 @@ -85,8 +85,8 @@
    1.80              [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ",Objective-C++"
    1.81              [ -n "${CT_CC_LANG_OTHERS}"     ] && printf ",${CT_CC_LANG_OTHERS}"
    1.82              printf ")\n"
    1.83 -            printf  "    %-*s : %s\n" ${t_width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
    1.84 -            printf  "    %-*s :" ${t_width} "Tools"
    1.85 +            printf  "    %-*s : %s\n" ${width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}"
    1.86 +            printf  "    %-*s :" ${width} "Tools"
    1.87              [ "${CT_TOOL_sstrip}"   ] && printf " sstrip"
    1.88              [ "${CT_DEBUG_dmalloc}" ] && printf " dmalloc-${CT_DMALLOC_VERSION}"
    1.89              [ "${CT_DEBUG_duma}"    ] && printf " duma-${CT_DUMA_VERSION}"
    1.90 @@ -153,13 +153,7 @@
    1.91      fi
    1.92  }
    1.93  
    1.94 -# Get largest sample width
    1.95 -width=0
    1.96 -for sample in "${@}"; do
    1.97 -    [ ${#sample} -gt ${width} ] && width=${#sample}
    1.98 -done
    1.99 -
   1.100 -if [ "${opt}" = -w ]; then
   1.101 +if [ "${opt}" = "-w" -a ${#} -eq 0 ]; then
   1.102      printf "^ %s  |||||||||||||||\n" "$( date "+%Y%m%d.%H%M %z" )"
   1.103      printf "^ Target  "
   1.104      printf "^ Host  "
   1.105 @@ -174,20 +168,13 @@
   1.106      printf "^  Initially\\\\\\\\ reported by  "
   1.107      printf "^  Last\\\\\\\\ updated  "
   1.108      echo   "^"
   1.109 -elif [ -z "${opt}" ]; then
   1.110 -    printf "%-*s  Status\n" ${width} "Sample name"
   1.111 +    exit 0
   1.112 +elif [ "${opt}" = "-W" ]; then
   1.113 +    printf "^ Total: ${#} samples  || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is currently BROKEN. |||||||||||||"
   1.114 +    echo   ""
   1.115 +    exit 0
   1.116  fi
   1.117  
   1.118  for sample in "${@}"; do
   1.119 -    ( dump_single_sample ${opt} ${width} "${sample}" )
   1.120 +    ( dump_single_sample ${opt} "${sample}" )
   1.121  done
   1.122 -
   1.123 -if [ "${opt}" = -w ]; then
   1.124 -    printf "^ Total: ${#@} samples  || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is currently BROKEN. |||||||||||||"
   1.125 -    echo   ""
   1.126 -elif [ -z "${opt}" ]; then
   1.127 -    echo '      L (Local)       : sample was found in current directory'
   1.128 -    echo '      G (Global)      : sample was installed with crosstool-NG'
   1.129 -    echo '      X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
   1.130 -    echo '      B (BROKEN)      : sample is currently broken'
   1.131 -fi