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 if(ENVIRON["winid"] != "") # running in acme window
12 updates = ""
13 }
15 function myflush(f)
16 {
17 # fflush is not available on sun, but system("") appears to work everywhere
18 system("")
19 }
21 function clearstatus(noflush, i)
22 {
23 if(!updates)
24 return
25 for(i=0; i<statuslen; i++)
26 printf("\b \b") >updates
27 statuslen = 0
28 if(!noflush)
29 myflush(updates)
30 }
32 function status(s)
33 {
34 if(!updates)
35 return
36 clearstatus(1)
37 printf(" %s ", s) >updates
38 statuslen = length(s)+5
39 myflush(updates)
40 }
42 debug!=0 { print "# " $0 }
44 /^$/ { next }
46 /^echo cd / { next }
47 /^\+\+ pwd/ { next }
49 /^\* /{
50 clearstatus()
51 if(debug) print "% mark"
52 print >out
53 myflush(out)
54 if(copy){
55 print >copy
56 myflush(copy)
57 }
58 cmd = ""
59 printtabs = 1 # print indented lines immediately following
60 errors = 0
61 next
62 }
64 /^ / && printtabs!=0 {
65 clearstatus()
66 print >out
67 myflush(out)
68 if(copy){
69 print >copy
70 myflush(copy)
71 }
72 next
73 }
75 { printtabs = 0 }
77 /^(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)($|[^:])/ {
78 if(debug) print "% start"
79 errors = 0
80 cmd = ""
81 if(!verbose)
82 cmd = cmd cd
83 cmd = cmd $0 "\n"
84 next
85 }
87 /^cd .+; mk .+/ && !verbose {
88 dir = $2
89 sub(/;$/, "", dir)
90 status(dir " mk " $4)
91 }
93 /^cd / {
94 if(debug) print "% cd"
95 errors = 0
96 if(verbose){
97 print >out
98 myflush(out)
99 if(copy){
100 print >copy
101 myflush(copy)
104 cd = $0 "\n"
105 cmd = ""
106 next
110 cmd = cmd $0 "\n"
113 errors != 0 {
114 clearstatus()
115 if(debug) print "% errors"
116 printf "%s", cmd >out
117 myflush(out)
118 if(copy){
119 printf "%s", cmd >copy
120 myflush(copy)
122 cmd = ""
123 next
126 /^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {
127 next
130 /^(conflicts:)/ {
131 if(debug) print "% skip1"
132 next
135 /(up to date|nothing to see|assuming it will be|loop not entered|# WSYSTYPE)/ {
136 next
139 /(nodes\(%e\)|packed transitions)/ {
140 if(debug) print "% skip2"
141 next
145 # unexpected line
146 clearstatus()
147 if(debug) print "% errors1"
148 errors = 1
149 printf ">>> %s", cmd >out
150 myflush(out)
151 if(copy){
152 printf ">>> %s", cmd >copy
153 myflush(copy)
155 cmd = ""