wok diff tazbb/stuff/tazbb @ rev 3512

Add Tazbb (SliTaz Build Bot)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Jun 20 04:41:53 2009 +0200 (2009-06-20)
parents
children 1f7365e120bb
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tazbb/stuff/tazbb	Sat Jun 20 04:41:53 2009 +0200
     1.3 @@ -0,0 +1,504 @@
     1.4 +#!/bin/sh
     1.5 +# Tazbb - SliTaz Build Bot.
     1.6 +# System wide config file: /etc/slitaz/tazbb.conf
     1.7 +#
     1.8 +# Tazbb is a tool to automate package building, it can be run manually
     1.9 +# or via a cron job. On SliTaz build host, tazbb is run in a chroot env.
    1.10 +#
    1.11 +# (c) 2009 SliTaz GNU/Linux project - GNU gpl v3
    1.12 +#
    1.13 +
    1.14 +# Include config file or exit if no file found.
    1.15 +if [ -f "./tazbb.conf" ]; then
    1.16 +	. ./tazbb.conf
    1.17 +elif [ -f "/etc/slitaz/tazbb.conf" ]; then
    1.18 +	. /etc/slitaz/tazbb.conf
    1.19 +else
    1.20 +	echo -e "\nNo config file found: tazbb.conf...\n" && exit 0
    1.21 +fi
    1.22 +
    1.23 +# Tazbb is only for root.
    1.24 +if test $(id -u) != 0 ; then
    1.25 +   echo -e "\nYou must be root to run: `basename $0`.\n" && exit 0
    1.26 +fi
    1.27 +
    1.28 +# Let tazbb finish is work and make sure needed files exist.
    1.29 +if [ -f $LOCK_FILE ]; then
    1.30 +	case $1 in
    1.31 +		usage|list-*|*block)
    1.32 +			continue ;;
    1.33 +		*)
    1.34 +			echo -e "\nTazbb is already running and locked...\n"
    1.35 +			exit 0 ;;
    1.36 +	esac
    1.37 +else
    1.38 +	mkdir -p $DB_DIR $LOG_DIR
    1.39 +	touch $LOCK_FILE $DB_DIR/blocked
    1.40 +fi
    1.41 +
    1.42 +usage()
    1.43 +{
    1.44 +	echo -e "\nSliTaz developers and build host tool\n
    1.45 +\033[1mUsage: \033[0m `basename $0` [command] [--option]
    1.46 +\033[1mCommands: \033[0m\n
    1.47 +  usage        Print this short usage and command list.
    1.48 +  list-pkgs    List last cooked packages with date.
    1.49 +  report       Run in report mode and dont cook anything [--verbose].
    1.50 +  cook-all     Cook all missing, modified or unbuilt packages.
    1.51 +  cook-commit  Cook all packages affected by a commit in the last update.
    1.52 +  test-pkgs    Execute a test suite on all packages [--verbose].
    1.53 +  [un]block    Block or unblock a package to skip or enable building.
    1.54 +  clean-up     Remove old packages [--verbose|--dry-run].
    1.55 +  clean-log    Remove all generated build log files.\n"
    1.56 +}
    1.57 +
    1.58 +status()
    1.59 +{
    1.60 +	local CHECK=$?
    1.61 +	echo -en "\033[70G"
    1.62 +	if [ $CHECK = 0 ]; then
    1.63 +		echo "Done"
    1.64 +	else
    1.65 +		echo "Failed"
    1.66 +	fi
    1.67 +	return $CHECK
    1.68 +}
    1.69 +
    1.70 +top_summary()
    1.71 +{
    1.72 +	cat > $DB_DIR/summary << _EOT_
    1.73 +Update   : `date`
    1.74 +Revision : $NEW_REV (<a href="$HG_URL/log/$NEW_REV">changelog</a>)
    1.75 +_EOT_
    1.76 +}
    1.77 +
    1.78 +packages_summary()
    1.79 +{
    1.80 +	if ! grep -q "^Packages" $DB_DIR/summary; then
    1.81 +		cat >> $DB_DIR/summary << _EOT_
    1.82 +Packages : `ls $BUILD_WOK | wc -l` in the wok, `cat $DB_DIR/cooklist | wc -l` to cook, \
    1.83 +`cat $DB_DIR/blocked | wc -l` blocked, `cat $DB_DIR/corrupted | wc -l` corrupted
    1.84 +_EOT_
    1.85 +	fi
    1.86 +}
    1.87 +
    1.88 +packages_summary_update()
    1.89 +{
    1.90 +	sed -i s/"[0-9]* in the wok"/"`ls $BUILD_WOK | wc -l` in the wok"/ \
    1.91 +		$DB_DIR/summary
    1.92 +	sed -i s/"[0-9]* to cook"/"`cat $DB_DIR/cooklist | wc -l` to cook"/ \
    1.93 +		$DB_DIR/summary
    1.94 +	sed -i s/"[0-9]* blocked"/"`cat $DB_DIR/blocked | wc -l` blocked"/ \
    1.95 +		$DB_DIR/summary
    1.96 +	sed -i s/"[0-9]* corrupted"/"`cat $DB_DIR/corrupted | wc -l` corrupted"/ \
    1.97 +		$DB_DIR/summary
    1.98 +}
    1.99 +
   1.100 +list_packages()
   1.101 +{
   1.102 +	cd $PACKAGES_REPOSITORY
   1.103 +	ls -1t *.tazpkg | head -20 | \
   1.104 +	while read file
   1.105 +	do
   1.106 +		echo -n $(stat -c '%y' $PACKAGES_REPOSITORY/$file | cut -d. -f1)
   1.107 +		echo "   $file"
   1.108 +	done
   1.109 +}
   1.110 +
   1.111 +show_report()
   1.112 +{
   1.113 +	echo "Cooklist"
   1.114 +	echo "================================================================================"
   1.115 +	cat $DB_DIR/cooklist && echo ""
   1.116 +	echo "Blocked"
   1.117 +	echo "================================================================================"
   1.118 +	cat $DB_DIR/blocked && echo ""
   1.119 +	echo "Corrupted"
   1.120 +	echo ""
   1.121 +}
   1.122 +
   1.123 +update_wok()
   1.124 +{
   1.125 +	echo ""
   1.126 +	echo "(updating wok)" > $DB_DIR/running
   1.127 +	cd $HG_WOK
   1.128 +	LAST_REV=`hg head --template '{rev}\n'`
   1.129 +	hg pull && hg update
   1.130 +	NEW_REV=`hg head --template '{rev}\n'`
   1.131 +	# Gen a new summary and link last revision for the web interface.
   1.132 +	echo -e "\nHg wok    : $HG_WOK ($NEW_REV)"
   1.133 +	echo -e "Build wok : $BUILD_WOK ($LAST_REV)\n"
   1.134 +	top_summary
   1.135 +	# Copy Hg wok if new revision or exit to stop process since nothing
   1.136 +	# have change (--forced can be used).
   1.137 +	if [ "$NEW_REV" != "$LAST_REV" ]; then
   1.138 +		size=`du -sh $HG_WOK | awk '{ print $1 }'`
   1.139 +		echo -n "Copying Hg wok to the build wok ($size)... "
   1.140 +		cp -a $HG_WOK/* $BUILD_WOK
   1.141 +		cp -a $HG_WOK/.hg $BUILD_WOK
   1.142 +		echo -e "Done\n"
   1.143 +	else
   1.144 +		if [ "$1" = "cook-all" ] || [ "$1" = "cook-commit" ]; then
   1.145 +			if [ "$2" != "--forced" ]; then
   1.146 +				echo -e "Nothing to cook...\n"
   1.147 +				packages_summary
   1.148 +				rm -f $LOCK_FILE && exit 0
   1.149 +			fi
   1.150 +		fi
   1.151 +	fi
   1.152 +}
   1.153 +
   1.154 +# Running 'tazbb report' should not cook anything and --verbose option
   1.155 +# can be used to display more messages.
   1.156 +check_wok()
   1.157 +{
   1.158 +	# Clean up last results.
   1.159 +	rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
   1.160 +	rm -f $DB_DIR/report && touch $DB_DIR/report
   1.161 +	rm -f $DB_DIR/unbuilt && touch $DB_DIR/unbuilt
   1.162 +	echo "Checking all files in: $HG_WOK"
   1.163 +	echo "================================================================================"
   1.164 +	echo "(checking wok)" > $DB_DIR/running
   1.165 +	for pkg in $HG_WOK/*
   1.166 +	do
   1.167 +		EXTRAVERSION=""
   1.168 +		WANTED=""
   1.169 +		. $pkg/receipt
   1.170 +		[ "$2" = "--verbose" ] && echo "Package : $PACKAGE"
   1.171 +		# Skip blocked packages.
   1.172 +		if grep -qs "^$PACKAGE$" $DB_DIR/blocked; then
   1.173 +			echo "Blocked : $PACKAGE ($VERSION)" && continue
   1.174 +		fi
   1.175 +
   1.176 +		# Bristuff hack until the receipt are improved...
   1.177 +		#[ "$VERSION" = "bristuff" ] && VERSION=`get_version`
   1.178 +		if [ "$VERSION" = "bristuff" ]; then
   1.179 +			. $BUILD_WOK/$PACKAGE/taz/*/receipt
   1.180 +		fi
   1.181 +
   1.182 +		# First check if package exit. Package naming _must_ be in the form of:
   1.183 +		# $PACKAGE-$VERSION or $PACKAGE-${VERSION}$EXTRAVERSION (Kernel string).
   1.184 +		if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then
   1.185 +			[ -z "$EXTRAVERSION" ] && EXTRAVERSION="_$KERNEL"
   1.186 +			if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg ]; then
   1.187 +				[ "$1" = "report" ] && echo "Missing : $PACKAGE ($VERSION)"
   1.188 +				echo "Missing : $PACKAGE ($VERSION)" >> $DB_DIR/report
   1.189 +				echo "$PACKAGE" >> $DB_DIR/cooklist
   1.190 +			fi
   1.191 +		else
   1.192 +			# Check if package is up-to-date.
   1.193 +			PKG_DATE=`date -u -r $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg '+%m%d%H%M%Y'`
   1.194 +			for file in `find $pkg -type f`
   1.195 +			do
   1.196 +				FILE_DATE=`date -u -r $file '+%m%d%H%M%Y'`
   1.197 +				[ "$2" = "--verbose" ] && echo " -> Checking: $file"
   1.198 +				if [ "$FILE_DATE" -gt "$PKG_DATE" ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
   1.199 +					[ "$1" = "report" ] && echo "Refresh : $PACKAGE ($VERSION)"
   1.200 +					echo "Refresh : $PACKAGE ($VERSION)" >> $DB_DIR/report
   1.201 +					echo "$PACKAGE" >> $DB_DIR/cooklist
   1.202 +				fi
   1.203 +			done
   1.204 +		fi
   1.205 +		# Now check if package is built and not already in the list.
   1.206 +		if [ ! -d $BUILD_WOK/$PACKAGE/taz ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
   1.207 +			[ "$1" = "report" ] && echo "Unbuilt : $PACKAGE ($VERSION)"
   1.208 +			echo "Unbuilt : $PACKAGE ($VERSION)" >> $DB_DIR/report
   1.209 +			echo "$PACKAGE" >> $DB_DIR/cooklist
   1.210 +		fi
   1.211 +		# Rebuild unbuilt packages list with link to log file. This list
   1.212 +		# is also generated by cook_inslall to have real time stats.
   1.213 +		if [ ! -d $BUILD_WOK/$PACKAGE/taz ]; then
   1.214 +			echo "<a href=\"log.php?package=$PACKAGE\">$PACKAGE</a>" \
   1.215 +				>> $DB_DIR/unbuilt
   1.216 +		fi
   1.217 +	done
   1.218 +	packages_summary
   1.219 +}
   1.220 +
   1.221 +# Create a new cooklist and summary (dont modify report) so 'tazbb cook-commit'
   1.222 +# can cook last changes.
   1.223 +check_commit()
   1.224 +{
   1.225 +	echo "(checking commit)" > $DB_DIR/running
   1.226 +	cd $HG_WOK
   1.227 +	# Clean up last results.
   1.228 +	rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
   1.229 +	# Get the name of modified packages by the revision range. +1 last
   1.230 +	# commit was build by the previous build.
   1.231 +	LAST_REV=$(($LAST_REV+1))
   1.232 +	echo -e "Will cook from revision $LAST_REV to $NEW_REV\n"
   1.233 +	for file in `hg log --rev=$LAST_REV:$NEW_REV --template '{files}\n'`
   1.234 +	do
   1.235 +		pkg=`echo $file | cut -d "/" -f 1`
   1.236 +		if ! grep -q ^$pkg$ $DB_DIR/cooklist; then
   1.237 +			. $pkg/receipt
   1.238 +			echo "Commit  : $PACKAGE ($VERSION)" >> $DB_DIR/report
   1.239 +			echo "$PACKAGE" >> $DB_DIR/cooklist
   1.240 +		fi
   1.241 +	done
   1.242 +	packages_summary
   1.243 +}
   1.244 +
   1.245 +# Here we cook all packages found in the cooklist.
   1.246 +cook_install()
   1.247 +{
   1.248 +	echo "" > $DB_DIR/unbuilt
   1.249 +	for pkg in `cat $DB_DIR/cooklist | sort`
   1.250 +	do
   1.251 +		EXTRAVERSION=""
   1.252 +		DEPENDS=""
   1.253 +		BUILD_DEPENDS=""
   1.254 +		SOURCE=""
   1.255 +		WANTED=""
   1.256 +		echo "(cooking <a href=\"log.php?package=$pkg\">$pkg</a>)" > $DB_DIR/running
   1.257 +		tazwok clean $pkg
   1.258 +		script -c "echo 'install' | tazwok cook $pkg" $LOG_DIR/$pkg.log
   1.259 +		# Install new package (important for new shared libs). Note
   1.260 +		# that tests are done separatly with 'test_packages' and should
   1.261 +		# be done by tazwok.
   1.262 +		if [ -f $BUILD_WOK/$pkg/taz/*/receipt ]; then
   1.263 +			. $BUILD_WOK/$pkg/taz/*/receipt
   1.264 +			echo "(installing $PACKAGE-${VERSION}$EXTRAVERSION.tazpkg)" \
   1.265 +				> $DB_DIR/running
   1.266 +			yes | tazpkg install \
   1.267 +				$PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg \
   1.268 +				--forced
   1.269 +		else
   1.270 +			# Link to build log.
   1.271 +			echo "<a href=\"log.php?package=$pkg\">$pkg</a>" >> \
   1.272 +				$DB_DIR/unbuilt
   1.273 +		fi
   1.274 +		# Remove package from the cooklist and empty lines for HTML <pre>.
   1.275 +		sed -i /"^$pkg$"/d $DB_DIR/cooklist
   1.276 +		sed -i '/^$/d' $DB_DIR/cooklist
   1.277 +	done
   1.278 +}
   1.279 +
   1.280 +# Remove old packages in the build wok and clean pkgs repository. The
   1.281 +# Hg wok is copied into the build wok so packages removed by hg must be
   1.282 +# removed. To remove old packages in the repository we look into the
   1.283 +# build wok and dont remove unbuilt packages. Clean-up will also remove
   1.284 +# all corrupted packages.
   1.285 +clean_up()
   1.286 +{
   1.287 +	touch $DB_DIR/removed
   1.288 +	echo -e "\nCleaning the build wok, old and corrupted packages...\n"
   1.289 +	echo "(cleaning)" > $DB_DIR/running
   1.290 +	for pkg in `ls $HG_WOK`
   1.291 +	do
   1.292 +		if [ ! -d $BUILD_WOK/$pkg ]; then
   1.293 +			case $2 in
   1.294 +				--dry-run)
   1.295 +					echo "Removing directory : $pkg" ;;
   1.296 +				--verbose)
   1.297 +					echo "Removing directory : $pkg"
   1.298 +					rm -rf $BUILD_WOK/$pkg ;;
   1.299 +				*)
   1.300 +					rm -rf $BUILD_WOK/$pkg ;;
   1.301 +			esac
   1.302 +		fi
   1.303 +	done
   1.304 +	# Build a packages list with EXTRAVERSION so we can grep into it.
   1.305 +	rm -f $DB_DIR/packaged && touch $DB_DIR/packaged
   1.306 +	for receipt in $BUILD_WOK/*/taz/*/receipt
   1.307 +	do
   1.308 +		EXTRAVERSION=""
   1.309 +		. $receipt
   1.310 +		echo "$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg" >> $DB_DIR/packaged
   1.311 +	done
   1.312 +	for pkg in `cd $PACKAGES_REPOSITORY && ls *.tazpkg`
   1.313 +	do
   1.314 +		if ! grep -q "^$pkg$" $DB_DIR/packaged; then
   1.315 +			case $2 in
   1.316 +				--dry-run)
   1.317 +					echo "Removing package : $pkg" ;;
   1.318 +				--verbose)
   1.319 +					echo "Removing package : $pkg"
   1.320 +					echo "$pkg" >> $DB_DIR/removed
   1.321 +					rm -f $PACKAGES_REPOSITORY/$pkg ;;
   1.322 +				*)
   1.323 +					echo "$pkg" >> $DB_DIR/removed
   1.324 +					rm -f $PACKAGES_REPOSITORY/$pkg ;;
   1.325 +			esac
   1.326 +		fi
   1.327 +	done
   1.328 +	# Remove all corrupted packages
   1.329 +	for pkg in `cat $DB_DIR/corrupted | awk '{ print $3 }'`
   1.330 +	do
   1.331 +		case $2 in
   1.332 +			--dry-run)
   1.333 +				echo "Removing corrupted: $pkg" ;;
   1.334 +			--verbose)
   1.335 +				echo "Removing corrupted: $pkg"
   1.336 +				echo "$pkg" >> $DB_DIR/removed
   1.337 +				rm -rf $PACKAGES_REPOSITORY/$pkg ;;
   1.338 +			*)
   1.339 +				echo "$pkg" >> $DB_DIR/removed
   1.340 +				rm -rf $PACKAGES_REPOSITORY/$pkg ;;
   1.341 +		esac
   1.342 +	done
   1.343 +	echo ""
   1.344 +	# Keep the 20 last removed packages list.
   1.345 +	cat $DB_DIR/removed | tail -n 20 > /tmp/removed.tail
   1.346 +	mv -f /tmp/removed.tail $DB_DIR/removed
   1.347 +}
   1.348 +
   1.349 +blocked_urls()
   1.350 +{
   1.351 +	rm -f $DB_DIR/blocked.urls
   1.352 +	for pkg in `cat $DB_DIR/blocked`
   1.353 +	do
   1.354 +		if [ -f $LOG_DIR/$pkg.log ]; then
   1.355 +			echo "<a href=\"log.php?package=$pkg\">$pkg</a>" >> \
   1.356 +				$DB_DIR/blocked.urls
   1.357 +		else
   1.358 +			echo "$pkg" >> $DB_DIR/blocked.urls
   1.359 +		fi
   1.360 +	done
   1.361 +}
   1.362 +
   1.363 +# 4k, not a meta or a get-* package and no files = buggy package
   1.364 +test_packages()
   1.365 +{
   1.366 +	echo -e "\nTesting all packages in: $PACKAGES_REPOSITORY"
   1.367 +	echo "================================================================================"
   1.368 +	echo "(testing packages)" > $DB_DIR/running
   1.369 +	rm -f $DB_DIR/corrupted && touch $DB_DIR/corrupted
   1.370 +	for pkg in $PACKAGES_REPOSITORY/*.tazpkg
   1.371 +	do
   1.372 +		tmp=/tmp/bb-test.$$
   1.373 +		CATEGORY=""
   1.374 +		if du $pkg | grep -qw '^4' && ! echo `basename $pkg` | grep -q '^get-'; then
   1.375 +			mkdir -p $tmp && cd $tmp
   1.376 +			cpio -i receipt 2>/dev/null < $pkg
   1.377 +			. ./receipt
   1.378 +			if [ "$CATEGORY" != "meta" ]; then
   1.379 +				[ "$2" = "--verbose" ] && echo "Testing: $PACKAGE"
   1.380 +				cpio -i fs.cpio.gz 2>/dev/null < $pkg
   1.381 +				if [ ! -f fs.cpio.gz ]; then
   1.382 +					echo "No fs : `basename $pkg`"
   1.383 +					if [ -f $LOG_DIR/$PACKAGE.log ];then
   1.384 +						echo "No fs : `basename $pkg` <a href=\"log.php?package=$PACKAGE\">Log</a>" \
   1.385 +							>> $DB_DIR/corrupted
   1.386 +					else
   1.387 +						echo "No fs : `basename $pkg`" \
   1.388 +							>> $DB_DIR/corrupted
   1.389 +					fi
   1.390 +				else
   1.391 +					zcat fs.cpio.gz | cpio -id 2>/dev/null
   1.392 +					files=`find fs -type f`
   1.393 +					if [ -z "$files" ]; then
   1.394 +						echo "Empty : `basename $pkg`"
   1.395 +						if [ -f $LOG_DIR/$PACKAGE.log ]; then
   1.396 +							echo "Empty : `basename $pkg` <a href=\"log.php?package=$PACKAGE\">Log</a>" \
   1.397 +								>> $DB_DIR/corrupted
   1.398 +						else
   1.399 +							echo "No fs : `basename $pkg`" \
   1.400 +							>> $DB_DIR/corrupted
   1.401 +						fi
   1.402 +					fi
   1.403 +				fi
   1.404 +			fi
   1.405 +			cd .. && rm -rf $tmp
   1.406 +		fi
   1.407 +	done
   1.408 +	packages_summary_update
   1.409 +	echo ""
   1.410 +}
   1.411 +
   1.412 +case "$1" in
   1.413 +	list-pkgs)
   1.414 +		# List last cooked packages.
   1.415 +		list_packages ;;
   1.416 +	report)
   1.417 +		# Run in report mode. If an update is done we must cook-all to
   1.418 +		# rebuild all updated packages.
   1.419 +		[ "$2" == "--update" ] && update_wok $@ || echo ""
   1.420 +		check_wok $@
   1.421 +		test_packages $@
   1.422 +		show_report ;;
   1.423 +	cook-all)
   1.424 +		# Update wok, gen report (with cooklist), cook all packages, test,
   1.425 +		# clean, gen new report and lists.
   1.426 +		update_wok $@
   1.427 +		check_wok $@
   1.428 +		cook_install
   1.429 +		test_packages $@
   1.430 +		clean_up $@
   1.431 +		check_wok $@
   1.432 +		echo "(generating lists)" > $DB_DIR/running
   1.433 +		tazwok gen-list --text
   1.434 +		echo "" ;;
   1.435 +	cook-commit)
   1.436 +		# Cook all packages affected by the last commits in the wok.
   1.437 +		update_wok $@
   1.438 +		check_commit
   1.439 +		cook_install
   1.440 +		test_packages $@
   1.441 +		clean_up $@
   1.442 +		check_wok $@
   1.443 +		echo "(generating lists)" > $DB_DIR/running
   1.444 +		tazwok gen-list --text
   1.445 +		echo "" ;;
   1.446 +	block)
   1.447 +		# Add a pkg name to the list of blocked packages.
   1.448 +		echo ""
   1.449 +		if grep -qs "^$2$" $DB_DIR/blocked; then
   1.450 +			echo -e "$2 is already in the blocked packages list."
   1.451 +		else
   1.452 +			echo -n "Adding $2 to     : $DB_DIR/blocked... "
   1.453 +			echo "$2" >> $DB_DIR/blocked && echo "Done"
   1.454 +			if grep -q "^$2$" $DB_DIR/cooklist; then
   1.455 +				echo -n "Removing $2 from : $DB_DIR/cooklist... "
   1.456 +				sed -i /"^$2$"/d $DB_DIR/cooklist && echo "Done"
   1.457 +				packages_summary_update
   1.458 +			fi
   1.459 +		fi
   1.460 +		blocked_urls
   1.461 +		echo "" ;;
   1.462 +	unblock)
   1.463 +		# Remove a pkg name from the list of blocked packages.
   1.464 +		echo ""
   1.465 +		if grep -qs "^$2$" $DB_DIR/blocked; then
   1.466 +			echo -n "Removing $2 from : $DB_DIR/blocked... "
   1.467 +			sed -i /"^$2$"/d $DB_DIR/blocked
   1.468 +			sed -i '/^$/d' $DB_DIR/blocked && echo "Done"
   1.469 +			echo -n "Adding $2 to     : $DB_DIR/cooklist... "
   1.470 +			echo "$2" >> $DB_DIR/cooklist && echo "Done"
   1.471 +			packages_summary_update
   1.472 +		else
   1.473 +			echo -e "$2 is not in the blocked packages list."
   1.474 +		fi
   1.475 +		blocked_urls
   1.476 +		echo "" ;;
   1.477 +	test-pkgs)
   1.478 +		# Start a test suite on all builded packages.
   1.479 +		test_packages $@ ;;
   1.480 +	test-suite)
   1.481 +		# Start a test suite on all builded package and the wok using
   1.482 +		# the great 'tazwok check'.
   1.483 +		#
   1.484 +		# test_packages > $LOG_DIR/test-suite.log
   1.485 +		# tazwok check >> $LOG_DIR/test-suite.log
   1.486 +		#
   1.487 +		test_packages $@
   1.488 +		script -c "tazwok check" $LOG_DIR/test-suite.log ;;
   1.489 +	clean-up)
   1.490 +		# Remove old packages and generate new packages lists.
   1.491 +		update_wok $@
   1.492 +		clean_up $@
   1.493 +		packages_summary_update
   1.494 +		[ "$2" != "--dry-run" ] && tazwok gen-list --text ;;
   1.495 +	clean-log)
   1.496 +		logs=`ls $LOG_DIR | wc -l`
   1.497 +		echo -n "Cleaning: $LOG_DIR... "
   1.498 +		rm -rf $LOG_DIR/*
   1.499 +		echo "$logs log removed" ;;
   1.500 +	*)
   1.501 +		usage ;;
   1.502 +esac
   1.503 +
   1.504 +echo "" > $DB_DIR/running
   1.505 +rm -f $LOCK_FILE
   1.506 +
   1.507 +exit 0