cookutils view web/cooker.cgi @ rev 865

Split modules/compressor (~500 lines of code) from cook.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jan 11 11:53:04 2017 +0200 (2017-01-11)
parents 1520231a65c2
children 5f6be706ab4f
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"; touch $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#done$#<span class="span-ok">done</span>#g' \
159 -e 's#\([^a-z]\)ok$#\1<span class="span-ok">ok</span>#g' \
160 -e 's#\([^a-z]\)yes$#\1<span class="span-ok">yes</span>#g' \
161 -e 's#\([^a-z]\)no$#\1<span class="span-no">no</span>#g' \
162 \
163 -e 's#\( \[Y[nm/]\?\] n\)$# <span class="span-no">\1</span>#g' \
164 -e 's#\( \[N[ym/]\?\] y\)$# <span class="span-ok">\1</span>#g' \
165 -e 's#(NEW) $#<span class="span-red">(NEW) </span>#g' \
166 \
167 -e 's#error$#<span class="span-red">error</span>#g' \
168 -e 's#ERROR:#<span class="span-red">ERROR:</span>#g' \
169 -e 's#Error#<span class="span-red">Error</span>#g' \
170 \
171 -e 's#^.*[Ff]ailed.*#<span class="span-red">\0</span>#g' \
172 -e 's#^.*[Ff]atal.*#<span class="span-red">\0</span>#g' \
173 -e 's#^.*[Nn]ot found.*#<span class="span-red">\0</span>#g' \
174 -e 's#^.*[Nn]o such file.*#<span class="span-red">\0</span>#g' \
175 \
176 -e 's#WARNING:#<span class="span-red">WARNING:</span>#g' \
177 -e 's#warning:#<span class="span-no">warning:</span>#g' \
178 -e 's#error:#<span class="span-no">error:</span>#g' \
179 -e 's#missing#<span class="span-no">missing</span>#g' \
180 \
181 -e 's#^.* will not .*#<span class="span-no">\0</span>#' \
182 -e 's!^Hunk .* succeeded at .*!<span class="span-no">\0</span>!' \
183 -e 's#^.* Warning: .*#<span class="span-no">\0</span>#' \
184 \
185 -e "s#^Executing:\([^']*\).#<span class='sh-val'>\0</span>#" \
186 -e "s#^Making.*#<span class='sh-val'>\0</span>#" \
187 -e "s#^====\([^']*\).#<span class='span-line'>\0</span>#g" \
188 -e "s#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#g" \
189 -e "s#ftp://[^ '\"]*#<a href='\0'>\0</a>#g" \
190 -e "s#http://[^ '\"]*#<a href='\0'>\0</a>#g" \
191 -e "s|$_src|<span class='var'>\${src}</span>|g;
192 s|$_install|<span class='var'>\${install}</span>|g;
193 s|$_fs|<span class='var'>\${fs}</span>|g;
194 s|$_stuff|<span class='var'>\${stuff}</span>|g" \
195 -e "s|\[91m|<span style='color: #F00'>|;
196 s|\[92m|<span style='color: #080'>|;
197 s|\[93m|<span style='color: #FF0'>|;
198 s|\[94m|<span style='color: #00F'>|;
199 s|\[95m|<span style='color: #808'>|;
200 s|\[96m|<span style='color: #0CC'>|;
201 s|\[39m|</span>|;"
202 ;;
204 receipt)
205 sed -e s'|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|'g \
206 -e s"#^\#\([^']*\)#<span class='sh-comment'>\0</span>#"g \
207 -e s"#\"\([^']*\)\"#<span class='sh-val'>\0</span>#"g ;;
209 diff)
210 sed -e 's|&|\&amp;|g' -e 's|<|\&lt;|g' -e 's|>|\&gt;|g' \
211 -e s"#^-\([^']*\).#<span class='span-red'>\0</span>#"g \
212 -e s"#^+\([^']*\).#<span class='span-ok'>\0</span>#"g \
213 -e s"#@@\([^']*\)@@#<span class='span-sky'>@@\1@@</span>#"g ;;
215 activity)
216 sed s"#^\([^']* : \)#<span class='log-date'>\0</span>#"g ;;
217 esac
218 }
221 # Latest build pkgs.
223 list_packages() {
224 cd $PKGS
225 ls -1t *.tazpkg | head -n 20 | \
226 while read file; do
227 echo -n $(TZ=UTC stat -c '%y' $PKGS/$file | cut -d . -f 1 | sed s/:[0-9]*$//)
228 echo " : $file"
229 done
230 }
233 # Optional full list button
235 more_button() {
236 [ $(wc -l < ${3:-$CACHE/$1}) -gt ${4:-12} ] && cat <<EOT
237 <div style="float: right;">
238 <a class="button" href="?file=$1">$2</a>
239 </div>
240 EOT
241 }
244 # Show the running command and its progression
246 running_command()
247 {
248 local state="Not running"
249 if [ -s "$command" ]; then
250 state="$(cat $command)"
251 set -- $(grep "^$state" $cooktime)
252 if [ -n "$1" ]; then
253 state="$state $((($(date +%s)-$3)*100/$2))%"
254 [ $2 -gt 300 ] && state="$state (should end $(date -u -d @$(($2+$3))))"
255 fi
256 fi
257 echo $state
258 }
261 # xHTML header. Pages can be customized with a separated html.header file.
263 if [ -f "header.html" ]; then
264 cat header.html
265 else
266 cat <<EOT
267 <!DOCTYPE html>
268 <html lang="en">
269 <head>
270 <meta charset="UTF-8">
271 <title>SliTaz Cooker</title>
272 <link rel="shortcut icon" href="favicon.ico">
273 <link rel="stylesheet" href="style.css">
274 <meta name="robots" content="nofollow">
275 </head>
276 <body>
278 <div id="header">
279 <div id="logo"></div>
280 <h1><a href="cooker.cgi">SliTaz Cooker</a></h1>
281 </div>
283 <!-- Content -->
284 <div id="content">
285 EOT
286 fi
289 #
290 # Load requested page
291 #
293 case "${QUERY_STRING}" in
294 pkg=*)
295 pkg=${QUERY_STRING#pkg=}
296 log=$LOGS/$pkg.log
297 echo "<h2>Package: $pkg</h2>"
299 # Define cook variables for syntax highlighter
300 if [ -s "$WOK/$pkg/receipt" ]; then
301 . "$WOK/$pkg/receipt"
302 _wok='/home/slitaz/wok'
303 _src="$_wok/$pkg/source/$PACKAGE-$VERSION"
304 _install="$_wok/$pkg/install"
305 _fs="$_wok/$pkg/taz/$PACKAGE-$VERSION/fs"
306 _stuff="$_wok/$pkg/stuff"
307 fi
309 # Package info.
310 echo '<div id="info">'
311 if [ -f "$wok/$pkg/receipt" ]; then
312 echo "<a href='?receipt=$pkg'>receipt</a>"
313 unset WEB_SITE
314 unset WANTED
315 bpkg=$pkg
316 . $wok/$pkg/receipt
318 [ -n "$WANTED" ] && bpkg="${WANTED%% *}" # see locale-* with multiple WANTED
319 [ -n "$WEB_SITE" ] && # busybox wget -s $WEB_SITE &&
320 echo "<a href='$WEB_SITE'>home</a>"
322 if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then
323 echo "<a href='?files=$pkg'>files</a>"
324 unset EXTRAVERSION
325 . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt
326 if [ -f $wok/$pkg/taz/$PACKAGE-$VERSION/description.txt ]; then
327 echo "<a href='?description=$pkg'>description</a>"
328 fi
329 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg ]; then
330 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION.tazpkg'>download</a>"
331 fi
332 if [ -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg ]; then
333 echo "<a href='?download=$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg'>download</a>"
334 fi
335 fi
336 [ -x ./man2html ] &&
337 if [ -d $wok/$bpkg/install/usr/man ] ||
338 [ -d $wok/$bpkg/install/usr/share/man ] ||
339 [ -d $wok/$bpkg/taz/*/fs/usr/man ] ||
340 [ -d $wok/$bpkg/taz/*/fs/usr/share/man ]; then
341 echo "<a href='?man=$bpkg'>man</a>"
342 fi
343 if [ -d $wok/$bpkg/install/usr/doc ] ||
344 [ -d $wok/$bpkg/install/usr/share/doc ] ||
345 [ -d $wok/$bpkg/taz/*/fs/usr/doc ] ||
346 [ -d $wok/$bpkg/taz/*/fs/usr/share/doc ]; then
347 echo "<a href='?doc=$bpkg'>doc</a>"
348 fi
349 if [ -d $wok/$bpkg/install/usr/info ] ||
350 [ -d $wok/$bpkg/install/usr/share/info ] ||
351 [ -d $wok/$bpkg/taz/*/fs/usr/info ] ||
352 [ -d $wok/$bpkg/taz/*/fs/usr/share/info ]; then
353 echo "<a href='?info=$bpkg'>info</a>"
354 fi
355 [ -n "$(echo $REQUEST_URI | sed 's|/[^/]*?pkg.*||')" ] ||
356 echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
357 else
358 if [ $(ls $wok/*$pkg*/receipt 2>/dev/null | wc -l) -eq 0 ]; then
359 echo "No package named: $pkg"
360 else
361 ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
362 echo '<table style="width:100%">'
363 for i in $(cd $wok ; ls $pkg/receipt); do
364 pkg=$(dirname $i)
365 unset SHORT_DESC CATEGORY
366 . $wok/$pkg/receipt
367 cat <<EOT
368 <tr>
369 <td><a href="?pkg=$pkg">$pkg</a></td>
370 <td>$SHORT_DESC</td>
371 <td>$CATEGORY</td>
372 </tr>
373 EOT
374 done
375 echo '</table>'
376 unset pkg
377 fi
378 fi
379 echo '</div>'
381 # Check for a log file and display summary if it exists.
382 if [ -f "$log" ]; then
383 if grep -q "cook:$pkg$" $command; then
384 echo "<pre>The Cooker is currently building: $pkg</pre>"
385 fi
386 if fgrep -q "Summary for:" $LOGS/$pkg.log; then
387 echo '<h3>Cook summary</h3>'
388 echo '<pre>'
389 grep -A 12 "^Summary for:" $LOGS/$pkg.log | sed /^$/d | \
390 syntax_highlighter log
391 echo '</pre>'
392 fi
393 if fgrep -q "Debug information" $LOGS/$pkg.log; then
394 echo '<h3>Cook failed</h3>'
395 echo '<pre>'
396 grep -A 8 "^Debug information" $LOGS/$pkg.log | sed /^$/d | \
397 syntax_highlighter log
398 echo '</pre>'
399 fi
400 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
401 for i in $(ls -t $log.*); do
402 echo -n "<a href=\"?log=$(basename $i)\">"
403 echo "$(stat -c %y $i | sed 's/ .*//')</a>"
404 done
405 echo '<pre>'
406 cat $log | syntax_highlighter log
407 echo '</pre>'
408 case "$HTTP_USER_AGENT" in
409 *SliTaz*)
410 [ -f $CACHE/cooker-request ] && [ -n "$HTTP_REFERER" ] &&
411 echo "<a class=\"button\" href=\"?recook=$pkg\">Recook $pkg</a>"
412 esac
413 else
414 [ "$pkg" ] && echo "<pre>No log: $pkg</pre>"
415 fi ;;
417 log=*)
418 log=$LOGS/${QUERY_STRING#log=}
419 if [ -s $log ]; then
420 echo "<h3>Cook log $(stat -c %y $log | sed 's/:..\..*//')</h3>"
421 echo '<pre>'
422 cat $log | syntax_highlighter log
423 echo '</pre>'
424 fi
425 ;;
426 file=*)
427 # Don't allow all files on the system for security reasons.
428 file=${QUERY_STRING#file=}
429 case "$file" in
430 activity|cooknotes|cooklist)
431 [ "$file" == "cooklist" ] && \
432 nb="- Packages: $(cat $cooklist | wc -l)"
433 echo "<h2>DB: $file $nb</h2>"
434 echo '<pre>'
435 tac $CACHE/$file | syntax_highlighter activity
436 echo '</pre>' ;;
438 broken)
439 nb=$(cat $broken | wc -l)
440 echo "<h2>DB: broken - Packages: $nb</h2>"
441 echo '<pre>'
442 cat $CACHE/$file | sort | \
443 sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g
444 echo '</pre>' ;;
446 *.diff)
447 diff=$CACHE/$file
448 echo "<h2>Diff for: ${file%.diff}</h2>"
449 [ "$file" == "installed.diff" ] && echo \
450 "<p>This is the latest diff between installed packages \
451 and installed build dependencies to cook.</p>"
452 echo '<pre>'
453 cat $diff | syntax_highlighter diff
454 echo '</pre>' ;;
456 *.log)
457 log=$LOGS/$file
458 name=$(basename $log)
459 echo "<h2>Log for: ${name%.log}</h2>"
460 if [ -f "$log" ]; then
461 if fgrep -q "Summary" $log; then
462 echo '<pre>'
463 grep -A 20 "^Summary" $log | sed /^$/d | \
464 syntax_highlighter log
465 echo '</pre>'
466 fi
467 echo '<pre>'
468 cat $log | syntax_highlighter log
469 echo '</pre>'
470 else
471 echo "<pre>No log file: $log</pre>"
472 fi ;;
473 esac ;;
475 stuff=*)
476 file=${QUERY_STRING#stuff=}
477 echo "<h2>$file</h2>"
478 echo '<pre>'
479 cat $wok/$file | sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
480 echo '</pre>' ;;
482 receipt=*)
483 pkg=${QUERY_STRING#receipt=}
484 echo "<h2>Receipt for: $pkg</h2>"
485 if [ -f "$wok/$pkg/receipt" ]; then
486 . $wok/$pkg/receipt
487 [ -n "$TARBALL" ] && [ -s "$SRC/$TARBALL" ] &&
488 echo "<a href='?src=$TARBALL'>source</a>"
490 ( cd $wok/$pkg ; find stuff -type f 2> /dev/null ) | \
491 while read file ; do
492 echo "<a href=\"?stuff=$pkg/$file\">$file</a>"
493 done | sort
494 echo '<pre>'
495 cat $wok/$pkg/receipt | \
496 syntax_highlighter receipt
497 echo '</pre>'
498 else
499 echo "<pre>No receipt for: $pkg</pre>"
500 fi ;;
502 files=*)
503 pkg=${QUERY_STRING#files=}
504 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
505 if [ -d "$dir/fs" ]; then
506 echo "<h2>Installed files by: $pkg ($(du -hs $dir/fs | awk '{ print $1 }'))</h2>"
507 echo '<pre>'
508 find $dir/fs -not -type d -print0 | xargs -0 ls -ld | \
509 sed "s|\(.*\) /.*\(${dir#*wok}/fs\)\(.*\)|\1 <a href=\"?download=../wok\2\3\">\3</a>|;s|^\([^-].*\)\(<a.*\)\">\(.*\)</a>|\1\3|"
510 echo '</pre>'
511 else
512 echo "<pre>No files list for: $pkg</pre>"
513 fi ;;
515 description=*)
516 pkg=${QUERY_STRING#description=}
517 echo "<h2>Description of $pkg</h2>"
518 dir=$(ls -d $WOK/$pkg/taz/$pkg-*)
519 if [ -s "$dir/description.txt" ]; then
520 echo '<pre>'
521 cat $dir/description.txt | \
522 sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
523 echo '</pre>'
524 else
525 echo "<pre>No description for: $pkg</pre>"
526 fi ;;
528 man=*|doc=*|info=*)
529 type=${QUERY_STRING%%=*}
530 pkg=$(GET $type)
531 dir=$WOK/$pkg/install/usr/share/$type
532 [ -d $dir ] || dir=$WOK/$pkg/install/usr/$type
533 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/share/$type)
534 [ -d $dir ] || dir=$(echo $WOK/$pkg/taz/*/fs/usr/$type)
535 page=$(GET file)
536 if [ -z "$page" ]; then
537 page=$(find $dir -type f | sed q)
538 page=${page#$dir/}
539 fi
540 find $dir -type f | while read file ; do
541 [ -s $file ] || continue
542 case "$file" in
543 *.jp*g|*.png|*.gif|*.svg) continue
544 esac
545 file=${file#$dir/}
546 echo "<a href='?$type=$pkg&amp;file=$file'>$(basename $file)</a>"
547 done | sort -t \> -k 2
548 echo "<h2>$(basename $page)</h2>"
549 tmp="$(mktemp)"
550 docat "$dir/$page" > $tmp
551 [ -s "$tmp" ] && case "$type" in
552 info)
553 echo '<pre>'
554 info2html < "$tmp"
555 echo '</pre>' ;;
556 doc)
557 echo '<pre>'
558 case "$page" in
559 *.htm*) cat ;;
560 *) sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
561 esac < "$tmp"
562 echo '</pre>' ;;
563 man)
564 export TEXTDOMAIN='man2html'
565 ./man2html "$tmp" | sed -e '1,/<header>/d' \
566 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
567 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g' ;;
568 esac
569 rm -f $tmp
570 ;;
571 *)
572 # We may have a toolchain.cgi script for cross cooker's
573 if [ -f "toolchain.cgi" ]; then
574 toolchain='toolchain.cgi'
575 else
576 toolchain='?pkg=slitaz-toolchain'
577 fi
578 # Main page with summary. Count only package include in ARCH,
579 # use 'cooker arch-db' to manually create arch.$ARCH files.
580 inwok=$(ls $WOK/*/arch.$ARCH | wc -l)
581 cooked=$(ls $PKGS/*.tazpkg | wc -l)
582 unbuilt=$(($inwok - $cooked))
583 pct=0
584 [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok ))
585 cat <<EOT
586 <div style="float: right;">
587 <form method="get" action="$SCRIPT_NAME">
588 Package:
589 <input type="text" name="pkg" />
590 </form>
591 </div>
593 <h2>Summary</h2>
595 <pre>
596 Running command : $(running_command)
597 Wok revision : <a href="$WOK_URL">$(cat $wokrev)</a>
598 Commits to cook : $(cat $commits | wc -l)
599 Current cooklist : $(cat $cooklist | wc -l)
600 Broken packages : $(cat $broken | wc -l)
601 Blocked packages : $(cat $blocked | wc -l)
602 </pre>
603 EOT
604 [ -e $CACHE/cooker-request ] &&
605 [ $CACHE/activity -nt $CACHE/cooker-request ] && cat <<EOT
606 <div style="float: right;">
607 <a class="button" href="?poke">Poke cooker</a>
608 </div>
609 EOT
610 cat <<EOT
611 <p class="info">
612 Packages: $inwok in the wok | $cooked cooked | $unbuilt unbuilt |
613 Server date: $(date -u '+%F %R %Z')
614 </p>
615 <div class="pctbar">
616 <div class="pct" style="width: ${pct}%;">${pct}%</div>
617 </div>
619 <p>
620 Latest:
621 <a href="?file=cookorder.log">cookorder.log</a>
622 <a href="?file=commits.log">commits.log</a>
623 <a href="?file=pkgdb.log">pkgdb.log</a>
624 <a href="?file=installed.diff">installed.diff</a>
625 - Architecture $ARCH:
626 <a href="$toolchain">toolchain</a>
627 </p>
629 $(more_button activity "More activity" $CACHE/activity 12)
630 <h2 id="activity">Activity</h2>
631 <pre>
632 $(tac $CACHE/activity | head -n 12 | syntax_highlighter activity)
633 </pre>
634 EOT
636 [ -s $cooknotes ] && cat <<EOT
637 $(more_button cooknotes "More notes" $cooknotes 12)
638 <h2 id="cooknotes">Cooknotes</h2>
639 <pre>
640 $(tac $cooknotes | head -n 12 | syntax_highlighter activity)
641 </pre>
642 EOT
644 [ -s $commits ] && cat <<EOT
645 <h2 id="commits">Commits</h2>
646 <pre>
647 $(cat $commits)
648 </pre>
649 EOT
651 [ -s $cooklist ] && cat <<EOT
652 $(more_button cooklist "Full cooklist" $cooklist 20)
653 <h2 id="cooklist">Cooklist</h2>
654 <pre>
655 $(cat $cooklist | head -n 20)
656 </pre>
657 EOT
659 [ -s $broken ] && cat <<EOT
660 $(more_button broken "All broken packages" $broken 20)
661 <h2 id="broken">Broken</h2>
662 <pre>
663 $(cat $broken | head -n 20 | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
664 </pre>
665 EOT
667 [ -s $blocked ] && cat <<EOT
668 <h2 id="blocked">Blocked</h2>
669 <pre>
670 $(cat $blocked | sed s"#^[^']*#<a href='?pkg=\0'>\0</a>#"g)
671 </pre>
672 EOT
674 cat <<EOT
675 <h2 id="lastcook">Latest cook</h2>
676 <pre>
677 $(list_packages | sed s"#^\([^']*\).* : #<span class='log-date'>\0</span>#"g)
678 </pre>
679 EOT
680 ;;
681 esac
684 # Close xHTML page
686 cat <<EOT
687 </div>
689 <div id="footer">
690 <a href="http://www.slitaz.org/">SliTaz Website</a>
691 <a href="cooker.cgi">Cooker</a>
692 <a href="doc/cookutils/cookutils.en.html">Documentation</a>
693 </div>
695 </body>
696 </html>
697 EOT
699 exit 0