cookutils rev 215

cook: dont install anything if we have missing dep
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 24 02:01:43 2011 +0200 (2011-05-24)
parents 1e9981880495
children c734b58c9a91
files cook
line diff
     1.1 --- a/cook	Mon May 23 20:09:53 2011 +0100
     1.2 +++ b/cook	Tue May 24 02:01:43 2011 +0200
     1.3 @@ -437,14 +437,13 @@
     1.4  
     1.5  	# Export flags and path to be used by make
     1.6  	DESTDIR=$pkgdir/install
     1.7 -	export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS BUILD_HOST CONFIG_SITE
     1.8 -	local LC_ALL=POSIX LANG=POSIX
     1.9 +	export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C
    1.10  
    1.11  	# Check for build deps and handle implicit depends of *-dev packages
    1.12  	# (ex: libusb-dev :: libusb).
    1.13 -	cd $INSTALLED && ls -1 > $CACHE/installed.list
    1.14 -	rm -f $CACHE/missing
    1.15 -	[ "$DEPENDS" ] && gettext -e "Checking build dependencies...\n"
    1.16 +	rm -f $CACHE/installed.local $CACHE/installed.web $CACHE/missing.dep
    1.17 +	touch $CACHE/installed.local $CACHE/installed.web
    1.18 +	[ "$BUILD_DEPENDS" ] && gettext -e "Checking build dependencies...\n"
    1.19  	for dep in $BUILD_DEPENDS
    1.20  	do
    1.21  		implicit=${dep%-dev}
    1.22 @@ -456,35 +455,30 @@
    1.23  				unset vers
    1.24  				vers=$(grep ^VERSION= $WOK/$i/receipt 2>/dev/null | cut -d '"' -f 2)
    1.25  				if [ -f "$PKGS/$i-$vers.tazpkg" ]; then
    1.26 -					gettext "Installing dep (pkg/local):"; echo " $i $vers"
    1.27 -					cd $PKGS && tazpkg install $i-$vers.tazpkg >/dev/null
    1.28 +					echo $i-$vers.tazpkg >> $CACHE/installed.local
    1.29  				else
    1.30  					if [ "$vers" ]; then
    1.31  						if fgrep -q $i-$vers $DB/packages.list; then
    1.32 -							gettext "Installing dep (web/cache):"; echo " $i $vers"
    1.33 -							tazpkg get-install $i >/dev/null
    1.34 +							echo $i >> $CACHE/installed.web
    1.35  						else
    1.36  							# So package exists in wok but not available.
    1.37 -							gettext "Missing dep (wok/pkg)     :"; echo " $i $vers"
    1.38 -							echo $i >> $CACHE/missing
    1.39 +							gettext "Missing dep (wok/pkg):"; echo " $i $vers"
    1.40 +							echo $i >> $CACHE/missing.dep
    1.41  						fi
    1.42  					fi
    1.43  				fi
    1.44  			fi
    1.45  		done
    1.46  	done
    1.47 -	cd $INSTALLED && ls -1 > $CACHE/installed.cook && cd $CACHE
    1.48  	
    1.49 -	# If a cook failed deps are removed.
    1.50 -	[ ! -s "installed.cook.diff" ] && \
    1.51 -		busybox diff installed.list installed.cook > installed.cook.diff
    1.52 -	deps=$(cat installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l)
    1.53 +	# Get the list of installed packages
    1.54 +	cd $INSTALLED && ls -1 > $CACHE/installed.list
    1.55  	
    1.56  	# Have we a missing build dep to cook ?
    1.57 -	if [ -s "$CACHE/missing" ] && [ "$AUTO_COOK" ]; then
    1.58 +	if [ -s "$CACHE/missing.dep" ] && [ "$AUTO_COOK" ]; then
    1.59  		gettext -e "Auto cook config is set   : AUTO_COOK\n"
    1.60  		cp -f $LOGS/$PACKAGE.log $LOGS/$PACKAGE.log.$$
    1.61 -		for i in $(cat $CACHE/missing)
    1.62 +		for i in $(cat $CACHE/missing.dep)
    1.63  		do
    1.64  			(gettext "Building dep (wok/pkg)    :"; echo " $i $vers") | \
    1.65  				tee -a $LOGS/$PACKAGE.log.$$
    1.66 @@ -493,18 +487,39 @@
    1.67  				fgrep "Removing: " $LOGS/$i.log && echo "") | \
    1.68  				tee -a $LOGS/$PACKAGE.log.$$ && break
    1.69  		done
    1.70 -		rm -f $CACHE/missing
    1.71 +		rm -f $CACHE/missing.dep
    1.72  		mv  $LOGS/$PACKAGE.log.$$ $LOGS/$PACKAGE.log
    1.73  	fi
    1.74  	
    1.75  	# QA: Exit on missing dep errors. We exit in both cases, if AUTO_COOK
    1.76  	# is enabled and cook fails we have ERROR in log, if no auto cook we have
    1.77  	# missing dep in cached file.
    1.78 -	if fgrep -q "ERROR:" $LOGS/$pkg.log || [ -s "$CACHE/missing" ]; then
    1.79 -		[ -s "$CACHE/missing" ] && nb=$(cat $CACHE/missing | wc -l)
    1.80 -		echo -e "ERROR: missing dep $nb\n"
    1.81 -		exit 1
    1.82 +	if fgrep -q "ERROR:" $LOGS/$pkg.log || [ -s "$CACHE/missing.dep" ]; then
    1.83 +		[ -s "$CACHE/missing.dep" ] && nb=$(cat $CACHE/missing.dep | wc -l)
    1.84 +		echo "ERROR: missing dep $nb" && exit 1
    1.85  	fi
    1.86 +	
    1.87 +	# Install local packages.
    1.88 +	cd $PKGS
    1.89 +	for i in $(cat $CACHE/installed.local)
    1.90 +	do
    1.91 +		gettext "Installing dep (pkg/local):"; echo " $i $vers"
    1.92 +		tazpkg install $i >/dev/null
    1.93 +	done
    1.94 +	
    1.95 +	# Install web or cached packages (if mirror is set to $PKGS we only
    1.96 +	# use local packages).
    1.97 +	for i in $(cat $CACHE/installed.web)
    1.98 +	do
    1.99 +		gettext "Installing dep (web/cache):"; echo " $i $vers"
   1.100 +		tazpkg get-install $i >/dev/null
   1.101 +	done
   1.102 +	
   1.103 +	# If a cook failed deps are removed.
   1.104 +	cd $INSTALLED && ls -1 > $CACHE/installed.cook && cd $CACHE
   1.105 +	[ ! -s "installed.cook.diff" ] && \
   1.106 +		busybox diff installed.list installed.cook > installed.cook.diff
   1.107 +	deps=$(cat installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l)
   1.108  
   1.109  	# Get source tarball and make sure we have source dir named:
   1.110  	# $PACKAGE-$VERSION to be standard in receipts. Here we use tar.lzma