cookutils diff cooker @ 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 8fc5b2a08f0e
children 5782ad5be711
line diff
     1.1 --- a/cooker	Fri May 06 16:14:39 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"