cookutils rev 17
Improve debug info and syntax highlither
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 05 17:45:44 2011 +0200 (2011-05-05) |
parents | dcf50aa1bb76 |
children | 58496d7c2c18 |
files | cook web/cooker.cgi web/style.css |
line diff
1.1 --- a/cook Thu May 05 17:05:19 2011 +0200 1.2 +++ b/cook Thu May 05 17:45:44 2011 +0200 1.3 @@ -213,7 +213,7 @@ 1.4 1.5 # Display debugging erroe info. 1.6 debug_info() { 1.7 - echo "Debug information" 1.8 + echo -e "\nDebug information" 1.9 separator 1.10 fgrep ERROR $LOGS/$pkg.log 1.11 separator && echo "" 1.12 @@ -388,11 +388,7 @@ 1.13 fi 1.14 # ERROR can be echoed any time in cookit() 1.15 if grep -q ^ERROR $LOGS/$pkg.log; then 1.16 - echo "" 1.17 - debug_info | tee $CACHE/debug 1.18 - # Debug info on top, easier to check errors. 1.19 - cat $CACHE/debug $LOGS/$pkg.log > $CACHE/$pkg.debug 1.20 - mv -f $CACHE/$pkg.debug $LOGS/$pkg.log 1.21 + debug_info | tee -a $LOGS/$pkg.log 1.22 exit 1 1.23 fi 1.24 } 1.25 @@ -674,7 +670,7 @@ 1.26 fi 1.27 fi 1.28 # Finally we DONT WANT to build the *-dev or packages with WANTED="$pkg" 1.29 - # You automation: use the Cooker Build Bot. 1.30 + # You want automation: use the Cooker Build Bot. 1.31 #[ -d "$WOK/$pkg-dev" ] && cook $pkg-dev 1.32 ;; 1.33 esac
2.1 --- a/web/cooker.cgi Thu May 05 17:05:19 2011 +0200 2.2 +++ b/web/cooker.cgi Thu May 05 17:45:44 2011 +0200 2.3 @@ -26,17 +26,21 @@ 2.4 2.5 # Put some colors in log and DB files. 2.6 syntax_highlighter() { 2.7 - sed -e 's#OK$#<span class="span-ok">OK</span>#g' \ 2.8 - -e 's#yes$#<span class="span-ok">yes</span>#g' \ 2.9 - -e 's#no$#<span class="span-no">no</span>#g' \ 2.10 - -e 's#error$#<span class="span-error">error</span>#g' \ 2.11 - -e 's#ERROR:#<span class="span-error">ERROR:</span>#g' \ 2.12 - -e s"#^Executing:\([^']*\).#<span class='span-sky'>\0</span>#"g \ 2.13 - -e s"#^====\([^']*\).#<span class='span-line'>\0</span>#"g \ 2.14 - -e s"#ftp://\([^']*\).*#<a href='\0'>\0</a>#"g \ 2.15 - -e s"#http://\([^']*\).*#<a href='\0'>\0</a>#"g \ 2.16 - -e s"#^\#\([^']*\)#<span class='sh-comment'>\0</span>#"g 2.17 - #-e s"#\"\([^']*\)\"#<span class='sh-val'>\0</span>#"g 2.18 + case $1 in 2.19 + log) 2.20 + sed -e 's#OK$#<span class="span-ok">OK</span>#g' \ 2.21 + -e 's#yes$#<span class="span-ok">yes</span>#g' \ 2.22 + -e 's#no$#<span class="span-no">no</span>#g' \ 2.23 + -e 's#error$#<span class="span-error">error</span>#g' \ 2.24 + -e 's#ERROR:#<span class="span-error">ERROR:</span>#g' \ 2.25 + -e s"#^Executing:\([^']*\).#<span class='span-sky'>\0</span>#"g \ 2.26 + -e s"#^====\([^']*\).#<span class='span-line'>\0</span>#"g \ 2.27 + -e s"#ftp://\([^']*\).*#<a href='\0'>\0</a>#"g \ 2.28 + -e s"#http://\([^']*\).*#<a href='\0'>\0</a>#"g ;; 2.29 + receipt) 2.30 + sed -e s"#^\#\([^']*\)#<span class='sh-comment'>\0</span>#"g \ 2.31 + -e s"#\"\([^']*\)\"#<span class='sh-val'>\0</span>#"g ;; 2.32 + esac 2.33 } 2.34 2.35 # Latest build pkgs. 2.36 @@ -102,16 +106,20 @@ 2.37 echo "<h3>Cook summary</h3>" 2.38 echo '<pre>' 2.39 grep -A 8 "^Summary " $LOGS/$pkg.log | sed /^$/d | \ 2.40 - syntax_highlighter 2.41 + syntax_highlighter log 2.42 echo '</pre>' 2.43 fi 2.44 fi 2.45 - if fgrep -q "ERROR:" $LOGS/$pkg.log; then 2.46 - fgrep "ERROR:" $LOGS/$pkg.log 2.47 + if fgrep -q "Debug " $LOGS/$pkg.log; then 2.48 + echo "<h3>Cook failed</h3>" 2.49 + echo '<pre>' 2.50 + grep -A 8 "^Debug " $LOGS/$pkg.log | sed /^$/d | \ 2.51 + syntax_highlighter log 2.52 + echo '</pre>' 2.53 fi 2.54 echo "<h3>Cook log</h3>" 2.55 echo '<pre>' 2.56 - cat $log | syntax_highlighter 2.57 + cat $log | syntax_highlighter log 2.58 echo '</pre>' 2.59 else 2.60 echo "<pre>No log: $pkg</pre>" 2.61 @@ -122,17 +130,17 @@ 2.62 echo "<h2>Log for: $log</h2>" 2.63 if [ -f "$LOGS/$log.log" ]; then 2.64 echo '<pre>' 2.65 - cat $file | syntax_highlighter 2.66 + cat $file | syntax_highlighter log 2.67 echo '</pre>' 2.68 else 2.69 echo "<pre>No log for: $log</pre>" 2.70 fi ;; 2.71 receipt=*) 2.72 pkg=${QUERY_STRING#receipt=} 2.73 - echo "<h2>Receipt: $pkg</h2>" 2.74 + echo "<h2>Receipt for: $pkg</h2>" 2.75 if [ -f "$wok/$pkg/receipt" ]; then 2.76 echo '<pre>' 2.77 - cat $wok/$pkg/receipt | syntax_highlighter 2.78 + cat $wok/$pkg/receipt | syntax_highlighter receipt 2.79 echo '</pre>' 2.80 else 2.81 echo "<pre>No receipt for: $log</pre>"
3.1 --- a/web/style.css Thu May 05 17:05:19 2011 +0200 3.2 +++ b/web/style.css Thu May 05 17:45:44 2011 +0200 3.3 @@ -36,4 +36,6 @@ 3.4 .span-sky { color: blue; } 3.5 .span-no { color: orange; } 3.6 .span-line { color: #888; } 3.7 -.span-date { color: #666; font-size: 95%; } 3.8 +.log-date { color: #666; font-size: 95%; } 3.9 +.sh-comment { color: #b20000; } 3.10 +.sh-val { color: #f35a00; }