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 myflush(f)
14 {
15 # fflush is not available on sun, but system("") appears to work everywhere
16 system("")
17 }
19 function clearstatus(noflush, i)
20 {
21 if(!updates)
22 return
23 for(i=0; i<statuslen; i++)
24 printf("\b \b") >updates
25 statuslen = 0
26 if(!noflush)
27 myflush(updates)
28 }
30 function status(s)
31 {
32 if(!updates)
33 return
34 clearstatus(1)
35 printf(" %s ", s) >updates
36 statuslen = length(s)+5
37 myflush(updates)
38 }
40 debug!=0 { print "# " $0 }
42 /^$/ { next }
44 /^echo cd / { next }
45 /^\+\+ pwd/ { next }
47 /^\* /{
48 clearstatus()
49 if(debug) print "% mark"
50 print >out
51 myflush(out)
52 if(copy){
53 print >copy
54 myflush(copy)
55 }
56 cmd = ""
57 printtabs = 1 # print indented lines immediately following
58 errors = 0
59 next
60 }
62 /^ / && printtabs!=0 {
63 clearstatus()
64 print >out
65 myflush(out)
66 if(copy){
67 print >copy
68 myflush(copy)
69 }
70 next
71 }
73 { printtabs = 0 }
75 /^(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)($|[^:])/ {
76 if(debug) print "% start"
77 errors = 0
78 cmd = ""
79 if(!verbose)
80 cmd = cmd cd
81 cmd = cmd $0 "\n"
82 next
83 }
85 /^cd .+; mk .+/ && !verbose {
86 dir = $2
87 sub(/;$/, "", dir)
88 status(dir " mk " $4)
89 }
91 /^cd / {
92 if(debug) print "% cd"
93 errors = 0
94 if(verbose){
95 print >out
96 myflush(out)
97 if(copy){
98 print >copy
99 myflush(copy)
102 cd = $0 "\n"
103 cmd = ""
104 next
108 cmd = cmd $0 "\n"
111 errors != 0 {
112 clearstatus()
113 if(debug) print "% errors"
114 printf "%s", cmd >out
115 myflush(out)
116 if(copy){
117 printf "%s", cmd >copy
118 myflush(copy)
120 cmd = ""
121 next
124 /^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {
125 next
128 /^(conflicts:)/ {
129 if(debug) print "% skip1"
130 next
133 /(up to date|nothing to see|assuming it will be|loop not entered)/ {
134 next
137 /(nodes\(%e\)|packed transitions)/ {
138 if(debug) print "% skip2"
139 next
143 # unexpected line
144 clearstatus()
145 if(debug) print "% errors1"
146 errors = 1
147 printf ">>> %s", cmd >out
148 myflush(out)
149 if(copy){
150 printf ">>> %s", cmd >copy
151 myflush(copy)
153 cmd = ""