cookutils rev 908

cook: support per-package CONFIG_FILES, fix pre_install etc. extracting; lighttpd/index.cgi: display all descriptions.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon May 29 04:48:50 2017 +0300 (2017-05-29)
parents ae08a6458965
children e68dad1ffbff
files cook lighttpd/index.cgi
line diff
     1.1 --- a/cook	Mon May 29 01:54:22 2017 +0300
     1.2 +++ b/cook	Mon May 29 04:48:50 2017 +0300
     1.3 @@ -859,6 +859,7 @@
     1.4  	[ -n "$TAGS" ]    && echo "TAGS=\"$TAGS\""
     1.5  	[ -n "$DEPENDS" ] && echo "DEPENDS=\"$DEPENDS\"" | tr -ds '\t' ' '
     1.6  	[ -n "$PROVIDE" ] && echo "PROVIDE=\"$PROVIDE\""
     1.7 +	[ -n "$CONFIG_FILES" ] && echo "CONFIG_FILES=\"$CONFIG_FILES\""
     1.8  
     1.9  	# Extract {pre,post}_{install,remove} functions;
    1.10  	# post_install_gtk_() will be copied as post_install() for gtk+ package
    1.11 @@ -869,7 +870,7 @@
    1.12  		for j in install remove; do
    1.13  			if grep -q "^${i}_${j}_$rname()" "$orig_receipt"; then
    1.14  				echo
    1.15 -				sed "/^${i}_${j}_$rname()/,/}/!d" "$orig_receipt" | \
    1.16 +				sed "/^${i}_${j}_$rname()/,/^}/!d" "$orig_receipt" | \
    1.17  				sed "s|^${i}_${j}_$rname()|${i}_${j}()|"
    1.18  			fi
    1.19  		done
    1.20 @@ -1030,7 +1031,7 @@
    1.21  	:; status
    1.22  	# Find and remove old package(s)
    1.23  	tempd="$(mktemp -d)"; cd "$tempd"
    1.24 -	for testpkg in $(ls $PKGS/$PACKAGE-*.tazpkg 2> /dev/null); do
    1.25 +	for testpkg in $(ls $PKGS/$PACKAGE-*.tazpkg 2>/dev/null); do
    1.26  		# Extract receipt from each matched package
    1.27  		cpio -F "$testpkg" -i receipt >/dev/null 2>&1
    1.28  		name=$(. receipt; echo $PACKAGE)
    1.29 @@ -1055,7 +1056,7 @@
    1.30  	set_paths
    1.31  	if head -n1 "$pkgdir/receipt" | fgrep -q 'v2'; then
    1.32  		for i in $PACKAGE $SPLIT; do
    1.33 -			unset DEPENDS CAT
    1.34 +			unset DEPENDS CAT CONFIG_FILES
    1.35  			packit $i
    1.36  		done
    1.37  	else
     2.1 --- a/lighttpd/index.cgi	Mon May 29 01:54:22 2017 +0300
     2.2 +++ b/lighttpd/index.cgi	Mon May 29 04:48:50 2017 +0300
     2.3 @@ -638,7 +638,7 @@
     2.4  	if [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION/receipt" ]; then
     2.5  		echo "<a class='button icon files$(active files)' href='$base/$pkg/files'>files</a>"
     2.6  
     2.7 -		[ -f "$wok/$pkg/description.txt" ] &&
     2.8 +		[ -n "$(ls $wok/$pkg/description*.txt)" ] &&
     2.9  			echo "<a class='button icon desc$(active description)' href='$base/$pkg/description'>description</a>"
    2.10  
    2.11  		unset EXTRAVERSION
    2.12 @@ -691,6 +691,17 @@
    2.13  }
    2.14  
    2.15  
    2.16 +show_desc() {
    2.17 +	echo "<section><h3>Description of “$1”</h3>"
    2.18 +	if [ -n "$md2html" ]; then
    2.19 +		$md2html $2
    2.20 +	else
    2.21 +		show_code markdown < $2
    2.22 +	fi
    2.23 +	echo "</section>"
    2.24 +}
    2.25 +
    2.26 +
    2.27  
    2.28  
    2.29  #
    2.30 @@ -1051,14 +1062,17 @@
    2.31  	description)
    2.32  		page_header
    2.33  		pkg_info
    2.34 -		desc="$WOK$REQUEST_URI.txt"
    2.35 -		if [ -s "$desc" ]; then
    2.36 +		descs="$(ls $WOK/$pkg/description*.txt)"
    2.37 +		if [ -n "$descs" ]; then
    2.38  			echo '<div id="content2">'
    2.39 -			if [ -n "$md2html" ]; then
    2.40 -				$md2html $desc
    2.41 -			else
    2.42 -				show_code markdown < $desc
    2.43 -			fi
    2.44 +			[ -f "$WOK/$pkg/description.txt" ] && show_desc "$pkg" "$WOK/$pkg/description.txt"
    2.45 +			for i in $descs; do
    2.46 +				case $i in
    2.47 +					*/description.txt) continue ;;
    2.48 +					*) package=$(echo $i | cut -d. -f2) ;;
    2.49 +				esac
    2.50 +				show_desc "$package" "$i"
    2.51 +			done
    2.52  			echo '</div>'
    2.53  		else
    2.54  			show_note w "No description of $pkg"