/[CCFs]/bin/mtovccf
ViewVC logotype

Contents of /bin/mtovccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Mar 10 16:50:59 2015 UTC (9 years, 8 months ago) by ccflib
Branch: MAIN
Changes since 1.2: +24 -12 lines
Added parameter 1 to select all_ccfs file

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.2 2015/03/10 15:21:00 ccflib Exp $
9
10 VALID_CCF="/home/ccflib/valid_ccf"
11
12 if [ -z "$1" ] ; then
13 echo
14 echo "Use: mtovccf all_ccfs"
15 echo " File all_ccfs (without .txt ext) must be produced by mlovccf"
16 echo
17 exit
18 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
30
31 ccf_classes="${VALID_CCF}/ccf_classes.txt"
32
33 while read line
34 do
35 class=`echo $line | awk -F"_" '{print $1"_"$2}'`
36 echo $class >> ${ccf_classes}
37 done < ${VALID_CCF}/${all_ccfs}.txt
38
39 cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
40 mv ${VALID_CCF}/kk.txt ${ccf_classes}
41
42 # Output final file is named all_ccfs_table.txt
43
44 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}
49
50
51
52 echo "Table of valid CCFs at $now" >> ${all_ccfs_table}
53 echo >> ${all_ccfs_table}
54 echo "|================================|=============|" >> ${all_ccfs_table}
55 echo "| Calibration File | Issue range |" >> ${all_ccfs_table}
56 echo "|================================|=============|" >> ${all_ccfs_table}
57
58
59 while read ccf_class
60 do
61 echo -n "Processing class $ccf_class ..."
62 issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"
63 [ -f "${issues_file}" ] && rm ${issues_file}
64 while read line
65 do
66 class=`echo $line | awk -F"_" '{print $1"_"$2}'`
67 [ "$class" != "$ccf_class" ] && continue
68 issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`
69 echo $issue >> ${issues_file}
70 done < ${VALID_CCF}/${all_ccfs}.txt
71
72
73 cat ${issues_file} | sort -u > kk.txt
74 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}`
78 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
92 printf "| %-30s | %4s-%4s%3s|\n" ${ccf_class} ${first_issue} ${last_issue} ${asterisk} >> ${all_ccfs_table}
93 else
94 printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table}
95 fi
96
97 echo "done"
98 done < ${ccf_classes}
99
100 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}"

  ViewVC Help
Powered by ViewVC 1.1.27