# HG changeset patch # User Aleksej Bobylev # Date 1497206375 -10800 # Node ID f4e577c714e2e22e97509e938b24fe52fb5745dd # Parent 5d6cbb57121717e54c5d6600805efdca93701e06 A bunch of small improvements, incl.: cook: not touching main log when packing; find lastcooktime in other logs; summary for packing log; index.cgi: return back after changing the theme; show directories too among the files list, quick jump links; new download page (src & pkgs); new toolchain page; show packing log too. diff -r 5d6cbb571217 -r f4e577c714e2 cook --- a/cook Sun Jun 11 00:01:29 2017 +0300 +++ b/cook Sun Jun 11 21:39:35 2017 +0300 @@ -73,7 +73,7 @@ clean_log() { sed -i -e s'|\[70G\[ \[1;32m| |' \ - -e s'|\[0;39m \]||' $LOGS/$pkg.log + -e s'|\[0;39m \]||' $LOGS/${1:-$pkg}.log } @@ -1328,7 +1328,7 @@ # Copy "standard" files (all but "developer files", man pages, documentation, translations) sed '/\.h$/d; /\.hxx$/d; /\.a$/d; /\.la$/d; /\.pc$/d; /bin\/.*-config$/d; /\.m4$/d; /\.gir$/d; /\.typelib$/d; /\.vapi$/d; /\.deps$/d; /\.cmake$/d; - /\/Makefile.*/d; /\/include\//d; + /\/Makefile.*/d; /\.inc$/d; /\/include\//d; /\/share\/man\//d; /\/share\/doc\//d; /\/share\/gtk-doc\//d; /\/share\/info\//d; /\/share\/devhelp\//d; /\/share\/locale\//d; /\/share\/bash-completion\//d; /\/lib\/systemd\//d; @@ -1338,7 +1338,7 @@ # Copy "developer files" sed -n '/\.h$/p; /\.hxx$/p; /\.a$/p; /\.la$/p; /\.pc$/p; /bin\/.*-config$/p; /\.m4$/p; /\.gir$/p; /\.typelib$/p; /\.vapi$/p; /\.deps$/p; /\.cmake$/p; - /\/Makefile.*/p; /\/include\//p; + /\/Makefile.*/p; /\.inc$/p; /\/include\//p; ' $filelist ;; */) @@ -1720,8 +1720,14 @@ pkg="$1" [ -z "$pkg" ] && usage - lastcooktime=$(sed '/^Cook time/!d; s|.*: *\([0-9]*\)s.*|\1|' \ - $LOGS/$pkg.log 2>/dev/null | sed '$!d') + # Search last successful cook time in all logs from newer to older + for i in '' $(seq 0 9 | sed 's|^|.|'); do + [ -f "$LOGS/$pkg.log$i" ] || break + lastcooktime=$(sed '/^Cook time/!d; s|.*: *\([0-9]*\)s.*|\1|' \ + $LOGS/$pkg.log$i 2>/dev/null | sed '$!d') + [ -n "$lastcooktime" ] && break + done + receipt="$WOK/$pkg/receipt" check_pkg_in_wok newline @@ -1811,11 +1817,13 @@ exit 0 ;; --pack) - [ -d $WOK/$pkg/taz ] || die 'Need to build "%s"' "$pkg" - rm -rf $WOK/$pkg/taz - [ -f $LOGS/$pkg-pack.log ] && rm -rf $LOGS/$pkg-pack.log + [ -d "$WOK/$pkg/install" ] || die 'Need to build "%s"' "$pkg" + [ ! -d "$WOK/$pkg/taz" ] || rm -rf "$WOK/$pkg/taz" + [ ! -f "$LOGS/$pkg-pack.log" ] || rm -rf $LOGS/$pkg-pack.log packall 2>&1 | tee -a $LOGS/$pkg-pack.log - clean_log + clean_log "$pkg-pack" + time=$(($(date +%s) - $time)) + summary | sed 's|^Cook |Pack |' | tee -a $LOGS/$pkg-pack.log rm -f $command exit 0 ;; diff -r 5d6cbb571217 -r f4e577c714e2 lighttpd/cooker.css --- a/lighttpd/cooker.css Sun Jun 11 00:01:29 2017 +0300 +++ b/lighttpd/cooker.css Sun Jun 11 21:39:35 2017 +0300 @@ -314,7 +314,7 @@ /* Table */ table { width: 100%; box-sizing: border-box; border-collapse: collapse; /*box-shadow: 0 0 4px rgba(0,0,0,0.3);*/ } -th { color: rgba(0,0,0,0.6); background-color: rgba(0,0,0,0.2); padding: 3px; } +th { color: rgba(0,0,0,0.6); background-color: rgba(0,0,0,0.1); padding: 3px; } td { padding: 2px; vertical-align: top; } td:first-child { white-space: nowrap; width: 5rem; } td+td, th+th { border-left: 1px solid rgba(0,0,0,0.1); } diff -r 5d6cbb571217 -r f4e577c714e2 lighttpd/cooker.js --- a/lighttpd/cooker.js Sun Jun 11 00:01:29 2017 +0300 +++ b/lighttpd/cooker.js Sun Jun 11 21:39:35 2017 +0300 @@ -54,10 +54,13 @@ // Calculate and show server date function calcAndShowDate() { - var serverDateNow = new Date() - deltaTime; - var serverDateString = new Date(serverDateNow).toISOString(); - // Format string in form 'YYYY-mm-dd HH:MM UTC' - document.getElementById('date').innerHTML = serverDateString.substring(0, 10) + ' ' + serverDateString.substring(11, 16) + ' UTC'; + var dateEl = document.getElementById('date'); + if (dateEl !== null) { + var serverDateNow = new Date() - deltaTime; + var serverDateString = new Date(serverDateNow).toISOString(); + // Format string in form 'YYYY-mm-dd HH:MM UTC' + dateEl.innerHTML = serverDateString.substring(0, 10) + ' ' + serverDateString.substring(11, 16) + ' UTC'; + } } diff -r 5d6cbb571217 -r f4e577c714e2 lighttpd/index.cgi --- a/lighttpd/index.cgi Sun Jun 11 00:01:29 2017 +0300 +++ b/lighttpd/index.cgi Sun Jun 11 21:39:35 2017 +0300 @@ -273,6 +273,7 @@ if [ -n "$(GET theme)" ]; then theme="$(GET theme)" + ref="$(echo "$HTTP_REFERER" | sed 's|:|%3A|g; s|/|%2F|g; s|\?|%3F|g; s|\+|%2B|g;')" case $theme in theme) current=$(COOKIE theme) @@ -284,7 +285,7 @@ @@ -294,9 +295,11 @@ exit 0 ;; default|emerald|sky|goldenrod|midnight|like2016|terminal) + ref="$(GET ref)" + [ -n "$ref" ] || ref="$base/" # Expires in a year expires=$(date -uRd @$(($(date +%s)+31536000)) | sed 's|UTC|GMT|') - echo -e "HTTP/1.1 302 Found\nLocation: $base/\nCache-Control: no-cache\nSet-Cookie: theme=$theme; expires=$expires\n\n" + echo -e "HTTP/1.1 302 Found\nLocation: $ref\nCache-Control: no-cache\nSet-Cookie: theme=$theme; expires=$expires\n\n" exit 0 ;; esac @@ -528,12 +531,14 @@ if (part3 != "root ") part3 = "" part3 ""; print part1 part2 part3 part4; }' | \ - sed "s|\[\([01]\);3\([1-7]\)m||g; + sed "s|\[0m/|/\[0m|g; + s|\[\([01]\);3\([1-7]\)m||g; s|\[\([01]\);0m||g; s|\[0m||g; s|^\(lrwxrwxrwx\)|\1|; s|^\(-rwxr-xr-x\)|\1|; s|^\(-rw-r--r--\)|\1|; + s|^\(drwxr-xr-x\)|\1|; s|^\([lrwxs-]*\)|\1|; " ;; @@ -627,7 +632,7 @@ local log active bpkg log="$LOGS/$pkg.log" - echo "

