/[CCFs]/bin/mtovccf
ViewVC logotype

Annotation of /bin/mtovccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Mon Sep 7 13:35:49 2015 UTC (9 years, 2 months ago) by ccflib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +58 -58 lines
aligned code with mlovccf

1 ccflib 1.1 #! /bin/bash
2    
3     # mtovccf (make tableof valid ccfs)
4     #
5     # 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
7     #
8 ccflib 1.4 # $Id: mtovccf,v 1.3 2015/03/10 16:50:59 ccflib Exp $
9 ccflib 1.1
10     VALID_CCF="/home/ccflib/valid_ccf"
11    
12 ccflib 1.4 now_table=`date +'%Y-%m-%dT%H:%M:%S'`
13    
14 ccflib 1.3 if [ -z "$1" ] ; then
15     echo
16 ccflib 1.4 echo "Use: mtovccf all_ccfs_YYYMMDD_HHMM"
17     echo " File all_ccfs_YYYMMDD_HHMM (without .txt ext) must be produced by mlovccf"
18 ccflib 1.3 echo
19 ccflib 1.1 exit
20     fi
21    
22 ccflib 1.3 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
27     fi
28    
29 ccflib 1.4 # Make a table of classes and issues type "Pipeline Release Notes"
30 ccflib 1.3
31 ccflib 1.1 # Lists all CCF classes
32    
33     ccf_classes="${VALID_CCF}/ccf_classes.txt"
34    
35     while read line
36 ccflib 1.4 do
37     class=`echo $line | awk -F"_" '{print $1"_"$2}'`
38 ccflib 1.1 echo $class >> ${ccf_classes}
39 ccflib 1.3 done < ${VALID_CCF}/${all_ccfs}.txt
40 ccflib 1.1
41     cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
42     mv ${VALID_CCF}/kk.txt ${ccf_classes}
43    
44 ccflib 1.4 # Output final file is named all_ccfs_${now}_table.txt
45 ccflib 1.1
46 ccflib 1.2 total_number_of_ccfs=0
47    
48 ccflib 1.3 all_ccfs_table="${VALID_CCF}/${all_ccfs}_table.txt"
49 ccflib 1.1
50     [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}
51    
52 ccflib 1.4 echo "Table of valid CCFs at $now_table" >> ${all_ccfs_table}
53     echo >> ${all_ccfs_table}
54     echo "|================================|=============|=======|" >> ${all_ccfs_table}
55     echo "| Calibration File | Issue range | Count |" >> ${all_ccfs_table}
56     echo "|================================|=============|=======|" >> ${all_ccfs_table}
57 ccflib 1.3
58 ccflib 1.4 while read ccf_class
59     do
60     echo -n "Processing class $ccf_class ..."
61     issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"
62     [ -f "${issues_file}" ] && rm ${issues_file}
63     while read line
64     do
65     class=`echo $line | awk -F"_" '{print $1"_"$2}'`
66     [ "$class" != "$ccf_class" ] && continue
67     issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`
68     echo $issue >> ${issues_file}
69     done < ${VALID_CCF}/${all_ccfs}.txt
70    
71     cat ${issues_file} | sort -u > kk.txt
72     mv kk.txt ${issues_file}
73     real_number_of_issues_for_this_class=`wc -l ${issues_file} | awk -F" " '{print $1}'`
74    
75     first_issue=`head -1 ${issues_file}`
76     last_issue=`tail -1 ${issues_file}`
77     li=$((10#$last_issue))
78     fi=$((10#$first_issue))
79 ccflib 1.2
80 ccflib 1.4 sequential_number_of_issues_for_this_class=$((li - fi + 1))
81 ccflib 1.1
82 ccflib 1.4 asterisk=" "
83     [ "${real_number_of_issues_for_this_class}" -lt "${sequential_number_of_issues_for_this_class}" ] && asterisk="(*)"
84 ccflib 1.1
85 ccflib 1.4 total_number_of_ccfs=$((real_number_of_issues_for_this_class + total_number_of_ccfs))
86 ccflib 1.1
87 ccflib 1.4 rn=$real_number_of_issues_for_this_class
88 ccflib 1.2
89 ccflib 1.4 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 ccflib 1.2 rm ${VALID_CCF}/ccf_classes.txt
108     rm ${VALID_CCF}/ccf_issues_for*.txt

  ViewVC Help
Powered by ViewVC 1.1.27