/[CCFs]/bin/mtovccf
ViewVC logotype

Diff of /bin/mtovccf

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ccflib, Tue Mar 10 13:28:13 2015 UTC revision 1.3 by ccflib, Tue Mar 10 16:50:59 2015 UTC
# Line 5  Line 5 
5  # Make a table of classes and issues type "Pipeline Release Notes"  # Make a table of classes and issues type "Pipeline Release Notes"
6  # Requires that mlovccf has been run before to produce the all_ccfs.txt file  # Requires that mlovccf has been run before to produce the all_ccfs.txt file
7  #  #
8  # $Id$  # $Id: mtovccf,v 1.2 2015/03/10 15:21:00 ccflib Exp $
9    
10  VALID_CCF="/home/ccflib/valid_ccf"  VALID_CCF="/home/ccflib/valid_ccf"
11    
12  if [ ! -f "${VALID_CCF}/all_ccfs.txt" ] ; then  if [ -z "$1" ] ; then
13          echo "Error: Please run first mlovccf"          echo
14            echo "Use: mtovccf all_ccfs"
15            echo "     File all_ccfs (without .txt ext) must be produced by mlovccf"
16            echo    
17          exit          exit
18  fi  fi
19    
20    all_ccfs=$1
21    
22    if [ ! -f "${VALID_CCF}/${all_ccfs}.txt" ] ; then
23            echo "Error: Cannot find ${all_ccfs}.txt in directory ${VALID_CCF}"
24            exit
25    fi
26    
27    now=`date +'%Y-%M-%dT%H:%M:%S'`
28    
29  # Lists all CCF classes  # Lists all CCF classes
30    
31  ccf_classes="${VALID_CCF}/ccf_classes.txt"  ccf_classes="${VALID_CCF}/ccf_classes.txt"
# Line 22  while read line Line 34  while read line
34  do  do
35          class=`echo $line | awk -F"_" '{print $1"_"$2}'`          class=`echo $line | awk -F"_" '{print $1"_"$2}'`
36          echo $class >> ${ccf_classes}          echo $class >> ${ccf_classes}
37  done < ${VALID_CCF}/all_ccfs.txt  done < ${VALID_CCF}/${all_ccfs}.txt
38    
39  cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt  cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
40  mv ${VALID_CCF}/kk.txt ${ccf_classes}  mv ${VALID_CCF}/kk.txt ${ccf_classes}
41    
42  # Output final file is named all_ccfs_table.txt  # Output final file is named all_ccfs_table.txt
43    
44  all_ccfs_table="${VALID_CCF}/all_ccfs_table.txt"  total_number_of_ccfs=0
45    
46    all_ccfs_table="${VALID_CCF}/${all_ccfs}_table.txt"
47    
48  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}  [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}
49    
50    
51    
52    echo "Table of valid CCFs at $now"                      >> ${all_ccfs_table}
53    echo                                                    >> ${all_ccfs_table}
54  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|" >> ${all_ccfs_table}
55  echo "| Calibration File               | Issue range |" >> ${all_ccfs_table}  echo "| Calibration File               | Issue range |" >> ${all_ccfs_table}
56  echo "|================================|=============|" >> ${all_ccfs_table}  echo "|================================|=============|" >> ${all_ccfs_table}
57    
58    
59  while read ccf_class  while read ccf_class
60  do  do
61            echo -n "Processing class $ccf_class ..."
62          issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"          issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"
63          [ -f "${issues_file}" ] && rm ${issues_file}          [ -f "${issues_file}" ] && rm ${issues_file}
64          while read line          while read line
# Line 47  do Line 67  do
67                  [ "$class" != "$ccf_class" ] && continue                  [ "$class" != "$ccf_class" ] && continue
68                  issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`                  issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`
69                  echo $issue >> ${issues_file}                  echo $issue >> ${issues_file}
70          done < ${VALID_CCF}/all_ccfs.txt          done < ${VALID_CCF}/${all_ccfs}.txt
71    
72    
73          cat ${issues_file} | sort -u > kk.txt          cat ${issues_file} | sort -u > kk.txt
74          mv kk.txt ${issues_file}          mv kk.txt ${issues_file}
75            real_number_of_issues_for_this_class=`wc -l ${issues_file} | awk -F" " '{print $1}'`
76    
77          first_issue=`head -1 ${issues_file}`          first_issue=`head -1 ${issues_file}`
78          last_issue=`tail -1 ${issues_file}`          last_issue=`tail -1 ${issues_file}`
79    
80            li=$((10#$last_issue))
81            fi=$((10#$first_issue))
82    
83            sequential_number_of_issues_for_this_class=$(($li - $fi + 1))
84            if [ "${real_number_of_issues_for_this_class}"  -lt "${sequential_number_of_issues_for_this_class}" ] ; then
85                    asterisk="(*)"
86            else
87                    asterisk="   "
88            fi
89            total_number_of_ccfs=$(($real_number_of_issues_for_this_class + $total_number_of_ccfs))
90    
91          if [ "${first_issue}" != "${last_issue}" ] ; then          if [ "${first_issue}" != "${last_issue}" ] ; then
92                  printf "| %-30s | %4s-%4s   |\n" ${ccf_class} ${first_issue} ${last_issue} >> ${all_ccfs_table}                  printf "| %-30s | %4s-%4s%3s|\n" ${ccf_class} ${first_issue} ${last_issue} ${asterisk} >> ${all_ccfs_table}
93          else          else
94                  printf "| %-30s | %4s        |\n" ${ccf_class} ${first_issue}              >> ${all_ccfs_table}                  printf "| %-30s | %4s        |\n" ${ccf_class} ${first_issue}                          >> ${all_ccfs_table}
95          fi          fi
96        
97            echo "done"
98  done < ${ccf_classes}    done < ${ccf_classes}  
99    
100  echo "|================================|=============|"                                    >> ${all_ccfs_table}  echo "|================================|=============|"                                                >> ${all_ccfs_table}
101    echo                                                                                                   >> ${all_ccfs_table}
102    echo "(*): Some issues in the range are not required."                                                 >> ${all_ccfs_table}
103    rm ${VALID_CCF}/ccf_classes.txt
104    rm ${VALID_CCF}/ccf_issues_for*.txt
105    
106    
107    
108    echo ; echo "Number of valid CCFs required as of $now : ${total_number_of_ccfs}"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.27