tazwok rev 208

Automated merge with http://repos.slitaz.org/tazwok-experimental
author Antoine Bodin <gokhlayeh@slitaz.org>
date Mon Jan 31 02:53:24 2011 +0100 (2011-01-31)
parents 59de3ae8f196 e8e5f72760ed
children 0215ceb46bce
files .hgtags
line diff
     1.1 --- a/.hgtags	Wed Jan 26 22:42:53 2011 +0000
     1.2 +++ b/.hgtags	Mon Jan 31 02:53:24 2011 +0100
     1.3 @@ -4,3 +4,4 @@
     1.4  4359e83840f9fae3b52ca83964698ce5c45a1764 0.0.3
     1.5  d07da31a635efd81efcb19e5ee620dac925d65cc 0.0.4
     1.6  3cbde35a56d91c155eba43b045cc23eeae3e44cc 0.0.4.1
     1.7 +8c233be73ba9e91086f590113e96d882a8170e79 0.0.5
     2.1 --- a/tazwok	Wed Jan 26 22:42:53 2011 +0000
     2.2 +++ b/tazwok	Mon Jan 31 02:53:24 2011 +0100
     2.3 @@ -102,10 +102,8 @@
     2.4  
     2.5  	# /!\ This part needs some changes.
     2.6  	# Basically, get theses files from the net if they are missing.
     2.7 -	dbtype=wok
     2.8  	dep_db=$INCOMING_REPOSITORY/wok-depends.txt
     2.9  	wan_db=$INCOMING_REPOSITORY/wok-wanted.txt
    2.10 -	target_db=$INCOMING_REPOSITORY/wok-depends.txt
    2.11  
    2.12  	# Check commons directories, create them if user is root.
    2.13  	if test $(id -u) = 0 ; then
    2.14 @@ -118,7 +116,7 @@
    2.15  	
    2.16  	# Some files are needed by tazwok in PACKAGES_REPOSITORY. Create
    2.17  	# them if they are missing.
    2.18 -	for file in broken blocked commit incoming genpkglist cooklist; do
    2.19 +	for file in broken blocked commit incoming cooklist; do
    2.20  		[ ! -f $PACKAGES_REPOSITORY/$file ] && touch $PACKAGES_REPOSITORY/$file
    2.21  	done
    2.22  	
    2.23 @@ -182,6 +180,16 @@
    2.24  	fi
    2.25  }
    2.26  
    2.27 +check_for_pkg_in_wok()
    2.28 +{
    2.29 +	[ -f $WOK/$PACKAGE/receipt ] && return
    2.30 +	if [ "$undigest" ]; then
    2.31 +		[ -f "$SLITAZ_VERSION/wok/$PACKAGE/receipt" ] && return 1
    2.32 +		grep -q ^$PACKAGE$ $SLITAZ_VERSION/packages/packages.txt && return 1
    2.33 +	fi
    2.34 +	echo "Can't find $PACKAGE in wok or mirror" >&2
    2.35 +	return 2
    2.36 +}
    2.37  
    2.38  ########################################################################
    2.39  # TAZWOK CORE FUNCTIONS
    2.40 @@ -189,6 +197,7 @@
    2.41  
    2.42  remove_src()
    2.43  {
    2.44 +	[ "$WANTED" ] && return
    2.45  	look_for_cookopt !remove_src && return
    2.46  	if [ ! -d $WOK/$PACKAGE/install ] && [ "$_pkg" ] && [ -d "$_pkg" ]; then
    2.47  		check_for_var_modification _pkg src || return
    2.48 @@ -260,10 +269,10 @@
    2.49  	fi
    2.50  }
    2.51  
    2.52 -
    2.53  # Check for build dependencies, notify user and install if specified.
    2.54  check_for_build_depends()
    2.55  {
    2.56 +	[ "$WANTED" ] && return
    2.57  	report step "Looking for build dependencies"
    2.58  
    2.59  	# Keep the list of previously installed build_depends then compare
    2.60 @@ -274,8 +283,8 @@
    2.61  	unset MISSING_PACKAGE remove_later
    2.62  	rwanted=$(look_for_rwanted)
    2.63  
    2.64 -	for pkg in $(scan $PACKAGE --look_for=bdep --with_dev | \
    2.65 -		fgrep -v -e "Don't make the command fail" $(for i in $(look_for_rwanted); do echo " -e $i"; done))
    2.66 +	for pkg in $(scan $BUILD_DEPENDS $DEPENDS --look_for=dep --with_dev --with_args | \
    2.67 +		fgrep -v $(for i in $(look_for_rwanted) $PACKAGE; do echo " -e $i"; done))
    2.68  	do
    2.69  
    2.70  		# Delay the removing of previous cook depends if they are needed
    2.71 @@ -381,17 +390,15 @@
    2.72  	else
    2.73  		_pkg=$src/_pkg
    2.74  	fi
    2.75 -	
    2.76  }
    2.77  
    2.78  # Output $VERSION-$EXTRAVERSION using packages.txt
    2.79  get_pkg_version()
    2.80  {
    2.81  	[ "$PACKAGE" ] || return
    2.82 -	grep -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
    2.83 +	grep -m1 -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
    2.84  }
    2.85  
    2.86 -
    2.87  remove_previous_tarball()
    2.88  {
    2.89  	[ "$prev_VERSION" ] || return
    2.90 @@ -406,6 +413,7 @@
    2.91  	if [ "$VERSION$EXTRAVERSION" != "$prev_VERSION" ]; then
    2.92  		rm -f $1/$PACKAGE-$prev_VERSION.tazpkg
    2.93  	fi
    2.94 +	return
    2.95  }
    2.96  
    2.97  # Check for src tarball and wget if needed.
    2.98 @@ -574,7 +582,7 @@
    2.99  	shift
   2.100  	[ -n "$1" ] || return
   2.101  	list=""
   2.102 -	
   2.103 +
   2.104  	# Filter out already processed deps
   2.105  	for i in $@; do
   2.106  		case " $ALL_DEPS" in
   2.107 @@ -607,7 +615,7 @@
   2.108  {
   2.109  	# make tazwok genpkg happy
   2.110  	mkdir $WOK/$PACKAGE/taz
   2.111 -	
   2.112 +
   2.113  	# Cook rwanted in default or specied order
   2.114  	genlist=" $(look_for_rwanted | tr '\n' ' ') "
   2.115  	for i in $(look_for_cookopt genpkg | tac); do
   2.116 @@ -618,7 +626,7 @@
   2.117  		tazwok genpkg $i --SLITAZ_VERSION=$SLITAZ_VERSION \
   2.118  			--undigest=$undigest --SLITAZ_DIR=$SLITAZ_DIR
   2.119  	done
   2.120 -	
   2.121 +
   2.122  	# Still needs tazwok genpkg for this package
   2.123  	rm -rf $WOK/$PACKAGE/taz
   2.124  }
   2.125 @@ -680,7 +688,6 @@
   2.126  # Find and strip : --strip-all (-s) or --strip-debug on static libs.
   2.127  strip_package()
   2.128  {
   2.129 -	look_for_cookopt !strip && return
   2.130  	report step "Executing strip on all files"
   2.131  	
   2.132  	# Binaries.
   2.133 @@ -806,7 +813,7 @@
   2.134  		if [ ! "$WANTED" ]; then
   2.135  			copy_generic_files
   2.136  		fi
   2.137 -		strip_package
   2.138 +		look_for_cookopt !strip || strip_package
   2.139  		py_compiled_files_remove
   2.140  	else
   2.141  		echo "No package rules to gen $PACKAGE..." >&2
   2.142 @@ -899,13 +906,13 @@
   2.143  		[ -f "fs$file" ] || continue
   2.144  		md5sum "fs$file" | sed 's/  fs/  /'
   2.145  	done < files.list > md5sum
   2.146 +	report end-step
   2.147  	UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum description.txt \
   2.148  		2> /dev/null | awk '{ sz=$1 } END { print sz }')
   2.149  	
   2.150  	# Build cpio archives. Find, cpio and gzip the fs, finish by
   2.151  	# removing the fs tree.
   2.152  	# Don't log this because compression always output error messages.
   2.153 -	report end-step
   2.154  	find fs -print | cpio -o -H newc | case "$PACKAGE-$COMPRESSION" in
   2.155  	tazpkg-lzma)	gzip > fs.cpio.gz;;
   2.156  	*-lzma)		lzma e fs.cpio.lzma -si;;
   2.157 @@ -940,14 +947,9 @@
   2.158  	echo "Size : `du -sh $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg`"
   2.159  	echo ""
   2.160  	
   2.161 -	# Remove package from broken & genpkg list if needed.
   2.162 -	if grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/broken; then
   2.163 -		sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/broken
   2.164 -		regen_cooklist=yes
   2.165 -	fi
   2.166 -	
   2.167 -	# Remove package from genpkglist.
   2.168 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/genpkglist
   2.169 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/broken
   2.170 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/commit
   2.171 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/cooklist
   2.172  }
   2.173  
   2.174  ########################################################################
   2.175 @@ -971,30 +973,24 @@
   2.176  }
   2.177  
   2.178  ########################################################################
   2.179 -# This section contains functions to generate packages/wok databases.
   2.180 +# This section contains functions to generate packages databases.
   2.181  ########################
   2.182  
   2.183 -# Generic actions in both gen-packages-db/gen-wok-db
   2.184 -gen_db()
   2.185 -{
   2.186 -	report step "Generating $dbtype database"
   2.187 -	report open-bloc
   2.188 -	report step "Removing old files"
   2.189 -	for file in $files_list; do
   2.190 -		[ -f $file ] && rm $file
   2.191 -		[ "${file##*.}" != lzma ] && touch $file
   2.192 -	done
   2.193 -	
   2.194 -	# Generate wok/packages data lists.
   2.195 -	gen_${dbtype}_db
   2.196 -	report close-bloc
   2.197 -}
   2.198  
   2.199  gen_packages_db()
   2.200  {
   2.201  	# pkg_repository can be $PACKAGES_REPOSITORY or $INCOMING_REPOSITORY.
   2.202 -	[ ! "$pkg_repository" ] && pkg_repository=$PACKAGES_REPOSITORY
   2.203 +	[ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
   2.204  	cd $pkg_repository
   2.205 +	report step "Generating packages lists: $pkg_repository"
   2.206 +	report open-bloc
   2.207 +	report step "Removing old files"
   2.208 +	for file in files.list.lzma packages.list packages.txt \
   2.209 +		packages.desc packages.equiv packages.md5; do
   2.210 +		[ -f $file ] && rm $file
   2.211 +	done
   2.212 +	touch files.list
   2.213 +	
   2.214  	packages_db_start
   2.215  	unset RECEIPT
   2.216  	report step "Reading datas from all packages"
   2.217 @@ -1003,33 +999,29 @@
   2.218  	done
   2.219  	report end-step
   2.220  	packages_db_end
   2.221 +	report close-bloc
   2.222  }
   2.223  
   2.224  update_packages_db()
   2.225  {
   2.226 -	[ ! "$pkg_repository" ] && pkg_repository=$PACKAGES_REPOSITORY
   2.227 +	[ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
   2.228  	cd $pkg_repository
   2.229 -	
   2.230 -	# If files are missing, generate the lists - not only update.
   2.231 -	dbtype=packages
   2.232 -	files_list="packages.list packages.equiv packages.md5 packages.desc packages.txt"
   2.233 -	for file in $files_list; do
   2.234 +	for file in packages.list packages.equiv packages.md5 packages.desc \
   2.235 +		packages.txt; do
   2.236  		if [ ! -f "$file" ]; then
   2.237 -			gen_db
   2.238 +			gen_packages_db
   2.239  			return
   2.240  		fi
   2.241  	done
   2.242  	if	[ -f files.list.lzma ]; then
   2.243  		lzma d files.list.lzma files.list
   2.244  	else
   2.245 -		gen_db
   2.246 +		gen_packages_db
   2.247  	fi
   2.248 +	report step "Updating packages lists: $pkg_repository"
   2.249  	packages_db_start
   2.250 -	report step "Updating packages lists"
   2.251 -	touch $tmp/pkglist
   2.252  	
   2.253  	# Look for removed/update packages.
   2.254 -	unset updated_pkg
   2.255  	for PACKAGE in $(grep ^[0-9,a-z,A-Z] packages.txt); do
   2.256  		pkg="$pkg_repository/$(grep -m1 ^$PACKAGE- packages.list).tazpkg"
   2.257  		if ! [ -f "$pkg" ]; then
   2.258 @@ -1045,6 +1037,7 @@
   2.259  		erase_package_info
   2.260  		get_packages_info
   2.261  	done
   2.262 +	unset updated_pkg
   2.263  	
   2.264  	# Look for new packages.
   2.265  	for pkg in $(echo $pkg_repository/*.tazpkg | fgrep -v '*'); do
   2.266 @@ -1163,7 +1156,8 @@
   2.267  	
   2.268  	# Dont log this because lzma always output error.
   2.269  	lzma e files.list files.list.lzma
   2.270 -	rm files.list 2>/dev/null
   2.271 +	rm -f files.list
   2.272 +	[ -f packages.equiv ] || touch packages.equiv
   2.273  }
   2.274  
   2.275  ########################################################################
   2.276 @@ -1172,33 +1166,50 @@
   2.277  
   2.278  gen_wok_db()
   2.279  {
   2.280 -	get_wok_info $(echo $WOK/*/receipt | sed -e "s~$WOK/~~g" -e "s~/receipt~~g")
   2.281 -	sort_db
   2.282 -	report close-bloc
   2.283 -}
   2.284 -
   2.285 -get_wok_info()
   2.286 -{
   2.287 -	report step "Getting datas from wok"
   2.288 +	report step "Generating wok database"
   2.289  	report open-bloc
   2.290 -	
   2.291 +	report step "Removing old files"
   2.292 +	for file in $wan_db $dep_db $PACKAGES_REPOSITORY/cookorder.txt; do
   2.293 +		[ -f $file ] && rm $file
   2.294 +	done
   2.295  	report step "Generating wok-wanted.txt"
   2.296 -	for PACKAGE in $@; do
   2.297 -		RECEIPT=$WOK/$PACKAGE/receipt
   2.298 -		source_receipt
   2.299 -		[ "$WANTED" ] || continue
   2.300 -		echo -e $PACKAGE"\t"$WANTED >> $wan_db
   2.301 -	done
   2.302 -	
   2.303 +	gen_wan_db
   2.304  	report step "Generating wok-depends.txt"
   2.305 -	for PACKAGE in $@; do
   2.306 +	for PACKAGE in $(cut -f1 -d '|' $PACKAGES_REPOSITORY/packages.desc \
   2.307 +		$INCOMING_REPOSITORY/packages.desc | sort -u); do
   2.308  		RECEIPT=$WOK/$PACKAGE/receipt
   2.309  		if [ -s $RECEIPT ]; then
   2.310  			source_receipt
   2.311  			echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db
   2.312  		fi
   2.313  	done
   2.314 -	report end-step
   2.315 +	report close-bloc
   2.316 +}
   2.317 +
   2.318 +gen_wan_db()
   2.319 +{
   2.320 +	for RECEIPT in $(fgrep -l WANTED $WOK/*/receipt); do
   2.321 +		WANTED=
   2.322 +		source $RECEIPT
   2.323 +		[ "$WANTED" ] || continue
   2.324 +		echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db
   2.325 +	done
   2.326 +	if [ "$(diff -q $tmp/wan_db $wan_db)" ]; then
   2.327 +		mv -f $tmp/wan_db $wan_db
   2.328 +		plan_regen_cookorder=yes
   2.329 +	else
   2.330 +		rm $tmp/wan_db
   2.331 +	fi
   2.332 +}
   2.333 +
   2.334 +update_dep_db()
   2.335 +{
   2.336 +	dep_info=$(echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ')
   2.337 +	[ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db)" ] && return
   2.338 +	sed "/^$PACKAGE\t/d" -i $dep_db
   2.339 +	echo "$dep_info" >> $dep_db
   2.340 +	plan_regen_cookorder=yes
   2.341 +	plan_sort_depdb=yes
   2.342  }
   2.343  
   2.344  sort_db()
   2.345 @@ -1251,6 +1262,7 @@
   2.346  	done
   2.347  
   2.348  	tac $tmp/cookorder >> $PACKAGES_REPOSITORY/cookorder.txt
   2.349 +	unset plan_regen_cookorder
   2.350  	report end-step
   2.351  }
   2.352  
   2.353 @@ -1273,13 +1285,6 @@
   2.354  
   2.355  look_for_bdep()
   2.356  {
   2.357 -#	if [ "$undigest" ] && [ ! -f "$WOK/$PACKAGE/receipt" ]; then
   2.358 -#		grep ^$PACKAGE$'\t' $SLITAZ_DIR/$SLITAZ_VERSION/packages/wok-depends.txt \
   2.359 -#		| cut -f 3
   2.360 -#	else
   2.361 -#		grep ^$PACKAGE$'\t' $INCOMING_REPOSITORY/wok-depends.txt | \
   2.362 -#			cut -f 3
   2.363 -#	fi
   2.364  	look_for_all
   2.365  }
   2.366  
   2.367 @@ -1294,23 +1299,6 @@
   2.368  	fi
   2.369  }
   2.370  
   2.371 -filter()
   2.372 -{
   2.373 -	for pkg in $(cat); do
   2.374 -		if grep -q ^$pkg$'\t' $dep_db; then
   2.375 -			{ grep ^$pkg$'\t' $wan_db || echo $pkg
   2.376 -			} | sed 's/\t/ /'
   2.377 -		else
   2.378 -			echo "Error: $pkg can't be found." >&2
   2.379 -		fi
   2.380 -	done
   2.381 -}
   2.382 -
   2.383 -look_for_all_filtered()
   2.384 -{
   2.385 -	look_for_all | filter
   2.386 -}
   2.387 -
   2.388  look_for_rdep()
   2.389  {
   2.390  	fgrep ' '$PACKAGE' ' $INCOMING_REPOSITORY/wok-depends.txt | cut -f 1
   2.391 @@ -1383,21 +1371,14 @@
   2.392  	if [ "$COMMAND" = gen-cooklist ] || [ "$COMMAND" = build-depends ]; then
   2.393  		report(){ : ; }
   2.394  	fi
   2.395 -	
   2.396 -	# Generate wok data files if they're missing. Output message in
   2.397 -	# stderr as stdout output may be used as packages list.
   2.398 -	if [ ! -s "$wan_db" ] || [ ! -s "$dep_db" ]; then
   2.399 -		echo "Missing wok data files, generating them... This may take few minutes." >&2
   2.400 -		gen_wok_db
   2.401 -	fi
   2.402 -	
   2.403 +
   2.404  	# Get packages in argument.
   2.405  	local PACKAGE pkg_list=
   2.406  	for arg in $@; do
   2.407  		[ "$arg" = "${arg#--}" ] || continue
   2.408  		pkg_list="$pkg_list $arg"
   2.409  	done
   2.410 -	
   2.411 +
   2.412  	# Get options.
   2.413  	[ "$pkg_list" ] || return
   2.414  	local cooklist= look_for= with_dev= with_wanted= with_args= log_command="$0 $@" \
   2.415 @@ -1407,72 +1388,85 @@
   2.416  	# Cooklist is a special case where we need to modify a little
   2.417  	# scan behavior
   2.418  	if [ "$cooklist" ]; then
   2.419 -		look_for=all_filtered && with_args=yes && with_dev= && with_wanted= && rwan=yes
   2.420 -		pkg_list=$(echo $pkg_list | filter)
   2.421 +		gen_wan_db
   2.422 +		look_for=all && with_args=yes && with_dev= && with_wanted=
   2.423 +		filter=use_wanted
   2.424 +		append_to_dep()
   2.425 +		{
   2.426 +			check_for_commit && echo $PACKAGE >> $tmp/dep
   2.427 +		}
   2.428 +	else
   2.429 +		append_to_dep()
   2.430 +		{
   2.431 +			echo $PACKAGE >> $tmp/dep
   2.432 +		}
   2.433  	fi
   2.434 +
   2.435 +	[ "$with_dev" ] && filter=with_dev
   2.436 +	[ "$with_wanted" ] && filter=with_wanted
   2.437  	
   2.438  	##############################################################
   2.439  	# ADD TO LISTS PROPOSAL ######################################
   2.440  	##############################################################
   2.441  	#
   2.442 -	include_wanted()
   2.443 +	with_dev()
   2.444  	{
   2.445 -		for pkg in $(cat); do
   2.446 -			{ grep ^$pkg$'\t' $wan_db || echo $pkg
   2.447 -			} | sed 's/\t/ /'
   2.448 +		for PACKAGE in $(cat); do
   2.449 +			echo $PACKAGE
   2.450 +			look_for_dev
   2.451 +		done
   2.452 +	}
   2.453 +
   2.454 +	with_wanted()
   2.455 +	{
   2.456 +		for PACKAGE in $(cat); do
   2.457 +			echo $PACKAGE
   2.458 +			look_for_wanted
   2.459  		done
   2.460  	}
   2.461  	
   2.462 -	no_duplication()
   2.463 +	use_wanted()
   2.464  	{
   2.465 -		for pkg in $(cat); do
   2.466 -			grep -q ^$pkg$ $tmp/list $tmp/dep && continue
   2.467 -			echo $pkg
   2.468 -		done
   2.469 +	for PACKAGE in $(cat); do
   2.470 +		{ grep ^$PACKAGE$'\t' $wan_db || echo $PACKAGE
   2.471 +		} | sed 's/.*\t//'
   2.472 +	done
   2.473  	}
   2.474 -		
   2.475 -	append_to_list()
   2.476 -	{
   2.477 -		no_duplication  >> $tmp/list
   2.478 -		# OU
   2.479 -		include_wanted | no_duplication >> $tmp/list
   2.480 -	}
   2.481 -	#
   2.482 -	##############################################################
   2.483 -	for PACKAGE in $(echo $pkg_list | filter); do
   2.484 -		look_for_$look_for
   2.485 +	
   2.486 +	if [ "$filter" ]; then
   2.487 +		pkg_list=$(echo $pkg_list | $filter)
   2.488 +		scan_pkg()
   2.489 +		{
   2.490 +			look_for_$look_for | $filter
   2.491 +		}
   2.492 +	else
   2.493 +		scan_pkg()
   2.494 +		{
   2.495 +			look_for_$look_for
   2.496 +		}
   2.497 +	fi
   2.498 +	
   2.499 +	for PACKAGE in $pkg_list; do
   2.500 +		[ "$with_args" ] && append_to_dep
   2.501 +		scan_pkg		
   2.502  	done  | tr ' ' '\n' | sort -u > $tmp/list
   2.503  	[ "$look_for" = bdep ] && look_for=dep
   2.504  	while [ -s $tmp/list ]; do
   2.505  		PACKAGE=$(sed 1!d $tmp/list)
   2.506  		sed 1d -i $tmp/list
   2.507 -		echo $PACKAGE >> $tmp/dep
   2.508 -		for depend in $(look_for_$look_for); do
   2.509 -			if ! grep -q ^$depend$ $tmp/list $tmp/dep; then
   2.510 -				echo $depend >> $tmp/list
   2.511 +		append_to_dep
   2.512 +		for pkg in $(scan_pkg); do
   2.513 +			if ! grep -q ^$pkg$ $tmp/list $tmp/dep; then
   2.514 +				echo $pkg >> $tmp/list
   2.515  			fi
   2.516  		done
   2.517  	done
   2.518 -	[ "$with_args" ] && echo $pkg_list | tr ' ' '\n' >> $tmp/dep
   2.519 -	if [ -s $tmp/dep ]; then
   2.520 -		if [ "$with_wanted" ]; then
   2.521 -			cat $tmp/dep | while read PACKAGE; do
   2.522 -				look_for_rwanted >> $tmp/dep
   2.523 -			done
   2.524 -		elif [ "$with_dev" ]; then
   2.525 -			cat $tmp/dep | while read PACKAGE; do
   2.526 -				look_for_dev >> $tmp/dep
   2.527 -			done
   2.528 -		fi
   2.529 -		if [ "$cooklist" ]; then
   2.530 -			mv $tmp/dep $tmp/cooklist
   2.531 -			sort_cooklist
   2.532 -			rm $tmp/cooklist
   2.533 -		else
   2.534 -			cat $tmp/dep | sort -u
   2.535 -		fi
   2.536 +	if [ "$cooklist" ]; then
   2.537 +		mv $tmp/dep $tmp/cooklist
   2.538 +	else	
   2.539 +		cat $tmp/dep | sort -u
   2.540  	fi
   2.541 -	rm $tmp/dep $tmp/list 2>/dev/null
   2.542 +	rm -f $tmp/dep $tmp/list
   2.543  }
   2.544  
   2.545  ########################################################################
   2.546 @@ -1480,32 +1474,22 @@
   2.547  # find which packages to cook.
   2.548  ########################
   2.549  
   2.550 -# Actually its becomes more than check commit... Maybe put this in report
   2.551 -# function is a good idea.
   2.552  check_for_commit()
   2.553  {
   2.554 -	report step "Checking for commits"
   2.555 -	
   2.556 -	# Clean the list... Later we will perfom a partial clean only to keep
   2.557 -	# some usefull informations
   2.558 -	rm $PACKAGES_REPOSITORY/commit 2>/dev/null
   2.559 -	
   2.560 -	# If there's a packages-incoming repository we need to check it too.
   2.561 -	for RECEIPT in $(echo $WOK/*/receipt | fgrep -v '*'); do
   2.562 +	if ! check_for_pkg_in_wok; then
   2.563 +		[ "$?" = 2 ] && return 1
   2.564 +		return
   2.565 +	fi
   2.566 +	for PACKAGE in $(look_for_rwanted) $PACKAGE; do
   2.567 +		RECEIPT=$WOK/$PACKAGE/receipt
   2.568  		source_receipt
   2.569 -	
   2.570 +
   2.571  		# We use md5 of cooking stuff in the packaged receipt to check
   2.572  		# commit. We look consecutively in 3 different locations :
   2.573 -		# - in the wok/PACKAGE/taz folder
   2.574 +		# - in the wok/PACKAGE/taz/* folder
   2.575  		# - in the receipt in the package in incoming repository
   2.576  		# - in the receipt in the package in packages repository
   2.577  		# If md5sum match, there's no commit.
   2.578 -		# If there's not md5sum datas, because the package was cooked
   2.579 -		# with a previous version of tazwok, we don't put in in commit
   2.580 -		# list (need a cook-all to refresh them)
   2.581 -		# If there's no receipt available, package is missing so we put
   2.582 -		# it in commit list.
   2.583 -		# First look for package in packages-incoming.
   2.584  		check_for_commit_using_md5sum()
   2.585  		{
   2.586  			if [ ! -f $WOK/$PACKAGE/md5 ]; then
   2.587 @@ -1513,16 +1497,16 @@
   2.588  					sed -e 1d -e 's/^# //' > $WOK/$PACKAGE/md5
   2.589  				cd $WOK/$PACKAGE
   2.590  			fi
   2.591 -	
   2.592 -			# Use md5sum list in receipt to check for commit.
   2.593 +		
   2.594  			if [ -s md5 ]; then					
   2.595  				if md5sum -cs md5; then
   2.596 -					return_code=0
   2.597 -	
   2.598 -					# If md5sum check if ok, check for new files in
   2.599 -					# cooking stuff.
   2.600 -					for file in receipt description.txt $( [ -d stuff ] && find stuff); do
   2.601 -						if [ -f $file ] && ! fgrep -q "  $file" md5; then
   2.602 +		
   2.603 +				# If md5sum check if ok, check for new/missing files in
   2.604 +				# cooking stuff.
   2.605 +				for file in $([ -f receipt ] && echo receipt; \
   2.606 +						[ -f description.txt ] && echo description.txt; \
   2.607 +						[ -d stuff ] && find stuff); do
   2.608 +						if ! fgrep -q "  $file" md5; then
   2.609  							set_commited
   2.610  						fi
   2.611  					done
   2.612 @@ -1530,14 +1514,15 @@
   2.613  					set_commited
   2.614  				fi
   2.615  			else
   2.616 -				gen_cookmd5
   2.617 +				set_commited
   2.618  			fi
   2.619  		}
   2.620  		set_commited()
   2.621  		{
   2.622 -			echo $PACKAGE >> $PACKAGES_REPOSITORY/commit
   2.623 -			echo "Commit: $PACKAGE ($VERSION)"
   2.624 +			! grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/commit &&
   2.625 +				echo $PACKAGE >> $PACKAGES_REPOSITORY/commit
   2.626  			gen_cookmd5
   2.627 +			update_dep_db
   2.628  		}
   2.629  		taz_dir=$(echo $WOK/$PACKAGE/taz/$PACKAGE-* | fgrep -v '*')
   2.630  		if [ -f $WOK/$PACKAGE/md5 ]; then
   2.631 @@ -1553,135 +1538,143 @@
   2.632  				get_pkg_files $pkg
   2.633  				check_for_commit_using_md5sum
   2.634  				rm -r $pkg_files_dir
   2.635 -				continue
   2.636 +			else
   2.637 +				set_commited
   2.638  			fi
   2.639 -			set_commited
   2.640  		fi
   2.641 +	[ "$forced" ] || echo $PACKAGE >> $tmp/checked
   2.642  	done
   2.643 -	report end-step
   2.644 +	return
   2.645  }
   2.646  
   2.647  gen_cook_list()
   2.648  {
   2.649 +	report step "Scanning wok"
   2.650 +	if [ "$pkg" ]; then
   2.651 +		scan $pkg --cooklist
   2.652 +	else
   2.653 +		scan `cat $cooklist` --cooklist
   2.654 +	fi
   2.655 +	report end-step
   2.656 +	[ -s $tmp/checked ] || return
   2.657  	if [ -s $PACKAGES_REPOSITORY/commit ]; then
   2.658 -		report step "Generate genpkg & cook lists."
   2.659  		cd $PACKAGES_REPOSITORY
   2.660 -		#cp commit $tmp/commit
   2.661 -		#if [ -s broken ]; then	
   2.662 -			## dep_scan return deps including the packages given in argument.
   2.663 -			## To avoid that, we firt generate a list of direct rdepends of
   2.664 -			## brokens without packages in argument, then we generate the
   2.665 -			## full rdeps list. We do this because we don't want to block
   2.666 -			## packages at source of broken tree if a fix as been commited.
   2.667 -			#for PACKAGE in $(cat broken); do
   2.668 -				#look_for_rdep >> $tmp/broken
   2.669 -			#done
   2.670 -			#cat $tmp/broken
   2.671 -			#look_for=rdep && with_wanted=yes
   2.672 -			#for PACKAGE in $(dep_scan `cat $tmp/broken`); do
   2.673 -				#if grep -q ^$PACKAGE$ $tmp/commit; then
   2.674 -					#sed "/^$PACKAGE$/d" -i $tmp/commit
   2.675 -				#fi
   2.676 -			#done
   2.677 -			#rm $tmp/broken
   2.678 -		#fi
   2.679  		for PACKAGE in $(cat commit); do
   2.680  			WANTED="$(look_for_wanted)"
   2.681  			if [ "$WANTED" ]; then
   2.682 -
   2.683 -				# If cook of wanted package is planned, this one will be
   2.684 -				# packaged at the same time. Else if wanted package is
   2.685 -				# broken or blocked, ignore the commit. Else, put the
   2.686 -				# package in genpkglist.
   2.687 -				{ grep -q ^$WANTED$ commit || grep -q ^$WANTED$ broken || \
   2.688 -					grep -q ^$WANTED$ cooklist || grep -q ^$WANTED$ blocked || \
   2.689 -					grep -q ^$WANTED$ genpkglist
   2.690 -				} && continue
   2.691 -				echo $WANTED >> genpkglist
   2.692 -			else
   2.693 -				{ grep -q ^$PACKAGE$ blocked || grep -q ^$PACKAGE$ cooklist 
   2.694 -				} && continue
   2.695 -				echo $PACKAGE >> cooklist
   2.696 -				sed "/^$PACKAGE$/d" -i broken
   2.697 +				grep -q ^$WANTED$ broken cooklist blocked commit && continue
   2.698  			fi
   2.699 +			grep -q ^$PACKAGE$ blocked cooklist && continue
   2.700 +			echo $PACKAGE >> cooklist
   2.701  		done
   2.702 -		#rm $tmp/commit
   2.703 -		if [ -s genpkglist ]; then
   2.704 -			echo "genpkglist:"
   2.705 -			cat genpkglist
   2.706 -		fi
   2.707 -		report end-step
   2.708  	fi
   2.709 -	cooklist=$PACKAGES_REPOSITORY/cooklist
   2.710 +	[ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
   2.711 +	[ "$plan_regen_cookorder" ] && sort_db
   2.712 +	[ -s $PACKAGES_REPOSITORY/cooklist ] || return
   2.713 +	
   2.714 +	# Core toolchain should not be cooked unless cook-toolchain is used.
   2.715 +	if ! [ -f /etc/config.site.tmptoolchain ] ; then
   2.716 +		for PACKAGE in $(scan gcc --look_for=all --with_args --with_wanted); do
   2.717 +			[ -f $tmp/cooklist ] && sed "/^$PACKAGE/d" -i $tmp/cooklist
   2.718 +			[ -f $tmp/checked ] && sed "/^$PACKAGE/d" -i $tmp/checked
   2.719 +			grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/blocked || \
   2.720 +				echo $PACKAGE >> $PACKAGES_REPOSITORY/blocked
   2.721 +		done
   2.722 +	fi
   2.723  	sort_cooklist
   2.724  }
   2.725  
   2.726  sort_cooklist()
   2.727  {
   2.728 -	[ ! "$cooklist" ] && cooklist=$PACKAGES_REPOSITORY/cooklist
   2.729 -	[ -s $cooklist ] || [ -s "$tmp/cooklist" ] || return
   2.730 -	[ -s $PACKAGES_REPOSITORY/cookorder.txt ] || gen_wok_db
   2.731 -	[ ! -s "$tmp/cooklist" ] && cp -a $cooklist $tmp/cooklist
   2.732 +	
   2.733 +	if [ -f "$tmp/checked" ]; then
   2.734 +		rm -f $tmp/cooklist
   2.735 +		cat $tmp/checked | while read PACKAGE; do
   2.736 +			grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/cooklist && \
   2.737 +				echo $PACKAGE >> $tmp/cooklist
   2.738 +		done
   2.739 +	fi
   2.740 +	
   2.741 +	[ -s $tmp/cooklist ] || return
   2.742  	report step "Sorting cooklist"
   2.743 -
   2.744 -	# Use cookorder.txt to sort cooklist.
   2.745 -	cat $PACKAGES_REPOSITORY/cookorder.txt | while read PACKAGE; do
   2.746 -		if grep -q ^$PACKAGE$ $tmp/cooklist; then
   2.747 +	for PACKAGE in $(cat $tmp/cooklist); do
   2.748 +		WANTED="$(look_for_wanted)"
   2.749 +		[ "$WANTED" ] || continue
   2.750 +		if grep -q ^$WANTED$ $PACKAGES_REPOSITORY/broken $tmp/cooklist.tmp; then		
   2.751  			sed "/^$PACKAGE$/d" -i $tmp/cooklist
   2.752 -			echo $PACKAGE >> $tmp/cooklist.tmp
   2.753 +		elif [ ! -d $WOK/$WANTED/install ]; then
   2.754 +			sed "/^$PACKAGE$/d" -i $tmp/cooklist
   2.755 +			echo $WANTED >> $tmp/cooklist
   2.756  		fi
   2.757  	done
   2.758  
   2.759 -	# Remaining packages in cooklist are thoses without compile_rules.
   2.760 -	# They can be cooked first in any order.
   2.761 -	mv -f $tmp/cooklist.tmp $tmp/cooklist
   2.762 -	[ "$cooklist" = "$PACKAGES_REPOSITORY/cooklist" ] && \
   2.763 -		cat $tmp/cooklist > $cooklist
   2.764 -	cat $tmp/cooklist
   2.765 +	# Use cookorder.txt to sort cooklist.
   2.766 +	if [ -s $tmp/cooklist ]; then
   2.767 +		cat $PACKAGES_REPOSITORY/cookorder.txt | while read PACKAGE; do
   2.768 +			if grep -q ^$PACKAGE$ $tmp/cooklist; then
   2.769 +				sed "/^$PACKAGE$/d" -i $tmp/cooklist
   2.770 +				echo $PACKAGE >> $tmp/cooklist.tmp
   2.771 +			fi
   2.772 +		done
   2.773 +
   2.774 +		# Remaining packages in cooklist are thoses without compile_rules.
   2.775 +		# They can be cooked first in any order.
   2.776 +		if [ -f $tmp/cooklist.tmp ]; then
   2.777 +			cat $tmp/cooklist.tmp >> $tmp/cooklist
   2.778 +			rm $tmp/cooklist.tmp
   2.779 +		fi
   2.780 +		
   2.781 +		cat $tmp/cooklist
   2.782 +		[ "$cooklist" = "$PACKAGES_REPOSITORY/cooklist" ] && \
   2.783 +			cat $tmp/cooklist > $cooklist
   2.784 +	fi
   2.785 +	
   2.786  	report end-step
   2.787  }
   2.788  
   2.789  check_for_incoming()
   2.790  {
   2.791 -	[ -s $INCOMING_REPOSITORY/packages.txt ] || return
   2.792 -	report step "Checking packages-incoming repository"
   2.793 -	cd $INCOMING_REPOSITORY
   2.794 -	grep ^[0-9,a-z,A-Z] packages.txt > $tmp/incoming
   2.795 -	scan `cat $PACKAGES_REPOSITORY/broken` --look_for=bdep --with_wanted > $tmp/broken
   2.796 -	for PACKAGE in $(scan `cat $tmp/broken` --look_for=rdep --with_wanted --with_args); do
   2.797 -		sed "/^$PACKAGE$/d" -i $tmp/incoming
   2.798 -		for rwanted in $(look_for_rwanted); do
   2.799 -			sed "/^$rwanted$/d" -i $tmp/incoming
   2.800 -		done
   2.801 -	done
   2.802 -	rm $tmp/broken
   2.803 -	if [ "$incoming_delay" != 0 ]; then
   2.804 -		cat $tmp/incoming | while read PACKAGE; do
   2.805 -			[ "$(grep ^$PACKAGE$ $tmp/incoming)" ] || continue
   2.806 -			dep_list=$( { scan $PACKAGE --look_for=bdep --with_wanted && \
   2.807 -				scan $PACKAGE --look_for=rdep --with_wanted --with_args; } \
   2.808 -				| sort -u )
   2.809 -			for dep in $dep_list; do
   2.810 -				[ "$(find -name "`get_pkg_version $INCOMING_REPOSITORY`.tazpkg" -mtime +$incoming_delay)" ] && continue
   2.811 -				for pkg in $dep_list; do
   2.812 -					sed "/^$pkg$/d" -i $tmp/incoming
   2.813 -				done && break
   2.814 -			done
   2.815 -		done
   2.816 +	[ -s $INCOMING_REPOSITORY/packages.desc ] || {
   2.817 +	echo "No packages in $INCOMING_REPOSITORY."
   2.818 +	return; }
   2.819 +	if [ -s $PACKAGES_REPOSITORY/broken ]; then
   2.820 +		echo "Don't move incoming packages to main repository because theses ones are broken:
   2.821 +		$(cat $PACKAGES_REPOSITORY/broken)" >&2
   2.822 +		return
   2.823  	fi
   2.824 -	if [ -s "$tmp/incoming" ]; then
   2.825 -		for PACKAGE in $(cat $tmp/incoming); do
   2.826 +	if [ -s $PACKAGES_REPOSITORY/cooklist ]; then
   2.827 +		echo "Don't move incoming packages to main repository because some of them need to be cooked:
   2.828 +		$(cat $PACKAGES_REPOSITORY/cooklist)" >&2
   2.829 +		return
   2.830 +	fi
   2.831 +	rm -f $WOK/*/md5
   2.832 +	pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
   2.833 +		grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
   2.834 +		} | sort -u)"
   2.835 +	cooklist=$PACKAGES_REPOSITORY/cooklist
   2.836 +	gen_cook_list
   2.837 +	if [ -s $PACKAGES_REPOSITORY/cooklist ]; then
   2.838 +		echo "Don't move incoming packages to main repository because some of them need to be cooked." >&2
   2.839 +		return
   2.840 +	fi
   2.841 +	report step "Moving incoming packages to main repository"
   2.842 +	unset EXTRAVERSION
   2.843 +	for PACKAGE in $(cut -f 1 -d '|' $INCOMING_REPOSITORY/packages.desc); do
   2.844  			prev_VERSION=$(get_pkg_version $PACKAGES_REPOSITORY)
   2.845 +			VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
   2.846  			remove_previous_package $PACKAGES_REPOSITORY
   2.847  			remove_previous_tarball
   2.848 -			cur_VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
   2.849 -			mv -f $PACKAGE-$cur_VERSION.tazpkg $PACKAGES_REPOSITORY
   2.850 -			echo "Moving $PACKAGE to main repository."
   2.851 -		done
   2.852 -	pkg_repository=$INCOMING_REPOSITORY && update_packages_db
   2.853 +			echo "Moving $PACKAGE..."
   2.854 +			mv -f $INCOMING_REPOSITORY/$PACKAGE-$VERSION.tazpkg $PACKAGES_REPOSITORY
   2.855 +			touch $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg
   2.856 +	done
   2.857 +	report end-step
   2.858 +	for file in packages.list packages.equiv packages.md5 packages.desc \
   2.859 +		packages.txt; do
   2.860 +		echo -n "" > $INCOMING_REPOSITORY/$file
   2.861 +	done
   2.862 +	rm -r $INCOMING_REPOSITORY/files.list.lzma
   2.863  	pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
   2.864 -	fi
   2.865 -	report end-step
   2.866  }
   2.867  
   2.868  ########################################################################
   2.869 @@ -1750,12 +1743,7 @@
   2.870  	report step "Cooking $PACKAGE"
   2.871  	report open-bloc
   2.872  
   2.873 -	# Clean package if needed.
   2.874  	clean $PACKAGE
   2.875 -
   2.876 -	# Remove PACKAGE from commit & cook lists.
   2.877 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/commit
   2.878 -	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/cooklist
   2.879  	[ -s $tmp/cooklist ] && sed "/^$PACKAGE$/d" -i $tmp/cooklist
   2.880  	
   2.881  	if compile_package; then
   2.882 @@ -1821,33 +1809,26 @@
   2.883  	return $cook_code
   2.884  }
   2.885  
   2.886 -genpkg_list()
   2.887 -{
   2.888 -	while [ -s $PACKAGES_REPOSITORY/genpkglist ]; do
   2.889 -		PACKAGE=$(sed 1!d $PACKAGES_REPOSITORY/genpkglist)
   2.890 -		gen_package
   2.891 -	done
   2.892 -}
   2.893 -
   2.894  cook_list()
   2.895  {
   2.896 -	if [ ! -s $cooklist ]; then
   2.897 +	if [ -s $tmp/cooklist ]; then
   2.898 +		if [ -f /usr/bin/tazchroot ]; then
   2.899 +			# Note : options -main variables- are automatically keeped by
   2.900 +			# the sub-applications tazchroot/tazwok; as well as report data.
   2.901 +			cd $LOCAL_REPOSITORY
   2.902 +			[ ! -f tazchroot.conf ] && configure_tazchroot
   2.903 +			tazchroot tazwok cook-list --SLITAZ_DIR=$SLITAZ_DIR --SLITAZ_VERSION=$SLITAZ_VERSION ${undigest:+ --undigest=$undigest}
   2.904 +			return
   2.905 +		fi
   2.906 +		while [ -s $tmp/cooklist ]; do
   2.907 +			PACKAGE=$(sed 1!d $tmp/cooklist)
   2.908 +			cook
   2.909 +		done
   2.910 +		remove_build_depends $MISSING_PACKAGE $remove_later
   2.911 +	else
   2.912  		echo "Nothing to cook."
   2.913  		return
   2.914  	fi
   2.915 -	if [ -f /usr/bin/tazchroot ]; then
   2.916 -		# Note : options -main variables- are automatically keeped by
   2.917 -		# the sub-applications tazchroot/tazwok; as well as report data.
   2.918 -		cd $LOCAL_REPOSITORY
   2.919 -		[ ! -f tazchroot.conf ] && configure_tazchroot
   2.920 -		tazchroot tazwok cook-list --SLITAZ_DIR=$SLITAZ_DIR --SLITAZ_VERSION=$SLITAZ_VERSION ${undigest:+ --undigest=$undigest}
   2.921 -		return
   2.922 -	fi
   2.923 -	while [ -s $tmp/cooklist ]; do
   2.924 -		PACKAGE=$(sed 1!d $tmp/cooklist)
   2.925 -		cook
   2.926 -	done
   2.927 -	remove_build_depends $MISSING_PACKAGE $remove_later
   2.928  }
   2.929  
   2.930  configure_tazchroot()
   2.931 @@ -1977,22 +1958,14 @@
   2.932  		fi
   2.933  	;;
   2.934  	gen-cooklist)
   2.935 -		get_options_list="list"
   2.936 +		get_options_list="pkg"
   2.937  		get_tazwok_config
   2.938 -		if [ "$list" ]; then
   2.939 -			LIST="$list"
   2.940 -			check_for_list
   2.941 -		else
   2.942 -			LIST=$(for pkg in $@; do
   2.943 -				[ "$pkg" = "${pkg#--}" ] || continue
   2.944 -				echo -n "$pkg "
   2.945 -			done)
   2.946 -			if [ ! "$LIST" ]; then
   2.947 -				echo "Please give packages or a list file in argument." >&2
   2.948 -				exit
   2.949 -			fi
   2.950 +		check_root
   2.951 +		if ! [ "$pkg" ]; then
   2.952 +			cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   2.953  		fi
   2.954 -		scan $LIST --cooklist
   2.955 +		forced=yes
   2.956 +		gen_cook_list
   2.957  	;;
   2.958  	check-depends)
   2.959  		# Check package depends /!\ 
   2.960 @@ -2311,19 +2284,16 @@
   2.961  		cp -af $tmp/cooklist $cooklist
   2.962  	;;
   2.963  	cook-list)
   2.964 -		# Cook all packages listed in a file. The path to the cooklist must
   2.965 -		# be specified on the cmdline.
   2.966 -		# /!\ 
   2.967 +		# Cook all packages listed in a file or in default cooklist.
   2.968  		check_root
   2.969 +		get_options_list="pkg forced"
   2.970  		get_tazwok_config
   2.971  		source_lib report
   2.972  		report start
   2.973 -		cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   2.974 -		if [ "$LIST" ]; then
   2.975 -			sort_cooklist
   2.976 -		else
   2.977 -			cp $cooklist $tmp/cooklist
   2.978 +		if ! [ "$pkg" ]; then
   2.979 +			cooklist=${LIST:-$PACKAGES_REPOSITORY/cooklist}
   2.980  		fi
   2.981 +		gen_cook_list
   2.982  		cook_list
   2.983  	;;
   2.984  	clean)
   2.985 @@ -2385,54 +2355,47 @@
   2.986  		echo "`ls -1 $WOK | wc -l` packages cleaned."
   2.987  	;;
   2.988  	gen-list)
   2.989 -		check_root
   2.990  		get_tazwok_config
   2.991 +		if [ "$2" ]; then
   2.992 +			if [ -d "$2" ]; then
   2.993 +				pkg_repository=$2
   2.994 +			else
   2.995 +				echo -e "\nUnable to find directory : $2\n" >&2
   2.996 +				exit 1
   2.997 +			fi
   2.998 +		fi
   2.999 +				
  2.1000  		source_lib report
  2.1001  		report start
  2.1002 -		dbtype=packages
  2.1003 -		mode=gen
  2.1004 -		for pkg_repository in $PACKAGES_REPOSITORY $INCOMING_REPOSITORY; do
  2.1005 -			files_list="$pkg_repository/files.list.lzma \
  2.1006 -				$pkg_repository/packages.list \
  2.1007 -				$pkg_repository/packages.txt \
  2.1008 -				$pkg_repository/packages.desc \
  2.1009 -				$pkg_repository/packages.equiv \
  2.1010 -				$pkg_repository/packages.md5"
  2.1011 -			gen_db
  2.1012 -			echo "$pkgs packages in the repository."
  2.1013 -			echo ""
  2.1014 -		done
  2.1015 +		if [ "$pkg_repository" ]; then
  2.1016 +			gen_packages_db
  2.1017 +		else
  2.1018 +			pkg_repository=$PACKAGES_REPOSITORY && gen_packages_db
  2.1019 +			pkg_repository=$INCOMING_REPOSITORY && gen_packages_db
  2.1020 +		fi
  2.1021  	;;
  2.1022  	check-list)
  2.1023  		# The directory to move into by default is the repository,
  2.1024  		# if $2 is not empty cd into $2.
  2.1025  		#
  2.1026  		get_tazwok_config
  2.1027 -		if [ -z "$2" ]; then
  2.1028 -			PACKAGES_REPOSITORY=$PACKAGES_REPOSITORY
  2.1029 -		else
  2.1030 +		if [ "$2" ]; then
  2.1031  			if [ -d "$2" ]; then
  2.1032 -				PACKAGES_REPOSITORY=$2
  2.1033 +				pkg_repository=$2
  2.1034  			else
  2.1035  				echo -e "\nUnable to find directory : $2\n" >&2
  2.1036  				exit 1
  2.1037  			fi
  2.1038  		fi
  2.1039  		
  2.1040 -		# Use report shared library to control output.
  2.1041 -		tmp=/tmp/tazwok-$$
  2.1042  		source_lib report
  2.1043 -		dbtype=packages
  2.1044 -		mode=update
  2.1045 -		cd $PACKAGES_REPOSITORY
  2.1046 -		for pkg in $(echo *.tazpkg); do
  2.1047 -			package_md5=$(md5sum $pkg)
  2.1048 -			[ "$package_md5" = "$(fgrep "  $pkg" packages.md5)" ] && continue
  2.1049 -			erase_package_info
  2.1050 -			get_packages_info
  2.1051 -		done
  2.1052 -		echo "$pkgs packages in the repository."
  2.1053 -		echo ""
  2.1054 +		report start
  2.1055 +		if [ "$pkg_repository" ]; then
  2.1056 +			update_packages_db
  2.1057 +		else
  2.1058 +			pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
  2.1059 +			pkg_repository=$INCOMING_REPOSITORY && update_packages_db
  2.1060 +		fi
  2.1061  	;;
  2.1062  	new-tree)
  2.1063  		# Just create a few directories and generate an empty receipt to prepare
  2.1064 @@ -2469,12 +2432,7 @@
  2.1065  compile_rules()
  2.1066  {
  2.1067  	cd $src
  2.1068 -	./configure \
  2.1069 -		--prefix=/usr \
  2.1070 -		--infodir=/usr/share/info \
  2.1071 -		--mandir=/usr/share/man \
  2.1072 -		$CONFIGURE_ARGS &&
  2.1073 -	make -j 4 && make DESTDIR=$PWD/_pkg install
  2.1074 +	./configure && make && make install
  2.1075  }
  2.1076  
  2.1077  # Rules to gen a SliTaz package suitable for Tazpkg.
  2.1078 @@ -2630,50 +2588,62 @@
  2.1079  			echo "No tarball to download for $PACKAGE"
  2.1080  		fi
  2.1081  	;;
  2.1082 -	rec-commit)
  2.1083 +	check-commit)
  2.1084  		check_root
  2.1085 +		get_options_list="missing forced"
  2.1086  		get_tazwok_config
  2.1087  		source_lib report
  2.1088  		report start
  2.1089 -		check_for_commit
  2.1090 +		if [ "$forced" ]; then
  2.1091 +			rm -f $WOK/*/md5
  2.1092 +			unset forced
  2.1093 +		fi
  2.1094 +		if [ "$missing" ]; then
  2.1095 +			pkg=$(ls -1 $WOK)
  2.1096 +		else
  2.1097 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  2.1098 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  2.1099 +			} | sort -u)"
  2.1100 +		fi
  2.1101 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  2.1102  		gen_cook_list
  2.1103  	;;
  2.1104  	cook-commit)
  2.1105  		check_root
  2.1106 +		get_options_list="missing forced"
  2.1107  		get_tazwok_config
  2.1108  		source_lib report
  2.1109  		report start
  2.1110 -		check_for_commit
  2.1111 -		# 2) update cook-database (actually complete regeneration)
  2.1112 -		dbtype=wok
  2.1113 -		mode=gen
  2.1114 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  2.1115 -		gen_db
  2.1116 -		# 3) check cooklist
  2.1117 -		# 	3.1) rename pkgs with wanted variable to wanted pkg
  2.1118 +		if [ "$forced" ]; then
  2.1119 +			rm -f $WOK/*/md5
  2.1120 +			unset forced
  2.1121 +		fi
  2.1122 +		if [ "$missing" ]; then
  2.1123 +			pkg=$(ls -1 $WOK)
  2.1124 +		else
  2.1125 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  2.1126 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  2.1127 +			} | sort -u)"
  2.1128 +		fi
  2.1129 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  2.1130  		gen_cook_list
  2.1131  		cook_list
  2.1132  	;;
  2.1133  	cook-all)
  2.1134  		check_root
  2.1135 +		get_options_list="forced missing"
  2.1136  		get_tazwok_config
  2.1137  		source_lib report
  2.1138  		report start
  2.1139 -		# 2) update cook-database (actually complete regeneration)
  2.1140 -		dbtype=wok
  2.1141 -		mode=gen
  2.1142 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  2.1143 -		gen_db
  2.1144 -		# Add all packages, without toolchain, in cooklist.
  2.1145 -		# Recook toolchain need to be coded.
  2.1146 -		echo -n "" > $PACKAGES_REPOSITORY/cooklist
  2.1147 -		for pkg in $(cd $WOK && echo *); do
  2.1148 -			echo $pkg >> $PACKAGES_REPOSITORY/cooklist
  2.1149 -		done
  2.1150 -		for pkg in $(scan gcc --look_for=all --with_wanted --with_args); do
  2.1151 -			sed "/^$pkg$/d" -i $PACKAGES_REPOSITORY/cooklist
  2.1152 -		done
  2.1153 -		sort_cooklist
  2.1154 +		if [ "$missing" ]; then
  2.1155 +			pkg=$(ls -1 $WOK)
  2.1156 +		else
  2.1157 +			pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
  2.1158 +				grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
  2.1159 +			} | sort -u)"
  2.1160 +		fi
  2.1161 +		cooklist=$PACKAGES_REPOSITORY/cooklist
  2.1162 +		gen_cook_list
  2.1163  		cook_list
  2.1164  	;;
  2.1165  	gen-wok-db)
  2.1166 @@ -2681,16 +2651,13 @@
  2.1167  		get_tazwok_config
  2.1168  		source_lib report
  2.1169  		report start
  2.1170 -		dbtype=wok
  2.1171 -		mode=gen
  2.1172 -		files_list="$dep_db $wan_db $PACKAGE_REPOSITORY/cookorder.txt"
  2.1173 -		gen_db
  2.1174 +		gen_wok_db
  2.1175  	;;
  2.1176  	report)
  2.1177  		check_root
  2.1178  		get_tazwok_config
  2.1179  		cd $PACKAGES_REPOSITORY
  2.1180 -		for i in commit genpkglist cooklist incoming broken blocked; do
  2.1181 +		for i in commit cooklist incoming broken blocked; do
  2.1182  			if [ -s $i ]; then
  2.1183  				echo -e "\n********************* $i *********************\n$(cat $i)\n*********************"
  2.1184  			fi
  2.1185 @@ -2752,5 +2719,4 @@
  2.1186  	;;
  2.1187  esac
  2.1188  
  2.1189 -[ -d "$tmp" ] && rm -r $tmp
  2.1190  report stop 2>/dev/null || exit 0