cookutils view web/cooker.cgi @ rev 848

cook: add cook_split_rm(); web/cooker.cgi: visualize console colorizations (existed in the bash log)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Dec 14 23:03:59 2016 +0200 (2016-12-14)
parents cb0d015fce20
children 7e846bbf8b7c
line source
1 #!/bin/sh
2 #
3 # SliTaz Cooker CGI/web interface.
4 #
6 . /usr/lib/slitaz/httphelper.sh
8 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
9 [ -f "cook.conf" ] && . ./cook.conf
11 # The same wok as cook.
12 wok="$WOK"
14 # Cooker DB files.
15 activity="$CACHE/activity"
16 commits="$CACHE/commits"
17 cooklist="$CACHE/cooklist"
18 cookorder="$CACHE/cookorder"
19 command="$CACHE/command"
20 blocked="$CACHE/blocked"
21 broken="$CACHE/broken"
22 cooknotes="$CACHE/cooknotes"
23 cooktime="$CACHE/cooktime"
24 wokrev="$CACHE/wokrev"
26 # We're not logged and want time zone to display correct server date.
27 export TZ=$(cat /etc/TZ)
29 case "$QUERY_STRING" in
30 recook=*)
31 case "$HTTP_USER_AGENT" in
32 *SliTaz*)
33 grep -qs "^${QUERY_STRING#recook=}$" $CACHE/recook-packages ||
34 echo ${QUERY_STRING#recook=} >> $CACHE/recook-packages
35 esac
36 cat <<EOT
37 Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
39 EOT
40 exit ;;
41 poke)
42 touch $CACHE/cooker-request
43 cat <<EOT
44 Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}
46 EOT
47 exit ;;
48 src*)
49 file=$(busybox httpd -d "$SRC/${QUERY_STRING#*=}")
50 cat <<EOT
51 Content-Type: application/octet-stream
52 Content-Length: $(stat -c %s "$file")
53 Content-Disposition: attachment; filename="$(basename "$file")"
55 EOT
56 cat "$file"
57 exit ;;
58 download*)
59 file=$(busybox httpd -d "$PKGS/${QUERY_STRING#*=}")
60 cat <<EOT
61 Content-Type: application/octet-stream
62 Content-Length: $(stat -c %s "$file")
63 Content-Disposition: attachment; filename="$(basename "$file")"
65 EOT
66 cat "$file"
67 exit ;;
68 rss)
69 cat <<EOT
70 Content-Type: application/rss+xml
72 EOT
73 ;;
74 *)
75 cat <<EOT
76 Content-Type: text/html; charset=utf-8
78 EOT
79 ;;
80 esac
83 # RSS feed generator
84 if [ "$QUERY_STRING" == 'rss' ]; then
85 pubdate=$(date -R)
86 cat <<EOT
87 <?xml version="1.0" encoding="utf-8" ?>
88 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
89 <channel>
90 <title>SliTaz Cooker</title>
91 <description>The SliTaz packages cooker feed</description>
92 <link>$COOKER_URL</link>
93 <lastBuildDate>$pubdate</lastBuildDate>
94 <pubDate>$pubdate</pubDate>
95 <atom:link href="http://cook.slitaz.org/?rss" rel="self" type="application/rss+xml" />
96 EOT
97 for rss in $(ls -lt $FEEDS/*.xml | head -n 12); do
98 cat $rss | sed 's|<guid|& isPermaLink="false"|g;s|</pubDate| GMT&|g'
99 done
100 cat <<EOT
101 </channel>
102 </rss>
103 EOT
104 exit 0
105 fi
108 #
109 # Functions
110 #
113 # Unpack to stdout
115 docat() {
116 case "$1" in
117 *gz) zcat ;;
118 *bz2) bzcat ;;
119 *xz) xzcat ;;
120 *) cat
121 esac < $1
122 }
125 # Tiny texinfo browser
127 info2html() {
128 sed \
129 -e 's|&|\&amp;|g' -e 's|<|\&lt;|g' \
130 -e 's|^\* \(.*\)::|* <a href="#\1">\1</a> |' \
131 -e 's|\*note \(.*\)::|<a href="#\1">\1</a>|' \
132 -e '/^File: /s|(dir)|Top|g' \
133 -e '/^File: /s|Node: \([^,]*\)|Node: <a name="\1"></a><u>\1</u>|' \
134 -e '/^File: /s|Next: \([^,]*\)|Next: <a href="#\1">\1</a>|' \
135 -e '/^File: /s|Prev: \([^,]*\)|Prev: <a href="#\1">\1</a>|' \
136 -e '/^File: /s|Up: \([^,]*\)|Up: <a href="#\1">\1</a>|' \
137 -e '/^File: /s|^.*$|<i>&</i>|' \
138 -e '/^Tag Table:$/,/^End Tag Table$/d' \
139 -e '/INFO-DIR/,/^END-INFO-DIR/d' \
140 -e "s|https*://[^>),'\"\` ]*|<a href=\"&\">&</a>|g" \
141 -e "s|ftp://[^>),\"\` ]*|<a href=\"&\">&</a>|g"
142 }
145 # Put some colors in log and DB files.
147 syntax_highlighter() {
148 case $1 in
149 log)
150 # If variables not defined - define them with some rare values
151 : ${_src=#_#_#}
152 : ${_install=#_#_#}
153 : ${_fs=#_#_#}
154 : ${_stuff=#_#_#}
155 sed -e 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' \
156 -e 's#OK$#<span class="span-ok">OK</span>#g' \
157 -e 's#Done$#<span class="span-ok">Done</span>#g' \
158 -e 's#yes$#<span class="span-ok">yes</span>#g' \
159 -e 's#no$#<span class="span-no">no</span>#g' \
160 -e 's#error$#<span class="span-red">error</span>#g' \
161 -e 's#ERROR:#<span class="span-red">ERROR:</span>#g' \
162 -e 's#WARNING:#<span class="span-red">WARNING:</span>#g' \
163 -e "s#^Executing:\([^']*\).#<span class='sh-val'>\0</span>#g" \
164 -e "s#^====\([^']*\).#<span class='span-line'>\0</span>#g" \
165 -e "s#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#g" \
166 -e "s#ftp://[^ '\"]*#<a href='\0'>\0</a>#g" \
167 -e "s#http://[^ '\"]*#<a href='\0'>\0</a>#g" \
168 -e "s|$_src|<span class='var'>\${src}</span>|g;
169 s|$_install|<span class='var'>\${install}</span>|g;
170 s|$_fs|<span class='var'>\${fs}</span>|g;
171 s|$_stuff|<span class='var'>\${stuff}</span>|g" \
172 -e "s|\[91m|<span style='color: #F00'>|;
173 s|\[92m|<span style='color: #080'>|;
174 s|\[93m|<span style='color: #FF0'>|;
175 s|\[94m|<span style='color: #00F'>|;
176 s|\[95m|<span style='color: #808'>|;
177 s|\[96m|<span style='color: #0CC'>|;
178 s|\[39m|</span>|;"
179 ;;
181 receipt)
182 sed -e s'|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|'g \
183 -e s"#^\#\([^']*\)#<span class='sh-comment'>\0</span>#"g \
184 -e s"#\"\([^']*\)\"#<span class='sh-val'>\0</span>#"g ;;
186 diff)
187 sed -e 's|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|g' \
188 -e s"#^-\([^']*\).#<span class='span-red'>\0</span>#"g \
189 -e s"#^+\([^']*\).#<span class='span-ok'>\0</span>#"g \
190 -e s"#@@\([^']*\)@@#<span class='span-sky'>@@\1@@</span>#"g ;;
192 activity)
193 sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g ;;
194 esac
195 }
198 # Latest build pkgs.
200 list_packages() {
201 cd $PKGS
202 ls -1t *.tazpkg | head -20 | \
203 while read file; do
204 echo -n $(TZ=UTC stat -c '%y' $PKGS/$file | cut -d . -f 1 | sed s/:[0-9]*$//)
205 echo " : $file"
206 done
207 }
210 # Optional full list button
212 more_button() {
213 [ $(wc -l < ${3:-$CACHE/$1}) -gt ${4:-12} ] && cat <<EOT
214 <div style="float: right;">
215 <a class="button" href="?file=$1">$2</a>
216 </div>
217 EOT
218 }
221 # Show the running command and its progression
223 running_command()
224 {
225 local state="Not running"
226 if [ -s "$command" ]; then
227 state="$(cat $command)"
228 set -- $(grep "^$state" $cooktime)
229 if [ -n "$1" ]; then
230 state="$state $((($(date +%s)-$3)*100/$2))%"
231 [ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))"
232 fi
233 fi
234 echo $state
235 }
238 # xHTML header. Pages can be customized with a separated html.header file.
240 if [ -f "header.html" ]; then
241 cat header.html
242 else
243 cat <<EOT
244 <!DOCTYPE html>
245 <html lang="en">
246 <head>
247 <meta charset="utf-8"/>
248 <title>SliTaz Cooker</title>
249 <link rel="shortcut icon" href="favicon.ico"/>
250 <link rel="stylesheet" type="text/css" href="style.css"/>
251 <meta name="robots" content="nofollow">
252 </head>
253 <body>
255 <div id="header">
256 <div id="logo"></div>
257 <h1><a href="cooker.cgi">SliTaz Cooker</a></h1>
258 </div>
260 <!-- Content -->
261 <div id="content">
262 EOT
263 fi
266 #
267 # Load requested page
268 #
270 case "${QUERY_STRING}" in
271 pkg=*)
272 pkg=${QUERY_STRING#pkg=}
273 log=$LOGS/$pkg.log
274 echo "<h2>Package: $pkg</h2>"
276 # Define cook variables for syntax highlighter
277 if [ -s "$WOK/$pkg/receipt" ]; then
278 . "$WOK/$pkg/receipt"
279 _wok='/home/slitaz/wok'
280 _src="$_wok/$pkg/source/$PACKAGE-$VERSION"
281 _install="$_wok/$pkg/install"
282 _fs="$_wok/$pkg/taz/$PACKAGE-$VERSION/fs"
283 _stuff="$_wok/$pkg/stuff"
284 fi
286 # Package info.
287 echo '<div id="info">'
288 if [ -f "$wok/$pkg/receipt" ]; then
289 echo "<a href='?receipt=$pkg'>receipt</a>"
290 unset WEB_SITE
291 unset WANTED
292 bpkg=$pkg
293 . $wok/$pkg/receipt
295 [ -n "$WANTED" ] && bpkg="$WANTED"
296 [ -n "$WEB_SITE" ] && # busybox wget -s $WEB_SITE &&
297 echo "<a href='$WEB_SITE'>home</a>"
299 if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then
300 echo "<a href='?files=$pkg'>files</a>"
301 unset EXTRAVERSION
302 . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt
303 if [ -f $wok/$pkg/taz/$PACKAGE-$VERSION/description.txt ]; then
304 echo "<a href='?description=$pkg'>description</a>"
305 fi
306 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg ]; then
307 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION.tazpkg'>download</a>"
308 fi
309 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg ]; then
310 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg'>download</a>"
311 fi
312 fi
313 [ -x ./man2html ] &&
314 if [ -d $wok/$bpkg/install/usr/man ] ||
315 [ -d $wok/$bpkg/install/usr/share/man ] ||
316 [ -d $wok/$bpkg/taz/*/fs/usr/man ] ||
317 [ -d $wok/$bpkg/taz/*/fs/usr/share/man ]; then
318 echo "<a href='?man=$bpkg'>man</a>"
319 fi
320 if [ -d $wok/$bpkg/install/usr/doc ] ||
321 [ -d $wok/$bpkg/install/usr/share/doc ] ||
322 [ -d $wok/$bpkg/taz/*/fs/usr/doc ] ||
323 [ -d $wok/$bpkg/taz/*/fs/usr/share/doc ]; then
324 echo "<a href='?doc=$bpkg'>doc</a>"
325 fi
326 if [ -d $wok/$bpkg/install/usr/info ] ||
327 [ -d $wok/$bpkg/install/usr/share/info ] ||
328 [ -d $wok/$bpkg/taz/*/fs/usr/info ] ||
329 [ -d $wok/$bpkg/taz/*/fs/usr/share/info ]; then
330 echo "<a href='?info=$bpkg'>info</a>"
331 fi
332 echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
333 else
334 if [ $(ls $wok/*$pkg*/receipt 2> /dev/null | wc -l) -eq 0 ]; then
335 echo "No package named: $pkg"
336 else
337 ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
338 echo '<table style="width:100%">'
339 for i in $(cd $wok ; ls $pkg/receipt); do
340 pkg=$(dirname $i)
341 unset SHORT_DESC CATEGORY
342 . $wok/$pkg/receipt
343 cat <<EOT
344 <tr>
345 <td><a href="?pkg=$pkg">$pkg</a></td>
346 <td>$SHORT_DESC</td>
347 <td>$CATEGORY</td>
348 </tr>
349 EOT
350 done
351 echo '</table>'
352 unset pkg
353 fi
354 fi
355 echo '</div>'
357 # Check for a log file and display summary if it exists.
358 if [ -f "$log" ]; then
359 if grep -q "cook:$pkg$" $command; then
360 echo "<pre>The Cooker is currently building: $pkg</pre>"
361 fi
362 if fgrep -q "Summary for:" $LOGS/$pkg.log; then
363 echo '<h3>Cook summary</h3>'
364 echo '<pre>'
365 grep -A 12 "^Summary for:" $LOGS/$pkg.log | sed /^$/d | \
366 syntax_highlighter log
367 echo '</pre>'
368 fi
369 if fgrep -q "Debug information" $LOGS/$pkg.log; then
370 echo '<h3>Cook failed</h3>'
371 echo '<pre>'
372 grep -A 8 "^Debug information" $LOGS/$pkg.log | sed /^$/d | \
373 syntax_highlighter log
374 echo '</pre>'
375 fi
376 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
377 for i in $(ls -t $log.*); do
378 echo -n "<a href=\"?log=$(basename $i)\">"
379 echo "$(stat -c %y $i | sed 's/ .*//')</a>"
380 done
381 echo '<pre>'
382 cat $log | syntax_highlighter log
383 echo '</pre>'
384 case "$HTTP_USER_AGENT" in
385 *SliTaz*)
386 [ -f $CACHE/cooker-request ] && [ -n "$HTTP_REFERER" ] &&
387 echo "<a class=\"button\" href=\"?recook=$pkg\">Recook $pkg</a>"
388 esac
389 else
390 [ "$pkg" ] && echo "<pre>No log: $pkg</pre>"
391 fi ;;
393 log=*)
394 log=$LOGS/${QUERY_STRING#log=}
395 if [ -s $log ]; then
396 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
397 echo '<pre>'
398 cat $log | syntax_highlighter log
399 echo '</pre>'
400 fi
401 ;;
402 file=*)
403 # Don't allow all files on the system for security reasons.
404 file=${QUERY_STRING#file=}
405 case "$file" in
406 activity|cooknotes|cooklist)
407 [ "$file" == "cooklist" ] && \
408 nb="- Packages: $(cat $cooklist | wc -l)"
409 echo "<h2>DB: $file $nb</h2>"
410 echo '<pre>'
411 tac $CACHE/$file | syntax_highlighter activity
412 echo '</pre>' ;;
414 broken)
415 nb=$(cat $broken | wc -l)
416 echo "<h2>DB: broken - Packages: $nb</h2>"
417 echo '<pre>'
418 cat $CACHE/$file | sort | \
419 sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g
420 echo '</pre>' ;;
422 *.diff)
423 diff=$CACHE/$file
424 echo "<h2>Diff for: ${file%.diff}</h2>"
425 [ "$file" == "installed.diff" ] && echo \
426 "<p>This is the latest diff between installed packages \
427 and installed build dependencies to cook.</p>"
428 echo '<pre>'
429 cat $diff | syntax_highlighter diff
430 echo '</pre>' ;;
432 *.log)
433 log=$LOGS/$file
434 name=$(basename $log)
435 echo "<h2>Log for: ${name%.log}</h2>"
436 if [ -f "$log" ]; then
437 if fgrep -q "Summary" $log; then
438 echo '<pre>'
439 grep -A 20 "^Summary" $log | sed /^$/d | \
440 syntax_highlighter log
441 echo '</pre>'
442 fi
443 echo '<pre>'
444 cat $log | syntax_highlighter log
445 echo '</pre>'
446 else
447 echo "<pre>No log file: $log</pre>"
448 fi ;;
449 esac ;;
451 stuff=*)
452 file=${QUERY_STRING#stuff=}
453 echo "<h2>$file</h2>"
454 echo '<pre>'
455 cat $wok/$file | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
456 echo '</pre>' ;;
458 receipt=*)
459 pkg=${QUERY_STRING#receipt=}
460 echo "<h2>Receipt for: $pkg</h2>"
461 if [ -f "$wok/$pkg/receipt" ]; then
462 . $wok/$pkg/receipt
463 [ -n "$TARBALL" ] && [ -s "$SRC/$TARBALL" ] &&
464 echo "<a href='?src=$TARBALL'>source</a>"
466 ( cd $wok/$pkg ; find stuff -type f 2> /dev/null ) | \
467 while read file ; do
468 echo "<a href=\"?stuff=$pkg/$file\">$file</a>"
469 done | sort
470 echo '<pre>'
471 cat $wok/$pkg/receipt | \
472 syntax_highlighter receipt
473 echo '</pre>'
474 else
475 echo "<pre>No receipt for: $pkg</pre>"
476 fi ;;
478 files=*)
479 pkg=${QUERY_STRING#files=}
480 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
481 if [ -d "$dir/fs" ]; then
482 echo "<h2>Installed files by: $pkg ($(du -hs $dir/fs | awk '{ print $1 }'))</h2>"
483 echo '<pre>'
484 find $dir/fs -not -type d -print0 | xargs -0 ls -ld | \
485 sed "s|\(.*\) /.*\(${dir#*wok}/fs\)\(.*\)|\1 <a href=\"?download=../wok\2\3\">\3</a>|;s|^\([^-].*\)\(<a.*\)\">\(.*\)</a>|\1\3|"
486 echo '</pre>'
487 else
488 echo "<pre>No files list for: $pkg</pre>"
489 fi ;;
491 description=*)
492 pkg=${QUERY_STRING#description=}
493 echo "<h2>Description of $pkg</h2>"
494 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
495 if [ -s "$dir/description.txt" ]; then
496 echo '<pre>'
497 cat $dir/description.txt | \
498 sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
499 echo '</pre>'
500 else
501 echo "<pre>No description for: $pkg</pre>"
502 fi ;;
504 man=*|doc=*|info=*)
505 type=${QUERY_STRING%%=*}
506 pkg=$(GET $type)
507 dir=$WOK/$pkg/install/usr/share/$type
508 [ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
509 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/share/$type)
510 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/$type)
511 page=$(GET file)
512 if [ -z "$page" ]; then
513 page=$(find $dir -type f | sed q)
514 page=${page#$dir/}
515 fi
516 find $dir -type f | while read file ; do
517 [ -s $file ] || continue
518 case "$file" in
519 *.jp*g|*.png|*.gif|*.svg) continue
520 esac
521 file=${file#$dir/}
522 echo "<a href='?$type=$pkg&amp;file=$file'>$(basename $file)</a>"
523 done | sort
524 echo "<h2>$(basename $page)</h2>"
525 tmp="$(mktemp)"
526 docat "$dir/$page" > $tmp
527 [ -s "$tmp" ] && case "$type" in
528 info)
529 echo '<pre>'
530 info2html < "$tmp"
531 echo '</pre>' ;;
532 doc)
533 echo '<pre>'
534 case "$page" in
535 *.htm*) cat ;;
536 *) sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
537 esac < "$tmp"
538 echo '</pre>' ;;
539 man)
540 export TEXTDOMAIN='man2html'
541 ./man2html "$tmp" | sed -e '1,/<header>/d' \
542 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
543 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g' ;;
544 esac
545 rm -f $tmp
546 ;;
547 *)
548 # We may have a toolchain.cgi script for cross cooker's
549 if [ -f "toolchain.cgi" ]; then
550 toolchain='toolchain.cgi'
551 else
552 toolchain='?pkg=slitaz-toolchain'
553 fi
554 # Main page with summary. Count only package include in ARCH,
555 # use 'cooker arch-db' to manually create arch.$ARCH files.
556 inwok=$(ls $WOK/*/arch.$ARCH | wc -l)
557 cooked=$(ls $PKGS/*.tazpkg | wc -l)
558 unbuilt=$(($inwok - $cooked))
559 pct=0
560 [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok ))
561 cat <<EOT
562 <div style="float: right;">
563 <form method="get" action="$SCRIPT_NAME">
564 Package:
565 <input type="text" name="pkg" />
566 </form>
567 </div>
569 <h2>Summary</h2>
571 <pre>
572 Running command : $(running_command)
573 Wok revision : <a href="$WOK_URL">$(cat $wokrev)</a>
574 Commits to cook : $(cat $commits | wc -l)
575 Current cooklist : $(cat $cooklist | wc -l)
576 Broken packages : $(cat $broken | wc -l)
577 Blocked packages : $(cat $blocked | wc -l)
578 </pre>
579 EOT
580 [ -e $CACHE/cooker-request ] &&
581 [ $CACHE/activity -nt $CACHE/cooker-request ] && cat <<EOT
582 <div style="float: right;">
583 <a class="button" href="?poke">Poke cooker</a>
584 </div>
585 EOT
586 cat <<EOT
587 <p class="info">
588 Packages: $inwok in the wok | $cooked cooked | $unbuilt unbuilt |
589 Server date: $(date -u '+%F %R %Z')
590 </p>
591 <div class="pctbar">
592 <div class="pct" style="width: ${pct}%;">${pct}%</div>
593 </div>
595 <p>
596 Latest:
597 <a href="?file=cookorder.log">cookorder.log</a>
598 <a href="?file=commits.log">commits.log</a>
599 <a href="?file=pkgdb.log">pkgdb.log</a>
600 <a href="?file=installed.diff">installed.diff</a>
601 - Architecture $ARCH:
602 <a href="$toolchain">toolchain</a>
603 </p>
605 $(more_button activity "More activity" $CACHE/activity 12)
606 <h2 id="activity">Activity</h2>
607 <pre>
608 $(tac $CACHE/activity | head -n 12 | syntax_highlighter activity)
609 </pre>
610 EOT
612 [ -s $cooknotes ] && cat <<EOT
613 $(more_button cooknotes "More notes" $cooknotes 12)
614 <h2 id="cooknotes">Cooknotes</h2>
615 <pre>
616 $(tac $cooknotes | head -n 12 | syntax_highlighter activity)
617 </pre>
618 EOT
620 [ -s $commits ] && cat <<EOT
621 <h2 id="commits">Commits</h2>
622 <pre>
623 $(cat $commits)
624 </pre>
625 EOT
627 [ -s $cooklist ] && cat <<EOT
628 $(more_button cooklist "Full cooklist" $cooklist 20)
629 <h2 id="cooklist">Cooklist</h2>
630 <pre>
631 $(cat $cooklist | head -n 20)
632 </pre>
633 EOT
635 [ -s $broken ] && cat <<EOT
636 $(more_button broken "All broken packages" $broken 20)
637 <h2 id="broken">Broken</h2>
638 <pre>
639 $(cat $broken | head -n 20 | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
640 </pre>
641 EOT
643 [ -s $blocked ] && cat <<EOT
644 <h2 id="blocked">Blocked</h2>
645 <pre>
646 $(cat $blocked | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
647 </pre>
648 EOT
650 cat <<EOT
651 <h2 id="lastcook">Latest cook</h2>
652 <pre>
653 $(list_packages | sed s"#^\([^']*\).* : #<span class='log-date'>\0</span>#"g)
654 </pre>
655 EOT
656 ;;
657 esac
660 # Close xHTML page
662 cat <<EOT
663 </div>
665 <div id="footer">
666 <a href="http://www.slitaz.org/">SliTaz Website</a>
667 <a href="cooker.cgi">Cooker</a>
668 <a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
669 Documentation</a>
670 </div>
672 </body>
673 </html>
674 EOT
676 exit 0