cookutils rev 44

Add $taz var, bunch of tiny improvment and one more info in README
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 07 03:32:53 2011 +0200 (2011-05-07)
parents 14576e7f36dd
children 7fc260d77233
files README cook
line diff
     1.1 --- a/README	Sat May 07 02:56:03 2011 +0200
     1.2 +++ b/README	Sat May 07 03:32:53 2011 +0200
     1.3 @@ -35,14 +35,21 @@
     1.4      * The work of a Build Bot, unix philosophy: one tool for one task
     1.5      * Cook a package if your receipt is crappy :-)
     1.6  
     1.7 -Cook variables used in receipt:
     1.8 +Cook paths variables used in receipt:
     1.9  
    1.10 -    * $src     : Path to package source: wok/pkg/source
    1.11 -    * $stuff   : Path to package stuff: wok/pkg/stuff
    1.12 -    * $fs      : Path to package file system: wok/pkg/taz/*/fs
    1.13 -    * $install : Path to all installed files by the package
    1.14 +    * $src     : Package source: wok/pkg/source
    1.15 +    * $stuff   : Package stuff: wok/pkg/stuff
    1.16 +    * $fs      : Package file system: wok/pkg/taz/*/fs
    1.17 +    * $install : All installed files by the package
    1.18                   Old style is $_pkg and cook is compatible
    1.19  
    1.20 +Cook internal paths variables:
    1.21 +
    1.22 +    * $pkgdir  : Package directory in the wok: wok/pkg
    1.23 +    * $receipt : Package receipt in wok: wok/pkg/receipt
    1.24 +    * $taz     : The taz directory: wok/pkg/taz
    1.25 +    * $pack    : Package to compress: wok/taz/pkg-*
    1.26 +
    1.27  Cook also manages packages lists so they can be used for a personal packages
    1.28  repository or sent to the official mirror. We create and use:
    1.29  
    1.30 @@ -55,9 +62,9 @@
    1.31  
    1.32  Cooker
    1.33  --------------------------------------------------------------------------------
    1.34 -The Cooker is a Build Bot which automates the build process but doesn't make the dinner
    1.35 -for you! We need quality receipts to cook succesfully and the goal is not to have
    1.36 -a bloated script so please Keep It Short and Simple.
    1.37 +The Cooker is a Build Bot which automates the build process but doesn't make
    1.38 +the dinner for you! We need quality receipts to cook succesfully and the goal
    1.39 +is not to have a bloated script so please Keep It Short and Simple.
    1.40  
    1.41  Cmdline tool  : /usr/bin/cooker
    1.42  Web interface : /var/www/cgi-bin/cooker
    1.43 @@ -65,8 +72,8 @@
    1.44  
    1.45  The web interface consists of one CGI script and one CSS style. Cook logs can
    1.46  be produced by cook and the cooker just acts as a fronted to check them in
    1.47 -a nice way. A web interface also highlights success and error and can show receipts
    1.48 -and the cooker logs such as the last ordered list or commits check.
    1.49 +a nice way. A web interface also highlights success and error and can show
    1.50 +receipts and the cooker logs such as the last ordered list or commits check.
    1.51  
    1.52  
    1.53  Toolchain
    1.54 @@ -84,6 +91,7 @@
    1.55  
    1.56      * In all cases: KISS
    1.57      * Use tab and not space to indent
    1.58 +    * Max 80 char by line (try to edit in a Xterm 80x24)
    1.59      * Use names rather than $1 $2 $3
    1.60      * Variables from config file are $UPPERCASE
    1.61      * Variables initialized by cook are $lowercase
     2.1 --- a/cook	Sat May 07 02:56:03 2011 +0200
     2.2 +++ b/cook	Sat May 07 03:32:53 2011 +0200
     2.3 @@ -106,7 +106,7 @@
     2.4  	for var in PACKAGE VERSION CATEGORY SHORT_DESC MAINTAINER WEB_SITE
     2.5  	do
     2.6  		unset value
     2.7 -		value=$(grep ^$var= receipt | cut -d \" -f 2)
     2.8 +		value=$(grep ^$var= $receipt | cut -d \" -f 2)
     2.9  		case "$var" in
    2.10  			PACKAGE|VERSION|SHORT_DESC)
    2.11  				if_empty_value ;;
    2.12 @@ -140,7 +140,8 @@
    2.13  set_paths() {
    2.14  	pkgdir=$WOK/$PACKAGE
    2.15  	src=$pkgdir/source/$PACKAGE-$VERSION
    2.16 -	pack=$pkgdir/taz/$PACKAGE-${VERSION}${EXTRAVERSION}
    2.17 +	taz=$pkgdir/taz
    2.18 +	pack=$taz/$PACKAGE-${VERSION}${EXTRAVERSION}
    2.19  	fs=$pack/fs
    2.20  	stuff=$pkgdir/stuff
    2.21  	install=$pkgdir/install
    2.22 @@ -206,8 +207,8 @@
    2.23  	cd $WOK/$pkg
    2.24  	[ -d install ] && prod=$(du -sh install | awk '{print $1}' 2>/dev/null)
    2.25  	fs=$(du -sh taz/* | awk '{print $1}')
    2.26 -	size=$(du -sh $PKGS/$PACKAGE-${VERSION}*.tazpkg | awk '{print $1}')
    2.27 -	files=$(cat taz/$PACKAGE-*/files.list | wc -l)
    2.28 +	size=$(du -sh $PKGS/$pkg-${VERSION}*.tazpkg | awk '{print $1}')
    2.29 +	files=$(cat taz/$pkg-*/files.list | wc -l)
    2.30  	cookdate=$(date "+%Y-%m-%d %H:%M")
    2.31  	gettext "Summary for:"; echo " $PACKAGE $VERSION"
    2.32  	separator
    2.33 @@ -324,6 +325,7 @@
    2.34  	separator
    2.35  	set_paths
    2.36  	[ "$QA" ] && receipt_quality
    2.37 +	cd $pkgdir
    2.38  	rm -rf install taz source
    2.39  
    2.40  	# Disable -pipe if less than 512Mb free RAM.
    2.41 @@ -336,7 +338,7 @@
    2.42  	unset free
    2.43  
    2.44  	# Export flags and path to be used by make
    2.45 -	DESTDIR=$WOK/$PACKAGE/install
    2.46 +	DESTDIR=$pkgdir/install
    2.47  	export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS BUILD_HOST CONFIG_SITE
    2.48  	local LC_ALL=POSIX LANG=POSIX
    2.49  
    2.50 @@ -381,7 +383,7 @@
    2.51  	fi
    2.52  
    2.53  	# Execute receipt rules.
    2.54 -	if grep -q ^compile_rules $pkgdir/receipt; then
    2.55 +	if grep -q ^compile_rules $receipt; then
    2.56  		gettext -e "Executing: compile_rules\n"
    2.57  		[ -d "$src" ] && cd $src 
    2.58  		compile_rules || echo "" && exit 1
    2.59 @@ -414,13 +416,13 @@
    2.60  	set_paths
    2.61  	echo "Pack: $PACKAGE $VERSION"
    2.62  	separator
    2.63 -	if grep -q ^genpkg_rules $pkgdir/receipt; then
    2.64 +	if grep -q ^genpkg_rules $receipt; then
    2.65  		gettext -e "Executing: genpkg_rules\n"
    2.66  		cd $pkgdir
    2.67  		mkdir -p $fs && genpkg_rules || (echo -e \
    2.68  			"\nERROR: genpkg_rules failed\n" >> $LOGS/$pkg.log && exit 1)
    2.69  	fi
    2.70 -	cd $pkgdir/taz
    2.71 +	cd $taz
    2.72  	for file in receipt description.txt
    2.73  	do
    2.74  		[ ! -f "../$file" ] && continue
    2.75 @@ -498,12 +500,13 @@
    2.76  	if fgrep -q ERROR: $LOGS/$pkg.log; then
    2.77  		rm -f $command && exit 1
    2.78  	fi
    2.79 +	gettext "QA: Checking for empty package..."
    2.80  	files=$(grep -q ^/ $pkgdir/taz/$pkg-*/files.list)
    2.81  	if [ ! "$files" ] && [ "$CATEGORY" != "meta" ]; then
    2.82 -		echo -e "ERROR: empty package"
    2.83 +		echo -e "\nERROR: empty package"
    2.84  		rm -f $command && exit 1
    2.85  	else
    2.86 -		mv -f $WOK/$pkg/taz/$pkg-*.tazpkg $PKGS
    2.87 +		status && mv -f $pkgdir/taz/$pkg-*.tazpkg $PKGS
    2.88  		sed -i /^${pkg}$/d $broken
    2.89  	fi
    2.90  }
    2.91 @@ -649,11 +652,12 @@
    2.92  		time=$(date +%s)
    2.93  		pkg="$1"
    2.94  		[ -z "$pkg" ] && usage
    2.95 +		receipt="$WOK/$pkg/receipt"
    2.96  		check_pkg_in_wok && echo ""
    2.97  		echo "cook:$pkg" > $command
    2.98  		unset inst
    2.99  		unset_receipt
   2.100 -		cd $WOK/$pkg && . ./receipt
   2.101 +		. $receipt
   2.102  		
   2.103  		# Handle --options
   2.104  		case "$2" in