cookutils diff cook @ 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 556429e78e83
children c7acc35d3a59
line diff
     1.1 --- a/cook	Mon Oct 23 23:12:42 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