blob: cb29eb3105da2691c78e3c5d9e716d51c8daf546 [file] [log] [blame]
rscdc794ed2005-11-26 15:36:47 +00001# Summarize the installation log, printing errors along with
2# enough context to make sense of them.
3
4BEGIN {
5# print verbose
6 cd = ""
rsc5348a602005-12-15 03:31:07 +00007 out = "/dev/stdout"
rsc32a580f2006-07-23 14:36:05 +00008 statuslen = 0
rsc5348a602005-12-15 03:31:07 +00009 debug = 0
rsc32a580f2006-07-23 14:36:05 +000010 updates = "/dev/stderr"
11}
12
13function clearstatus( i)
14{
15 if(!updates)
16 return
17 for(i=0; i<statuslen; i++)
18 printf("\b \b") >updates
19 statuslen = 0
20 fflush(updates)
21}
22
23function status(s)
24{
25 if(!updates)
26 return
27 clearstatus()
28 printf(" %s ", s) >updates
29 statuslen = length(s)+5
30 fflush(updates)
rscdc794ed2005-11-26 15:36:47 +000031}
32
rsc5348a602005-12-15 03:31:07 +000033debug!=0 { print "# " $0 }
rscdc794ed2005-11-26 15:36:47 +000034
35/^$/ { next }
36
rsc6637b802005-11-28 21:14:44 +000037/^echo cd / { next }
38/^\+\+ pwd/ { next }
39
rscdc794ed2005-11-26 15:36:47 +000040/^\* /{
rsc32a580f2006-07-23 14:36:05 +000041 clearstatus()
rscdc794ed2005-11-26 15:36:47 +000042 if(debug) print "% mark"
43 print >out
44 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000045 if(copy){
46 print >copy
47 fflush(copy)
48 }
rscdc794ed2005-11-26 15:36:47 +000049 cmd = ""
50 printtabs = 1 # print indented lines immediately following
51 errors = 0
52 next
53}
54
rsc5348a602005-12-15 03:31:07 +000055/^ / && printtabs!=0 {
rsc32a580f2006-07-23 14:36:05 +000056 clearstatus()
rscdc794ed2005-11-26 15:36:47 +000057 print >out
58 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000059 if(copy){
60 print >copy
61 fflush(copy)
62 }
rscdc794ed2005-11-26 15:36:47 +000063 next
64}
65
66{ printtabs = 0 }
67
68/^(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)($|[^:])/ {
69 if(debug) print "% start"
70 errors = 0
71 cmd = ""
72 if(!verbose)
73 cmd = cmd cd
74 cmd = cmd $0 "\n"
75 next
76}
77
78/^cd / {
79 if(debug) print "% cd"
80 errors = 0
81 if(verbose){
82 print >out
83 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000084 if(copy){
85 print >copy
86 fflush(copy)
87 }
88 }
89 else{
90 dir = $2
91 sub(/;$/, "", dir)
92 status(dir)
rscdc794ed2005-11-26 15:36:47 +000093 }
94 cd = $0 "\n"
95 cmd = ""
96 next
97}
98
99{
100 cmd = cmd $0 "\n"
101}
102
rsc5348a602005-12-15 03:31:07 +0000103errors != 0 {
rsc32a580f2006-07-23 14:36:05 +0000104 clearstatus()
rscdc794ed2005-11-26 15:36:47 +0000105 if(debug) print "% errors"
106 printf "%s", cmd >out
107 fflush(out)
rsc32a580f2006-07-23 14:36:05 +0000108 if(copy){
109 printf "%s", cmd >copy
110 fflush(copy)
111 }
rscdc794ed2005-11-26 15:36:47 +0000112 cmd = ""
113 next
114}
115
116/^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {
117 next
118}
119
rsc5348a602005-12-15 03:31:07 +0000120/^(conflicts:)/ {
rscdc794ed2005-11-26 15:36:47 +0000121 if(debug) print "% skip1"
122 next
123}
124
rsc5348a602005-12-15 03:31:07 +0000125/(up to date|nothing to see|assuming it will be|loop not entered)/ {
rscdc794ed2005-11-26 15:36:47 +0000126 next
127}
128
129/(nodes\(%e\)|packed transitions)/ {
130 if(debug) print "% skip2"
131 next
132}
133
134{
135 # unexpected line
rsc32a580f2006-07-23 14:36:05 +0000136 clearstatus()
rscdc794ed2005-11-26 15:36:47 +0000137 if(debug) print "% errors1"
138 errors = 1
139 printf ">>> %s", cmd >out
140 fflush(out)
rsc32a580f2006-07-23 14:36:05 +0000141 if(copy){
142 printf ">>> %s", cmd >copy
143 fflush(copy)
144 }
rscdc794ed2005-11-26 15:36:47 +0000145 cmd = ""
146}
147