blob: 4fce96ec282c309ea6b483dbb945d4baed0b7d5e [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
rsc5fa03292006-07-23 14:41:55 +000013function clearstatus( noflush, i)
rsc32a580f2006-07-23 14:36:05 +000014{
15 if(!updates)
16 return
17 for(i=0; i<statuslen; i++)
18 printf("\b \b") >updates
19 statuslen = 0
rsc5fa03292006-07-23 14:41:55 +000020 if(!noflush)
21 fflush(updates)
rsc32a580f2006-07-23 14:36:05 +000022}
23
24function status(s)
25{
26 if(!updates)
27 return
rsc5fa03292006-07-23 14:41:55 +000028 clearstatus(1)
rsc32a580f2006-07-23 14:36:05 +000029 printf(" %s ", s) >updates
30 statuslen = length(s)+5
31 fflush(updates)
rscdc794ed2005-11-26 15:36:47 +000032}
33
rsc5348a602005-12-15 03:31:07 +000034debug!=0 { print "# " $0 }
rscdc794ed2005-11-26 15:36:47 +000035
36/^$/ { next }
37
rsc6637b802005-11-28 21:14:44 +000038/^echo cd / { next }
39/^\+\+ pwd/ { next }
40
rscdc794ed2005-11-26 15:36:47 +000041/^\* /{
rsc32a580f2006-07-23 14:36:05 +000042 clearstatus()
rscdc794ed2005-11-26 15:36:47 +000043 if(debug) print "% mark"
44 print >out
45 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000046 if(copy){
47 print >copy
48 fflush(copy)
49 }
rscdc794ed2005-11-26 15:36:47 +000050 cmd = ""
51 printtabs = 1 # print indented lines immediately following
52 errors = 0
53 next
54}
55
rsc5348a602005-12-15 03:31:07 +000056/^ / && printtabs!=0 {
rsc32a580f2006-07-23 14:36:05 +000057 clearstatus()
rscdc794ed2005-11-26 15:36:47 +000058 print >out
59 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000060 if(copy){
61 print >copy
62 fflush(copy)
63 }
rscdc794ed2005-11-26 15:36:47 +000064 next
65}
66
67{ printtabs = 0 }
68
Russ Cox77809fb2008-05-10 13:34:45 -040069/^(9a|9c|9l|9ar|9?install|cat pdf|cp|rm|mv|mk|9 yacc|9 lex|9 rc|do|for i|if|mk|gcc|cpp|cp|sh|cmp|rc|\.\/o)($|[^:])/ {
rscdc794ed2005-11-26 15:36:47 +000070 if(debug) print "% start"
71 errors = 0
72 cmd = ""
73 if(!verbose)
74 cmd = cmd cd
75 cmd = cmd $0 "\n"
76 next
77}
78
rsc5fa03292006-07-23 14:41:55 +000079/^cd .+; mk .+/ && !verbose {
80 dir = $2
81 sub(/;$/, "", dir)
82 status(dir " mk " $4)
83}
84
rscdc794ed2005-11-26 15:36:47 +000085/^cd / {
86 if(debug) print "% cd"
87 errors = 0
88 if(verbose){
89 print >out
90 fflush(out)
rsc32a580f2006-07-23 14:36:05 +000091 if(copy){
92 print >copy
93 fflush(copy)
94 }
95 }
rscdc794ed2005-11-26 15:36:47 +000096 cd = $0 "\n"
97 cmd = ""
98 next
99}
100
101{
102 cmd = cmd $0 "\n"
103}
104
rsc5348a602005-12-15 03:31:07 +0000105errors != 0 {
rsc32a580f2006-07-23 14:36:05 +0000106 clearstatus()
rscdc794ed2005-11-26 15:36:47 +0000107 if(debug) print "% errors"
108 printf "%s", cmd >out
109 fflush(out)
rsc32a580f2006-07-23 14:36:05 +0000110 if(copy){
111 printf "%s", cmd >copy
112 fflush(copy)
113 }
rscdc794ed2005-11-26 15:36:47 +0000114 cmd = ""
115 next
116}
117
118/^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {
119 next
120}
121
rsc5348a602005-12-15 03:31:07 +0000122/^(conflicts:)/ {
rscdc794ed2005-11-26 15:36:47 +0000123 if(debug) print "% skip1"
124 next
125}
126
rsc5348a602005-12-15 03:31:07 +0000127/(up to date|nothing to see|assuming it will be|loop not entered)/ {
rscdc794ed2005-11-26 15:36:47 +0000128 next
129}
130
131/(nodes\(%e\)|packed transitions)/ {
132 if(debug) print "% skip2"
133 next
134}
135
136{
137 # unexpected line
rsc32a580f2006-07-23 14:36:05 +0000138 clearstatus()
rscdc794ed2005-11-26 15:36:47 +0000139 if(debug) print "% errors1"
140 errors = 1
141 printf ">>> %s", cmd >out
142 fflush(out)
rsc32a580f2006-07-23 14:36:05 +0000143 if(copy){
144 printf ">>> %s", cmd >copy
145 fflush(copy)
146 }
rscdc794ed2005-11-26 15:36:47 +0000147 cmd = ""
148}
149