/[CCFs]/bin/mtovccf
ViewVC logotype

Contents of /bin/mtovccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show 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
Error occurred while calculating annotation data.
aligned code with mlovccf

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 # $Id: mtovccf,v 1.3 2015/03/10 16:50:59 ccflib Exp $
9
10 VALID_CCF="/home/ccflib/valid_ccf"
11
12 now_table=`date +'%Y-%m-%dT%H:%M:%S'`
13
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
27 fi
28
29 # Make a table of classes and issues type "Pipeline Release Notes"
30
31 # Lists all CCF classes
32
33 ccf_classes="${VALID_CCF}/ccf_classes.txt"
34
35 while read line
36 do
37 class=`echo $line | awk -F"_" '{print $1"_"$2}'`
38 echo $class >> ${ccf_classes}
39 done < ${VALID_CCF}/${all_ccfs}.txt
40
41 cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
42 mv ${VALID_CCF}/kk.txt ${ccf_classes}
43
44 # Output final file is named all_ccfs_${now}_table.txt
45
46 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}
51
52 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
58 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
80 sequential_number_of_issues_for_this_class=$((li - fi + 1))
81
82 asterisk=" "
83 [ "${real_number_of_issues_for_this_class}" -lt "${sequential_number_of_issues_for_this_class}" ] && asterisk="(*)"
84
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

  ViewVC Help
Powered by ViewVC 1.1.27