tazwok rev 240

Update usage; automatically fill wok_db when looking for depends
author Antoine Bodin <gokhlayeh@slitaz.org>
date Thu Feb 10 23:13:52 2011 +0100 (2011-02-10)
parents f631650e0925
children c49dfdbcab2b
files tazwok
line diff
     1.1 --- a/tazwok	Thu Feb 10 21:14:01 2011 +0100
     1.2 +++ b/tazwok	Thu Feb 10 23:13:52 2011 +0100
     1.3 @@ -31,7 +31,6 @@
     1.4    stats          Print Tazwok statistics from the config file and the wok.
     1.5    edit           Edit a package receipt in the current wok.
     1.6    build-depends  Generate a list of packages to build a wok.
     1.7 -  cmp|compare*   Compare the wok and the cooked pkgs (--remove old pkgs).
     1.8    list           List all packages in the wok tree or by category.
     1.9    info           Get information about a package in the wok.
    1.10    check          Check every receipt for common errors.
    1.11 @@ -46,16 +45,18 @@
    1.12    cook-commit    Cook all modified receipts.
    1.13    cook-all       Cook all packages excepted toolchain.
    1.14    cook-toolchain Cook the toolchain packages.
    1.15 -  gen-cooklist   Generate a sorted cooklist using packages or list (--list) in argument.
    1.16 +  gen-cooklist   Generate a sorted cooklist using packages or list.
    1.17    sort-cooklist  Sort the cooklist given in argument.
    1.18    get-src        Download the tarball of the package given in argument.
    1.19    clean          Clean all generated files in the package tree.
    1.20    new-tree       Prepare a new package tree and receipt (--interactive).
    1.21    gen-list       (Re-)Generate a packages list for a repository.
    1.22 +  check-list     Update packages lists for a repository.
    1.23    gen-wok-db     (Re-)Generate wok lists with depends and wanted datas.
    1.24 -  gen-clean-wok  Gen a clean wok in a dir ('clean-wok' cleans current wok).
    1.25 +  gen-clean-wok  Generate a clean wok in a dir.
    1.26    clean-wok      Clean entirely the wok.
    1.27    remove         Remove a package from the wok.
    1.28 +  webserver      Enable/disable webserver on localhost.
    1.29    hgup           Pull and update a wok under Hg.
    1.30    maintainers    List all maintainers in the wok.
    1.31    maintained-by  List packages maintained by a contributor.\n
    1.32 @@ -199,7 +200,7 @@
    1.33  	[ -f $WOK/$PACKAGE/receipt ] && return
    1.34  	if [ "$undigest" ]; then
    1.35  		[ -f "$SLITAZ_VERSION/wok/$PACKAGE/receipt" ] && return 1
    1.36 -		grep -q ^$PACKAGE$ $SLITAZ_VERSION/packages/packages.txt && return 1
    1.37 +		grep -q ^$PACKAGE$ $SLITAZ_DIR/$SLITAZ_VERSION/packages/packages.txt && return 1
    1.38  	fi
    1.39  	echo "Can't find $PACKAGE in wok or mirror" >&2
    1.40  	return 2
    1.41 @@ -1320,7 +1321,7 @@
    1.42  look_for_dep()
    1.43  {
    1.44  	if [ "$undigest" ] && [ ! -f "$WOK/$PACKAGE/receipt" ]; then
    1.45 -		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt \
    1.46 +		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-depends.txt \
    1.47  			| cut -f 2
    1.48  	else
    1.49  		grep ^$PACKAGE$'\t' $INCOMING_REPOSITORY/wok-depends.txt | \
    1.50 @@ -1336,7 +1337,7 @@
    1.51  look_for_all()
    1.52  {
    1.53  	if [ "$undigest" ] && [ ! -f "$WOK/$PACKAGE/receipt" ]; then
    1.54 -		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt \
    1.55 +		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-depends.txt \
    1.56  			| cut -f 2,3 | sed 's/ 	 / /'
    1.57  	else
    1.58  		grep ^$PACKAGE$'\t' $INCOMING_REPOSITORY/wok-depends.txt | \
    1.59 @@ -1348,7 +1349,7 @@
    1.60  {
    1.61  	fgrep ' '$PACKAGE' ' $INCOMING_REPOSITORY/wok-depends.txt | cut -f 1
    1.62  	if [ "$undigest" ]; then
    1.63 -		for rdep in $(fgrep ' '$PACKAGE' ' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt | cut -f 1); do
    1.64 +		for rdep in $(fgrep ' '$PACKAGE' ' $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-depends.txt | cut -f 1); do
    1.65  			if [ ! -f "WOK$/$rdep/receipt" ]; then
    1.66  				echo "$rdep"
    1.67  			fi
    1.68 @@ -1361,7 +1362,7 @@
    1.69  	fgrep ' '$PACKAGE' ' $INCOMING_REPOSITORY/wok-depends.txt | \
    1.70  		cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1
    1.71  	if [ "$undigest" ]; then
    1.72 -		for rdep in $(fgrep ' '$PACKAGE' ' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt \
    1.73 +		for rdep in $(fgrep ' '$PACKAGE' ' $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-depends.txt \
    1.74  			| cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1); do
    1.75  			if [ ! -f "WOK$/$rdep/receipt" ]; then
    1.76  				echo "$rdep"
    1.77 @@ -1374,7 +1375,7 @@
    1.78  look_for_wanted()
    1.79  {
    1.80  	if [ "$undigest" ] && [ ! -f "$WOK/$PACKAGE/receipt" ]; then
    1.81 -		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-wanted.txt | cut -f 2
    1.82 +		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-wanted.txt | cut -f 2
    1.83  	else
    1.84  		grep ^$PACKAGE$'\t' $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 2
    1.85  	fi
    1.86 @@ -1385,7 +1386,7 @@
    1.87  {
    1.88  	grep $'\t'$PACKAGE$ $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 1
    1.89  	if [ "$undigest" ]; then
    1.90 -		for rwanted in $(grep $'\t'$PACKAGE$ $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-wanted.txt | cut -f 1); do
    1.91 +		for rwanted in $(grep $'\t'$PACKAGE$ $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming/wok-wanted.txt | cut -f 1); do
    1.92  			if [ ! -f "$WOK/$rwanted/receipt" ]; then
    1.93  				echo "$rwanted"
    1.94  			fi
    1.95 @@ -1474,6 +1475,25 @@
    1.96  		{
    1.97  			echo $PACKAGE >> $tmp/dep
    1.98  		}
    1.99 +		# If requested packages are not in dep_db, partial generation of this db is needed.
   1.100 +		for p in $pkg_list; do
   1.101 +			grep -q ^$p$'\t' $dep_db && continue
   1.102 +			[ -d "$WOK/$p" ] || continue	
   1.103 +			plan_check_for_missing=yes	
   1.104 +			check_for_missing
   1.105 +		done
   1.106 +		if [ "$plan_check_for_missing" ]; then
   1.107 +			append_to_dep()
   1.108 +			{
   1.109 +				if ! grep -q ^$PACKAGE$'\t' $dep_db; then
   1.110 +					check_for_missing && echo $PACKAGE >> $tmp/dep
   1.111 +				else
   1.112 +					echo $PACKAGE >> $tmp/dep
   1.113 +				fi
   1.114 +			}
   1.115 +			check_db_status=yes
   1.116 +			unset plan_check_for_missing
   1.117 +		fi
   1.118  	fi
   1.119  	
   1.120  	[ "$with_dev" ] && filter=with_dev
   1.121 @@ -1512,6 +1532,14 @@
   1.122  		cat $tmp/dep | sort -u
   1.123  	fi
   1.124  	rm -f $tmp/dep $tmp/list
   1.125 +	if [ "$check_db_status" ]; then
   1.126 +		[ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
   1.127 +		[ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb
   1.128 +		if [ "$plan_regen_cookorder" ]; then
   1.129 +			grep -q "^#" $PACKAGES_REPOSITORY/cookorder.txt || \
   1.130 +			sed 1i"#PlanSort" -i $PACKAGES_REPOSITORY/cookorder.txt
   1.131 +		fi
   1.132 +	fi
   1.133  }
   1.134  
   1.135  ########################################################################
   1.136 @@ -1519,6 +1547,23 @@
   1.137  # find which packages to cook.
   1.138  ########################
   1.139  
   1.140 +check_for_missing()
   1.141 +{
   1.142 +	local PACKAGE
   1.143 +	if ! check_for_pkg_in_wok; then
   1.144 +		[ "$?" = 2 ] && return 1
   1.145 +		return
   1.146 +	fi
   1.147 +	source_receipt
   1.148 +	PACKAGE=${WANTED:-$PACKAGE}
   1.149 +	update_wan_db
   1.150 +	for PACKAGE in $(look_for_rwanted) $PACKAGE; do
   1.151 +		RECEIPT=$WOK/$PACKAGE/receipt
   1.152 +		source_receipt
   1.153 +		update_dep_db
   1.154 +	done
   1.155 +}
   1.156 +
   1.157  check_for_commit()
   1.158  {
   1.159  	if ! check_for_pkg_in_wok; then