cookutils rev 994

modules/deps: clean files from missing legacy packages; lighttpd/index.cgi: display appropriate name/description for split packages, display fair table in "Related packages" section.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Nov 01 02:49:40 2017 +0200 (2017-11-01)
parents 3de0a0c5d4c8
children c8e2be5291b8
files lighttpd/index.cgi modules/deps
line diff
     1.1 --- a/lighttpd/index.cgi	Mon Oct 30 18:41:22 2017 +0000
     1.2 +++ b/lighttpd/index.cgi	Wed Nov 01 02:49:40 2017 +0200
     1.3 @@ -664,7 +664,9 @@
     1.4  	local log active bpkg
     1.5  	log="$LOGS/$pkg.log"
     1.6  
     1.7 -	echo "<h2><a href=\"$base/$pkg\">$pkg</a>$(. $wok/$pkg/receipt; [ -n "$SHORT_DESC" ] && echo ": $SHORT_DESC")</h2>"
     1.8 +	echo -n "<h2><a href=\"$base/$requested_pkg\">$requested_pkg</a>"
     1.9 +	[ -f $PKGS/packages.info ] && awk -F$'\t' -vp="$requested_pkg" '{if ($1 == p) { print ": " $4; exit; }}' $PKGS/packages.info
    1.10 +	echo '</h2>'
    1.11  	echo '<div id="info">'
    1.12  	echo "<a class='button icon receipt$(active receipt stuff)' href='$base/$pkg/receipt'>receipt &amp; stuff</a>"
    1.13  
    1.14 @@ -1075,8 +1077,43 @@
    1.15  		# Check for a log file and display summary if it exists.
    1.16  		summary "$log"
    1.17  
    1.18 +
    1.19 +
    1.20 +
    1.21  		# Informal table with dependencies
    1.22  		pkg="$requested_pkg"
    1.23 +		inf="$(mktemp -d)"
    1.24 +
    1.25 +		# 1/3: Build dependencies (from receipt)
    1.26 +		for i in $WANTED $BUILD_DEPENDS; do
    1.27 +			echo "$i" >> $inf/a
    1.28 +		done
    1.29 +
    1.30 +		# 2/3: Runtime dependencies (from pkgdb)
    1.31 +		inf_col2="$(mktemp)"
    1.32 +		{
    1.33 +			[ -s "$PKGS/packages.info" ] &&
    1.34 +			awk -F$'\t' -vp="$pkg" '{
    1.35 +				if ($1 == p) print $8
    1.36 +			}' "$PKGS/packages.info"
    1.37 +		} | tr ' ' '\n' | sort -u > $inf/b
    1.38 +
    1.39 +		# 3/3: Required by (from pkgdb)
    1.40 +		inf_col3="$(mktemp)"
    1.41 +		{
    1.42 +			for i in $(awk -F$'\t' -vp="$pkg" '{if ($1 == p) print $2}' $splitdb); do
    1.43 +				[ -s "$PKGS/packages.info" ] &&
    1.44 +				awk -F$'\t' -vp=" $i " '{
    1.45 +					if (index(" " $8 " ", p)) print $1
    1.46 +				}' "$PKGS/packages.info"
    1.47 +
    1.48 +				[ -s "$PKGS/bdeps.txt" ] &&
    1.49 +				awk -F$'\t' -vp=" $i " '{
    1.50 +					if (index(" " $2 " ", p)) print $1
    1.51 +				}' $PKGS/bdeps.txt
    1.52 +			done
    1.53 +		} | sort -u > $inf/c
    1.54 +
    1.55  		cat <<EOT
    1.56  <section>
    1.57  	<h3>Related packages</h3>
    1.58 @@ -1089,61 +1126,31 @@
    1.59  			</tr>
    1.60  		</thead>
    1.61  		<tbody>
    1.62 -			<tr>
    1.63 -				<td>
    1.64 -					<table>
    1.65 -EOT
    1.66 -		for i in $WANTED $BUILD_DEPENDS; do
    1.67 -			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
    1.68 -		done
    1.69 -		cat <<EOT
    1.70 -					</table>
    1.71 -				</td>
    1.72 -				<td>
    1.73 -					<table>
    1.74 -EOT
    1.75 -		{
    1.76 -			[ -s "$PKGS/packages.info" ] &&
    1.77 -			awk -F$'\t' -vp="$pkg" '{
    1.78 -				if ($1 == p) print $8
    1.79 -			}' "$PKGS/packages.info"
    1.80 -		} | tr ' ' '\n' | sort -u | \
    1.81 -		while read i; do
    1.82 -			[ -n "$i" ] &&
    1.83 -			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
    1.84 -		done
    1.85 -		cat <<EOT
    1.86 -					</table>
    1.87 -				</td>
    1.88 -				<td>
    1.89 -					<table>
    1.90  EOT
    1.91  
    1.92 -		{
    1.93 -			for i in $(awk -F$'\t' -vp="$pkg" '{if($1==p)print $2}' $splitdb); do
    1.94 -
    1.95 -				[ -s "$PKGS/packages.info" ] &&
    1.96 -				awk -F$'\t' -vp=" $i " '{
    1.97 -					if (index(" " $8 " ", p)) print $1
    1.98 -				}' "$PKGS/packages.info"
    1.99 -
   1.100 -				[ -s "$PKGS/bdeps.txt" ] &&
   1.101 -				awk -F$'\t' -vp=" $i " '{
   1.102 -					if (index(" " $2 " ", p)) print $1
   1.103 -				}' $PKGS/bdeps.txt
   1.104 -			done
   1.105 -		} | sort -u | \
   1.106 -		while read i; do
   1.107 -			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
   1.108 -		done
   1.109 +		awk -vinf="$inf" -vbase="$base" '
   1.110 +			function linki(i) {
   1.111 +				if (i) return sprintf("<img src=\"%s/s/%s\"> <a href=\"%s/%s\">%s</a>", base, i, base, i, i);
   1.112 +			}
   1.113 +			BEGIN{
   1.114 +				do {
   1.115 +					a = b = c = "";
   1.116 +					getline a < inf "/a";
   1.117 +					getline b < inf "/b";
   1.118 +					getline c < inf "/c";
   1.119 +					printf("<tr><td>%s </td><td>%s </td><td>%s </td></tr>", linki(a), linki(b), linki(c));
   1.120 +				} while ( a b c )
   1.121 +			}'
   1.122  		cat <<EOT
   1.123 -					</table>
   1.124 -				</td>
   1.125 -			</tr>
   1.126  		</tbody>
   1.127  	</table>
   1.128  </section>
   1.129  EOT
   1.130 +		# Clean
   1.131 +		rm -r $inf
   1.132 +
   1.133 +
   1.134 +
   1.135  
   1.136  		# Display <Recook> button only for SliTaz web browser
   1.137  		case "$HTTP_USER_AGENT" in
     2.1 --- a/modules/deps	Mon Oct 30 18:41:22 2017 +0000
     2.2 +++ b/modules/deps	Wed Nov 01 02:49:40 2017 +0200
     2.3 @@ -18,6 +18,22 @@
     2.4  fl_mirrorz='/var/lib/tazpkg/files.list.lzma'	# mirror files list
     2.5  fl_local='/home/slitaz/cache/files.list'		# local files list
     2.6  
     2.7 +
     2.8 +# check "local files list" doesn't contain files from missing/removed packages
     2.9 +
    2.10 +action 'Updating %s...' "$(basename $fl_local)"
    2.11 +
    2.12 +splitdb="$CACHE/split.db"
    2.13 +sed 's|:.*||' $fl_local \
    2.14 +| sort -u \
    2.15 +| while read pkg; do
    2.16 +	mainpkg=$(awk -F$'\t' -vpkg=" $pkg " '{
    2.17 +		if (index(" " $2 " ", pkg)) {print 1; exit}
    2.18 +	}' $splitdb)
    2.19 +	[ -n "$mainpkg" ] || sed -i "/^$pkg: /d" $fl_local
    2.20 +done
    2.21 +status
    2.22 +
    2.23  # recreate "combined list of all files" in the cases:
    2.24  #   * if absent
    2.25  #   * mirror files list has been updated
    2.26 @@ -154,6 +170,8 @@
    2.27  				s("polkit-pam-dev", "polkit-dev");
    2.28  				s("nspr", "palemoon"); # I doubt app may depend on Palemoon
    2.29  				s("nss", "palemoon");  #
    2.30 +				s("xfconf", "libxfconf"); s("xfconf-dev", "libxfconf-dev");
    2.31 +				s("exo",    "libexo");    s("exo-dev",    "libexo-dev");
    2.32  
    2.33  				# if called with "--incl": show all deps including glibc-base,
    2.34  				# gcc-lib-base, glibc-dev and gcc; otherwise hide them