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

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

  ViewVC Help
Powered by ViewVC 1.1.27