Blob
1 # Summarize the installation log, printing errors along with2 # enough context to make sense of them.4 BEGIN {5 # print verbose6 cd = ""7 out = "/dev/stdout"8 statuslen = 09 debug = 010 updates = "/dev/stderr"11 }13 function myflush(f)14 {15 # fflush is not available on sun, but system("") appears to work everywhere16 system("")17 }19 function clearstatus(noflush, i)20 {21 if(!updates)22 return23 for(i=0; i<statuslen; i++)24 printf("\b \b") >updates25 statuslen = 026 if(!noflush)27 myflush(updates)28 }30 function status(s)31 {32 if(!updates)33 return34 clearstatus(1)35 printf(" %s ", s) >updates36 statuslen = length(s)+537 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 >out51 myflush(out)52 if(copy){53 print >copy54 myflush(copy)55 }56 cmd = ""57 printtabs = 1 # print indented lines immediately following58 errors = 059 next60 }62 /^ / && printtabs!=0 {63 clearstatus()64 print >out65 myflush(out)66 if(copy){67 print >copy68 myflush(copy)69 }70 next71 }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 = 078 cmd = ""79 if(!verbose)80 cmd = cmd cd81 cmd = cmd $0 "\n"82 next83 }85 /^cd .+; mk .+/ && !verbose {86 dir = $287 sub(/;$/, "", dir)88 status(dir " mk " $4)89 }91 /^cd / {92 if(debug) print "% cd"93 errors = 094 if(verbose){95 print >out96 myflush(out)97 if(copy){98 print >copy99 myflush(copy)100 }101 }102 cd = $0 "\n"103 cmd = ""104 next105 }107 {108 cmd = cmd $0 "\n"109 }111 errors != 0 {112 clearstatus()113 if(debug) print "% errors"114 printf "%s", cmd >out115 myflush(out)116 if(copy){117 printf "%s", cmd >copy118 myflush(copy)119 }120 cmd = ""121 next122 }124 /^( |then|else|fi|done|[ar] - [^ ]*\.o$)/ {125 next126 }128 /^(conflicts:)/ {129 if(debug) print "% skip1"130 next131 }133 /(up to date|nothing to see|assuming it will be|loop not entered)/ {134 next135 }137 /(nodes\(%e\)|packed transitions)/ {138 if(debug) print "% skip2"139 next140 }142 {143 # unexpected line144 clearstatus()145 if(debug) print "% errors1"146 errors = 1147 printf ">>> %s", cmd >out148 myflush(out)149 if(copy){150 printf ">>> %s", cmd >copy151 myflush(copy)152 }153 cmd = ""154 }