cookutils diff lighttpd/index.cgi @ rev 912

cook: remake copy_generic_files()/copy_generic_stuff() logic; change build dep installation (AUTO_COOK isn't work now) with tazpkg cookmode; improve mk_pkg_receipt(), copy(); update 'cook package --pack'; add docs about copy(); lighttpd/index.cgi: summary on unpackaged files; tiny edits on lighttpd/cooker.css and modules/compressor.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Jun 05 15:59:11 2017 +0300 (2017-06-05)
parents e68dad1ffbff
children 1e4e278b2285
line diff
     1.1 --- a/lighttpd/index.cgi	Tue May 30 05:33:45 2017 +0300
     1.2 +++ b/lighttpd/index.cgi	Mon Jun 05 15:59:11 2017 +0300
     1.3 @@ -458,9 +458,11 @@
     1.4  				-e 's#Success$#<i>Success</i>#' \
     1.5  				-e 's#\([^a-z]\)ok$#\1<i>ok</i>#' \
     1.6  				-e 's#\([^a-z]\)yes$#\1<i>yes</i>#' \
     1.7 +				-e 's#\([^a-z]\)ON$#\1<i>ON</i>#' \
     1.8  				-e 's#\([^a-z]\)no$#\1<u>no</u>#' \
     1.9  				-e 's#\([^a-z]\)none$#\1<u>none</u>#' \
    1.10  				-e 's#\([^a-z]\)false$#\1<u>false</u>#' \
    1.11 +				-e 's#\([^a-z]\)OFF$#\1<u>OFF</u>#' \
    1.12  				-e 's#\(^checking .*\.\.\. \)\(.*\)$#\1<i>\2</i>#' \
    1.13  				\
    1.14  				-e 's#\( \[Y[nm/]\?\] n\)$# <u>\1</u>#' \
    1.15 @@ -1018,14 +1020,20 @@
    1.16  
    1.17  			size=$(du -hs $dir | awk '{ sub(/\.0/, ""); print $1 }')
    1.18  
    1.19 -			echo "<section><h3>Files of package “$namever” ($size):</h3>"
    1.20 -			echo -en '<pre class="files">\n<span class="underline">permissions·lnk·user    ·'
    1.21 -			echo -en 'group   ·     size·date &amp; time ·file name\n</span>'
    1.22 -			find $dir -not -type d -print0 | sort -z | xargs -0 ls -ld --color=always | \
    1.23 -			syntax_highlighter files | \
    1.24 -			sed "s|\([^>]*\)>/.*/fs\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|" | \
    1.25 -			awk 'BEGIN { FS="\""; }
    1.26 -				{ gsub("+", "%2B", $2); print; }'
    1.27 +			echo "<section><h3>Files of package “$namever” (${size:-empty}):</h3>"
    1.28 +			echo '<pre class="files">'
    1.29 +			if [ -s "$wok/$indir/taz/$p-$ver/files.list" ]; then
    1.30 +				echo -n '<span class="underline">permissions·lnk·user    ·'
    1.31 +				echo -en 'group   ·     size·date &amp; time ·file name\n</span>'
    1.32 +				cd $dir
    1.33 +				find . -not -type d -print0 | sort -z | xargs -0 ls -ld --color=always | \
    1.34 +				syntax_highlighter files | \
    1.35 +				sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|" | \
    1.36 +				awk 'BEGIN { FS="\""; }
    1.37 +					{ gsub("+", "%2B", $2); print; }'
    1.38 +			else
    1.39 +				echo 'No files'
    1.40 +			fi
    1.41  			echo '</pre></section>'
    1.42  			cat $wok/$indir/taz/$p-$ver/files.list >> $packaged
    1.43  		done
    1.44 @@ -1042,21 +1050,45 @@
    1.45  		all_files=$(mktemp)
    1.46  		cd $wok/$main/install; find ! -type d | sed 's|\.||' > $all_files
    1.47  		orphans="$(sort $all_files $packaged | uniq -u)"
    1.48 -		if [ -n "$orphans" ]; then
    1.49 -			echo -n '<section><h3>Unpackaged files:</h3><pre class="files">'
    1.50 +		if [ -d "$wok/$main/install" -a -n "$orphans" ]; then
    1.51 +			echo '<section><h3>Unpackaged files:</h3>'
    1.52 +			table=$(mktemp)
    1.53  			echo "$orphans" | awk '
    1.54  			function tag(text, color) { printf("<span class=\"c%s1\">%s</span> %s\n", color, text, $0); }
    1.55 -			/\/perllocal.pod$/ || /\/\.packlist$/ || /\/share\/bash-completion\// || /\/lib\/systemd\// { tag("---", 0); next }
    1.56 +			/\/perllocal.pod$/ || /\/\.packlist$/ || /\/share\/bash-completion\// ||
    1.57 +				/\/lib\/systemd\// || /\.pyc$/ || /\.pyo$/ { tag("---", 0); next }
    1.58  			/\.pod$/  { tag("pod", 5); next }
    1.59  			/\/share\/man\// { tag("man", 5); next }
    1.60 -			/\/share\/doc\// || /\/share\/gtk-doc\// || /\/share\/info\// || /\/share\/devhelp\// { tag("doc", 5); next }
    1.61 +			/\/share\/doc\// || /\/share\/gtk-doc\// || /\/share\/info\// ||
    1.62 +				/\/share\/devhelp\// { tag("doc", 5); next }
    1.63  			/\/share\/icons\// { tag("ico", 2); next }
    1.64  			/\/share\/locale\// { tag("loc", 4); next }
    1.65  			/\.h$/ || /\.a$/ || /\.la$/ || /\.pc$/ || /\/bin\/.*-config$/ { tag("dev", 3); next }
    1.66  			{ tag("???", 1) }
    1.67 -			'
    1.68 +			' > $table
    1.69 +
    1.70 +			# Summary table
    1.71 +			for i in head body; do
    1.72 +				case $i in
    1.73 +					head) echo -n '<table class="summary"><tr>';;
    1.74 +					body) echo -n '<th> </th></tr><tr>';;
    1.75 +				esac
    1.76 +				for j in '???1' dev3 loc4 ico2 doc5 man5 pod5 '---0'; do
    1.77 +					tag=${j:0:3}; class="c${j:3:1}0"; [ "$class" == 'c00' ] && class='c01'
    1.78 +					case $i in
    1.79 +						head) echo -n "<th class='$class'>$tag</th>";;
    1.80 +						body) printf '<td>%s</td>' "$(grep ">$tag<" $table | wc -l)";;
    1.81 +					esac
    1.82 +				done
    1.83 +			done
    1.84 +			echo '<td> </td></tr></table>'
    1.85 +
    1.86 +			echo -n '<pre class="files">'
    1.87 +			cat $table
    1.88  			echo '</pre></section>'
    1.89 +			rm $table
    1.90  		fi
    1.91 +		rm $packaged $all_files
    1.92  		;;
    1.93  
    1.94  	description)
    1.95 @@ -1243,15 +1275,24 @@
    1.96  
    1.97  					if [ -n "$(echo "$html" | fgrep 'The requested file /tmp/tmp.')" ]; then
    1.98  						# Process the pre-formatted man-cat page
    1.99 -						echo '<pre>'
   1.100 -						sed '
   1.101 +						# (for example see sudo package without groff in build dependencies)
   1.102 +						sed -i '
   1.103  							s|M-bM-^@M-^S|—|g;
   1.104  							s|M-bM-^@M-^\\|<b>|g;
   1.105  							s|M-bM-^@M-^]|</b>|g
   1.106  							s|M-bM-^@M-^X|<u>|g;
   1.107  							s|M-bM-^@M-^Y|</u>|g;
   1.108  							s|M-BM-||g;
   1.109 +							s|++oo|•|g;
   1.110 +							s|&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g;
   1.111  							' "$tmp"
   1.112 +						for i in a b c d e f g h i j k l m n o p q r s t u v w x y z \
   1.113 +								 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
   1.114 +								 0 1 2 3 4 5 6 7 8 9 _ - '\\+' '\.' /; do
   1.115 +							sed -i "s|$i$i|<b>$i</b>|g; s|_$i|<u>$i</u>|g" "$tmp"
   1.116 +						done
   1.117 +						echo '<pre class="catman">'
   1.118 +						sed 's|</b><b>||g; s|</u><u>||g; s|</u><b>_</b><u>|_|g; s|</b> <b>| |g;' "$tmp"
   1.119  						echo '</pre>'
   1.120  					else
   1.121  						echo "$html"