Package “$pkg”

" + echo "

$pkg

" echo '
' echo "receipt & stuff" @@ -643,18 +648,10 @@ [ -n "$(ls $wok/$pkg/description*.txt)" ] && echo "description" - unset EXTRAVERSION - . $wok/$pkg/taz/$PACKAGE-$VERSION/receipt - for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg"; do - [ -f "$PKGS/$filename" ] && - echo "download" - done - + [ -n "$TARBALL" -a -s "$SRC/$TARBALL" -o -d "$wok/$pkg/taz" ] && + echo "download" fi - [ -n "$TARBALL" -a -s "$SRC/$TARBALL" ] && - echo "source" - echo "browse" [ -x ./man2html -a -d "$wok/$pkg/install/usr/share/man" ] && @@ -704,6 +701,40 @@ } +# Return all the names of packages bundled in this receipt + +all_names() { + local split=" $SPLIT " + if [ "${split/ $PACKAGE /}" != "$split" ]; then + # $PACKAGE included somewhere in $SPLIT (probably in the end). + # We should build packages in the order defined in the $SPLIT. + echo $SPLIT + else + # We'll build the $PACKAGE, then all defined in the $SPLIT. + echo $PACKAGE $SPLIT + fi +} + + +toolchain_version() { + echo "$1" + if [ -e "$WOK/$1/receipt" ]; then + grep ^VERSION $WOK/$1/receipt | cut -d '"' -f2 + echo '' + grep ^SHORT_DESC $WOK/$1/receipt | cut -d '"' -f2 + else + echo -n '------' + fi + echo "" +} + + +files_header() { + echo '

Available downloads:

' + echo '' +} + + # @@ -752,6 +783,34 @@ show_note e "No log file: $log" fi ;; + toolchain) + cat < +
+

SliTaz GNU/Linux toolchain

+ +
FileSizeDescription
+ + + + + + +$(toolchain_version slitaz-toolchain) +$(toolchain_version binutils) +$(toolchain_version linux-api-headers) +$(toolchain_version gcc) +$(toolchain_version glibc) +
Build date $(sed -n '/^Cook date/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Build duration $(sed -n '/^Cook time/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Architecture $ARCH
Build system $BUILD_SYSTEM
Host system $HOST_SYSTEM
PackageVersionDescription
+ +

Toolchain documentation: http://doc.slitaz.org/en:cookbook:toolchain +

+ +
+
+EOT + ;; esac page_footer exit 0 @@ -762,12 +821,12 @@ if [ -f "toolchain.cgi" ]; then toolchain="toolchain.cgi" else - toolchain="slitaz-toolchain/" + toolchain="?toolchain" fi # Main page with summary. Count only packages included in ARCH, # use 'cooker arch-db' to manually create arch.$ARCH files. inwok=$(ls $WOK/*/arch.$ARCH | wc -l) - cooked=$(ls $PKGS/*.tazpkg | wc -l) + cooked=$(ls -d $WOK/*/taz | wc -l) unbuilt=$(($inwok - $cooked)) pct=0; [ $inwok -gt 0 ] && pct=$(( ($cooked * 100) / $inwok )) cat <Packages: $inwok in the wok · $cooked cooked · $unbuilt unbuilt

+

Receipts in the wok: $inwok total · $cooked cooked · $unbuilt unbuilt

${pct}%${pct}%
@@ -1018,6 +1077,13 @@ fi ver=$(. $wok/$main/receipt; echo $VERSION$EXTRAVERSION) + + echo "

Quick jump:

" + for p in $split; do namever="$p-$ver" if [ -d "$wok/$p/taz/$p-$ver" ]; then @@ -1029,15 +1095,15 @@ size=$(du -hs $dir | awk '{ sub(/\.0/, ""); print $1 }') - echo "

Files of package “$namever” (${size:-empty}):

" + echo "

Content of package “$namever” (${size:-empty}):

" echo '
'
 			if [ -s "$wok/$indir/taz/$p-$ver/files.list" ]; then
 				echo -n 'permissions·lnk·user    ·'
-				echo -en 'group   ·     size·date & time ·file name\n'
+				echo -en 'group   ·     size·date & time ·name\n'
 				cd $dir
-				find . -not -type d -print0 | sort -z | xargs -0 ls -ld --color=always | \
+				find . -print0 | sort -z | xargs -0 ls -ldp --color=always | \
 				syntax_highlighter files | \
-				sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|" | \
+				sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|;" | \
 				awk 'BEGIN { FS="\""; }
 					{ gsub("+", "%2B", $2); print; }'
 			else
@@ -1050,7 +1116,7 @@
 		# find repeatedly packaged files
 		repeats="$(sort $packaged | uniq -d)"
 		if [ -n "$repeats" ]; then
-			echo -n '

Repeatedly packaged files:

'
+			echo -n '

Repeatedly packaged files:

'
 			echo "$repeats" | sed 's|^|!!! |'
 			echo "
" fi @@ -1060,10 +1126,13 @@ cd $wok/$main/install; find ! -type d | sed 's|\.||' > $all_files orphans="$(sort $all_files $packaged | uniq -u)" if [ -d "$wok/$main/install" -a -n "$orphans" ]; then - echo '

Unpackaged files:

' + echo '

Unpackaged files:

' table=$(mktemp) - echo "$orphans" | awk ' - function tag(text, color) { printf("%s %s\n", color, text, $0); } + echo "$orphans" | awk -vi="$base/$indir/browse/install" ' + function tag(text, color) { + printf("%s ", color, text); + printf("%s\n", i $0, $0); + } /\/perllocal.pod$/ || /\/\.packlist$/ || /\/share\/bash-completion\// || /\/lib\/systemd\// || /\.pyc$/ || /\.pyo$/ { tag("---", 0); next } /\.pod$/ { tag("pod", 5); next } @@ -1072,7 +1141,8 @@ /\/share\/devhelp\// { tag("doc", 5); next } /\/share\/icons\// { tag("ico", 2); next } /\/share\/locale\// { tag("loc", 4); next } - /\.h$/ || /\.a$/ || /\.la$/ || /\.pc$/ || /\/bin\/.*-config$/ || /\/Makefile.*$/ { tag("dev", 3); next } + /\.h$/ || /\.a$/ || /\.la$/ || /\.pc$/ || /\/bin\/.*-config$/ || + /\/Makefile.*$/ { tag("dev", 3); next } { tag("???", 1) } ' > $table @@ -1126,14 +1196,16 @@ [ -z "$arg" ] && arg=$(stat -c %Y $LOGS/$pkg.log) echo '
' - acc='l' + acc='l' # access key for the latest log is 'L' while read log; do + # for all $pkg.log, $pkg.log.0 .. $pkg.log.9, $pkg-pack.log (if any) timestamp=$(stat -c %Y $log) class='' if [ "$arg" == "$timestamp" ]; then class=' log' logfile="$log" fi + case $log in *-pack.log) acc='p';; esac # access key for the packing log is 'P' echo -n "" echo "$(stat -c %y $log | cut -d: -f1,2)" case $acc in @@ -1142,6 +1214,7 @@ esac done <' @@ -1315,6 +1388,49 @@ fi ;; + download) + page_header + pkg_info + show=0 + + . $wok/$pkg/receipt + + if [ -n "$TARBALL" -a -s "$SRC/$TARBALL" ]; then + files_header + echo "$TARBALL" + ls -lh "$SRC/$TARBALL" | awk '{printf("%sB", $5)}' + echo "Sources for building the package “$pkg”" + show=1 + fi + + if [ -d "$wok/$pkg/taz" ]; then + [ "$show" -eq 1 ] || files_header + + for i in $(all_names); do + [ -e "$wok/$pkg/taz/$i-$VERSION$EXTRAVERSION/receipt" ] || continue + . $wok/$pkg/taz/$i-$VERSION$EXTRAVERSION/receipt + + for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg"; do + [ -f "$PKGS/$filename" ] && + cat < +$filename +$(ls -lh ./packages/$filename | awk '{printf("%sB", $5)}') +$SHORT_DESC + +EOT + done + done + show=1 + fi + + if [ "$show" -eq 1 ]; then + echo '
' + else + show_note w "Sorry, there's nothing to download…" + fi + ;; + esac