tazwok rev 204

Rework commits/cooklist handling and fixed various minor issues
author Antoine Bodin <gokhlayeh@slitaz.org>
date Mon Jan 31 02:51:00 2011 +0100 (2011-01-31)
parents e2010f105e5c
children e8e5f72760ed
files tazwok
line diff
     1.1 --- a/tazwok	Wed Jan 26 23:13:15 2011 +0100
     1.2 +++ b/tazwok	Mon Jan 31 02:51:00 2011 +0100
     1.3 @@ -102,10 +102,8 @@
     1.4  
     1.5  	# /!\ This part needs some changes.
     1.6  	# Basically, get theses files from the net if they are missing.
     1.7 -	dbtype=wok
     1.8  	dep_db=$INCOMING_REPOSITORY/wok-depends.txt
     1.9  	wan_db=$INCOMING_REPOSITORY/wok-wanted.txt
    1.10 -	target_db=$INCOMING_REPOSITORY/wok-depends.txt
    1.11  
    1.12  	# Check commons directories, create them if user is root.
    1.13  	if test $(id -u) = 0 ; then
    1.14 @@ -118,7 +116,7 @@
    1.15  	
    1.16  	# Some files are needed by tazwok in PACKAGES_REPOSITORY. Create
    1.17  	# them if they are missing.
    1.18 -	for file in broken blocked commit incoming genpkglist cooklist; do
    1.19 +	for file in broken blocked commit incoming cooklist; do
    1.20  		[ ! -f $PACKAGES_REPOSITORY/$file ] && touch $PACKAGES_REPOSITORY/$file
    1.21  	done
    1.22  	
    1.23 @@ -182,6 +180,16 @@
    1.24  	fi
    1.25  }
    1.26  
    1.27 +check_for_pkg_in_wok()
    1.28 +{
    1.29 +	[ -f $WOK/$PACKAGE/receipt ] && return
    1.30 +	if [ "$undigest" ]; then
    1.31 +		[ -f "$SLITAZ_VERSION/wok/$PACKAGE/receipt" ] && return 1
    1.32 +		grep -q ^$PACKAGE$ $SLITAZ_VERSION/packages/packages.txt && return 1
    1.33 +	fi
    1.34 +	echo "Can't find $PACKAGE in wok or mirror" >&2
    1.35 +	return 2
    1.36 +}
    1.37  
    1.38  ########################################################################
    1.39  # TAZWOK CORE FUNCTIONS
    1.40 @@ -189,6 +197,7 @@
    1.41  
    1.42  remove_src()
    1.43  {
    1.44 +	[ "$WANTED" ] && return
    1.45  	look_for_cookopt !remove_src && return
    1.46  	if [ ! -d $WOK/$PACKAGE/install ] && [ "$_pkg" ] && [ -d "$_pkg" ]; then
    1.47  		check_for_var_modification _pkg src || return
    1.48 @@ -260,10 +269,10 @@
    1.49  	fi
    1.50  }
    1.51  
    1.52 -
    1.53  # Check for build dependencies, notify user and install if specified.
    1.54  check_for_build_depends()
    1.55  {
    1.56 +	[ "$WANTED" ] && return
    1.57  	report step "Looking for build dependencies"
    1.58  
    1.59  	# Keep the list of previously installed build_depends then compare
    1.60 @@ -274,8 +283,8 @@
    1.61  	unset MISSING_PACKAGE remove_later
    1.62  	rwanted=$(look_for_rwanted)
    1.63  
    1.64 -	for pkg in $(scan $PACKAGE --look_for=bdep --with_dev | \
    1.65 -		fgrep -v -e "Don't make the command fail" $(for i in $(look_for_rwanted); do echo " -e $i"; done))
    1.66 +	for pkg in $(scan $BUILD_DEPENDS $DEPENDS --look_for=dep --with_dev --with_args | \
    1.67 +		fgrep -v $(for i in $(look_for_rwanted) $PACKAGE; do echo " -e $i"; done))
    1.68  	do
    1.69  
    1.70  		# Delay the removing of previous cook depends if they are needed
    1.71 @@ -381,17 +390,15 @@
    1.72  	else
    1.73  		_pkg=$src/_pkg
    1.74  	fi
    1.75 -	
    1.76  }
    1.77  
    1.78  # Output $VERSION-$EXTRAVERSION using packages.txt
    1.79  get_pkg_version()
    1.80  {
    1.81  	[ "$PACKAGE" ] || return
    1.82 -	grep -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
    1.83 +	grep -m1 -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
    1.84  }
    1.85  
    1.86 -
    1.87  remove_previous_tarball()
    1.88  {
    1.89  	[ "$prev_VERSION" ] || return
    1.90 @@ -406,6 +413,7 @@
    1.91  	if [ "$VERSION$EXTRAVERSION" != "$prev_VERSION" ]; then
    1.92  		rm -f $1/$PACKAGE-$prev_VERSION.tazpkg
    1.93  	fi
    1.94 +	return
    1.95  }
    1.96  
    1.97  # Check for src tarball and wget if needed.
    1.98 @@ -574,7 +582,7 @@
    1.99  	shift
   1.100  	[ -n "$1" ] || return
   1.101  	list=""
   1.102 -	
   1.103 +
   1.104  	# Filter out already processed deps
   1.105  	for i in $@; do
   1.106  		case " $ALL_DEPS" in
   1.107 @@ -607,7 +615,7 @@
   1.108  {
   1.109  	# make tazwok genpkg happy
   1.110  	mkdir $WOK/$PACKAGE/taz
   1.111 -	
   1.112 +
   1.113  	# Cook rwanted in default or specied order
   1.114  	genlist=" $(look_for_rwanted | tr '\n' ' ') "
   1.115  	for i in $(look_for_cookopt genpkg | tac); do
   1.116 @@ -618,7 +626,7 @@
   1.117  		tazwok genpkg $i --SLITAZ_VERSION=$SLITAZ_VERSION \
   1.118  			--undigest=$undigest --SLITAZ_DIR=$SLITAZ_DIR
   1.119  	done
   1.120 -	
   1.121 +
   1.122  	# Still needs tazwok genpkg for this package
   1.123  	rm -rf $WOK/$PACKAGE/taz
   1.124  }
   1.125 @@ -680,7 +688,6 @@
   1.126  # Find and strip : --strip-all (-s) or --strip-debug on static libs.
   1.127  strip_package()
   1.128  {
   1.129 -	look_for_cookopt !strip && return
   1.130  	report step "Executing strip on all files"
   1.131  	
   1.132  	# Binaries.
   1.133 @@ -806,7 +813,7 @@
   1.134  		if [ ! "$WANTED" ]; then
   1.135  			copy_generic_files
   1.136  		fi
   1.137 -		strip_package
   1.138 +		look_for_cookopt !strip || strip_package
   1.139  		py_compiled_files_remove
   1.140  	else
   1.141  		echo "No package rules to gen $PACKAGE..." >&2
   1.142 @@ -899,13 +906,13 @@
   1.143  		[ -f "fs$file" ] || continue
   1.144  		md5sum "fs$file" | sed 's/  fs/  /'
   1.145  	done < files.list > md5sum
   1.146 +	report end-step
   1.147  	UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum description.txt \
   1.148  		2> /dev/null | awk '{ sz=$1 } END { print sz }')
   1.149  	
   1.150  	# Build cpio archives. Find, cpio and gzip the fs, finish by
   1.151  	# removing the fs tree.
   1.152  	# Don't log this because compression always output error messages.
   1.153 -	report end-step
   1.154  	find fs -print | cpio -o -H newc | case "$PACKAGE-$COMPRESSION" in
   1.155  	tazpkg-lzma)	gzip > fs.cpio.gz;;
   1.156  	*-lzma)		lzma e fs.cpio.lzma -si;;
   1.157 @@ -940,14 +947,9 @@
   1.158  	echo "Size : `du -sh $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg`"
   1.159  	echo ""
   1.160  	
   1.161 -	# Remove package from broken & genpkg list if needed.
   1.162 -	if grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/broken; then
   1.163 -		sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/broken
   1.164 -		regen_cooklist=yes
   1.165 -	fi
   1.166 -	
   1.167 -	# Remove package from genpkglist.
   1.168 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/genpkglist
   1.169 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/broken
   1.170 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/commit
   1.171 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/cooklist
   1.172  }
   1.173  
   1.174  ########################################################################
   1.175 @@ -971,30 +973,24 @@
   1.176  }
   1.177  
   1.178  ########################################################################
   1.179 -# This section contains functions to generate packages/wok databases.
   1.180 +# This section contains functions to generate packages databases.
   1.181  ########################
   1.182  
   1.183 -# Generic actions in both gen-packages-db/gen-wok-db
   1.184 -gen_db()
   1.185 -{
   1.186 -	report step "Generating $dbtype database"
   1.187 -	report open-bloc
   1.188 -	report step "Removing old files"
   1.189 -	for file in $files_list; do
   1.190 -		[ -f $file ] && rm $file
   1.191 -		[ "${file##*.}" != lzma ] && touch $file
   1.192 -	done
   1.193 -	
   1.194 -	# Generate wok/packages data lists.
   1.195 -	gen_${dbtype}_db
   1.196 -	report close-bloc
   1.197 -}
   1.198  
   1.199  gen_packages_db()
   1.200  {
   1.201  	# pkg_repository can be $PACKAGES_REPOSITORY or $INCOMING_REPOSITORY.
   1.202 -	[ ! "$pkg_repository" ] && pkg_repository=$PACKAGES_REPOSITORY
   1.203 +	[ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
   1.204  	cd $pkg_repository
   1.205 +	report step "Generating packages lists: $pkg_repository"
   1.206 +	report open-bloc
   1.207 +	report step "Removing old files"
   1.208 +	for file in files.list.lzma packages.list packages.txt \
   1.209 +		packages.desc packages.equiv packages.md5; do
   1.210 +		[ -f $file ] && rm $file
   1.211 +	done
   1.212 +	touch files.list
   1.213 +	
   1.214  	packages_db_start
   1.215  	unset RECEIPT
   1.216  	report step "Reading datas from all packages"
   1.217 @@ -1003,33 +999,29 @@
   1.218  	done
   1.219  	report end-step
   1.220  	packages_db_end
   1.221 +	report close-bloc
   1.222  }
   1.223  
   1.224  update_packages_db()
   1.225  {
   1.226 -	[ ! "$pkg_repository" ] && pkg_repository=$PACKAGES_REPOSITORY
   1.227 +	[ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
   1.228  	cd $pkg_repository
   1.229 -	
   1.230 -	# If files are missing, generate the lists - not only update.
   1.231 -	dbtype=packages
   1.232 -	files_list="packages.list packages.equiv packages.md5 packages.desc packages.txt"
   1.233 -	for file in $files_list; do
   1.234 +	for file in packages.list packages.equiv packages.md5 packages.desc \
   1.235 +		packages.txt; do
   1.236  		if [ ! -f "$file" ]; then
   1.237 -			gen_db
   1.238 +			gen_packages_db
   1.239  			return
   1.240  		fi
   1.241  	done
   1.242  	if	[ -f files.list.lzma ]; then
   1.243  		lzma d files.list.lzma files.list
   1.244  	else
   1.245 -		gen_db
   1.246 +		gen_packages_db
   1.247  	fi
   1.248 +	report step "Updating packages lists: $pkg_repository"
   1.249  	packages_db_start
   1.250 -	report step "Updating packages lists"
   1.251 -	touch $tmp/pkglist
   1.252  	
   1.253  	# Look for removed/update packages.
   1.254 -	unset updated_pkg
   1.255  	for PACKAGE in $(grep ^[0-9,a-z,A-Z] packages.txt); do
   1.256  		pkg="$pkg_repository/$(grep -m1 ^$PACKAGE- packages.list).tazpkg"
   1.257  		if ! [ -f "$pkg" ]; then
   1.258 @@ -1045,6 +1037,7 @@
   1.259  		erase_package_info
   1.260  		get_packages_info
   1.261  	done
   1.262 +	unset updated_pkg
   1.263  	
   1.264  	# Look for new packages.
   1.265  	for pkg in $(echo $pkg_repository/*.tazpkg | fgrep -v '*'); do
   1.266 @@ -1163,7 +1156,8 @@
   1.267  	
   1.268  	# Dont log this because lzma always output error.
   1.269  	lzma e files.list files.list.lzma
   1.270 -	rm files.list 2>/dev/null
   1.271 +	rm -f files.list
   1.272 +	[ -f packages.equiv ] || touch packages.equiv
   1.273  }
   1.274  
   1.275  ########################################################################
   1.276 @@ -1172,33 +1166,50 @@
   1.277  
   1.278  gen_wok_db()
   1.279  {
   1.280 -	get_wok_info $(echo $WOK/*/receipt | sed -e "s~$WOK/~~g" -e "s~/receipt~~g")
   1.281 -	sort_db
   1.282 -	report close-bloc
   1.283 -}
   1.284 -
   1.285 -get_wok_info()
   1.286 -{
   1.287 -	report step "Getting datas from wok"
   1.288 +	report step "Generating wok database"
   1.289  	report open-bloc
   1.290 -	
   1.291 +	report step "Removing old files"
   1.292 +	for file in $wan_db $dep_db $PACKAGES_REPOSITORY/cookorder.txt; do
   1.293 +		[ -f $file ] && rm $file
   1.294 +	done
   1.295  	report step "Generating wok-wanted.txt"
   1.296 -	for PACKAGE in $@; do
   1.297 -		RECEIPT=$WOK/$PACKAGE/receipt
   1.298 -		source_receipt
   1.299 -		[ "$WANTED" ] || continue
   1.300 -		echo -e $PACKAGE"\t"$WANTED >> $wan_db
   1.301 -	done
   1.302 -	
   1.303 +	gen_wan_db
   1.304  	report step "Generating wok-depends.txt"
   1.305 -	for PACKAGE in $@; do
   1.306 +	for PACKAGE in $(cut -f1 -d '|' $PACKAGES_REPOSITORY/packages.desc \
   1.307 +		$INCOMING_REPOSITORY/packages.desc | sort -u); do
   1.308  		RECEIPT=$WOK/$PACKAGE/receipt
   1.309  		if [ -s $RECEIPT ]; then
   1.310  			source_receipt
   1.311  			echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db
   1.312  		fi
   1.313  	done
   1.314 -	report end-step
   1.315 +	report close-bloc
   1.316 +}
   1.317 +
   1.318 +gen_wan_db()
   1.319 +{
   1.320 +	for RECEIPT in $(fgrep -l WANTED $WOK/*/receipt); do
   1.321 +		WANTED=
   1.322 +		source $RECEIPT
   1.323 +		[ "$WANTED" ] || continue
   1.324 +		echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db
   1.325 +	done
   1.326 +	if [ "$(diff -q $tmp/wan_db $wan_db)" ]; then
   1.327 +		mv -f $tmp/wan_db $wan_db
   1.328 +		plan_regen_cookorder=yes
   1.329 +	else
   1.330 +		rm $tmp/wan_db
   1.331 +	fi
   1.332 +}
   1.333 +
   1.334 +update_dep_db()
   1.335 +{
   1.336 +	dep_info=$(echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ')
   1.337 +	[ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db)" ] && return
   1.338 +	sed "/^$PACKAGE\t/d" -i $dep_db
   1.339 +	echo "$dep_info" >> $dep_db
   1.340 +	plan_regen_cookorder=yes
   1.341 +	plan_sort_depdb=yes
   1.342  }
   1.343  
   1.344  sort_db()
   1.345 @@ -1251,6 +1262,7 @@
   1.346  	done
   1.347  
   1.348  	tac $tmp/cookorder >> $PACKAGES_REPOSITORY/cookorder.txt
   1.349 +	unset plan_regen_cookorder
   1.350  	report end-step
   1.351  }
   1.352  
   1.353 @@ -1273,13 +1285,6 @@
   1.354  
   1.355  look_for_bdep()
   1.356  {
   1.357 -#	if [ "$undigest" ] && [ ! -f "$WOK/$PACKAGE/receipt" ]; then
   1.358 -#		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt \
   1.359 -#		| cut -f 3
   1.360 -#	else
   1.361 -#		grep ^$PACKAGE$'\t' $INCOMING_REPOSITORY/wok-depends.txt | \
   1.362 -#			cut -f 3
   1.363 -#	fi
   1.364  	look_for_all
   1.365  }
   1.366  
   1.367 @@ -1294,23 +1299,6 @@
   1.368  	fi
   1.369  }
   1.370  
   1.371 -filter()
   1.372 -{
   1.373 -	for pkg in $(cat); do
   1.374 -		if grep -q ^$pkg$'\t' $dep_db; then
   1.375 -			{ grep ^$pkg$'\t' $wan_db || echo $pkg
   1.376 -			} | sed 's/\t/ /'
   1.377 -		else
   1.378 -			echo "Error: $pkg can't be found." >&2
   1.379 -		fi
   1.380 -	done
   1.381 -}
   1.382 -
   1.383 -look_for_all_filtered()
   1.384 -{
   1.385 -	look_for_all | filter
   1.386 -}
   1.387 -
   1.388  look_for_rdep()
   1.389  {
   1.390  	fgrep ' '$PACKAGE' ' $INCOMING_REPOSITORY/wok-depends.txt | cut -f 1
   1.391 @@ -1383,21 +1371,14 @@
   1.392  	if [ "$COMMAND" = gen-cooklist ] || [ "$COMMAND" = build-depends ]; then
   1.393  		report(){ : ; }
   1.394  	fi
   1.395 -	
   1.396 -	# Generate wok data files if they're missing. Output message in
   1.397 -	# stderr as stdout output may be used as packages list.
   1.398 -	if [ ! -s "$wan_db" ] || [ ! -s "$dep_db" ]; then
   1.399 -		echo "Missing wok data files, generating them... This may take few minutes." >&2
   1.400 -		gen_wok_db
   1.401 -	fi
   1.402 -	
   1.403 +
   1.404  	# Get packages in argument.
   1.405  	local PACKAGE pkg_list=
   1.406  	for arg in $@; do
   1.407  		[ "$arg" = "${arg#--}" ] || continue
   1.408  		pkg_list="$pkg_list $arg"
   1.409  	done
   1.410 -	
   1.411 +
   1.412  	# Get options.
   1.413  	[ "$pkg_list" ] || return
   1.414  	local cooklist= look_for= with_dev= with_wanted= with_args= log_command="$0 $@" \
   1.415 @@ -1407,72 +1388,85 @@
   1.416  	# Cooklist is a special case where we need to modify a little
   1.417  	# scan behavior
   1.418  	if [ "$cooklist" ]; then
   1.419 -		look_for=all_filtered && with_args=yes && with_dev= && with_wanted= && rwan=yes
   1.420 -		pkg_list=$(echo $pkg_list | filter)
   1.421 +		gen_wan_db
   1.422 +		look_for=all && with_args=yes && with_dev= && with_wanted=
   1.423 +		filter=use_wanted
   1.424 +		append_to_dep()
   1.425 +		{
   1.426 +			check_for_commit && echo $PACKAGE >> $tmp/dep
   1.427 +		}
   1.428 +	else
   1.429 +		append_to_dep()
   1.430 +		{
   1.431 +			echo $PACKAGE >> $tmp/dep
   1.432 +		}
   1.433  	fi
   1.434 +
   1.435 +	[ "$with_dev" ] && filter=with_dev
   1.436 +	[ "$with_wanted" ] && filter=with_wanted
   1.437  	
   1.438  	##############################################################
   1.439  	# ADD TO LISTS PROPOSAL ######################################
   1.440  	##############################################################
   1.441  	#
   1.442 -	include_wanted()
   1.443 +	with_dev()
   1.444  	{
   1.445 -		for pkg in $(cat); do
   1.446 -			{ grep ^$pkg$'\t' $wan_db || echo $pkg
   1.447 -			} | sed 's/\t/ /'
   1.448 +		for PACKAGE in $(cat); do
   1.449 +			echo $PACKAGE
   1.450 +			look_for_dev
   1.451 +		done
   1.452 +	}
   1.453 +
   1.454 +	with_wanted()
   1.455 +	{
   1.456 +		for PACKAGE in $(cat); do
   1.457 +			echo $PACKAGE
   1.458 +			look_for_wanted
   1.459  		done
   1.460  	}
   1.461  	
   1.462 -	no_duplication()
   1.463 +	use_wanted()
   1.464  	{
   1.465 -		for pkg in $(cat); do
   1.466 -			grep -q ^$pkg$ $tmp/list $tmp/dep && continue
   1.467 -			echo $pkg
   1.468 -		done
   1.469 +	for PACKAGE in $(cat); do
   1.470 +		{ grep ^$PACKAGE$'\t' $wan_db || echo $PACKAGE
   1.471 +		} | sed 's/.*\t//'
   1.472 +	done
   1.473  	}
   1.474 -		
   1.475 -	append_to_list()
   1.476 -	{
   1.477 -		no_duplication  >> $tmp/list
   1.478 -		# OU
   1.479 -		include_wanted | no_duplication >> $tmp/list
   1.480 -	}
   1.481 -	#
   1.482 -	##############################################################
   1.483 -	for PACKAGE in $(echo $pkg_list | filter); do
   1.484 -		look_for_$look_for
   1.485 +	
   1.486 +	if [ "$filter" ]; then
   1.487 +		pkg_list=$(echo $pkg_list | $filter)
   1.488 +		scan_pkg()
   1.489 +		{
   1.490 +			look_for_$look_for | $filter
   1.491 +		}
   1.492 +	else
   1.493 +		scan_pkg()
   1.494 +		{
   1.495 +			look_for_$look_for
   1.496 +		}
   1.497 +	fi
   1.498 +	
   1.499 +	for PACKAGE in $pkg_list; do
   1.500 +		[ "$with_args" ] && append_to_dep
   1.501 +		scan_pkg		
   1.502  	done  | tr ' ' '\n' | sort -u > $tmp/list
   1.503  	[ "$look_for" = bdep ] && look_for=dep
   1.504  	while [ -s $tmp/list ]; do
   1.505  		PACKAGE=$(sed 1!d $tmp/list)
   1.506  		sed 1d -i $tmp/list
   1.507 -		echo $PACKAGE >> $tmp/dep
   1.508 -		for depend in $(look_for_$look_for); do
   1.509 -			if ! grep -q ^$depend$ $tmp/list $tmp/dep; then
   1.510 -				echo $depend >> $tmp/list
   1.511 +		append_to_dep
   1.512 +		for pkg in $(scan_pkg); do
   1.513 +			if ! grep -q ^$pkg$ $tmp/list $tmp/dep; then
   1.514 +				echo $pkg >> $tmp/list
   1.515  			fi
   1.516  		done
   1.517  	done
   1.518 -	[ "$with_args" ] && echo $pkg_list | tr ' ' '\n' >> $tmp/dep
   1.519 -	if [ -s $tmp/dep ]; then
   1.520 -		if [ "$with_wanted" ]; then
   1.521 -			cat $tmp/dep | while read PACKAGE; do
   1.522 -				look_for_rwanted >> $tmp/dep
   1.523 -			done
   1.524 -		elif [ "$with_dev" ]; then
   1.525 -			cat $tmp/dep | while read PACKAGE; do
   1.526 -				look_for_dev >> $tmp/dep
   1.527 -			done
   1.528 -		fi
   1.529 -		if [ "$cooklist" ]; then
   1.530 -			mv $tmp/dep $tmp/cooklist
   1.531 -			sort_cooklist
   1.532 -			rm $tmp/cooklist
   1.533 -		else
   1.534 -			cat $tmp/dep | sort -u
   1.535 -		fi
   1.536 +	if [ "$cooklist" ]; then
   1.537 +		mv $tmp/dep $tmp/cooklist
   1.538 +	else	
   1.539 +		cat $tmp/dep | sort -u
   1.540  	fi
   1.541 -	rm $tmp/dep $tmp/list 2>/dev/null
   1.542 +	rm -f $tmp/dep $tmp/list
   1.543  }
   1.544  
   1.545  ########################################################################
   1.546 @@ -1480,32 +1474,22 @@
   1.547  # find which packages to cook.
   1.548  ########################
   1.549  
   1.550 -# Actually its becomes more than check commit... Maybe put this in report
   1.551 -# function is a good idea.
   1.552  check_for_commit()
   1.553  {
   1.554 -	report step "Checking for commits"
   1.555 -	
   1.556 -	# Clean the list... Later we will perfom a partial clean only to keep
   1.557 -	# some usefull informations
   1.558 -	rm $PACKAGES_REPOSITORY/commit 2>/dev/null
   1.559 -	
   1.560 -	# If there's a packages-incoming repository we need to check it too.
   1.561 -	for RECEIPT in $(echo $WOK/*/receipt | fgrep -v '*'); do
   1.562 +	if ! check_for_pkg_in_wok; then
   1.563 +		[ "$?" = 2 ] && return 1
   1.564 +		return
   1.565 +	fi
   1.566 +	for PACKAGE in $(look_for_rwanted) $PACKAGE; do
   1.567 +		RECEIPT=$WOK/$PACKAGE/receipt
   1.568  		source_receipt
   1.569 -	
   1.570 +
   1.571  		# We use md5 of cooking stuff in the packaged receipt to check
   1.572  		# commit. We look consecutively in 3 different locations :
   1.573 -		# - in the wok/PACKAGE/taz folder
   1.574 +		# - in the wok/PACKAGE/taz/* folder
   1.575  		# - in the receipt in the package in incoming repository
   1.576  		# - in the receipt in the package in packages repository
   1.577  		# If md5sum match, there's no commit.
   1.578 -		# If there's not md5sum datas, because the package was cooked
   1.579 -		# with a previous version of tazwok, we don't put in in commit
   1.580 -		# list (need a cook-all to refresh them)
   1.581 -		# If there's no receipt available, package is missing so we put
   1.582 -		# it in commit list.
   1.583 -		# First look for package in packages-incoming.
   1.584  		check_for_commit_using_md5sum()
   1.585  		{
   1.586  			if [ ! -f $WOK/$PACKAGE/md5 ]; then
   1.587 @@ -1513,16 +1497,16 @@
   1.588  					sed -e 1d -e 's/^# //' > $WOK/$PACKAGE/md5
   1.589  				cd $WOK/$PACKAGE
   1.590  			fi
   1.591 -	
   1.592 -			# Use md5sum list in receipt to check for commit.
   1.593 +		
   1.594  			if [ -s md5 ]; then					
   1.595  				if md5sum -cs md5; then
   1.596 -					return_code=0
   1.597 -	
   1.598 -					# If md5sum check if ok, check for new files in
   1.599 -					# cooking stuff.
   1.600 -					for file in receipt description.txt $( [ -d stuff ] && find stuff); do
   1.601 -						if [ -f $file ] && ! fgrep -q "  $file" md5; then
   1.602 +		
   1.603 +				# If md5sum check if ok, check for new/missing files in
   1.604 +				# cooking stuff.
   1.605 +				for file in $([ -f receipt ] && echo receipt; \
   1.606 +						[ -f description.txt ] && echo description.txt; \
   1.607 +						[ -d stuff ] && find stuff); do
   1.608 +						if ! fgrep -q "  $file" md5; then
   1.609  							set_commited
   1.610  						fi
   1.611  					done
   1.612 @@ -1530,14 +1514,15 @@
   1.613  					set_commited
   1.614  				fi
   1.615  			else
   1.616 -				gen_cookmd5
   1.617 +				set_commited
   1.618  			fi
   1.619  		}
   1.620  		set_commited()
   1.621  		{
   1.622 -			echo $PACKAGE >> $PACKAGES_REPOSITORY/commit
   1.623 -			echo "Commit: $PACKAGE ($VERSION)"
   1.624 +			! grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/commit &&
   1.625 +				echo $PACKAGE >> $PACKAGES_REPOSITORY/commit
   1.626  			gen_cookmd5
   1.627 +			update_dep_db
   1.628  		}
   1.629  		taz_dir=$(echo $WOK/$PACKAGE/taz/$PACKAGE-* | fgrep -v '*')
   1.630  		if [ -f $WOK/$PACKAGE/md5 ]; then
   1.631 @@ -1553,135 +1538,143 @@
   1.632  				get_pkg_files $pkg
   1.633  				check_for_commit_using_md5sum
   1.634  				rm -r $pkg_files_dir
   1.635 -				continue
   1.636 +			else
   1.637 +				set_commited
   1.638  			fi
   1.639 -			set_commited
   1.640  		fi
   1.641 +	[ "$forced" ] || echo $PACKAGE >> $tmp/checked
   1.642  	done
   1.643 -	report end-step
   1.644 +	return
   1.645  }
   1.646  
   1.647  gen_cook_list()
   1.648  {
   1.649 +	report step "Scanning wok"
   1.650 +	if [ "$pkg" ]; then
   1.651 +		scan $pkg --cooklist
   1.652 +	else
   1.653 +		scan `cat $cooklist` --cooklist
   1.654 +	fi
   1.655 +	report end-step
   1.656 +	[ -s $tmp/checked ] || return
   1.657  	if [ -s $PACKAGES_REPOSITORY/commit ]; then
   1.658 -		report step "Generate genpkg & cook lists."
   1.659  		cd $PACKAGES_REPOSITORY
   1.660 -		#cp commit $tmp/commit
   1.661 -		#if [ -s broken ]; then	
   1.662 -			## dep_scan return deps including the packages given in argument.
   1.663 -			## To avoid that, we firt generate a list of direct rdepends of
   1.664 -			## brokens without packages in argument, then we generate the
   1.665 -			## full rdeps list. We do this because we don't want to block
   1.666 -			## packages at source of broken tree if a fix as been commited.
   1.667 -			#for PACKAGE in $(cat broken); do
   1.668 -				#look_for_rdep >> $tmp/broken
   1.669 -			#done
   1.670 -			#cat $tmp/broken
   1.671 -			#look_for=rdep && with_wanted=yes
   1.672 -			#for PACKAGE in $(dep_scan `cat $tmp/broken`); do
   1.673 -				#if grep -q ^$PACKAGE$ $tmp/commit; then
   1.674 -					#sed "/^$PACKAGE$/d" -i $tmp/commit
   1.675 -				#fi
   1.676 -			#done
   1.677 -			#rm $tmp/broken
   1.678 -		#fi
   1.679  		for PACKAGE in $(cat commit); do
   1.680  			WANTED="$(look_for_wanted)"
   1.681  			if [ "$WANTED" ]; then
   1.682 -
   1.683 -				# If cook of wanted package is planned, this one will be
   1.684 -				# packaged at the same time. Else if wanted package is
   1.685 -				# broken or blocked, ignore the commit. Else, put the
   1.686 -				# package in genpkglist.
   1.687 -				{ grep -q ^$WANTED$ commit || grep -q ^$WANTED$ broken || \
   1.688 -					grep -q ^$WANTED$ cooklist || grep -q ^$WANTED$ blocked || \
   1.689 -					grep -q ^$WANTED$ genpkglist
   1.690 -				} && continue
   1.691 -				echo $WANTED >> genpkglist
   1.692 -			else
   1.693 -				{ grep -q ^$PACKAGE$ blocked || grep -q ^$PACKAGE$ cooklist 
   1.694 -				} && continue
   1.695 -				echo $PACKAGE >> cooklist
   1.696 -				sed "/^$PACKAGE$/d" -i broken
   1.697 +				grep -q ^$WANTED$ broken cooklist blocked commit && continue
   1.698  			fi
   1.699 +			grep -q ^$PACKAGE$ blocked cooklist && continue
   1.700 +			echo $PACKAGE >> cooklist
   1.701  		done
   1.702 -		#rm $tmp/commit
   1.703 -		if [ -s genpkglist ]; then
   1.704 -			echo "genpkglist:"
   1.705 -			cat genpkglist
   1.706 -		fi
   1.707 -		report end-step
   1.708  	fi
   1.709 -	cooklist=$PACKAGES_REPOSITORY/cooklist
   1.710 +	[ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
   1.711 +	[ "$plan_regen_cookorder" ] && sort_db
   1.712 +	[ -s $PACKAGES_REPOSITORY/cooklist ] || return
   1.713 +	
   1.714 +	# Core toolchain should not be cooked unless cook-toolchain is used.
   1.715 +	if ! [ -f /etc/config.site.tmptoolchain ] ; then
   1.716 +		for PACKAGE in $(scan gcc --look_for=all --with_args --with_wanted); do
   1.717 +			[ -f $tmp/cooklist ] && sed "/^$PACKAGE/d" -i $tmp/cooklist
   1.718 +			[ -f $tmp/checked ] && sed "/^$PACKAGE/d" -i $tmp/checked
   1.719 +			grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/blocked || \
   1.720 +				echo $PACKAGE >> $PACKAGES_REPOSITORY/blocked
   1.721 +		done
   1.722 +	fi
   1.723  	sort_cooklist
   1.724  }
   1.725  
   1.726  sort_cooklist()
   1.727  {
   1.728 -	[ ! "$cooklist" ] && cooklist=$PACKAGES_REPOSITORY/cooklist
   1.729 -	[ -s $cooklist ] || [ -s "$tmp/cooklist" ] || return
   1.730 -	[ -s $PACKAGES_REPOSITORY/cookorder.txt ] || gen_wok_db
   1.731 -	[ ! -s "$tmp/cooklist" ] && cp -a $cooklist $tmp/cooklist
   1.732 +	
   1.733 +	if [ -f "$tmp/checked" ]; then
   1.734 +		rm -f $tmp/cooklist
   1.735 +		cat $tmp/checked | while read PACKAGE; do
   1.736 +			grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/cooklist && \
   1.737 +				echo $PACKAGE >> $tmp/cooklist
   1.738 +		done
   1.739 +	fi
   1.740 +	
   1.741 +	[ -s $tmp/cooklist ] || return
   1.742  	report step "Sorting cooklist"
   1.743 -
   1.744 -	# Use cookorder.txt to sort cooklist.
   1.745 -	cat $PACKAGES_REPOSITORY/cookorder.txt | while read PACKAGE; do
   1.746 -		if grep -q ^$PACKAGE$ $tmp/cooklist; then
   1.747 +	for PACKAGE in $(cat $tmp/cooklist); do
   1.748 +		WANTED="$(look_for_wanted)"
   1.749 +		[ "$WANTED" ] || continue
   1.750 +		if grep -q ^$WANTED$ $PACKAGES_REPOSITORY/broken $tmp/cooklist.tmp; then		
   1.751  			sed "/^$PACKAGE$/d" -i $tmp/cooklist
   1.752 -			echo $PACKAGE >> $tmp/cooklist.tmp
   1.753 +		elif [ ! -d $WOK/$WANTED/install ]; then
   1.754 +			sed "/^$PACKAGE$/d" -i $tmp/cooklist
   1.755 +			echo $WANTED >> $tmp/cooklist
   1.756  		fi
   1.757  	done
   1.758  
   1.759 -	# Remaining packages in cooklist are thoses without compile_rules.
   1.760 -	# They can be cooked first in any order.
   1.761 -	mv -f $tmp/cooklist.tmp $tmp/cooklist
   1.762 -	[ "$cooklist" = "$PACKAGES_REPOSITORY/cooklist" ] && \
   1.763 -		cat $tmp/cooklist > $cooklist
   1.764 -	cat $tmp/cooklist
   1.765 +	# Use cookorder.txt to sort cooklist.
   1.766 +	if [ -s $tmp/cooklist ]; then
   1.767 +		cat $PACKAGES_REPOSITORY/cookorder.txt | while read PACKAGE; do
   1.768 +			if grep -q ^$PACKAGE$ $tmp/cooklist; then
   1.769 +				sed "/^$PACKAGE$/d" -i $tmp/cooklist
   1.770 +				echo $PACKAGE >> $tmp/cooklist.tmp
   1.771 +			fi
   1.772 +		done
   1.773 +
   1.774 +		# Remaining packages in cooklist are thoses without compile_rules.
   1.775 +		# They can be cooked first in any order.
   1.776 +		if [ -f $tmp/cooklist.tmp ]; then
   1.777 +			cat $tmp/cooklist.tmp >> $tmp/cooklist
   1.778 +			rm $tmp/cooklist.tmp
   1.779 +		fi
   1.780 +		
   1.781 +		cat $tmp/cooklist
   1.782 +		[ "$cooklist" = "$PACKAGES_REPOSITORY/cooklist" ] && \
   1.783 +			cat $tmp/cooklist > $cooklist
   1.784 +	fi
   1.785 +	
   1.786  	report end-step
   1.787  }
   1.788  
   1.789  check_for_incoming()
   1.790  {
   1.791 -	[ -s $INCOMING_REPOSITORY/packages.txt ] || return
   1.792 -	report step "Checking packages-incoming repository"
   1.793 -	cd $INCOMING_REPOSITORY
   1.794 -	grep ^[0-9,a-z,A-Z] packages.txt > $tmp/incoming
   1.795 -	scan `cat $PACKAGES_REPOSITORY/broken` --look_for=bdep --with_wanted > $tmp/broken
   1.796 -	for PACKAGE in $(scan `cat $tmp/broken` --look_for=rdep --with_wanted --with_args); do
   1.797 -		sed "/^$PACKAGE$/d" -i $tmp/incoming
   1.798 -		for rwanted in $(look_for_rwanted); do
   1.799 -			sed "/^$rwanted$/d" -i $tmp/incoming
   1.800 -		done
   1.801 -	done
   1.802 -	rm $tmp/broken
   1.803 -	if [ "$incoming_delay" != 0 ]; then
   1.804 -		cat $tmp/incoming | while read PACKAGE; do
   1.805 -			[ "$(grep ^$PACKAGE$ $tmp/incoming)" ] || continue
   1.806 -			dep_list=$( { scan $PACKAGE --look_for=bdep --with_wanted && \
   1.807 -				scan $PACKAGE --look_for=rdep --with_wanted --with_args; } \
   1.808 -				| sort -u )
   1.809 -			for dep in $dep_list; do
   1.810 -				[ "$(find -name "`get_pkg_version $INCOMING_REPOSITORY`.tazpkg" -mtime +$incoming_delay)" ] && continue
   1.811 -				for pkg in $dep_list; do
   1.812 -					sed "/^$pkg$/d" -i $tmp/incoming
   1.813 -				done && break
   1.814 -			done
   1.815 -		done
   1.816 +	[ -s $INCOMING_REPOSITORY/packages.desc ] || {
   1.817 +	echo "No packages in $INCOMING_REPOSITORY."
   1.818 +	return; }
   1.819 +	if [ -s $PACKAGES_REPOSITORY/broken ]; then
   1.820 +		echo "Don't move incoming packages to main repository because theses ones are broken:
   1.821 +		$(cat $PACKAGES_REPOSITORY/broken)" >&2
   1.822 +		return
   1.823  	fi
   1.824 -	if [ -s "$tmp/incoming" ]; then
   1.825 -		for PACKAGE in $(cat $tmp/incoming); do
   1.826 +	if [ -s $PACKAGES_REPOSITORY/cooklist ]; then
   1.827 +		echo "Don't move incoming packages to main repository because some of them need to be cooked:
   1.828 +		$(cat $PACKAGES_REPOSITORY/cooklist)" >&2
   1.829 +		return
   1.830 +	fi
   1.831 +	rm -f $WOK/*/md5
   1.832 +	pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
   1.833 +		grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
   1.834 +		} | sort -u)"
   1.835 +	cooklist=$PACKAGES_REPOSITORY/cooklist
   1.836 +	gen_cook_list
   1.837 +	if [ -s $PACKAGES_REPOSITORY/cooklist ]; then
   1.838 +		echo "Don't move incoming packages to main repository because some of them need to be cooked." >&2
   1.839 +		return
   1.840 +	fi
   1.841 +	report step "Moving incoming packages to main repository"
   1.842 +	unset EXTRAVERSION
   1.843 +	for PACKAGE in $(cut -f 1 -d '|' $INCOMING_REPOSITORY/packages.desc); do
   1.844  			prev_VERSION=$(get_pkg_version $PACKAGES_REPOSITORY)
   1.845 +			VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
   1.846  			remove_previous_package $PACKAGES_REPOSITORY
   1.847  			remove_previous_tarball
   1.848 -			cur_VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
   1.849 -			mv -f $PACKAGE-$cur_VERSION.tazpkg $PACKAGES_REPOSITORY
   1.850 -			echo "Moving $PACKAGE to main repository."
   1.851 -		done
   1.852 -	pkg_repository=$INCOMING_REPOSITORY && update_packages_db
   1.853 +			echo "Moving $PACKAGE..."
   1.854 +			mv -f $INCOMING_REPOSITORY/$PACKAGE-$VERSION.tazpkg $PACKAGES_REPOSITORY
   1.855 +			touch $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg
   1.856 +	done
   1.857 +	report end-step
   1.858 +	for file in packages.list packages.equiv packages.md5 packages.desc \
   1.859 +		packages.txt; do
   1.860 +		echo -n "" > $INCOMING_REPOSITORY/$file
   1.861 +	done
   1.862 +	rm -r $INCOMING_REPOSITORY/files.list.lzma
   1.863  	pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
   1.864 -	fi
   1.865 -	report end-step
   1.866  }
   1.867  
   1.868  ########################################################################
   1.869 @@ -1750,12 +1743,7 @@
   1.870  	report step "Cooking $PACKAGE"
   1.871  	report open-bloc
   1.872  
   1.873 -	# Clean package if needed.
   1.874  	clean $PACKAGE
   1.875 -
   1.876 -	# Remove PACKAGE from commit & cook lists.
   1.877 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/commit
   1.878 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/cooklist
   1.879  	[ -s $tmp/cooklist ] && sed "/^$PACKAGE$/d" -i $tmp/cooklist
   1.880  	
   1.881  	if compile_package; then
   1.882 @@ -1821,33 +1809,26 @@
   1.883  	return $cook_code
   1.884  }
   1.885  
   1.886 -genpkg_list()
   1.887 -{
   1.888 -	while [ -s $PACKAGES_REPOSITORY/genpkglist ]; do
   1.889 -		PACKAGE=$(sed 1!d $PACKAGES_REPOSITORY/genpkglist)
   1.890 -		gen_package
   1.891 -	done
   1.892 -}
   1.893 -
   1.894  cook_list()
   1.895  {
   1.896 -	if [ ! -s $cooklist ]; then
   1.897 +	if [ -s $tmp/cooklist ]; then
   1.898 +		if [ -f /usr/bin/tazchroot ]; then
   1.899 +			# Note : options -main variables- are automatically keeped by
   1.900 +			# the sub-applications tazchroot/tazwok; as well as report data.
   1.901 +			cd $LOCAL_REPOSITORY
   1.902 +			[ ! -f tazchroot.conf ] && configure_tazchroot
   1.903 +			tazchroot tazwok cook-list --SLITAZ_DIR=$SLITAZ_DIR --SLITAZ_VERSION=$SLITAZ_VERSION ${undigest:+ --undigest=$undigest}
   1.904 +			return
   1.905 +		fi
   1.906 +		while [ -s $tmp/cooklist ]; do
   1.907 +			PACKAGE=$(sed 1!d $tmp/cooklist)
   1.908 +			cook
   1.909 +		done
   1.910 +		remove_build_depends $MISSING_PACKAGE $remove_later
   1.911 +	else
   1.912  		echo "Nothing to cook."
   1.913  		return
   1.914  	fi
   1.915 -	if [ -f /usr/bin/tazchroot ]; then
   1.916 -		# Note : options -main variables- are automatically keeped by
   1.917 -		# the sub-applications tazchroot/tazwok; as well as report data.
   1.918 -		cd $LOCAL_REPOSITORY
   1.919 -		[ ! -f tazchroot.conf ] && configure_tazchroot
   1.920 -		tazchroot tazwok cook-list --SLITAZ_DIR=$SLITAZ_DIR --SLITAZ_VERSION=$SLITAZ_VERSION ${undigest:+ --undigest=$undigest}
   1.921 -		return
   1.922 -	fi
   1.923 -	while [ -s $tmp/cooklist ]; do
   1.924 -		PACKAGE=$(sed 1!d $tmp/cooklist)
   1.925 -		cook
   1.926 -	done
   1.927 -	remove_build_depends $MISSING_PACKAGE $remove_later
   1.928  }
   1.929  
   1.930  configure_tazchroot()
   1.931 @@ -1977,22 +1958,14 @@
   1.932  		fi
   1.933  	;;
   1.934  	gen-cooklist)
   1.935 -		get_options_list="list"
   1.936 +		get_options_list="pkg"
   1.937  		get_tazwok_config
   1.938 -		if [ "$list" ]; then
   1.939 -			LIST="$list"
   1.940 -			check_for_list
   1.941 -		else
   1.942 -			LIST=$(for pkg in $@; do
   1.943 -				[ "$pkg" = "${pkg#--}" ] || continue
   1.944 -				echo -n "$pkg "
   1.945 -			done)
   1.946 -			if [ ! "$LIST" ]; then
   1.947 -				echo "Please give packages or a list file in argument." >&2
   1.948 -				exit
   1.949 -			fi
   1.950 +		check_root
   1.951 +		if ! [ "$pkg" ]; then
   1.952 +			cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   1.953  		fi
   1.954 -		scan $LIST --cooklist
   1.955 +		forced=yes
   1.956 +		gen_cook_list
   1.957  	;;
   1.958  	check-depends)
   1.959  		# Check package depends /!\ 
   1.960 @@ -2311,19 +2284,16 @@
   1.961  		cp -af $tmp/cooklist $cooklist
   1.962  	;;
   1.963  	cook-list)
   1.964 -		# Cook all packages listed in a file. The path to the cooklist must
   1.965 -		# be specified on the cmdline.
   1.966 -		# /!\ 
   1.967 +		# Cook all packages listed in a file or in default cooklist.
   1.968  		check_root
   1.969 +		get_options_list="pkg forced"
   1.970  		get_tazwok_config
   1.971  		source_lib report
   1.972  		report start
   1.973 -		cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   1.974 -		if [ "$LIST" ]; then
   1.975 -			sort_cooklist
   1.976 -		else
   1.977 -			cp $cooklist $tmp/cooklist
   1.978 +		if ! [ "$pkg" ]; then
   1.979 +			cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   1.980  		fi
   1.981 +		gen_cook_list
   1.982  		cook_list
   1.983  	;;
   1.984  	clean)
   1.985 @@ -2385,54 +2355,47 @@
   1.986  		echo "`ls -1 $WOK | wc -l` packages cleaned."
   1.987  	;;
   1.988  	gen-list)
   1.989 -		check_root
   1.990  		get_tazwok_config
   1.991 +		if [ "$2" ]; then
   1.992 +			if [ -d "$2" ]; then
   1.993 +				pkg_repository=$2
   1.994 +			else
   1.995 +				echo -e "\nUnable to find directory : $2\n" >&2
   1.996 +				exit 1
   1.997 +			fi
   1.998 +		fi
   1.999 +				
  1.1000  		source_lib report
  1.1001  		report start
  1.1002 -		dbtype=packages
  1.1003 -		mode=gen
  1.1004 -		for pkg_repository in $PACKAGES_REPOSITORY $INCOMING_REPOSITORY; do
  1.1005 -			files_list="$pkg_repository/files.list.lzma \
  1.1006 -				$pkg_repository/packages.list \
  1.1007 -				$pkg_repository/packages.txt \
  1.1008 -				$pkg_repository/packages.desc \
  1.1009 -				$pkg_repository/packages.equiv \
  1.1010 -				$pkg_repository/packages.md5"
  1.1011 -			gen_db
  1.1012 -			echo "$pkgs packages in the repository."
  1.1013 -			echo ""
  1.1014 -		done
  1.1015 +		if [ "$pkg_repository" ]; then
  1.1016 +			gen_packages_db
  1.1017 +		else
  1.1018 +			pkg_repository=$PACKAGES_REPOSITORY && gen_packages_db
  1.1019 +			pkg_repository=$INCOMING_REPOSITORY && gen_packages_db
  1.1020 +		fi
  1.1021  	;;
  1.1022  	check-list)
  1.1023  		# The directory to move into by default is the repository,
  1.1024  		# if $2 is not empty cd into $2.
  1.1025  		#
  1.1026  		get_tazwok_config
  1.1027 -		if [ -z "$2" ]; then
  1.1028 -			PACKAGES_REPOSITORY=$PACKAGES_REPOSITORY
  1.1029 -		else
  1.1030 +		if [ "$2" ]; then
  1.1031  			if [ -d "$2" ]; then
  1.1032 -				PACKAGES_REPOSITORY=$2
  1.1033 +				pkg_repository=$2
  1.1034  			else
  1.1035  				echo -e "\nUnable to find directory : $2\n" >&2
  1.1036  				exit 1
  1.1037  			fi
  1.1038  		fi
  1.1039  		
  1.1040 -		# Use report shared library to control output.
  1.1041 -		tmp=/tmp/tazwok-$$
  1.1042  		source_lib report
  1.1043 -		dbtype=packages
  1.1044 -		mode=update
  1.1045 -		cd $PACKAGES_REPOSITORY
  1.1046 -		for pkg in $(echo *.tazpkg); do
  1.1047 -			package_md5=$(md5sum $pkg)
  1.1048 -			[ "$package_md5" = "$(fgrep "  $pkg" packages.md5)" ] && continue
  1.1049 -			erase_package_info
  1.1050 -			get_packages_info
  1.1051 -		done
  1.1052 -		echo "$pkgs packages in the repository."
  1.1053 -		echo ""
  1.1054 +		report start
  1.1055 +		if [ "$pkg_repository" ]; then
  1.1056 +			update_packages_db
  1.1057 +		else
  1.1058 +			pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
  1.1059 +			pkg_repository=$INCOMING_REPOSITORY && update_packages_db
  1.1060 +		fi
  1.1061  	;;
  1.1062  	new-tree)
  1.1063  		# Just create a few directories and generate an empty receipt to prepare
  1.1064 @@ -2469,12 +2432,7 @@
  1.1065  compile_rules()
  1.1066  {
  1.1067  	cd $src
  1.1068 -	./configure \
  1.1069 -		--prefix=/usr \
  1.1070 -		--infodir=/usr/share/info \
  1.1071 -		--mandir=/usr/share/man \
  1.1072 -		$CONFIGURE_ARGS &&
  1.1073 -	make -j 4 && make DESTDIR=$PWD/_pkg install
  1.1074 +	./configure && make && make install
  1.1075  }
  1.1076  
  1.1077  # Rules to gen a SliTaz package suitable for Tazpkg.
  1.1078 @@ -2630,50 +2588,62 @@
  1.1079  			echo "No tarball to download for $PACKAGE"
  1.1080  		fi
  1.1081  	;;
  1.1082 -	rec-commit)
  1.1083 +	check-commit)
  1.1084  		check_root
  1.1085 +		get_options_list="missing forced"
  1.1086  		get_tazwok_config
  1.1087  		source_lib report
  1.1088  		report start
  1.1089 -		check_for_commit
  1.1090 +		if [ "$forced" ]; then
  1.1091 +			rm -f $WOK/*/md5
  1.1092 +			unset forced
  1.1093 +		fi
  1.1094 +		if [ "$missing" ]; then
  1.1095 +			pkg=$(ls -1 $WOK)
  1.1096 +		else
  1.1097 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  1.1098 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  1.1099 +			} | sort -u)"
  1.1100 +		fi
  1.1101 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  1.1102  		gen_cook_list
  1.1103  	;;
  1.1104  	cook-commit)
  1.1105  		check_root
  1.1106 +		get_options_list="missing forced"
  1.1107  		get_tazwok_config
  1.1108  		source_lib report
  1.1109  		report start
  1.1110 -		check_for_commit
  1.1111 -		# 2) update cook-database (actually complete regeneration)
  1.1112 -		dbtype=wok
  1.1113 -		mode=gen
  1.1114 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  1.1115 -		gen_db
  1.1116 -		# 3) check cooklist
  1.1117 -		# 	3.1) rename pkgs with wanted variable to wanted pkg
  1.1118 +		if [ "$forced" ]; then
  1.1119 +			rm -f $WOK/*/md5
  1.1120 +			unset forced
  1.1121 +		fi
  1.1122 +		if [ "$missing" ]; then
  1.1123 +			pkg=$(ls -1 $WOK)
  1.1124 +		else
  1.1125 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  1.1126 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  1.1127 +			} | sort -u)"
  1.1128 +		fi
  1.1129 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  1.1130  		gen_cook_list
  1.1131  		cook_list
  1.1132  	;;
  1.1133  	cook-all)
  1.1134  		check_root
  1.1135 +		get_options_list="forced missing"
  1.1136  		get_tazwok_config
  1.1137  		source_lib report
  1.1138  		report start
  1.1139 -		# 2) update cook-database (actually complete regeneration)
  1.1140 -		dbtype=wok
  1.1141 -		mode=gen
  1.1142 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  1.1143 -		gen_db
  1.1144 -		# Add all packages, without toolchain, in cooklist.
  1.1145 -		# Recook toolchain need to be coded.
  1.1146 -		echo -n "" > $PACKAGES_REPOSITORY/cooklist
  1.1147 -		for pkg in $(cd $WOK && echo *); do
  1.1148 -			echo $pkg >> $PACKAGES_REPOSITORY/cooklist
  1.1149 -		done
  1.1150 -		for pkg in $(scan gcc --look_for=all --with_wanted --with_args); do
  1.1151 -			sed "/^$pkg$/d" -i $PACKAGES_REPOSITORY/cooklist
  1.1152 -		done
  1.1153 -		sort_cooklist
  1.1154 +		if [ "$missing" ]; then
  1.1155 +			pkg=$(ls -1 $WOK)
  1.1156 +		else
  1.1157 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  1.1158 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  1.1159 +			} | sort -u)"
  1.1160 +		fi
  1.1161 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  1.1162 +		gen_cook_list
  1.1163  		cook_list
  1.1164  	;;
  1.1165  	gen-wok-db)
  1.1166 @@ -2681,16 +2651,13 @@
  1.1167  		get_tazwok_config
  1.1168  		source_lib report
  1.1169  		report start
  1.1170 -		dbtype=wok
  1.1171 -		mode=gen
  1.1172 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  1.1173 -		gen_db
  1.1174 +		gen_wok_db
  1.1175  	;;
  1.1176  	report)
  1.1177  		check_root
  1.1178  		get_tazwok_config
  1.1179  		cd $PACKAGES_REPOSITORY
  1.1180 -		for i in commit genpkglist cooklist incoming broken blocked; do
  1.1181 +		for i in commit cooklist incoming broken blocked; do
  1.1182  			if [ -s $i ]; then
  1.1183  				echo -e "\n********************* $i *********************\n$(cat $i)\n*********************"
  1.1184  			fi
  1.1185 @@ -2752,5 +2719,4 @@
  1.1186  	;;
  1.1187  esac
  1.1188  
  1.1189 -[ -d "$tmp" ] && rm -r $tmp
  1.1190  report stop 2>/dev/null || exit 0