Debian Codegraph @

tests/aslts/bin/bugstate/parsebuglist

raw symbols SCIP
1 #!/bin/bash
2 #
3 # @echo off
4 #
5 # Parse the Bug List output file (ID State Result Component)
6 #
7 # Parameters:
8 #
9 # arg1 - pathname of file with the Bug List
10
11 # Includes
12
13 . common
14 . settings
15
16 # ID State Result Component
17 #
18 # State:=[NEW|RESO|CLOS|ASSI|REJE|NEED]
19 # Result:=[CODE|PATC|DOCU|FIXE|INVA]
20 #
21 # State entries:
22 #
23 # NEW == NEW
24 # RESO == RESOLVED
25 # CLOS == CLOSED
26 # ASSI == ASSIGNED
27 # REJE == REJECTED
28 # NEED == NEEDINFO
29 #
30 # Result entries:
31 #
32 # FIXE == FIXED
33 # INVA == INVALID
34 # CODE == CODE_FIX
35 # PATC == PATCH_ALREADY_AVAILABLE
36 # DOCU == DOCUMENTED
37
38 get_summary()
39 {
40 # echo "=====================$s0:$s1:$s2:$s3:$s4:$s5:$line"
41
42 ID="$s0"
43 State="$s1"
44 Result=
45 Component=
46
47 if [ "$State" == RESO\
48 -o "$State" == CLOS\
49 -o "$State" == REJE ]; then
50 Result="$s2"
51 if [ "x$s4" == x ]; then
52 Component="$s3"
53 else
54 Component="$s3 $s4"
55 fi
56 else
57 if [ "$State" != NEW\
58 -a "$State" != NEED\
59 -a "$State" != ASSI ]; then
60 echo "ERROR 0: get_summary, <$State>"
61 CountERR=$[ $CountERR + 1 ]
62 else
63 if [ "x$s3" == x ]; then
64 Component="$s2"
65 else
66 Component="$s2 $s3"
67 fi
68 fi
69 fi
70
71 echo "$ID:$State: Exp $Result:$Component:"
72 }
73
74 # arg1 - pathname of file with the Bug List
75 do_summary()
76 {
77 started=
78
79 OLD_IFS=$IFS
80 IFS=" "
81
82 cat "$1" |\
83 while [ 1 ]
84 do
85 read s0 s1 s2 s3 s4 s5 line
86 if [ $? -ne 0 ] ; then
87 # echo "Number of the table inconsistency errors: CountERR = $CountERR"
88 if [ "$CountERR" != 0 ]; then
89 return 1
90 fi
91 break
92 fi
93
94 if [ "$s1" == bugs -a "$s2" == "found." ]; then
95 if [ "$started" == yes ]; then
96 started=no
97 else
98 started=yes
99 fi
100 elif [ "$started" == yes ]; then
101 get_summary
102 fi
103 done
104
105 ret=$?
106
107 IFS=$OLD_IFS
108
109 if [ $ret -ne 0 ]; then
110 return 1
111 fi
112 }
113
114 # ############################## MAIN ###############################
115
116 PATHNAME="$1"
117 UTILSTATUS=0
118 SUMMARY=
119 CountERR=0
120
121 # echo "Parse the Bug List output file:"
122 # echo " $PATHNAME"
123
124 if [ ! -f "$PATHNAME" ]; then
125 do_exit 1 "It is not file: <$PATHNAME>"
126 fi
127
128 do_summary "$PATHNAME"
129 if [ $? -ne 0 ]; then
130 do_exit 1 "parsebuglist failed"
131 else
132 exit 0
133 fi
134