cookutils rev 239

improve and fix flavors creation
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 27 15:15:19 2011 +0200 (2011-05-27)
parents 9c07802ebc58
children 2389eed5eeb6
files cook
line diff
     1.1 --- a/cook	Fri May 27 14:31:02 2011 +0200
     1.2 +++ b/cook	Fri May 27 15:15:19 2011 +0200
     1.3 @@ -38,7 +38,7 @@
     1.4    list               $(gettext "Cook a list of packages.") 
     1.5    clean-wok          $(gettext "Clean-up all packages files.")
     1.6    clean-src          $(gettext "Clean-up all packages sources.")
     1.7 -  pkgdb              $(gettext "Create packages lists and pack flavors.")
     1.8 +  pkgdb              $(gettext "Create packages DB lists and flavors.")
     1.9  
    1.10  $(echo -e "\033[1m$(gettext "Options:")\033[0m")
    1.11    --clean|-c         Cook : $(gettext "clean the package in the wok.")
    1.12 @@ -50,6 +50,7 @@
    1.13    --wok|-w           Setup: $(gettext "clone the cooking wok from Hg repo.")
    1.14    --stable           Setup: $(gettext "clone the stable wok from Hg repo.")
    1.15    --undigest         Setup: $(gettext "clone the undigest wok from Hg repo.")
    1.16 +  --flavors          Pkgdb: $(gettext "create up-to-date flavors files.")
    1.17  
    1.18  EOT
    1.19  	exit 0
    1.20 @@ -863,14 +864,22 @@
    1.21  		# Create suitable packages list for TazPKG and only for built packages
    1.22  		# as well as flavors files for TazLiTo. We dont need logs since we do it
    1.23  		# manualy to ensure everything is fine before syncing the mirror.
    1.24 -		[ "$2" ] && PKGS="$2"
    1.25 -		[ ! -d "$PKGS" ] && \
    1.26 -			gettext -e "\nPackages directory doesn't exist\n\n" && exit 1
    1.27 +		case "$2" in
    1.28 +			--flavors)
    1.29 +				continue ;;
    1.30 +			*)
    1.31 +				PKGS="$2"
    1.32 +				[ ! -d "$PKGS" ] && \
    1.33 +					gettext -e "\nPackages directory doesn't exist\n\n" &&
    1.34 +					exit 1 ;;
    1.35 +		esac
    1.36  		time=$(date +%s)
    1.37 +		flavors=$SLITAZ/flavors
    1.38 +		live=$SLITAZ/live
    1.39  		echo "cook:pkgdb" > $command
    1.40  		echo "Cook pkgdb: Creating all packages lists" | log
    1.41  		echo ""
    1.42 -			gettext "Creating lists for: "; echo "$PKGS"
    1.43 +		gettext "Creating lists for: "; echo "$PKGS"
    1.44  		separator
    1.45  		gettext "Cook pkgdb started: "; date "+%Y-%m-%d %H:%M"
    1.46  		cd $PKGS
    1.47 @@ -935,13 +944,14 @@
    1.48  		# Create all flavors files at once. Do we realy need code to monitor
    1.49  		# flavors changes ? Let just build them with packages lists before
    1.50  		# syncing the mirror.
    1.51 -		flavors=$SLITAZ/flavors
    1.52 -		live=$SLITAZ/live
    1.53 -		[ -d "$flavors" ] || exit 0
    1.54 +		[ "$2" == "--flavors" ] || exit 1
    1.55 +		[ ! -d "$flavors" ] && echo -e "Missing flavors: $flavors\n" && exit 1
    1.56 +		[ -d "$live" ] || mkdir -p $live
    1.57  		gettext "Creating flavors files in:"; echo " $live"
    1.58 +		echo "Cook pkgdb: Creating all flavors" | log
    1.59  		separator
    1.60  		gettext -e "Recharging lists to use latest packages...\n"
    1.61 -		tazpkg recharge 2>&1 >/dev/null
    1.62 +		tazpkg recharge 2>1 >/dev/null
    1.63  		
    1.64  		# We need a custom tazlito config to set working dir to /home/slitaz.
    1.65  		if [ ! -f "$live/tazlito.conf" ]; then
    1.66 @@ -951,9 +961,10 @@
    1.67  				$live/tazlito.conf
    1.68  		fi
    1.69  
    1.70 -		# Update flavors repo and pack.
    1.71 -		cd $flavors && hg pull -u
    1.72 -		mkdir -p $live && cd $live
    1.73 +		# Update Hg flavors repo and pack.
    1.74 +		[ -d "$flavors/.hg" ] && cd $flavors && hg pull -u
    1.75 +		
    1.76 +		cd $live
    1.77  		echo "Starting to generate flavors..."
    1.78  		rm -f flavors.list *.flavor
    1.79  		for i in $flavors/*