cookutils rev 982

cook: don't waste time uninstalling bdeps while we are in aufs chroot; modules/pkgdb: make bdeps.txt; lighttpd/index.cgi: show table "Dependencies of packages" in the package's info page.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 20 16:54:05 2017 +0300 (2017-10-20)
parents 3531c84ef51d
children f468fc0fcdc3
files cook lighttpd/cooker.css lighttpd/index.cgi modules/pkgdb
line diff
     1.1 --- a/cook	Fri Oct 20 11:11:10 2017 +0300
     1.2 +++ b/cook	Fri Oct 20 16:54:05 2017 +0300
     1.3 @@ -529,12 +529,15 @@
     1.4  		_n 'Removing:'
     1.5  		for dep in $deps; do
     1.6  			echo -n " $dep"
     1.7 +			# Do not waste time uninstalling the packages if we are inside
     1.8 +			# aufs chroot - unmounting chroot will "uninstall" all packages.
     1.9 +			[ -s /aufs-umount.sh ] ||
    1.10  			echo 'y' | tazpkg remove $dep --root=$root >/dev/null
    1.11  		done
    1.12 -		newline; newline
    1.13 -		# Keep the last diff for debug and info.
    1.14 -		mv -f $diff $CACHE/installed.diff
    1.15  	} | busybox fold -sw80
    1.16 +	newline; newline
    1.17 +	# Keep the last diff for debug and info.
    1.18 +	mv -f $diff $CACHE/installed.diff
    1.19  }
    1.20  
    1.21  
     2.1 --- a/lighttpd/cooker.css	Fri Oct 20 11:11:10 2017 +0300
     2.2 +++ b/lighttpd/cooker.css	Fri Oct 20 16:54:05 2017 +0300
     2.3 @@ -363,7 +363,8 @@
     2.4  table { width: 100%; box-sizing: border-box; border-collapse: collapse; /*box-shadow: 0 0 4px rgba(0,0,0,0.3);*/ }
     2.5  th { /*color: rgba(0,0,0,0.6);*/ background-color: rgba(0,0,0,0.1); padding: 3px; font-weight: normal; }
     2.6  td { padding: 2px; vertical-align: top; }
     2.7 -td:first-child { white-space: nowrap; width: 5rem; }
     2.8 +table:not(.half) td:first-child { white-space: nowrap; width: 5rem; }
     2.9 +table.half td { width:50%; }
    2.10  td+td { border-left: 1px solid rgba(0,0,0,0.1); }
    2.11  .activity td:first-child, .cooknotes td:first-child, td.m { color: rgba(0,0,0,0.6); }
    2.12  
     3.1 --- a/lighttpd/index.cgi	Fri Oct 20 11:11:10 2017 +0300
     3.2 +++ b/lighttpd/index.cgi	Fri Oct 20 16:54:05 2017 +0300
     3.3 @@ -271,6 +271,29 @@
     3.4  fi
     3.5  
     3.6  
     3.7 +# Query '/s/<pkg>': show status indicator icon
     3.8 +# Can't use ?query - not able to change '+' to '%2B' in the sed rules (see log handler)
     3.9 +
    3.10 +if [ "$pkg" == 's' ]; then
    3.11 +	# argument <pkg> is in $cmd variable
    3.12 +
    3.13 +	# find main package
    3.14 +	main=$(awk -F$'\t' -vpkg=" $cmd " '{
    3.15 +		if (index(" " $2 " ", pkg)) {print $1; exit}
    3.16 +	}' $splitdb)
    3.17 +	# get version
    3.18 +	ver="$(. $wok/$main/receipt; echo "$VERSION")"
    3.19 +
    3.20 +	echo -en "Content-Type: image/svg+xml\n\n<svg xmlns='http://www.w3.org/2000/svg' height='12' width='8'><path d='"
    3.21 +	if [ -e $PKGS/$cmd-$ver.tazpkg ]; then
    3.22 +		echo "m1 2-1 1v8l1 1h6l1-1v-8l-1-1z' fill='#090'/></svg>"
    3.23 +	else
    3.24 +		echo "m0 3v8l1 1h6l1-1v-8l-1-1h-6zm3 0h2v5h-2zm0 6h2v2h-2z' fill='#d00'/></svg>"
    3.25 +	fi
    3.26 +	exit
    3.27 +fi
    3.28 +
    3.29 +
    3.30  # Query '?theme[=<theme>]': change UI theme
    3.31  
    3.32  if [ -n "$(GET theme)" ]; then
    3.33 @@ -1031,6 +1054,57 @@
    3.34  		# Check for a log file and display summary if it exists.
    3.35  		summary "$log"
    3.36  
    3.37 +		# Informal table with dependencies
    3.38 +		cat <<EOT
    3.39 +<section>
    3.40 +	<h3>Dependencies of packages</h3>
    3.41 +	<table class="half">
    3.42 +		<thead>
    3.43 +			<tr>
    3.44 +				<th>Build dependencies</th>
    3.45 +				<th>Required by</th>
    3.46 +			</tr>
    3.47 +		</thead>
    3.48 +		<tbody>
    3.49 +			<tr>
    3.50 +				<td>
    3.51 +					<table>
    3.52 +EOT
    3.53 +		for i in $BUILD_DEPENDS; do
    3.54 +			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
    3.55 +		done
    3.56 +		cat <<EOT
    3.57 +					</table>
    3.58 +				</td>
    3.59 +				<td>
    3.60 +					<table>
    3.61 +EOT
    3.62 +		{
    3.63 +			for i in $(awk -F$'\t' -vp="$pkg" '{if($1==p)print $2}' $splitdb); do
    3.64 +
    3.65 +				[ -s "$PKGS/packages.info" ] &&
    3.66 +				awk -F$'\t' -vp=" $i " '{
    3.67 +					if (index(" " $8 " ", p)) print $1
    3.68 +				}' "$PKGS/packages.info"
    3.69 +
    3.70 +				[ -s "$PKGS/bdeps.txt" ] &&
    3.71 +				awk -F$'\t' -vp=" $i " '{
    3.72 +					if (index(" " $2 " ", p)) print $1
    3.73 +				}' $PKGS/bdeps.txt
    3.74 +			done
    3.75 +		} | sort -u | \
    3.76 +		while read i; do
    3.77 +			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
    3.78 +		done
    3.79 +		cat <<EOT
    3.80 +					</table>
    3.81 +				</td>
    3.82 +			</tr>
    3.83 +		</tbody>
    3.84 +	</table>
    3.85 +</section>
    3.86 +EOT
    3.87 +
    3.88  		# Display <Recook> button only for SliTaz web browser
    3.89  		case "$HTTP_USER_AGENT" in
    3.90  			*SliTaz*)
     4.1 --- a/modules/pkgdb	Fri Oct 20 11:11:10 2017 +0300
     4.2 +++ b/modules/pkgdb	Fri Oct 20 16:54:05 2017 +0300
     4.3 @@ -93,6 +93,15 @@
     4.4  done
     4.5  echo " ($(filesize $PKGS/descriptions.txt))" | dblog
     4.6  
     4.7 +_n 'Creating file "%s"' 'bdeps.txt' | dblog
     4.8 +rm $PKGS/bdeps.txt 2>/dev/null
     4.9 +for i in $(ls $WOK | sort); do
    4.10 +	[ -s "$WOK/$i/receipt" ] || continue
    4.11 +	bdeps=$(. $WOK/$i/receipt; echo $BUILD_DEPENDS) # remove newlines from some receipts
    4.12 +	echo "$i	$bdeps" >> $PKGS/bdeps.txt
    4.13 +done
    4.14 +echo " ($(filesize $PKGS/bdeps.txt))" | dblog
    4.15 +
    4.16  
    4.17  _ 'Creating lists from "%s"' "$WOK" | dblog
    4.18  [ -e $PKGS/files.list ] && rm $PKGS/files.list