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$ |
9 |
|
10 |
VALID_CCF="/home/ccflib/valid_ccf" |
11 |
|
12 |
if [ ! -f "${VALID_CCF}/all_ccfs.txt" ] ; then |
13 |
echo "Error: Please run first mlovccf" |
14 |
exit |
15 |
fi |
16 |
|
17 |
# Lists all CCF classes |
18 |
|
19 |
ccf_classes="${VALID_CCF}/ccf_classes.txt" |
20 |
|
21 |
while read line |
22 |
do |
23 |
class=`echo $line | awk -F"_" '{print $1"_"$2}'` |
24 |
echo $class >> ${ccf_classes} |
25 |
done < ${VALID_CCF}/all_ccfs.txt |
26 |
|
27 |
cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt |
28 |
mv ${VALID_CCF}/kk.txt ${ccf_classes} |
29 |
|
30 |
# Output final file is named all_ccfs_table.txt |
31 |
|
32 |
all_ccfs_table="${VALID_CCF}/all_ccfs_table.txt" |
33 |
|
34 |
[ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table} |
35 |
|
36 |
echo "|================================|=============|" >> ${all_ccfs_table} |
37 |
echo "| Calibration File | Issue range |" >> ${all_ccfs_table} |
38 |
echo "|================================|=============|" >> ${all_ccfs_table} |
39 |
|
40 |
while read ccf_class |
41 |
do |
42 |
issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt" |
43 |
[ -f "${issues_file}" ] && rm ${issues_file} |
44 |
while read line |
45 |
do |
46 |
class=`echo $line | awk -F"_" '{print $1"_"$2}'` |
47 |
[ "$class" != "$ccf_class" ] && continue |
48 |
issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1` |
49 |
echo $issue >> ${issues_file} |
50 |
done < ${VALID_CCF}/all_ccfs.txt |
51 |
|
52 |
cat ${issues_file} | sort -u > kk.txt |
53 |
mv kk.txt ${issues_file} |
54 |
|
55 |
first_issue=`head -1 ${issues_file}` |
56 |
last_issue=`tail -1 ${issues_file}` |
57 |
|
58 |
if [ "${first_issue}" != "${last_issue}" ] ; then |
59 |
printf "| %-30s | %4s-%4s |\n" ${ccf_class} ${first_issue} ${last_issue} >> ${all_ccfs_table} |
60 |
else |
61 |
printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table} |
62 |
fi |
63 |
|
64 |
done < ${ccf_classes} |
65 |
|
66 |
echo "|================================|=============|" >> ${all_ccfs_table} |