cookutils view web/cooker.cgi @ rev 851

cooker.cgi: browse cooking only
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 19 09:38:36 2016 +0100 (2016-12-19)
parents cc73035433ab
children abae537cdde9
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 [ -n "${REQUEST_URI%$SCRIPT_NAME*}" ] ||
333 echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
334 else
335 if [ $(ls $wok/*$pkg*/receipt 2> /dev/null | wc -l) -eq 0 ]; then
336 echo "No package named: $pkg"
337 else
338 ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
339 echo '<table style="width:100%">'
340 for i in $(cd $wok ; ls $pkg/receipt); do
341 pkg=$(dirname $i)
342 unset SHORT_DESC CATEGORY
343 . $wok/$pkg/receipt
344 cat <<EOT
345 <tr>
346 <td><a href="?pkg=$pkg">$pkg</a></td>
347 <td>$SHORT_DESC</td>
348 <td>$CATEGORY</td>
349 </tr>
350 EOT
351 done
352 echo '</table>'
353 unset pkg
354 fi
355 fi
356 echo '</div>'
358 # Check for a log file and display summary if it exists.
359 if [ -f "$log" ]; then
360 if grep -q "cook:$pkg$" $command; then
361 echo "<pre>The Cooker is currently building: $pkg</pre>"
362 fi
363 if fgrep -q "Summary for:" $LOGS/$pkg.log; then
364 echo '<h3>Cook summary</h3>'
365 echo '<pre>'
366 grep -A 12 "^Summary for:" $LOGS/$pkg.log | sed /^$/d | \
367 syntax_highlighter log
368 echo '</pre>'
369 fi
370 if fgrep -q "Debug information" $LOGS/$pkg.log; then
371 echo '<h3>Cook failed</h3>'
372 echo '<pre>'
373 grep -A 8 "^Debug information" $LOGS/$pkg.log | sed /^$/d | \
374 syntax_highlighter log
375 echo '</pre>'
376 fi
377 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
378 for i in $(ls -t $log.*); do
379 echo -n "<a href=\"?log=$(basename $i)\">"
380 echo "$(stat -c %y $i | sed 's/ .*//')</a>"
381 done
382 echo '<pre>'
383 cat $log | syntax_highlighter log
384 echo '</pre>'
385 case "$HTTP_USER_AGENT" in
386 *SliTaz*)
387 [ -f $CACHE/cooker-request ] && [ -n "$HTTP_REFERER" ] &&
388 echo "<a class=\"button\" href=\"?recook=$pkg\">Recook $pkg</a>"
389 esac
390 else
391 [ "$pkg" ] && echo "<pre>No log: $pkg</pre>"
392 fi ;;
394 log=*)
395 log=$LOGS/${QUERY_STRING#log=}
396 if [ -s $log ]; then
397 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
398 echo '<pre>'
399 cat $log | syntax_highlighter log
400 echo '</pre>'
401 fi
402 ;;
403 file=*)
404 # Don't allow all files on the system for security reasons.
405 file=${QUERY_STRING#file=}
406 case "$file" in
407 activity|cooknotes|cooklist)
408 [ "$file" == "cooklist" ] && \
409 nb="- Packages: $(cat $cooklist | wc -l)"
410 echo "<h2>DB: $file $nb</h2>"
411 echo '<pre>'
412 tac $CACHE/$file | syntax_highlighter activity
413 echo '</pre>' ;;
415 broken)
416 nb=$(cat $broken | wc -l)
417 echo "<h2>DB: broken - Packages: $nb</h2>"
418 echo '<pre>'
419 cat $CACHE/$file | sort | \
420 sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g
421 echo '</pre>' ;;
423 *.diff)
424 diff=$CACHE/$file
425 echo "<h2>Diff for: ${file%.diff}</h2>"
426 [ "$file" == "installed.diff" ] && echo \
427 "<p>This is the latest diff between installed packages \
428 and installed build dependencies to cook.</p>"
429 echo '<pre>'
430 cat $diff | syntax_highlighter diff
431 echo '</pre>' ;;
433 *.log)
434 log=$LOGS/$file
435 name=$(basename $log)
436 echo "<h2>Log for: ${name%.log}</h2>"
437 if [ -f "$log" ]; then
438 if fgrep -q "Summary" $log; then
439 echo '<pre>'
440 grep -A 20 "^Summary" $log | sed /^$/d | \
441 syntax_highlighter log
442 echo '</pre>'
443 fi
444 echo '<pre>'
445 cat $log | syntax_highlighter log
446 echo '</pre>'
447 else
448 echo "<pre>No log file: $log</pre>"
449 fi ;;
450 esac ;;
452 stuff=*)
453 file=${QUERY_STRING#stuff=}
454 echo "<h2>$file</h2>"
455 echo '<pre>'
456 cat $wok/$file | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
457 echo '</pre>' ;;
459 receipt=*)
460 pkg=${QUERY_STRING#receipt=}
461 echo "<h2>Receipt for: $pkg</h2>"
462 if [ -f "$wok/$pkg/receipt" ]; then
463 . $wok/$pkg/receipt
464 [ -n "$TARBALL" ] && [ -s "$SRC/$TARBALL" ] &&
465 echo "<a href='?src=$TARBALL'>source</a>"
467 ( cd $wok/$pkg ; find stuff -type f 2> /dev/null ) | \
468 while read file ; do
469 echo "<a href=\"?stuff=$pkg/$file\">$file</a>"
470 done | sort
471 echo '<pre>'
472 cat $wok/$pkg/receipt | \
473 syntax_highlighter receipt
474 echo '</pre>'
475 else
476 echo "<pre>No receipt for: $pkg</pre>"
477 fi ;;
479 files=*)
480 pkg=${QUERY_STRING#files=}
481 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
482 if [ -d "$dir/fs" ]; then
483 echo "<h2>Installed files by: $pkg ($(du -hs $dir/fs | awk '{ print $1 }'))</h2>"
484 echo '<pre>'
485 find $dir/fs -not -type d -print0 | xargs -0 ls -ld | \
486 sed "s|\(.*\) /.*\(${dir#*wok}/fs\)\(.*\)|\1 <a href=\"?download=../wok\2\3\">\3</a>|;s|^\([^-].*\)\(<a.*\)\">\(.*\)</a>|\1\3|"
487 echo '</pre>'
488 else
489 echo "<pre>No files list for: $pkg</pre>"
490 fi ;;
492 description=*)
493 pkg=${QUERY_STRING#description=}
494 echo "<h2>Description of $pkg</h2>"
495 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
496 if [ -s "$dir/description.txt" ]; then
497 echo '<pre>'
498 cat $dir/description.txt | \
499 sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
500 echo '</pre>'
501 else
502 echo "<pre>No description for: $pkg</pre>"
503 fi ;;
505 man=*|doc=*|info=*)
506 type=${QUERY_STRING%%=*}
507 pkg=$(GET $type)
508 dir=$WOK/$pkg/install/usr/share/$type
509 [ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
510 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/share/$type)
511 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/$type)
512 page=$(GET file)
513 if [ -z "$page" ]; then
514 page=$(find $dir -type f | sed q)
515 page=${page#$dir/}
516 fi
517 find $dir -type f | while read file ; do
518 [ -s $file ] || continue
519 case "$file" in
520 *.jp*g|*.png|*.gif|*.svg) continue
521 esac
522 file=${file#$dir/}
523 echo "<a href='?$type=$pkg&amp;file=$file'>$(basename $file)</a>"
524 done | sort
525 echo "<h2>$(basename $page)</h2>"
526 tmp="$(mktemp)"
527 docat "$dir/$page" > $tmp
528 [ -s "$tmp" ] && case "$type" in
529 info)
530 echo '<pre>'
531 info2html < "$tmp"
532 echo '</pre>' ;;
533 doc)
534 echo '<pre>'
535 case "$page" in
536 *.htm*) cat ;;
537 *) sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
538 esac < "$tmp"
539 echo '</pre>' ;;
540 man)
541 export TEXTDOMAIN='man2html'
542 ./man2html "$tmp" | sed -e '1,/<header>/d' \
543 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
544 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g' ;;
545 esac
546 rm -f $tmp
547 ;;
548 *)
549 # We may have a toolchain.cgi script for cross cooker's
550 if [ -f "toolchain.cgi" ]; then
551 toolchain='toolchain.cgi'
552 else
553 toolchain='?pkg=slitaz-toolchain'
554 fi
555 # Main page with summary. Count only package include in ARCH,
556 # use 'cooker arch-db' to manually create arch.$ARCH files.
557 inwok=$(ls $WOK/*/arch.$ARCH | wc -l)
558 cooked=$(ls $PKGS/*.tazpkg | wc -l)
559 unbuilt=$(($inwok - $cooked))
560 pct=0
561 [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok ))
562 cat <<EOT
563 <div style="float: right;">
564 <form method="get" action="$SCRIPT_NAME">
565 Package:
566 <input type="text" name="pkg" />
567 </form>
568 </div>
570 <h2>Summary</h2>
572 <pre>
573 Running command : $(running_command)
574 Wok revision : <a href="$WOK_URL">$(cat $wokrev)</a>
575 Commits to cook : $(cat $commits | wc -l)
576 Current cooklist : $(cat $cooklist | wc -l)
577 Broken packages : $(cat $broken | wc -l)
578 Blocked packages : $(cat $blocked | wc -l)
579 </pre>
580 EOT
581 [ -e $CACHE/cooker-request ] &&
582 [ $CACHE/activity -nt $CACHE/cooker-request ] && cat <<EOT
583 <div style="float: right;">
584 <a class="button" href="?poke">Poke cooker</a>
585 </div>
586 EOT
587 cat <<EOT
588 <p class="info">
589 Packages: $inwok in the wok | $cooked cooked | $unbuilt unbuilt |
590 Server date: $(date -u '+%F %R %Z')
591 </p>
592 <div class="pctbar">
593 <div class="pct" style="width: ${pct}%;">${pct}%</div>
594 </div>
596 <p>
597 Latest:
598 <a href="?file=cookorder.log">cookorder.log</a>
599 <a href="?file=commits.log">commits.log</a>
600 <a href="?file=pkgdb.log">pkgdb.log</a>
601 <a href="?file=installed.diff">installed.diff</a>
602 - Architecture $ARCH:
603 <a href="$toolchain">toolchain</a>
604 </p>
606 $(more_button activity "More activity" $CACHE/activity 12)
607 <h2 id="activity">Activity</h2>
608 <pre>
609 $(tac $CACHE/activity | head -n 12 | syntax_highlighter activity)
610 </pre>
611 EOT
613 [ -s $cooknotes ] && cat <<EOT
614 $(more_button cooknotes "More notes" $cooknotes 12)
615 <h2 id="cooknotes">Cooknotes</h2>
616 <pre>
617 $(tac $cooknotes | head -n 12 | syntax_highlighter activity)
618 </pre>
619 EOT
621 [ -s $commits ] && cat <<EOT
622 <h2 id="commits">Commits</h2>
623 <pre>
624 $(cat $commits)
625 </pre>
626 EOT
628 [ -s $cooklist ] && cat <<EOT
629 $(more_button cooklist "Full cooklist" $cooklist 20)
630 <h2 id="cooklist">Cooklist</h2>
631 <pre>
632 $(cat $cooklist | head -n 20)
633 </pre>
634 EOT
636 [ -s $broken ] && cat <<EOT
637 $(more_button broken "All broken packages" $broken 20)
638 <h2 id="broken">Broken</h2>
639 <pre>
640 $(cat $broken | head -n 20 | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
641 </pre>
642 EOT
644 [ -s $blocked ] && cat <<EOT
645 <h2 id="blocked">Blocked</h2>
646 <pre>
647 $(cat $blocked | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
648 </pre>
649 EOT
651 cat <<EOT
652 <h2 id="lastcook">Latest cook</h2>
653 <pre>
654 $(list_packages | sed s"#^\([^']*\).* : #<span class='log-date'>\0</span>#"g)
655 </pre>
656 EOT
657 ;;
658 esac
661 # Close xHTML page
663 cat <<EOT
664 </div>
666 <div id="footer">
667 <a href="http://www.slitaz.org/">SliTaz Website</a>
668 <a href="cooker.cgi">Cooker</a>
669 <a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
670 Documentation</a>
671 </div>
673 </body>
674 </html>
675 EOT
677 exit 0