Blob


1 # Summarize the installation log, printing errors along with
2 # enough context to make sense of them.
4 BEGIN {
5 # print verbose
6 cd = ""
7 out = "/dev/stdout"
8 statuslen = 0
9 debug = 0
10 updates = "/dev/stderr"
11 }
13 function clearstatus( noflush, i)
14 {
15 if(!updates)
16 return
17 for(i=0; i<statuslen; i++)
18 printf("\b \b") >updates
19 statuslen = 0
20 if(!noflush)
21 fflush(updates)
22 }
24 function status(s)
25 {
26 if(!updates)
27 return
28 clearstatus(1)
29 printf(" %s ", s) >updates
30 statuslen = length(s)+5
31 fflush(updates)
32 }
34 debug!=0 { print "# " $0 }
36 /^$/ { next }
38 /^echo cd / { next }
39 /^\+\+ pwd/ { next }
41 /^\* /{
42 clearstatus()
43 if(debug) print "% mark"
44 print >out
45 fflush(out)
46 if(copy){
47 print >copy
48 fflush(copy)
49 }
50 cmd = ""
51 printtabs = 1 # print indented lines immediately following
52 errors = 0
53 next
54 }
56 /^ / && printtabs!=0 {
57 clearstatus()
58 print >out
59 fflush(out)
60 if(copy){
61 print >copy
62 fflush(copy)
63 }
64 next
65 }
67 { printtabs = 0 }
69 /^(9a|9c|9l|9ar|9?install|cp|rm|mv|mk|9 yacc|9 lex|9 rc|do|for i|if|mk|gcc|cpp|cp|sh|cmp|rc|\.\/o)($|[^:])/ {
70 if(debug) print "% start"
71 errors = 0
72 cmd = ""
73 if(!verbose)
74 cmd = cmd cd
75 cmd = cmd $0 "\n"
76 next
77 }
79 /^cd .+; mk .+/ && !verbose {
80 dir = $2
81 sub(/;$/, "", dir)
82 status(dir " mk " $4)
83 }
85 /^cd / {
86 if(debug) print "% cd"
87 errors = 0
88 if(verbose){
89 print >out
90 fflush(out)
91 if(copy){
92 print >copy
93 fflush(copy)
94 }
95 }
96 cd = $0 "\n"
97 cmd = ""
98 next
99 }
102 cmd = cmd $0 "\n"
105 errors != 0 {
106 clearstatus()
107 if(debug) print "% errors"
108 printf "%s", cmd >out
109 fflush(out)
110 if(copy){
111 printf "%s", cmd >copy
112 fflush(copy)
114 cmd = ""
115 next
118 /^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {
119 next
122 /^(conflicts:)/ {
123 if(debug) print "% skip1"
124 next
127 /(up to date|nothing to see|assuming it will be|loop not entered)/ {
128 next
131 /(nodes\(%e\)|packed transitions)/ {
132 if(debug) print "% skip2"
133 next
137 # unexpected line
138 clearstatus()
139 if(debug) print "% errors1"
140 errors = 1
141 printf ">>> %s", cmd >out
142 fflush(out)
143 if(copy){
144 printf ">>> %s", cmd >copy
145 fflush(copy)
147 cmd = ""