cookutils rev 31

cooker: use command like cook not --options so we can also use short switch, ex: cooker -n 'Add note to cooknotes'
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 06 17:05:53 2011 +0200 (2011-05-06)
parents c1a2be11e84a
children 5782ad5be711
files cooker doc/cookutils.en.html
line diff
     1.1 --- a/cooker	Fri May 06 16:30:47 2011 +0200
     1.2 +++ b/cooker	Fri May 06 17:05:53 2011 +0200
     1.3 @@ -12,6 +12,7 @@
     1.4  
     1.5  # The same wok as cook.
     1.6  wok="$WOK"
     1.7 +flavors="$SLITAZ/flavors"
     1.8  
     1.9  # Cooker DB files.
    1.10  activity="$CACHE/activity"
    1.11 @@ -30,18 +31,18 @@
    1.12  usage() {
    1.13  	cat << EOT
    1.14  
    1.15 -Usage: cooker [--option]
    1.16 +Usage: cooker [command] [pkg|list|note]
    1.17  
    1.18  Options:
    1.19 -  --usage        Display this short usage.
    1.20 -  --setup        Setup the Cooker environment.
    1.21 -  --notes        Display all the cooknotes.
    1.22 -  --note=        Add a note to the cooknotes.
    1.23 -  --pkg=         Same as 'cook pkg' but with cooker log.
    1.24 -  --flavor=      Cook all packages of a flavor.
    1.25 -  --list=        Cook all package in the given list.
    1.26 -  --cat=         Cook all packages of a category.
    1.27 -  --all          Find and cook all unbuilt packages.
    1.28 +  usage|-u      Display this short usage.
    1.29 +  setup|-s      Setup the Cooker environment.
    1.30 +  note|-n       Add a note to the cooknotes.
    1.31 +  notes|-ns     Display all the cooknotes.
    1.32 +  pkg|-p        Same as 'cook pkg' but with cooker log.
    1.33 +  flavor|-f     Cook all packages of a flavor.
    1.34 +  list|-l       Cook all package in the given list.
    1.35 +  cat|-c        Cook all packages of a category.
    1.36 +  all|-a        Find and cook all unbuilt packages.
    1.37  
    1.38  EOT
    1.39  	exit 0
    1.40 @@ -205,12 +206,12 @@
    1.41  # Commands
    1.42  #
    1.43  case "$1" in
    1.44 -	--usage|--help)
    1.45 +	usage|help|-u|-h)
    1.46  		usage ;;
    1.47 -	--setup)
    1.48 +	setup|-s)
    1.49  		# Setup the Cooker environment.
    1.50  		echo -e "\nSetting up the Cooker"
    1.51 -		echo "Cooker --setup using: $SLITAZ" | log
    1.52 +		echo "Cooker setup using: $SLITAZ" | log
    1.53  		separator
    1.54  		for pkg in $SETUP_PKGS mercurial rsync
    1.55  		do
    1.56 @@ -219,7 +220,7 @@
    1.57  		mkdir -p $SLITAZ && cd $SLITAZ
    1.58  		[ -d "${wok}-hg" ] && echo -e "Hg wok already exist.\n" && exit 1
    1.59  		[ -d "$wok" ] && echo -e "Build wok already exist.\n" && exit 1
    1.60 -		[ -d "flavors" ] && echo -e "Flavors repo already exist.\n" && exit 1
    1.61 +		[ -d "$flavors" ] && echo -e "Flavors repo already exist.\n" && exit 1
    1.62  
    1.63  		# Directories and files
    1.64  		echo "mkdir's and touch files in: $SLITAZ"
    1.65 @@ -232,23 +233,23 @@
    1.66  		hg clone $FLAVORS_URL flavors
    1.67  		cp -a ${wok}-hg $wok
    1.68  		separator && echo "" ;;
    1.69 -	--notes)
    1.70 +	note|-n)
    1.71 +		# Blocked a pkg and want other to know why ? Post a note!
    1.72 +		note="$2"
    1.73 +		[ "$note" ] && echo "$note" >> $cooknotes ;;
    1.74 +	notes|-ns)
    1.75  		# View cooknotes.
    1.76  		echo -e "\nCooknotes"
    1.77  		separator
    1.78  		cat $cooknotes
    1.79  		separator && echo "" ;;
    1.80 -	--note=*)
    1.81 -		# Blocked a pkg and want other to know why ? Post a note!
    1.82 -		note=${1#--note=}
    1.83 -		[ "$note" ] && echo "$note" >> $cooknotes ;;
    1.84 -	--reverse=*)
    1.85 +	reverse|-r)
    1.86  		# Cook all reverse dependencies for a packages. This command let us
    1.87  		# control the Cooker manually for commit that will cook a lot of packages.
    1.88  		#
    1.89  		# Use hg commit ? Ex: hg commit -m "Message bla bla | cooker:reverse"
    1.90  		#
    1.91 -		pkg=${1#--reverse=}
    1.92 +		pkg="$2"
    1.93  		[ ! -d "$wok/$pkg" ] && echo "No package $2 found." && exit 0
    1.94  		cd $wok
    1.95  		for rev in *
    1.96 @@ -257,14 +258,14 @@
    1.97  				echo "TODO: $rev"
    1.98  			fi
    1.99  		done ;;
   1.100 -	--pkg=*)
   1.101 +	pkg|-p)
   1.102  		# Same as 'cook pkg' but with log for web interface.
   1.103 -		pkg=${1#--pkg=}
   1.104 +		pkg="$2"
   1.105  		echo "Cook started for: <a href='cooker.cgi?pkg=$pkg'>$pkg</a>" | log
   1.106  		cook $pkg || broken ;;
   1.107 -	--cat=*)
   1.108 +	cat|-c)
   1.109  		# Cook all packages of a category.
   1.110 -		cat=${1#--cat=}
   1.111 +		cat="$2"
   1.112  		rm -f $cooklist && touch $cooklist && cd $wok
   1.113  		for pkg in *
   1.114  		do
   1.115 @@ -274,29 +275,29 @@
   1.116  		strip_blocked
   1.117  		cook_order | tee $LOGS/cookorder.log
   1.118  		cook_list ;;
   1.119 -	--flavor=*)
   1.120 +	flavor|-f)
   1.121  		# Cook all packages of a flavor.
   1.122 -		flavor=${1#--flavor=}
   1.123 -		[ ! -d "$SLITAZ/flavors/$flavor" ] && \
   1.124 -			echo -e "\nSpecified flavor does not exist: $flavor\n" && exit 1
   1.125 -		list=$SLITAZ/flavors/$flavor/packages.list
   1.126 +		name="$2"
   1.127 +		[ ! -d "$flavors/$name" ] && \
   1.128 +			echo -e "\nSpecified flavor does not exist: $name\n" && exit 1
   1.129 +		list=$flavors/$name/packages.list
   1.130  		cp -a $list $cooklist
   1.131  		strip_blocked
   1.132  		cook_order | tee $LOGS/cookorder.log
   1.133  		#cook_list
   1.134  		;;
   1.135 -	--list=*)
   1.136 +	list|-l)
   1.137  		# Cook a list og package given in argument.
   1.138 -		list=${1#--list=}
   1.139 +		list="$2"
   1.140  		[ ! -f "$list" ] && \
   1.141  			echo -e "\nSpecified list does not exist: $list\n" && exit 1
   1.142  		cp -a $list $cooklist
   1.143  		strip_blocked
   1.144  		cook_order | tee $LOGS/cookorder.log
   1.145  		cook_list ;;
   1.146 -	--all)
   1.147 +	all|-a)
   1.148  		# Try to build all unbuilt packages except blocked's.
   1.149 -		echo "cooker:--all" > $command
   1.150 +		echo "cooker:all" > $command
   1.151  		rm -f $cooklist && touch $cooklist
   1.152  		echo "" && cd $wok
   1.153  		echo "Cooker cooklist"
     2.1 --- a/doc/cookutils.en.html	Fri May 06 16:30:47 2011 +0200
     2.2 +++ b/doc/cookutils.en.html	Fri May 06 17:05:53 2011 +0200
     2.3 @@ -160,11 +160,12 @@
     2.4  	web server.
     2.5  </p>
     2.6  <p>
     2.7 -	The Cooker provide a small built-in help usage that you can display with
     2.8 -	the command:
     2.9 +	The Cooker provide a small built-in help usage and short command switch.
    2.10 +	For example to display usage you can use:
    2.11  </p>
    2.12  <pre>
    2.13 -# cooker --usage
    2.14 +# cooker usage
    2.15 +# cooker -u
    2.16  </pre>
    2.17  
    2.18  <h3>Cooker setup</h3>
    2.19 @@ -174,10 +175,12 @@
    2.20  	One Hg and clean wok as reference and one build wok, in this way is is easy
    2.21  	to compare both wok and get modifications. If you already have a cook
    2.22  	environement, you must move your wok before setting up the Cooker or it
    2.23 -	will complain:
    2.24 +	will complain. Setup will also install a set of development packages that
    2.25 +	can be configured in the cook.conf configuration file and the variable
    2.26 +	SETUP_PKGS. To setup your cooker environment:
    2.27  </p>
    2.28  <pre>
    2.29 -# cooker --setup
    2.30 +# cooker setup
    2.31  </pre>
    2.32  <p>
    2.33  	If all went well you have now 2 wok, base developement packages installed
    2.34 @@ -201,7 +204,7 @@
    2.35  	logs:
    2.36  </p>
    2.37  <pre>
    2.38 -# cooker --pkg=pkgname
    2.39 +# cooker pkg pkgname
    2.40  </pre>
    2.41  <p>
    2.42  	To cook more than one package at once you have different kind of choices.
    2.43 @@ -210,9 +213,9 @@
    2.44  	all packages of a category.
    2.45  </p>
    2.46  <pre>
    2.47 -# cooker --flavor=flavor
    2.48 -# cooker --list=/path/to/list
    2.49 -# cooker --cat=category
    2.50 +# cooker flavor [name]
    2.51 +# cooker list [/path/to/cooklist]
    2.52 +# cooker cat [category]
    2.53  </pre>
    2.54  
    2.55  <h3>Cooker CGI/Web</h3>
    2.56 @@ -265,8 +268,8 @@
    2.57  	checked from cmdline:
    2.58  </p>
    2.59  <pre>
    2.60 -# cooker --note="Blocked pkgname due to heavy CPU load"
    2.61 -# cooker --notes
    2.62 +# cooker note "Blocked pkgname due to heavy CPU load"
    2.63 +# cooker notes
    2.64  </pre>
    2.65  
    2.66  <!-- End content -->