cookutils rev 1019

cook: add fix() to use '--as-needed' linker flag in compile_rules(); cookit(): make QA fail on empty vars / bad values; remove_already_packed(): fix bug when $PACKAGE not listed in $SPLIT and we use this function for the default set. lighttpd/index.cgi: sort orphans. modules/precheck: separate error message by empty lines.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Dec 07 14:31:28 2017 +0200 (2017-12-07)
parents 6907a43402f6
children dc7238a11470
files cook lighttpd/index.cgi modules/precheck
line diff
     1.1 --- a/cook	Fri Dec 01 16:22:12 2017 +0200
     1.2 +++ b/cook	Thu Dec 07 14:31:28 2017 +0200
     1.3 @@ -527,6 +527,26 @@
     1.4  }
     1.5  
     1.6  
     1.7 +# Misc fix functions
     1.8 +
     1.9 +fix() {
    1.10 +	case $1 in
    1.11 +		# https://bugzilla.gnome.org/show_bug.cgi?id=655517
    1.12 +		# https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed
    1.13 +		ld)
    1.14 +			export LDFLAGS="$LDFLAGS -Wl,-Os,--as-needed"
    1.15 +			;;
    1.16 +		libtool)
    1.17 +			if [ -e 'libtool' ]; then
    1.18 +				sed -i 's| -shared | -Wl,-Os,--as-needed\0|g' libtool
    1.19 +			else
    1.20 +				echo "fix libtool: warning: libtool absent, nothing to fix."
    1.21 +			fi
    1.22 +			;;
    1.23 +	esac
    1.24 +}
    1.25 +
    1.26 +
    1.27  # The main cook function.
    1.28  
    1.29  cookit() {
    1.30 @@ -571,7 +591,7 @@
    1.31  			;;
    1.32  	esac
    1.33  
    1.34 -	[ -n "$QA" ] && @@PREFIX@@/libexec/cookutils/precheck $receipt # former receipt_quality()
    1.35 +	@@PREFIX@@/libexec/cookutils/precheck $receipt || exit 1 # former receipt_quality()
    1.36  
    1.37  	cd $pkgdir
    1.38  	[ -z "$continue" ] && rm -rf source 2>/dev/null
    1.39 @@ -775,7 +795,7 @@
    1.40  			echo
    1.41  
    1.42  			[ -d "$install" ] && rm -r $install
    1.43 -			mkdir -p $install
    1.44 +			#mkdir -p $install
    1.45  
    1.46  			compile_rules $@ || { broken; exit 1; }
    1.47  
    1.48 @@ -1321,8 +1341,10 @@
    1.49  
    1.50  remove_already_packed() {
    1.51  	local i j
    1.52 +	# $pkg is the name of the main package; $PACKAGE is the name of the current one
    1.53 +	# $pkg may (or may not) be included in the $SPLIT
    1.54  	neighbors=$(
    1.55 -		echo $SPLIT" " \
    1.56 +		echo $pkg $SPLIT" " \
    1.57  		| awk -F$'\t' -vpkg="$PACKAGE" '
    1.58  		BEGIN { RS = " "; FS = ":"; }
    1.59  		      { set[$1] = $2; }
     2.1 --- a/lighttpd/index.cgi	Fri Dec 01 16:22:12 2017 +0200
     2.2 +++ b/lighttpd/index.cgi	Thu Dec 07 14:31:28 2017 +0200
     2.3 @@ -1585,7 +1585,7 @@
     2.4  									if (! files_pkg[i]) print i;
     2.5  								}
     2.6  							}
     2.7 -						' "$all_files" "$packaged" > $orphans
     2.8 +						' "$all_files" "$packaged" | sort > $orphans
     2.9  						if [ -d "$install" -a -s "$orphans" ]; then
    2.10  							echo
    2.11  							echo "<script>document.getElementById('li-orphans$set').style.display = 'list-item'</script>"
     3.1 --- a/modules/precheck	Fri Dec 01 16:22:12 2017 +0200
     3.2 +++ b/modules/precheck	Thu Dec 07 14:31:28 2017 +0200
     3.3 @@ -7,6 +7,8 @@
     3.4  
     3.5  . /usr/lib/slitaz/libcook.sh
     3.6  
     3.7 +# Return immediately if QA is not used
     3.8 +[ -n "$QA" ] || return 0
     3.9  
    3.10  receipt="$(realpath $1)"
    3.11  
    3.12 @@ -22,8 +24,10 @@
    3.13  		CATEGORY)
    3.14  			valid="$(echo $PKGS_CATEGORIES)" # avoid newlines
    3.15  			if ! echo " $valid " | grep -q " $value "; then
    3.16 +				newline
    3.17  				_ 'QA: unknown category "%s"' "$value"
    3.18 -				die 'Please, use one of: %s' "$valid"
    3.19 +				longline "Please, use one of: $valid"
    3.20 +				die
    3.21  			fi
    3.22  			;;
    3.23  		WEB_SITE)