cookutils diff cook @ rev 33

cook: get debug info also when genpkg_rules fails
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 06 18:51:52 2011 +0200 (2011-05-06)
parents 5782ad5be711
children abfe01fcd176
line diff
     1.1 --- a/cook	Fri May 06 17:36:35 2011 +0200
     1.2 +++ b/cook	Fri May 06 18:51:52 2011 +0200
     1.3 @@ -223,6 +223,8 @@
     1.4  	echo -e "\nDebug information"
     1.5  	separator
     1.6  	fgrep ERROR $LOGS/$pkg.log
     1.7 +	fgrep "No package" $LOGS/$pkg.log
     1.8 +	fgrep "cp: can't stat" $LOGS/$pkg.log
     1.9  	separator && echo ""
    1.10  }
    1.11  
    1.12 @@ -316,7 +318,7 @@
    1.13  	separator
    1.14  	set_paths
    1.15  	[ "$QA" ] && receipt_quality
    1.16 -	rm -rf install taz source $CACHE/error
    1.17 +	rm -rf install taz source
    1.18  
    1.19  	# Disable -pipe if less than 512Mb free RAM.
    1.20  	free=$(free | fgrep '/+ buffers' | tr -s ' ' | cut -f 4 -d ' ')
    1.21 @@ -376,7 +378,7 @@
    1.22  	if grep -q ^compile_rules $pkgdir/receipt; then
    1.23  		gettext -e "Executing: compile_rules\n"
    1.24  		[ -d "$src" ] && cd $src 
    1.25 -		compile_rules || exit 1
    1.26 +		compile_rules || echo "" && exit 1
    1.27  		# Stay compatible with _pkg
    1.28  		[ -d $src/_pkg ] && mv $src/_pkg $install
    1.29  		# QA: compile_rules success so valid.
    1.30 @@ -394,10 +396,9 @@
    1.31  		echo -e "ERROR: cook failed" | tee -a $LOGS/$pkg.log
    1.32  	fi
    1.33  	# ERROR can be echoed any time in cookit()
    1.34 -	if grep -q ^ERROR $LOGS/$pkg.log; then
    1.35 +	if fgrep -q ERROR: $LOGS/$pkg.log; then
    1.36  		debug_info | tee -a $LOGS/$pkg.log
    1.37 -		rm -f $command
    1.38 -		exit 1
    1.39 +		rm -f $command && exit 1
    1.40  	fi
    1.41  }
    1.42  
    1.43 @@ -410,9 +411,10 @@
    1.44  	if grep -q ^genpkg_rules $pkgdir/receipt; then
    1.45  		gettext -e "Executing: genpkg_rules\n"
    1.46  		cd $pkgdir
    1.47 -		mkdir -p $fs && genpkg_rules || ( echo -e \
    1.48 -			"\nERROR: genpkg_rules failed\n" | tee -a $LOGS/$pkg.log && exit 1 )
    1.49 +		mkdir -p $fs && genpkg_rules || (echo -e \
    1.50 +			"\nERROR: genpkg_rules failed\n" >> $LOGS/$pkg.log && exit 1)
    1.51  	fi
    1.52 +	packit_quality
    1.53  	cd $pkgdir/taz
    1.54  	strip_package
    1.55  	for file in receipt description.txt
    1.56 @@ -481,7 +483,7 @@
    1.57  
    1.58  # Verify package quality and consitensy.
    1.59  packit_quality() {
    1.60 -	if grep -q ^ERROR $LOGS/$pkg.log; then
    1.61 +	if fgrep -q ERROR: $LOGS/$pkg.log; then
    1.62  		rm -f $command && exit 1
    1.63  	fi
    1.64  	if ! grep -q ^/ $WOK/$pkg/taz/$pkg-*/files.list; then
    1.65 @@ -659,10 +661,14 @@
    1.66  		cookit 2>&1 | tee $LOGS/$pkg.log
    1.67  		remove_deps | tee -a $LOGS/$pkg.log
    1.68  		cookit_quality
    1.69 -		
    1.70  		packit 2>&1 | tee -a $LOGS/$pkg.log
    1.71  		clean_log
    1.72 -		packit_quality
    1.73 +
    1.74 +		# Exit if any error in packing.
    1.75 +		if grep -q ^ERROR $LOGS/$pkg.log; then
    1.76 +			debug_info | tee -a $LOGS/$pkg.log
    1.77 +			rm -f $command && exit 1
    1.78 +		fi
    1.79  		
    1.80  		# Time and summary
    1.81  		time=$(($(date +%s) - $time))