aboutsummaryrefslogtreecommitdiff
path: root/dist/isum.awk
blob: fbb2cb92efb3ea1064720dadf6fea338a21c3af8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Summarize the installation log, printing errors along with
# enough context to make sense of them.

BEGIN {
#	print verbose 
	cd = ""
	out = "/dev/stdout"
	debug = 0
}

debug!=0 { print "# " $0 }

/^$/ { next }

/^echo cd / { next }
/^\+\+ pwd/ { next }

/^\* /{
	if(debug) print "% mark"
	print >out
	fflush(out)
	cmd = ""
	printtabs = 1	# print indented lines immediately following
	errors = 0
	next
}

/^	/ && printtabs!=0 {
	print >out
	fflush(out)
	next
}

{ printtabs = 0 }

/^(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)($|[^:])/ {
	if(debug) print "% start"
	errors = 0
	cmd = ""
	if(!verbose)
		cmd = cmd cd
	cmd = cmd $0 "\n"
	next
}

/^cd / {
	if(debug) print "% cd"
	errors = 0
	if(verbose){
		print >out
		fflush(out)
	}
	cd = $0 "\n"
	cmd = ""
	next
}

{
	cmd = cmd $0 "\n"
}

errors != 0 {
	if(debug) print "% errors"
	printf "%s", cmd >out
	fflush(out)
	cmd = ""
	next
}

/^(	|then|else|fi|done|[ar] - [^ ]*\.o$)/ {
	next
}

/^(conflicts:)/ {
	if(debug) print "% skip1"
	next
}

/(up to date|nothing to see|assuming it will be|loop not entered)/ {
	next
}

/(nodes\(%e\)|packed transitions)/ {
	if(debug) print "% skip2"
	next
}

{ 
	# unexpected line 
	if(debug) print "% errors1"
	errors = 1
	printf ">>> %s", cmd >out
	fflush(out)
	cmd = ""
}