cookutils rev 52

cook: Include Erjo patches - Beter test for installed packages and init DB files
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 07 12:11:33 2011 +0200 (2011-05-07)
parents 4341efb4e160
children 99f1b17a5659
files cook
line diff
     1.1 --- a/cook	Sat May 07 05:41:58 2011 +0200
     1.2 +++ b/cook	Sat May 07 12:11:33 2011 +0200
     1.3 @@ -99,6 +99,17 @@
     1.4  	fi
     1.5  }
     1.6  
     1.7 +# Initialise files used in $CACHE
     1.8 +init_db_files() {
     1.9 +	gettext "Creating directories structure in:"; echo " $SLITAZ"
    1.10 +	mkdir -p $WOK $PKGS $SRC $CACHE $LOGS
    1.11 +	gettext "Creating DB files in:"; echo " $CACHE"
    1.12 +	for f in $activity $command $broken $blocked
    1.13 +	do
    1.14 +		touch $f
    1.15 +	done
    1.16 +}
    1.17 +
    1.18  # QA: check a receip consistency befor building.
    1.19  receipt_quality() {
    1.20  	gettext -e "QA: checking package receipt...\n"
    1.21 @@ -351,7 +362,7 @@
    1.22  	[ "$DEPENDS" ] && gettext -e "Checking build dependencies...\n"
    1.23  	for dep in $BUILD_DEPENDS
    1.24  	do
    1.25 -		if [ ! -d "$INSTALLED/$dep" ]; then
    1.26 +		if [ ! -f "$INSTALLED/$dep/receipt" ]; then
    1.27  			# Try local package first
    1.28  			if [ -f "$PKGS/$dep-*.tazpkg" ]; then
    1.29  				gettext "Installing dep (local):"; echo " $dep"
    1.30 @@ -523,7 +534,7 @@
    1.31  	usage|help|-u|-h)
    1.32  		 usage ;;
    1.33  	list-wok)
    1.34 -		gettext "List of packages in:"; echo " $WOK"
    1.35 +		gettext -e "\nList of packages in:"; echo " $WOK"
    1.36  		separator
    1.37  		cd $WOK && ls -1
    1.38  		separator
    1.39 @@ -535,18 +546,18 @@
    1.40  		echo "Cook: setting up the environment" | log
    1.41  		gettext -e "\nSetting up your environment\n"
    1.42  		separator && cd $SLITAZ
    1.43 -		gettext "Creating directories structure in:"; echo " $SLITAZ"
    1.44 -		mkdir -p $WOK $PKGS $SRC $CACHE $LOGS
    1.45 +		init_db_files
    1.46  		gettext -e "Checking for packages to install...\n"
    1.47  		for pkg in $SETUP_PKGS
    1.48  		do
    1.49 -			[ ! -d "$INSTALLED/$pkg" ] && tazpkg get-install $pkg
    1.50 +			[ ! -f "$INSTALLED/$pkg/receipt" ] && tazpkg get-install $pkg
    1.51  		done
    1.52  
    1.53  		# Handle --options
    1.54  		case "$2" in
    1.55  			--wok|-w)
    1.56 -				[ ! -d "$INSTALLED/mercurial" ] && tazpkg get-install mercurial
    1.57 +				[ ! -f "$INSTALLED/mercurial/receipt" ] && \
    1.58 +					tazpkg get-install mercurial
    1.59  				[ -d "$WOK" ] && echo -e "A wok already exist.\n" && exit 1
    1.60  				hg clone $HG_URL ;;
    1.61  		esac