cookutils rev 1078

cook: allow multi-set & no-src receipts (sources may be downloaded inside compile_rules() individually for each set), allow change SHORT_DESC & WEB_SITE in genpkg_rules() (for differents sets);
lighttpd/cooker.css: add style for log line "Switching to the set...";
lighttpd/index.cgi: remove false-positive coloring with word "fatal", mark line "Switching to the set...", don't hide "Logs" button (fresh log initially empty and it may lasts for many seconds due to buffered "lazy write";
modules/compressor: better remove unwanted Perl files;
modules/mk_pkg_receipt: follow changed SHORT_DESC & WEB_SITE, improve condition speed (from 10 sec to 0.01 sec) when SPLIT is relatively long - looks like ${A/ $B /} is slow.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jun 21 12:57:52 2018 +0300 (2018-06-21)
parents aa5729cf385c
children 64c16be1dda4
files cook lighttpd/cooker.css lighttpd/index.cgi modules/compressor modules/mk_pkg_receipt
line diff
     1.1 --- a/cook	Wed Jun 13 14:14:45 2018 +0300
     1.2 +++ b/cook	Thu Jun 21 12:57:52 2018 +0300
     1.3 @@ -706,8 +706,6 @@
     1.4  
     1.5  	# Check for build deps and handle implicit depends of *-dev packages
     1.6  	# (ex: libusb-dev :: libusb).
     1.7 -#	rm -f $CACHE/installed.local $CACHE/installed.web $CACHE/missing.dep
     1.8 -#	touch $CACHE/installed.local $CACHE/installed.web
     1.9  	[ -n "$BUILD_DEPENDS" ] && _ 'Checking build dependencies...'
    1.10  	[ -n "$root" ] && _ 'Using packages DB: %s' "$root$DB"
    1.11  
    1.12 @@ -741,49 +739,6 @@
    1.13  		done
    1.14  	done
    1.15  
    1.16 -#	# Have we a missing build dep to cook?
    1.17 -#	if [ -s "$CACHE/missing.dep" ] && [ -n "$AUTO_COOK" ]; then
    1.18 -#		_ 'Auto cook config is set: %s' "$AUTO_COOK"
    1.19 -#		cp -f $LOGS/$PACKAGE.log $LOGS/$PACKAGE.log.$$
    1.20 -#		for i in $(uniq $CACHE/missing.dep); do
    1.21 -#			(_ 'Building dep (wok/pkg)    : %s' "$i $vers") | \
    1.22 -#				tee -a $LOGS/$PACKAGE.log.$$
    1.23 -#			# programmers: next two messages are exact copy from remove_deps()
    1.24 -#			togrep1=$(_n 'Build dependencies to remove:')
    1.25 -#			togrep2=$(_n 'Removing:')
    1.26 -#			cook $i || (_ "ERROR: can't cook dep \"%s\"" "$i" && newline && \
    1.27 -#				fgrep $togrep1 $LOGS/$i.log && \
    1.28 -#				fgrep $togrep2 $LOGS/$i.log && newline) | \
    1.29 -#				tee -a $LOGS/$PACKAGE.log.$$ && break
    1.30 -#		done
    1.31 -#		rm -f $CACHE/missing.dep
    1.32 -#		mv  $LOGS/$PACKAGE.log.$$ $LOGS/$PACKAGE.log
    1.33 -#	fi
    1.34 -#
    1.35 -#	# QA: Exit on missing dep errors. We exit in both cases, if AUTO_COOK
    1.36 -#	# is enabled and cook fails we have ERROR in log, if no auto cook we have
    1.37 -#	# missing dep in cached file.
    1.38 -#	lerror=$(_n 'ERROR')
    1.39 -#	if fgrep -q ^$lerror $LOGS/$pkg.log || [ -s "$CACHE/missing.dep" ]; then
    1.40 -#		[ -s "$CACHE/missing.dep" ] && nb=$(wc -l < $CACHE/missing.dep)
    1.41 -#		_p 'ERROR: missing %d dependency' 'ERROR: missing %d dependencies' "$nb" "$nb"
    1.42 -#		broken; exit 1
    1.43 -#	fi
    1.44 -#
    1.45 -#	# Install local packages: package-version$arch
    1.46 -#	cd $PKGS
    1.47 -#	for i in $(uniq $CACHE/installed.local); do
    1.48 -#		# _ 'Installing dep (pkg/local): %s' "$i"
    1.49 -#		tazpkg install $i --root=$root --local --quiet --cookmode
    1.50 -#	done
    1.51 -#
    1.52 -#	# Install web or cached packages (if mirror is set to $PKGS we only
    1.53 -#	# use local packages).
    1.54 -#	for i in $(uniq $CACHE/installed.web); do
    1.55 -#		# _ 'Installing dep (web/cache): %s' "$i"
    1.56 -#		tazpkg get-install $i --root=$root --local --quiet --cookmode
    1.57 -#	done
    1.58 -
    1.59  	update_installed_cook_diff
    1.60  
    1.61  	timestamp job2 # installing bdeps
    1.62 @@ -859,7 +814,7 @@
    1.63  			| tr '\n' ' ')
    1.64  		SETS=${SETS% }	# normalize space
    1.65  		# Prepare specified source sets using patched sources
    1.66 -		[ -n "$SETS" ] &&
    1.67 +		[ -n "$SETS" -a -d "$src" ] &&
    1.68  		for set in $SETS; do
    1.69  			echo "Preparing set $set"	# debug
    1.70  			cp -a $src $src-$set
    1.71 @@ -1027,7 +982,7 @@
    1.72  
    1.73  	cd $taz
    1.74  	action 'Copying "%s"...' 'receipt'
    1.75 -	export PACKAGE VERSION DEPENDS PROVIDE SUGGESTED TAZPANEL_DAEMON TAGS CAT CONFIG_FILES
    1.76 +	export PACKAGE VERSION SHORT_DESC WEB_SITE DEPENDS PROVIDE SUGGESTED TAZPANEL_DAEMON TAGS CAT CONFIG_FILES
    1.77  	@@PREFIX@@/libexec/cookutils/mk_pkg_receipt "$(realpath ../receipt)" > $pack/receipt
    1.78  	chown 0.0 $pack/receipt; status
    1.79  
    1.80 @@ -2125,7 +2080,7 @@
    1.81  			--pack)
    1.82  				[ -d "$WOK/$pkg/install" ] || die 'Need to build "%s"' "$pkg"
    1.83  				[ ! -d "$WOK/$pkg/taz" ] || rm -rf "$WOK/$pkg/taz"
    1.84 -				[ ! -f "$LOGS/$pkg-pack.log" ] || rm -rf $LOGS/$pkg-pack.log
    1.85 +				[ ! -f "$LOGS/$pkg-pack.log" ] || rm -f $LOGS/$pkg-pack.log
    1.86  				sed -i '$ s|$| (packing)|' $activity
    1.87  				packall 2>&1 | tee -a $LOGS/$pkg-pack.log
    1.88  				clean_log "$pkg-pack"
     2.1 --- a/lighttpd/cooker.css	Wed Jun 13 14:14:45 2018 +0300
     2.2 +++ b/lighttpd/cooker.css	Thu Jun 21 12:57:52 2018 +0300
     2.3 @@ -226,6 +226,7 @@
     2.4  .sh-comment { color: #a00; }
     2.5  .sh-val     { color: #e50; font-weight: bold; }
     2.6  .var        { color: #05a; }
     2.7 +.switch     { background-color: #fce94f; font-weight: bold; display: inline-block; width: 100%; }
     2.8  
     2.9  
    2.10  /* Colored log */
     3.1 --- a/lighttpd/index.cgi	Wed Jun 13 14:14:45 2018 +0300
     3.2 +++ b/lighttpd/index.cgi	Thu Jun 21 12:57:52 2018 +0300
     3.3 @@ -539,7 +539,7 @@
     3.4  				\
     3.5  				-e 's#^.*multiple definition of.*#<b>\0</b>#' \
     3.6  				-e 's#^.*[Ff][Aa][Ii][Ll][Ee][Dd].*#<b>\0</b>#' \
     3.7 -				-e 's#^.*[Ff]atal.*#<b>\0</b>#' \
     3.8 +				-e 's#^.*[^A-Za-z:/-][Ff]atal.*#<b>\0</b>#' \
     3.9  				-e '/non-fatal/ s|</*b>||g' \
    3.10  				-e 's#^.*[Nn]ot found.*#<b>\0</b>#' \
    3.11  				-e 's#^.*[Nn]o such file.*#<b>\0</b>#' \
    3.12 @@ -571,6 +571,7 @@
    3.13  				-e "s#^====\([^']*\).#<span class='span-line'>\0</span>#g" \
    3.14  				-e "s#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#g" \
    3.15  				-e "s#[fh]tt*ps*://[^ '\"]*#<a href='\0'>\0</a>#g" \
    3.16 +				-e 's|^Switching to the set.*|<span class="switch">‣‣‣ \0</span>|' \
    3.17  				\
    3.18  				-e 's|^<u>\(.*libtool: warning: relinking.*\)</u>|\1|' \
    3.19  				-e 's|^<u>\(.*libtool: warning: .* has not been installed in .*\)</u>|\1|' \
    3.20 @@ -775,7 +776,7 @@
    3.21  		printf "LFS</a>\n"
    3.22  	fi
    3.23  
    3.24 -	[ -s "$log" ] &&
    3.25 +	ls $log* >/dev/null 2>&1 &&
    3.26  		echo "<a class='button icon log$(active log)' href='$base/$pkg/log/'>logs</a>"
    3.27  
    3.28  	echo '</div>'
     4.1 --- a/modules/compressor	Wed Jun 13 14:14:45 2018 +0300
     4.2 +++ b/modules/compressor	Thu Jun 21 12:57:52 2018 +0300
     4.3 @@ -769,9 +769,10 @@
     4.4  	local perlfiles="$(find $fs -type f \( -name 'perllocal.pod' -o -name '.packlist' \))"
     4.5  	# 2. Perl *.pod (if not disabled)
     4.6  	[ "${COOKOPTS/!rmpod/}" == "$COOKOPTS" ] &&
     4.7 -		perlfiles="$perlfiles $(find $fs -type f -name '*.pod')"
     4.8 -	echo "$perlfiles" | xargs rm -f 2>/dev/null
     4.9 -	echo "$perlfiles" | awk 'BEGIN{FS=OFS="/"}{$NF="";print}' | xargs rmdir -p 2>/dev/null
    4.10 +		perlfiles="$perlfiles"$'\n'"$(find $fs -type f -name '*.pod')"
    4.11 +	echo "$perlfiles" | sort -u | xargs rm -f 2>/dev/null
    4.12 +	echo "$perlfiles" | sort -u | awk 'BEGIN{FS=OFS="/"}{$NF="";print}' \
    4.13 +	| xargs rmdir -p --ignore-fail-on-non-empty 2>/dev/null
    4.14  
    4.15  	# Strip documentation inside Perl files (*.pm and *.pl) (if not disabled)
    4.16  	[ "${COOKOPTS/!perlz/}" == "$COOKOPTS" ] &&
     5.1 --- a/modules/mk_pkg_receipt	Wed Jun 13 14:14:45 2018 +0300
     5.2 +++ b/modules/mk_pkg_receipt	Thu Jun 21 12:57:52 2018 +0300
     5.3 @@ -38,7 +38,8 @@
     5.4  cat > $save <<EOT
     5.5  PACKAGE="$PACKAGE"; DEPENDS="$(echo $DEPENDS)"; PROVIDE="$(echo $PROVIDE)"
     5.6  SUGGESTED="$(echo $SUGGESTED)"; TAZPANEL_DAEMON="$TAZPANEL_DAEMON"
     5.7 -TAGS="$(echo $TAGS)"; VERSION="$VERSION"
     5.8 +TAGS="$(echo $TAGS)"; VERSION="$VERSION"; SHORT_DESC="$SHORT_DESC"
     5.9 +WEB_SITE="$WEB_SITE"
    5.10  EOT
    5.11  unset_receipt
    5.12  . "$orig_receipt"
    5.13 @@ -47,9 +48,8 @@
    5.14  
    5.15  # Manage split packages
    5.16  SPLIT=" $SPLIT "
    5.17 -if [ "$PACKAGE"             != "$MAIN_PACKAGE" -a \
    5.18 -	 "$SPLIT"               != '  '            -a \
    5.19 -	 "${SPLIT/ $PACKAGE /}" != "$SPLIT" ]; then
    5.20 +if [ "$PACKAGE" != "$MAIN_PACKAGE"   -a   "$SPLIT" != '  ' ] &&
    5.21 +	echo "$SPLIT" | fgrep -q " $PACKAGE "; then
    5.22  	# For packages with empty $DEPENDS
    5.23  	if [ -z "$DEPENDS" ]; then
    5.24  		case $PACKAGE in