cookutils rev 49

cook + cooker + doc: add blocked functionality and information
author Christophe Lincoln <pankso@slitaz.org>
date Sat May 07 05:34:17 2011 +0200 (2011-05-07)
parents 8df3646e9d8f
children 7102d10a9fa8
files cook cooker doc/cookutils.en.html
line diff
     1.1 --- a/cook	Sat May 07 04:42:06 2011 +0200
     1.2 +++ b/cook	Sat May 07 05:34:17 2011 +0200
     1.3 @@ -40,6 +40,8 @@
     1.4    --clean|-c      Cook : $(gettext "clean the package in the wok.")
     1.5    --install|-i    Cook : $(gettext "cook and install the package.")
     1.6    --getsrc|-gs    Cook : $(gettext "get the package source tarball.")
     1.7 +  --block|-b      Cook : $(gettext "Block a package so cook will skip it.")
     1.8 +  --unblock|-ub   Cook : $(gettext "Unblock a blocked package.")
     1.9    --wok|-w        Setup: $(gettext "create also a wok from Hg repo.")
    1.10  
    1.11  EOT
    1.12 @@ -544,12 +546,10 @@
    1.13  
    1.14  		# Handle --options
    1.15  		case "$2" in
    1.16 -			--wok)
    1.17 +			--wok|-w)
    1.18  				[ ! -d "$INSTALLED/mercurial" ] && tazpkg get-install mercurial
    1.19  				[ -d "$WOK" ] && echo -e "A wok already exist.\n" && exit 1
    1.20  				hg clone $HG_URL ;;
    1.21 -			--chroot)
    1.22 -				echo "TODO: create a chroot with tazdev" ;;
    1.23  		esac
    1.24  
    1.25  		# SliTaz group and permissions
    1.26 @@ -659,7 +659,7 @@
    1.27  		check_pkg_in_wok && echo ""
    1.28  
    1.29  		# Skip blocked, 3 lines also for the Cooker.
    1.30 -		if grep -q ^$pkg$ $blocked; then
    1.31 +		if grep -q "^$pkg$" $blocked && [ "$2" == "--*" ]; then
    1.32  			gettext -e "Blocked package:"; echo -e " $pkg\n" && exit 0
    1.33  		fi
    1.34  
    1.35 @@ -672,15 +672,23 @@
    1.36  		# Handle --options
    1.37  		case "$2" in
    1.38  			--clean|-c)
    1.39 -				gettext -e "Cleaning package:"; echo -n " $pkg"
    1.40 +				gettext -e "Cleaning:"; echo -n " $pkg"
    1.41  				cd $WOK/$pkg && rm -rf install taz source
    1.42  				status && echo "" && exit 0 ;;
    1.43  			--install|-i)
    1.44  				inst='yes' ;;
    1.45 -			--getsrc)
    1.46 -				echo "Getting source for: $pkg"
    1.47 +			--getsrc|-gs)
    1.48 +				gettext "Getting source for:"; echo " $pkg"
    1.49  				separator && get_source
    1.50  				echo -e "Tarball: $SRC/$TARBALL\n" && exit 0 ;;
    1.51 +			--block|-b)
    1.52 +				gettext "Blocking:"; echo -n " $pkg"
    1.53 +				[ $(grep "^$pkg$" $blocked) ] || echo "$pkg" >> $blocked
    1.54 +				status && echo "" && exit 0 ;;
    1.55 +			--unblock|-ub)
    1.56 +				gettext "Unblocking:"; echo -n " $pkg"
    1.57 +				sed -i "/^${pkg}$/"d $blocked
    1.58 +				status && echo "" && exit 0 ;;
    1.59  		esac
    1.60  
    1.61  		# Check if wanted is build now so we have separate log files.
     2.1 --- a/cooker	Sat May 07 04:42:06 2011 +0200
     2.2 +++ b/cooker	Sat May 07 05:34:17 2011 +0200
     2.3 @@ -10,7 +10,8 @@
     2.4  [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
     2.5  [ -f "cook.conf" ] && . ./cook.conf
     2.6  
     2.7 -# The same wok as cook.
     2.8 +# Set pkg name and use same wok as cook.
     2.9 +pkg="$2"
    2.10  wok="$WOK"
    2.11  flavors="$SLITAZ/flavors"
    2.12  
    2.13 @@ -34,15 +35,17 @@
    2.14  Usage: cooker [command] [pkg|list|note]
    2.15  
    2.16  Options:
    2.17 -  usage|-u      Display this short usage.
    2.18 -  setup|-s      Setup the Cooker environment.
    2.19 -  note|-n       Add a note to the cooknotes.
    2.20 -  notes|-ns     Display all the cooknotes.
    2.21 -  pkg|-p        Same as 'cook pkg' but with cooker log.
    2.22 -  flavor|-f     Cook all packages of a flavor.
    2.23 -  list|-l       Cook all package in the given list.
    2.24 -  cat|-c        Cook all packages of a category.
    2.25 -  all|-a        Find and cook all unbuilt packages.
    2.26 +  usage|-u        Display this short usage.
    2.27 +  setup|-s        Setup the Cooker environment.
    2.28 +  note|-n         Add a note to the cooknotes.
    2.29 +  notes|-ns       Display all the cooknotes.
    2.30 +  block|-b        Block a package so cook will skip it.
    2.31 +  unblock|-ub     Unblock a blocked package.
    2.32 +  pkg|-p          Same as 'cook pkg' but with cooker log.
    2.33 +  flavor|-f       Cook all packages of a flavor.
    2.34 +  list|-l         Cook all package in the given list.
    2.35 +  cat|-c          Cook all packages of a category.
    2.36 +  all|-a          Find and cook all unbuilt packages.
    2.37  
    2.38  EOT
    2.39  	exit 0
    2.40 @@ -257,13 +260,18 @@
    2.41  		separator
    2.42  		cat $cooknotes
    2.43  		separator && echo "" ;;
    2.44 +	block|-b)
    2.45 +		# Block a package.
    2.46 +		[ "$pkg" ] && cook $pkg --block ;;
    2.47 +	unblock|-ub)
    2.48 +		# Unblock a package.
    2.49 +		[ "$pkg" ] && cook $pkg --unblock ;;
    2.50  	reverse|-r)
    2.51  		# Cook all reverse dependencies for a packages. This command let us
    2.52  		# control the Cooker manually for commit that will cook a lot of packages.
    2.53  		#
    2.54  		# Use hg commit ? Ex: hg commit -m "Message bla bla | cooker:reverse"
    2.55  		#
    2.56 -		pkg="$2"
    2.57  		[ ! -d "$wok/$pkg" ] && echo -e "\nNo package $2 found.\n" && exit 0
    2.58  		rm -f $cooklist && touch $cooklist && cd $wok
    2.59  		echo -e "\nReverse cooklist for: $pkg"
    2.60 @@ -281,7 +289,6 @@
    2.61  		cook_list ;;
    2.62  	pkg|-p)
    2.63  		# Same as 'cook pkg' but with log for web interface.
    2.64 -		pkg="$2"
    2.65  		echo "Cook started for: <a href='cooker.cgi?pkg=$pkg'>$pkg</a>" | log
    2.66  		cook $pkg || broken
    2.67  		empty_command ;;
     3.1 --- a/doc/cookutils.en.html	Sat May 07 04:42:06 2011 +0200
     3.2 +++ b/doc/cookutils.en.html	Sat May 07 05:34:17 2011 +0200
     3.3 @@ -26,7 +26,9 @@
     3.4  	Cook let you compile and create a package, provide a log file and check
     3.5  	receipt/package quality. The Cooker is a build bot with more automation
     3.6  	and can be used as a frontend to cook, since it provide a CGI/web interface
     3.7 -	who let you view cook logs in a nice and colored way.
     3.8 +	who let you view cook logs in a nice and colored way. Cook and the Cooker
     3.9 +	use the same DB files and wok, ther share <a href="#blocked">blocked</a>
    3.10 +	and broken packages as well as activity.
    3.11  </p>
    3.12  
    3.13  <h3>Cook usage</h3>
    3.14 @@ -242,6 +244,29 @@
    3.15  # cooker cat [category]
    3.16  </pre>
    3.17  
    3.18 +<a name="blocked"></a>
    3.19 +<h3>Blocked packages</h3>
    3.20 +<p>
    3.21 +	Cook and the Cooker handle a file with a list of blocked package so they
    3.22 +	not cook when commits appends or if a cooklist is used. This is very useful
    3.23 +	for a Cooker Build Bot in production. When you block or unblock a package
    3.24 +	you can add a note to the cooknotes. Blocking packages example:
    3.25 +</p>
    3.26 +<pre>
    3.27 +# cook pkgname --block
    3.28 +# cooker block pkgname
    3.29 +# cooker -n "Blocked pkgname note"
    3.30 +</pre>
    3.31 +<p>
    3.32 +	The list of blocked packages are also displayed on the Cooker web interface.
    3.33 +	To unblock a package you have to use the unblock command or cook --unblock
    3.34 +	option:
    3.35 +</p>
    3.36 +<pre>
    3.37 +# cook pkgname --unblock
    3.38 +# cooker unblock pkgname
    3.39 +</pre>
    3.40 +
    3.41  <h3>Cooker CGI/Web</h3>
    3.42  <p>
    3.43  	To let you view log files in a nice way, keep activity trace and help find