cookutils rev 989

cook: initial support of --trials|-t; copy(): @rm as quick alias for remove_already_packed(); cook_copy_icons(): initial removing of all hicolor icons; lighttpd/index.cgi: extend packages info; some more tiny edits.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Oct 28 16:04:43 2017 +0300 (2017-10-28)
parents 9c835beabf65
children c13b693c75c8
files cook cooker lighttpd/cooker.css lighttpd/index.cgi modules/deps
line diff
     1.1 --- a/cook	Tue Oct 24 05:28:32 2017 +0300
     1.2 +++ b/cook	Sat Oct 28 16:04:43 2017 +0300
     1.3 @@ -820,9 +820,28 @@
     1.4  # Cook quality assurance.
     1.5  
     1.6  cookit_quality() {
     1.7 -	if [ ! -d "$WOK/$pkg/install" ] && [ -z "$WANTED" ]; then
     1.8 +	while true; do
     1.9 +		[ ! -d "$WOK/$pkg/install" -a -z "$WANTED" ] || break
    1.10  		_ 'ERROR: cook failed' | tee -a $LOGS/$pkg.log
    1.11 -	fi
    1.12 +		[ "$trials" == 'yes' ] || break
    1.13 +		title "Interactive mode"
    1.14 +		# TODO: allow commands:
    1.15 +		# q - quit; v - edit receipt here using vi;
    1.16 +		# s - search for package containing package;
    1.17 +		# <package name> - install package; [Enter] - retry
    1.18 +		_ 'You may install the packages here and/or edit the receipt there.'
    1.19 +		newline
    1.20 +		while true; do
    1.21 +			_n 'Install the package? [name/N] '; read answer
    1.22 +			[ -n "$answer" ] || break
    1.23 +			tazpkg -gi $answer --root=$root --local --quiet --cookmode
    1.24 +		done
    1.25 +		newline
    1.26 +		_n 'Try again? [Y/n] '; read answer
    1.27 +		[ "$answer" == 'n' ] && break
    1.28 +		# here you may append log if you want (">>" insted of last ">")
    1.29 +		cookit $@ 2>&1 | loglimit 50 > $LOGS/$pkg.log
    1.30 +	done
    1.31  
    1.32  	[ "${COOKOPTS/skip-log-errors/}" != "$COOKOPTS" ] && return 0
    1.33  
    1.34 @@ -1386,6 +1405,24 @@
    1.35  }
    1.36  
    1.37  
    1.38 +# Remove from current $fs files that already packed (for receipts v2).
    1.39 +# Note: the order in $SPLIT is very important.
    1.40 +
    1.41 +remove_already_packed() {
    1.42 +	local i j
    1.43 +	IFS=$'\n'
    1.44 +	for i in $taz/*/files.list; do
    1.45 +		[ -e "$i" ] || continue
    1.46 +		while read j; do
    1.47 +			[ -f $fs$j -o -h $fs$j ] || continue
    1.48 +			rm $fs$j
    1.49 +			rmdir --parents --ignore-fail-on-non-empty $fs$(dirname $j)
    1.50 +		done < $i
    1.51 +	done
    1.52 +	unset IFS
    1.53 +}
    1.54 +
    1.55 +
    1.56  # Common function to copy files, folders and patterns
    1.57  
    1.58  copy() {
    1.59 @@ -1406,6 +1443,8 @@
    1.60  					/\/share\/devhelp\//d; /\/share\/locale\//d;
    1.61  					/\/share\/bash-completion\//d; /\/lib\/systemd\//d;
    1.62  					/\/fonts\.scale$/d; /\/fonts\.dir$/d;
    1.63 +					/\/share\/appdata\//d; /\/share\/help\//d;
    1.64 +					/\/share\/icons\/hicolor\/[1236][245][68]*x[1236][245][68]*\//d;	# 22, 24, 32, 64, 128, 256
    1.65  					' $filelist
    1.66  				;;
    1.67  			@dev)
    1.68 @@ -1415,6 +1454,9 @@
    1.69  					/\/Makefile.*/p; /\.inc$/p; /\/include\//p;
    1.70  					' $filelist
    1.71  				;;
    1.72 +			@rm)
    1.73 +				remove_already_packed
    1.74 +				;;
    1.75  			*/)
    1.76  				# Copy specified folders.
    1.77  				i="${i%/}"
    1.78 @@ -1467,34 +1509,19 @@
    1.79  }
    1.80  
    1.81  
    1.82 -# Remove from current $fs files that already packed (for receipts v2).
    1.83 -# Note: the order in $SPLIT is very important.
    1.84 -
    1.85 -remove_already_packed() {
    1.86 -	local i j
    1.87 -	IFS=$'\n'
    1.88 -	for i in $taz/*/files.list; do
    1.89 -		while read j; do
    1.90 -			[ -f $fs$j -o -h $fs$j ] || continue
    1.91 -			rm $fs$j
    1.92 -			rmdir --parents --ignore-fail-on-non-empty $fs$(dirname $j)
    1.93 -		done < $i
    1.94 -	done
    1.95 -	unset IFS
    1.96 -}
    1.97 -
    1.98 -
    1.99  # Function to use in genpkg_rules() to copy hicolor icons in specified sizes
   1.100  # (default: 16 and 48) from $install to $fs
   1.101  
   1.102  cook_copy_icons() {
   1.103 -	local sizes=$@
   1.104 +	local sizes=$@ i j
   1.105  	action 'Copying hicolor icons...'
   1.106 +	[ -d "$fs/usr/share/icons/hicolor" ] && rm -rf "$fs/usr/share/icons/hicolor"
   1.107  	mkdir -p $fs/usr/share/icons/hicolor
   1.108  	for i in ${sizes:-16 48}; do
   1.109 -		[ ! -e "$install/usr/share/icons/hicolor/${i}x$i" ] ||
   1.110 -		scopy $install/usr/share/icons/hicolor/${i}x$i \
   1.111 -			$fs/usr/share/icons/hicolor
   1.112 +		j="${i}x$i"; [ "$i" == 'scalable' ] && j="$i"
   1.113 +		[ ! -e "$install/usr/share/icons/hicolor/$j" ] ||
   1.114 +		scopy   $install/usr/share/icons/hicolor/$j \
   1.115 +			         $fs/usr/share/icons/hicolor
   1.116  	done
   1.117  	status
   1.118  }
   1.119 @@ -2008,6 +2035,9 @@
   1.120  				sed -i '$ s|$| [ Done ]|' $activity
   1.121  				rm -f $command
   1.122  				exit 0 ;;
   1.123 +
   1.124 +			--trials|-t)
   1.125 +				trials='yes' ;;
   1.126  		esac
   1.127  
   1.128  		# Rotate log
     2.1 --- a/cooker	Tue Oct 24 05:28:32 2017 +0300
     2.2 +++ b/cooker	Sat Oct 28 16:04:43 2017 +0300
     2.3 @@ -664,6 +664,7 @@
     2.4  				rm -rf $wok/$pkg $LOGS/$pkg.log
     2.5  				sed -i "/^${pkg}$/d" $blocked $broken $commits.tmp
     2.6  				sed -i "/^$pkg\t/d" $PKGS/packages.info
     2.7 +				sed -i "/^$pkg:/d" $cache/files.list
     2.8  			fi
     2.9  			if [ -d "$wok/$pkg/stuff" ]; then
    2.10  				if [ ! -d "$wok-hg/$pkg/stuff" ]; then
     3.1 --- a/lighttpd/cooker.css	Tue Oct 24 05:28:32 2017 +0300
     3.2 +++ b/lighttpd/cooker.css	Sat Oct 28 16:04:43 2017 +0300
     3.3 @@ -365,6 +365,7 @@
     3.4  td { padding: 2px; vertical-align: top; }
     3.5  table:not(.half):not(.pkgslist) td:first-child { white-space: nowrap; width: 5rem; }
     3.6  table.half td { width:50%; }
     3.7 +table.third td{ width:33%; }
     3.8  td+td { border-left: 1px solid rgba(0,0,0,0.1); }
     3.9  .activity td:first-child, .cooknotes td:first-child, td.m { color: rgba(0,0,0,0.6); }
    3.10  
     4.1 --- a/lighttpd/index.cgi	Tue Oct 24 05:28:32 2017 +0300
     4.2 +++ b/lighttpd/index.cgi	Sat Oct 28 16:04:43 2017 +0300
     4.3 @@ -507,6 +507,7 @@
     4.4  				\
     4.5  				-e 's#^.*[Ff][Aa][Ii][Ll][Ee][Dd].*#<b>\0</b>#' \
     4.6  				-e 's#^.*[Ff]atal.*#<b>\0</b>#' \
     4.7 +				-e '/non-fatal/ s|</*b>||g' \
     4.8  				-e 's#^.*[Nn]ot found.*#<b>\0</b>#' \
     4.9  				-e 's#^.*[Nn]o such file.*#<b>\0</b>#' \
    4.10  				-e 's#^.*No package .* found.*#<b>\0</b>#' \
    4.11 @@ -547,7 +548,9 @@
    4.12  					s|$_stuff|<var>\${stuff}</var>|g" \
    4.13  				-e "s|\[9\([1-6]\)m|<span class='c\10'>|;
    4.14  					s|\[39m|</span>|;
    4.15 -					s|\[1m|<strong>|g; s|\[0m|</strong>|g;"
    4.16 +					s|\[1m|<strong>|g; s|\[0m|</strong>|g" \
    4.17 +				-e "s|^+.*|<i>\0</i>|;
    4.18 +					s|^-.*|<b>\0</b>|; /----/s|</*b>||"
    4.19  			;;
    4.20  
    4.21  		files)
    4.22 @@ -661,7 +664,7 @@
    4.23  	local log active bpkg
    4.24  	log="$LOGS/$pkg.log"
    4.25  
    4.26 -	echo "<h2><a href=\"$base/$pkg\">$pkg</a></h2>"
    4.27 +	echo "<h2><a href=\"$base/$pkg\">$pkg</a>$(. $wok/$pkg/receipt; [ -n "$SHORT_DESC" ] && echo ": $SHORT_DESC")</h2>"
    4.28  	echo '<div id="info">'
    4.29  	echo "<a class='button icon receipt$(active receipt stuff)' href='$base/$pkg/receipt'>receipt &amp; stuff</a>"
    4.30  
    4.31 @@ -691,8 +694,11 @@
    4.32  	[ -d "$wok/$pkg/install/usr/share/info" ] &&
    4.33  		echo "<a class='button icon doc$(active info)' href='$base/$pkg/info/#Top'>info</a>"
    4.34  
    4.35 -	[ -n "$LFS" ] &&
    4.36 -		echo "<a class='button icon doc' href='$LFS' target='_blank' rel='noopener noreferrer'>(B)LFS</a>"
    4.37 +	if [ -n "$LFS" ]; then
    4.38 +		printf "<a class='button icon doc' href='%s' target='_blank' rel='noopener noreferrer'>" "$LFS"
    4.39 +		[ "${LFS/blfs/}" != "$LFS" ] && printf "B"
    4.40 +		printf "LFS</a>\n"
    4.41 +	fi
    4.42  
    4.43  	[ -s "$log" ] &&
    4.44  		echo "<a class='button icon log$(active log)' href='$base/$pkg/log/'>logs</a>"
    4.45 @@ -1019,6 +1025,7 @@
    4.46  	'')
    4.47  		page_header
    4.48  
    4.49 +		requested_pkg="$pkg"
    4.50  		# Package info.
    4.51  		if [ ! -f "$wok/$pkg/receipt" ]; then
    4.52  			# Let's look at the cases when the package was not found
    4.53 @@ -1069,13 +1076,15 @@
    4.54  		summary "$log"
    4.55  
    4.56  		# Informal table with dependencies
    4.57 +		pkg="$requested_pkg"
    4.58  		cat <<EOT
    4.59  <section>
    4.60 -	<h3>Dependencies of packages</h3>
    4.61 -	<table class="half">
    4.62 +	<h3>Related packages</h3>
    4.63 +	<table class="third">
    4.64  		<thead>
    4.65  			<tr>
    4.66  				<th>Build dependencies</th>
    4.67 +				<th>Runtime dependencies</th>
    4.68  				<th>Required by</th>
    4.69  			</tr>
    4.70  		</thead>
    4.71 @@ -1094,6 +1103,23 @@
    4.72  					<table>
    4.73  EOT
    4.74  		{
    4.75 +			[ -s "$PKGS/packages.info" ] &&
    4.76 +			awk -F$'\t' -vp="$pkg" '{
    4.77 +				if ($1 == p) print $8
    4.78 +			}' "$PKGS/packages.info"
    4.79 +		} | tr ' ' '\n' | sort -u | \
    4.80 +		while read i; do
    4.81 +			[ -n "$i" ] &&
    4.82 +			echo "<tr><td><img src='$base/s/$i'> <a href='$base/$i'>$i</a></td></tr>"
    4.83 +		done
    4.84 +		cat <<EOT
    4.85 +					</table>
    4.86 +				</td>
    4.87 +				<td>
    4.88 +					<table>
    4.89 +EOT
    4.90 +
    4.91 +		{
    4.92  			for i in $(awk -F$'\t' -vp="$pkg" '{if($1==p)print $2}' $splitdb); do
    4.93  
    4.94  				[ -s "$PKGS/packages.info" ] &&
    4.95 @@ -1336,6 +1362,7 @@
    4.96  			/\/share\/locale\// { tag("loc", 4); next }
    4.97  			/\.h$/ || /\.a$/ || /\.la$/ || /\.pc$/ || /\/bin\/.*-config$/ ||
    4.98  				/\/Makefile.*$/ { tag("dev", 3); next }
    4.99 +			/\/share\/help\// || /\/share\/appdata\// { tag("gnm", 6); next }
   4.100  			{ tag("???", 1) }
   4.101  			' > $table
   4.102  
   4.103 @@ -1346,7 +1373,7 @@
   4.104  					head) echo -n '<table class="summary"><tr>';;
   4.105  					body) echo -n '<th> </th></tr><tr>';;
   4.106  				esac
   4.107 -				for j in '???1' dev3 loc4 ico2 doc5 man5 pod5 '---0'; do
   4.108 +				for j in '???1' dev3 loc4 ico2 doc5 man5 pod5 gnm6 '---0'; do
   4.109  					tag=${j:0:3}; class="c${j:3:1}0"; [ "$class" == 'c00' ] && class='c01'
   4.110  					case $i in
   4.111  						head) echo -n "<th class='$class'>$tag</th>";;
     5.1 --- a/modules/deps	Tue Oct 24 05:28:32 2017 +0300
     5.2 +++ b/modules/deps	Sat Oct 28 16:04:43 2017 +0300
     5.3 @@ -151,8 +151,9 @@
     5.4  				s("xorg-xcb-util-renderutil-dev", "xcb-util-renderutil-dev");
     5.5  				s("eudev-dev", "udev-dev");
     5.6  				s("util-linux-uuid-dev", "ossp-uuid-dev");
     5.7 -				s("libltdl", "libltdl"); # weird
     5.8  				s("polkit-pam-dev", "polkit-dev");
     5.9 +				s("nspr", "palemoon"); # I doubt app may depend on Palemoon
    5.10 +				s("nss", "palemoon");  #
    5.11  
    5.12  				# if called with "--incl": show all deps including glibc-base,
    5.13  				# gcc-lib-base, glibc-dev and gcc; otherwise hide them