cookutils rev 1007

lighttpd/index.cgi: remake toolchain info (was broken for linux-api-headers); add feature: show tags
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 13 02:55:58 2017 +0200 (2017-11-13)
parents 553a90d99a5b
children 0a44898b817d
files lighttpd/cooker.css lighttpd/index.cgi
line diff
     1.1 --- a/lighttpd/cooker.css	Sat Nov 11 11:53:55 2017 +0000
     1.2 +++ b/lighttpd/cooker.css	Mon Nov 13 02:55:58 2017 +0200
     1.3 @@ -399,6 +399,10 @@
     1.4  div.list {
     1.5  	margin: 2rem auto;
     1.6  }
     1.7 +.dog {
     1.8 +	max-height: 12rem;
     1.9 +	overflow-y: auto;
    1.10 +}
    1.11  
    1.12  
    1.13  /* HTML5 progress */
     2.1 --- a/lighttpd/index.cgi	Sat Nov 11 11:53:55 2017 +0000
     2.2 +++ b/lighttpd/index.cgi	Mon Nov 13 02:55:58 2017 +0200
     2.3 @@ -772,15 +772,14 @@
     2.4  
     2.5  
     2.6  toolchain_version() {
     2.7 -	echo "<tr><td><a href='$base/$1'>$1</a></td><td>"
     2.8 -	if [ -e "$WOK/$1/receipt" ]; then
     2.9 -		grep ^VERSION $WOK/$1/receipt | cut -d '"' -f2
    2.10 -		echo '</td><td>'
    2.11 -		grep ^SHORT_DESC $WOK/$1/receipt | cut -d '"' -f2
    2.12 -	else
    2.13 -		echo -n '---</td><td>---'
    2.14 -	fi
    2.15 -	echo "</td></tr>"
    2.16 +	echo "<tr><td><a href='$base/$1'>$1</a></td>"
    2.17 +	awk -F$'\t' -vpkg="$1" '
    2.18 +	BEGIN { version = description = "---"; }
    2.19 +	      {
    2.20 +	        if ($1 == pkg) { version = $2; description = $4; }
    2.21 +	      }
    2.22 +	END   { printf("<td>%s</td><td>%s</td></tr>", version, description); }
    2.23 +	' $PKGS/packages.info
    2.24  }
    2.25  
    2.26  
    2.27 @@ -1039,6 +1038,35 @@
    2.28  fi
    2.29  
    2.30  
    2.31 +# show tag
    2.32 +
    2.33 +if [ "$pkg" == '~' -a -n "$cmd" ]; then
    2.34 +	tag="$cmd"
    2.35 +	page_header
    2.36 +	cat <<EOT
    2.37 +<div id="content2">
    2.38 +<section>
    2.39 +<h2>Tag “$tag”</h2>
    2.40 +
    2.41 +<table>
    2.42 +	<thead>
    2.43 +		<tr><th>Name</th><th>Description</th><th>Category</th></tr>
    2.44 +	</thead>
    2.45 +	<tbody>
    2.46 +EOT
    2.47 +	awk -F$'\t' -vtag=" $tag " -vbase="$base" '{
    2.48 +		if (index(" " $6 " ", tag)) {
    2.49 +			url = base "/" $1 "/";
    2.50 +			gsub("+", "%2B", url);
    2.51 +			printf("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", url, $1, $4, $3);
    2.52 +		}
    2.53 +	}' $PKGS/packages.info
    2.54 +	echo '</tbody></table>'
    2.55 +	page_footer
    2.56 +	exit 0
    2.57 +fi
    2.58 +
    2.59 +
    2.60  case "$cmd" in
    2.61  	'')
    2.62  		page_header
    2.63 @@ -1094,9 +1122,29 @@
    2.64  		summary "$log"
    2.65  
    2.66  
    2.67 +		# Show tag list
    2.68 +		taglist=$(
    2.69 +			for i in $pkg $(awk -F$'\t' -vp="$pkg" '{if ($1 == p) print $2}' $splitdb); do
    2.70 +				[ -s "$PKGS/packages.info" ] &&
    2.71 +				awk -F$'\t' -vpkg="$i" '{
    2.72 +					if ($1 == pkg) { print $6; exit; }
    2.73 +				}' "$PKGS/packages.info"
    2.74 +			done \
    2.75 +			| tr ' ' '\n' \
    2.76 +			| sort -u
    2.77 +		)
    2.78 +		if [ -n "$taglist" ]; then
    2.79 +			echo -n '<section><h3>Tags</h3><p>'
    2.80 +			lasttag=$(echo "$taglist" | tail -n1)
    2.81 +			for tag in $taglist; do
    2.82 +				echo -n "<a href=\"$base/~/${tag//+/%2B}\">$tag</a>"
    2.83 +				[ "$tag" != "$lasttag" ] && echo -n " · "
    2.84 +			done
    2.85 +			echo '</p></section>'
    2.86 +		fi
    2.87  
    2.88  
    2.89 -		# Informal table with dependencies
    2.90 +		# Informational table with dependencies
    2.91  		pkg="$requested_pkg"
    2.92  		inf="$(mktemp -d)"
    2.93