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.1 2015/03/10 13:28:13 ccflib Exp $ |
9 |
|
|
10 |
VALID_CCF="/home/ccflib/valid_ccf" |
VALID_CCF="/home/ccflib/valid_ccf" |
11 |
|
|
29 |
|
|
30 |
# Output final file is named all_ccfs_table.txt |
# Output final file is named all_ccfs_table.txt |
31 |
|
|
32 |
|
total_number_of_ccfs=0 |
33 |
|
|
34 |
all_ccfs_table="${VALID_CCF}/all_ccfs_table.txt" |
all_ccfs_table="${VALID_CCF}/all_ccfs_table.txt" |
35 |
|
|
36 |
[ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table} |
[ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table} |
37 |
|
|
38 |
|
now=`date +'%Y-%M-%dT%H:%M:%S'` |
39 |
|
|
40 |
|
echo "Table of valid CCFs at $now" >> ${all_ccfs_table} |
41 |
|
echo >> ${all_ccfs_table} |
42 |
echo "|================================|=============|" >> ${all_ccfs_table} |
echo "|================================|=============|" >> ${all_ccfs_table} |
43 |
echo "| Calibration File | Issue range |" >> ${all_ccfs_table} |
echo "| Calibration File | Issue range |" >> ${all_ccfs_table} |
44 |
echo "|================================|=============|" >> ${all_ccfs_table} |
echo "|================================|=============|" >> ${all_ccfs_table} |
45 |
|
|
46 |
|
|
47 |
while read ccf_class |
while read ccf_class |
48 |
do |
do |
49 |
|
echo -n "Processing class $ccf_class ..." |
50 |
issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt" |
issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt" |
51 |
[ -f "${issues_file}" ] && rm ${issues_file} |
[ -f "${issues_file}" ] && rm ${issues_file} |
52 |
while read line |
while read line |
57 |
echo $issue >> ${issues_file} |
echo $issue >> ${issues_file} |
58 |
done < ${VALID_CCF}/all_ccfs.txt |
done < ${VALID_CCF}/all_ccfs.txt |
59 |
|
|
60 |
|
|
61 |
cat ${issues_file} | sort -u > kk.txt |
cat ${issues_file} | sort -u > kk.txt |
62 |
mv kk.txt ${issues_file} |
mv kk.txt ${issues_file} |
63 |
|
real_number_of_issues_for_this_class=`wc -l ${issues_file} | awk -F" " '{print $1}'` |
64 |
|
|
65 |
first_issue=`head -1 ${issues_file}` |
first_issue=`head -1 ${issues_file}` |
66 |
last_issue=`tail -1 ${issues_file}` |
last_issue=`tail -1 ${issues_file}` |
67 |
|
|
68 |
|
li=$((10#$last_issue)) |
69 |
|
fi=$((10#$first_issue)) |
70 |
|
|
71 |
|
sequential_number_of_issues_for_this_class=$(($li - $fi + 1)) |
72 |
|
if [ "${real_number_of_issues_for_this_class}" -lt "${sequential_number_of_issues_for_this_class}" ] ; then |
73 |
|
asterisk="(*)" |
74 |
|
else |
75 |
|
asterisk=" " |
76 |
|
fi |
77 |
|
total_number_of_ccfs=$(($real_number_of_issues_for_this_class + $total_number_of_ccfs)) |
78 |
|
|
79 |
if [ "${first_issue}" != "${last_issue}" ] ; then |
if [ "${first_issue}" != "${last_issue}" ] ; then |
80 |
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} |
81 |
else |
else |
82 |
printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table} |
printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table} |
83 |
fi |
fi |
84 |
|
|
85 |
|
echo "done" |
86 |
done < ${ccf_classes} |
done < ${ccf_classes} |
87 |
|
|
88 |
echo "|================================|=============|" >> ${all_ccfs_table} |
echo "|================================|=============|" >> ${all_ccfs_table} |
89 |
|
echo >> ${all_ccfs_table} |
90 |
|
echo "(*): Some issues in the range are not required." >> ${all_ccfs_table} |
91 |
|
rm ${VALID_CCF}/ccf_classes.txt |
92 |
|
rm ${VALID_CCF}/ccf_issues_for*.txt |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
echo ; echo "Number of valid CCFs required at $now : ${total_number_of_ccfs}" |