scripts/showSamples.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Sep 04 15:42:25 2008 +0000 (2008-09-04)
changeset 828 f11e2ba89d7f
parent 825 7e90583334e0
child 850 ef8549b58b6f
permissions -rwxr-xr-x
Dump the EXPERIMENTAL status and brokenness of samples in the WiKi table.

/trunk/scripts/showSamples.sh | 9 7 2 0 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
     1 #!/bin/bash
     2 
     3 # Parses all samples on the command line, and for each of them, prints
     4 # the versions of the main tools
     5 
     6 [ "$1" = "-v" ] && opt="$1" && shift
     7 [ "$1" = "-w" ] && opt="$1" && shift
     8 
     9 # GREP_OPTIONS screws things up.
    10 export GREP_OPTIONS=
    11 
    12 # Dump a single sample
    13 dump_single_sample() {
    14     local verbose=0
    15     [ "$1" = "-v" ] && verbose=1 && shift
    16     [ "$1" = "-w" ] && wiki=1 && shift
    17     local width="$1"
    18     local sample="$2"
    19     if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
    20         sample_top="${CT_TOP_DIR}"
    21         sample_type="l"
    22     else
    23         sample_top="${CT_LIB_DIR}"
    24         sample_type="g"
    25     fi
    26     . "${sample_top}/samples/${sample}/crosstool.config"
    27     if [ -z "${wiki}" ]; then
    28         printf "  %-*s  [%s" ${width} "${sample}" "${sample_type}"
    29         [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf " "
    30         [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf " "
    31         echo "]"
    32         if [ ${verbose} -ne 0 ]; then
    33             echo    "    OS        : ${CT_KERNEL}-${CT_KERNEL_VERSION}"
    34             if [ "${CT_GMP_MPFR}" = "y" ]; then
    35                 echo    "    GMP/MPFR  : gmp-${CT_GMP_VERSION} / mpfr-${CT_MPFR_VERSION}"
    36             fi
    37             echo    "    binutils  : binutils-${CT_BINUTILS_VERSION}"
    38             printf  "    C compiler: ${CT_CC}-${CT_CC_VERSION} (C"
    39             [ "${CT_CC_LANG_CXX}" = "y"     ] && printf ",C++"
    40             [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
    41             [ "${CT_CC_LANG_JAVA}" = "y"    ] && printf ",Java"
    42             [ "${CT_CC_LANG_ADA}" = "y"     ] && printf ",ADA"
    43             [ "${CT_CC_LANG_OBJC}" = "y"    ] && printf ",Objective-C"
    44             [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ",Objective-C++"
    45             [ -n "${CT_CC_LANG_OTHERS}"     ] && printf ",${CT_CC_LANG_OTHERS}"
    46             echo    ")"
    47             echo    "    C library : ${CT_LIBC}-${CT_LIBC_VERSION}"
    48             printf  "    Tools     :"
    49             [ "${CT_LIBELF}"  ] && printf " libelf-${CT_LIBELF_VERSION}"
    50             [ "${CT_SSTRIP}"  ] && printf " sstrip"
    51             [ "${CT_DMALLOC}" ] && printf " dmalloc-${CT_DMALLOC_VERSION}"
    52             [ "${CT_DUMA}"    ] && printf " duma-${CT_DUMA_VERSION}"
    53             [ "${CT_GDB}"     ] && printf " gdb-${CT_GDB_VERSION}"
    54             [ "${CT_LTRACE}"  ] && printf " ltrace-${CT_LTRACE_VERSION}"
    55             [ "${CT_STRACE}"  ] && printf " strace-${CT_STRACE_VERSION}"
    56             echo
    57         fi
    58     else
    59         printf "| ''${sample}''  "
    60         printf "|  "
    61         [ "${CT_EXPERIMENTAL}" = "y" ] && printf "X"
    62         [ -f "${sample_top}/samples/${sample}/broken" ] && printf "B"
    63         printf '  '
    64         printf "|  ''${CT_KERNEL}''  "
    65         if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" = "y" ]; then
    66             printf "|  //custom//  "
    67         else
    68             printf "|  ${CT_KERNEL_VERSION}  "
    69         fi
    70         printf "|  ${CT_BINUTILS_VERSION}  "
    71         printf "|  ''${CT_CC}''  "
    72         printf "|  ${CT_CC_VERSION}  "
    73         printf "|  ''${CT_LIBC}''  "
    74         printf "|  ${CT_LIBC_VERSION}  "
    75         printf "|  ${CT_THREADS_NPTL:+NPTL}${CT_THREADS_LINUXTHREADS:+linuxthreads}${CT_THREADS_NONE:+none}  "
    76         printf "|  ${CT_ARCH_FLOAT_HW:+hard}${CT_ARCH_FLOAT_SW:+soft} float  "
    77         printf "|  C"
    78         [ "${CT_CC_LANG_CXX}" = "y"     ] && printf ", C++"
    79         [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ", Fortran"
    80         [ "${CT_CC_LANG_JAVA}" = "y"    ] && printf ", Java"
    81         [ "${CT_CC_LANG_ADA}" = "y"     ] && printf ", ADA"
    82         [ "${CT_CC_LANG_OBJC}" = "y"    ] && printf ", Objective-C"
    83         [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && printf ", Objective-C++"
    84         [ -n "${CT_CC_LANG_OTHERS}"     ] && printf "\\\\\\\\ Others: ${CT_CC_LANG_OTHERS}"
    85         printf "  "
    86         if [ -f "${sample_top}/samples/${sample}/reported.by" ]; then
    87             ( . "${sample_top}/samples/${sample}/reported.by"
    88               if [ -n "${reporter_url}" ]; then
    89                   printf "|  [[${reporter_url}|${reporter_name}]]  "
    90               else
    91                   printf "|  ${reporter_name}  "
    92               fi
    93             )
    94         else
    95             printf "|  [[http://ymorin.is-a-geek.org/|YEM]]  "
    96         fi
    97         sample_updated=$(date -u "+%Y%m%d"                                                  \
    98                               -d "$(LC_ALL=C svn info ${sample_top}/samples/${sample}       \
    99                                     |GREP_OPTIONS= egrep '^Last Changed Date:'              \
   100                                     |sed -r -e 's/^[^:]+: //;'                              \
   101                                             -e 's/^(.+:.. [+-][[:digit:]]{4}) \(.+\)$/\1/;' \
   102                                    )"                                                       \
   103                         )
   104         printf "|  ${sample_updated}  "
   105         echo "|"
   106     fi
   107 }
   108 
   109 # Get largest sample width
   110 width=0
   111 for sample in "${@}"; do
   112     [ ${#sample} -gt ${width} ] && width=${#sample}
   113 done
   114 
   115 if [ "${opt}" = -w ]; then
   116     echo "^ @@DATE@@  ^ |||||||||||||"
   117     printf "^ Target "
   118     printf "^  Status  "
   119     printf "^  Kernel headers\\\\\\\\ version  ^"
   120     printf "^  binutils version  "
   121     printf "^  C compiler\\\\\\\\ version  ^"
   122     printf "^  C library version  ^"
   123     printf "^  Threading model  "
   124     printf "^  Floating point\\\\\\\\ support  "
   125     printf "^  Languages  "
   126     printf "^  Initially\\\\\\\\ reported by  "
   127     printf "^  Last\\\\\\\\ updated  "
   128     echo   "^"
   129 fi
   130 
   131 for sample in "${@}"; do
   132     ( dump_single_sample ${opt} ${width} "${sample}" )
   133 done
   134 
   135 if [ "${opt}" = -w ]; then
   136     printf "^ Total: ${#@} samples  | ''X'': sample uses features marked as being EXPERIMENTAL.\\\\\\\\ ''B'': Samples is curently BROKEN. |||||||||||||"
   137     echo   ""
   138 elif [ -z "${opt}" ]; then
   139     echo '      l (local)       : sample was found in current directory'
   140     echo '      g (global)      : sample was installed with crosstool-NG'
   141     echo '      X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
   142     echo '      B (BORKEN)      : sample is currently broken'
   143 fi