cookutils rev 204

cook: Add AUTO_COOK and handle missing build dep
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 22 15:42:10 2011 +0200 (2011-05-22)
parents b17298f26bac
children 476e94b5223a
files cook cook.conf
line diff
     1.1 --- a/cook	Sun May 22 13:53:26 2011 +0200
     1.2 +++ b/cook	Sun May 22 15:42:10 2011 +0200
     1.3 @@ -443,6 +443,7 @@
     1.4  	# Check for build deps and handle implicit depends of *-dev packages
     1.5  	# (ex: libusb-dev :: libusb).
     1.6  	cd $INSTALLED && ls -1 > $CACHE/installed.list
     1.7 +	rm -f $CACHE/missing
     1.8  	[ "$DEPENDS" ] && gettext -e "Checking build dependencies...\n"
     1.9  	for dep in $BUILD_DEPENDS
    1.10  	do
    1.11 @@ -464,7 +465,8 @@
    1.12  							tazpkg get-install $i >/dev/null
    1.13  						else
    1.14  							# So package exist in wok but not available.
    1.15 -							echo "ERROR: missing dep: $i $vers"
    1.16 +							gettext "Missing dep (wok/pkg)     :"; echo " $i $vers"
    1.17 +							echo $i >> $CACHE/missing
    1.18  						fi
    1.19  					fi
    1.20  				fi
    1.21 @@ -473,13 +475,30 @@
    1.22  	done
    1.23  	cd $INSTALLED && ls -1 > $CACHE/installed.cook && cd $CACHE
    1.24  	
    1.25 -	# If a cook failed deps are not removed since we exit 1.
    1.26 +	# If a cook failed deps are removed.
    1.27  	[ ! -s "installed.cook.diff" ] && \
    1.28  		busybox diff installed.list installed.cook > installed.cook.diff
    1.29  	deps=$(cat installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l)
    1.30 -
    1.31 -	# QA: Exit on missing dep error.
    1.32 -	if fgrep -q ERROR: $LOGS/$pkg.log; then
    1.33 +	
    1.34 +	# Have we missing build dep to cook ?
    1.35 +	if [ -s "$CACHE/missing" ] && [ "$AUTO_COOK" ]; then
    1.36 +		cp -f $LOGS/$PACKAGE.log $LOGS/$PACKAGE.log.$$
    1.37 +		for i in $(cat $CACHE/missing)
    1.38 +		do
    1.39 +			(gettext "Building dep (wok/pkg):"; echo " $i $vers") | \
    1.40 +				tee -a $LOGS/$PACKAGE.log.$$
    1.41 +			cook $i || echo "ERROR: can't cook dep: $i $vers" | \
    1.42 +				tee -a $LOGS/$PACKAGE.log.$$ && break
    1.43 +		done
    1.44 +		rm -f $CACHE/missing
    1.45 +		mv  $LOGS/$PACKAGE.log.$$ $LOGS/$PACKAGE.log
    1.46 +	fi
    1.47 +	
    1.48 +	# QA: Exit on missing dep errors. We exit in both case, if AUTO_COOK
    1.49 +	# is enable and cook fail we have ERROR in log, if no auto cook we have
    1.50 +	# missing dep in cached file.
    1.51 +	if fgrep -q "ERROR:" $LOGS/$pkg.log || [ -s "$CACHE/missing" ]; then
    1.52 +		echo "ERROR: missing build dep"
    1.53  		exit 1
    1.54  	fi
    1.55  
     2.1 --- a/cook.conf	Sun May 22 13:53:26 2011 +0200
     2.2 +++ b/cook.conf	Sun May 22 15:42:10 2011 +0200
     2.3 @@ -19,6 +19,9 @@
     2.4  # Quality Assurance (empty to disable receipt_quality).
     2.5  QA="0"
     2.6  
     2.7 +# Automatically cook missing build dependencies (empty to disable).
     2.8 +AUTO_COOK=""
     2.9 +
    2.10  # Hg wok for setup and flavors URL for the Cooker.
    2.11  WOK_URL="http://hg.slitaz.org/wok"
    2.12  FLAVORS_URL="http://hg.slitaz.org/flavors"