wok view tazbb/stuff/tazbb @ rev 4913

putty: update depends
author Paul Issott <paul@slitaz.org>
date Sat Feb 13 20:16:32 2010 +0000 (2010-02-13)
parents 59b97b3fe2f7
children 1941b0214dd4
line source
1 #!/bin/sh
2 # Tazbb - SliTaz Build Bot.
3 # System wide config file: /etc/slitaz/tazbb.conf
4 #
5 # Tazbb is a tool to automate package building, it can be run manually
6 # or via a cron job. On SliTaz build host, tazbb is run in a chroot env.
7 #
8 # (c) 2009 SliTaz GNU/Linux project - GNU gpl v3
9 #
11 # Include config file or exit if no file found.
12 if [ -f "./tazbb.conf" ]; then
13 . ./tazbb.conf
14 elif [ -f "/etc/slitaz/tazbb.conf" ]; then
15 . /etc/slitaz/tazbb.conf
16 else
17 echo -e "\nNo config file found: tazbb.conf...\n" && exit 0
18 fi
20 # Tazbb is only for root.
21 if test $(id -u) != 0 ; then
22 echo -e "\nYou must be root to run: `basename $0`.\n" && exit 0
23 fi
25 # Let tazbb finish is work and make sure needed files exist.
26 if [ -f $LOCK_FILE ]; then
27 case $1 in
28 usage|list-*|*block)
29 continue ;;
30 *)
31 echo -e "\nTazbb is already running and locked...\n"
32 exit 0 ;;
33 esac
34 else
35 mkdir -p $DB_DIR $LOG_DIR
36 touch $LOCK_FILE $DB_DIR/blocked
37 fi
39 # Set KERNEL variable
40 if [ -s $BUILD_WOK/linux/receipt ]; then
41 . $BUILD_WOK/linux/receipt
42 KERNEL=$VERSION
43 fi
45 usage()
46 {
47 echo -e "\nSliTaz developers and build host tool\n
48 \033[1mUsage: \033[0m `basename $0` [command] [--option]
49 \033[1mCommands: \033[0m\n
50 usage Print this short usage and command list.
51 list-pkgs List last cooked packages with date.
52 report Run in report mode and dont cook anything [--verbose].
53 cook Cook, install and log a single package build.
54 cook-all Cook all missing, modified or unbuilt packages.
55 cook-commit Cook all packages affected by a commit in the last update.
56 test-pkgs Execute a test suite on all packages [--verbose].
57 [un]block Block or unblock a package to skip or enable building.
58 mail Send mail to package maintainer with tazbbmail.
59 clean-up Remove old packages [--verbose|--dry-run].
60 clean-log Remove all generated build log files.\n"
61 }
63 status()
64 {
65 local CHECK=$?
66 echo -en "\033[70G"
67 if [ $CHECK = 0 ]; then
68 echo "Done"
69 else
70 echo "Failed"
71 fi
72 return $CHECK
73 }
75 top_summary()
76 {
77 cat > $DB_DIR/summary << _EOT_
78 Update : `date`
79 Revision : $NEW_REV (<a href="$HG_URL/log/$NEW_REV">changelog</a>)
80 _EOT_
81 }
83 packages_summary()
84 {
85 if ! grep -q "^Packages" $DB_DIR/summary; then
86 cat >> $DB_DIR/summary << _EOT_
87 Packages : `ls $BUILD_WOK | wc -l` in the wok, `cat $DB_DIR/cooklist | wc -l` to cook, \
88 `cat $DB_DIR/blocked | wc -l` blocked, `cat $DB_DIR/corrupted | wc -l` corrupted
89 _EOT_
90 fi
91 }
93 packages_summary_update()
94 {
95 sed -i s/"[0-9]* in the wok"/"`ls $BUILD_WOK | wc -l` in the wok"/ \
96 $DB_DIR/summary
97 sed -i s/"[0-9]* to cook"/"`cat $DB_DIR/cooklist | wc -l` to cook"/ \
98 $DB_DIR/summary
99 sed -i s/"[0-9]* blocked"/"`cat $DB_DIR/blocked | wc -l` blocked"/ \
100 $DB_DIR/summary
101 sed -i s/"[0-9]* corrupted"/"`cat $DB_DIR/corrupted | wc -l` corrupted"/ \
102 $DB_DIR/summary
103 }
105 list_packages()
106 {
107 cd $PACKAGES_REPOSITORY
108 ls -1t *.tazpkg | head -20 | \
109 while read file
110 do
111 echo -n $(stat -c '%y' $PACKAGES_REPOSITORY/$file | cut -d. -f1)
112 echo " $file"
113 done
114 }
116 show_report()
117 {
118 echo "Cooklist"
119 echo "================================================================================"
120 cat $DB_DIR/cooklist && echo ""
121 echo "Packlist"
122 echo "================================================================================"
123 cat $DB_DIR/packlist && echo ""
124 echo "Blocked"
125 echo "================================================================================"
126 cat $DB_DIR/blocked && echo ""
127 echo ""
128 }
130 # URL encoding
131 escape()
132 {
133 echo $1 | sed -e 's/+/%2B/g' -e 's|/|%2F|g' -e 's/:/%3A/g'
134 }
136 update_wok()
137 {
138 local forced
139 forced=""
140 echo ""
141 echo "(updating flavors)" > $DB_DIR/running
142 cd $HG_FLAVORS
143 LAST_REV=`hg head --template '{rev}\n'`
144 hg pull && hg update
145 NEW_REV=`hg head --template '{rev}\n'`
146 if [ "$NEW_REV" != "$LAST_REV" ]; then
147 size=`du -sh $HG_FLAVORS | awk '{ print $1 }'`
148 echo -n "Copying Hg flavors to the build flavors ($size)... "
149 cp -a $HG_FLAVORS/* $BUILD_FLAVORS
150 cp -a $HG_FLAVORS/.hg $BUILD_FLAVORS
151 echo -e "Done\n"
152 forced="yes"
153 fi
154 echo "(updating wok)" > $DB_DIR/running
155 cd $HG_WOK
156 LAST_REV=`hg head --template '{rev}\n'`
157 hg pull && hg update
158 NEW_REV=`hg head --template '{rev}\n'`
159 # Gen a new summary and link last revision for the web interface.
160 echo -e "\nHg wok : $HG_WOK ($NEW_REV)"
161 echo -e "Build wok : $BUILD_WOK ($LAST_REV)\n"
162 top_summary
163 # Copy Hg wok if new revision or exit to stop process since nothing
164 # have change (--forced can be used).
165 if [ "$NEW_REV" != "$LAST_REV" ]; then
166 size=`du -sh $HG_WOK | awk '{ print $1 }'`
167 echo -n "Copying Hg wok to the build wok ($size)... "
168 #rsync -r -n -t $HG_WOK/ $BUILD_WOK/
169 cp -a $HG_WOK/* $BUILD_WOK
170 cp -a $HG_WOK/.hg $BUILD_WOK
171 echo -e "Done\n"
172 else
173 if [ "$1" = "cook-all" ] || [ "$1" = "cook-commit" ]; then
174 if [ "$2" != "--forced" -a -z "$forced" ]; then
175 echo -e "Nothing to cook...\n"
176 packages_summary
177 rm -f $LOCK_FILE && exit 0
178 fi
179 fi
180 fi
181 }
183 # Running 'tazbb report' should not pack anything and --verbose option
184 # can be used to display more messages.
185 check_flavors()
186 {
187 # Clean up last results.
188 rm -f $DB_DIR/packlist && touch $DB_DIR/packlist
189 echo ""
190 echo "Checking all files in: $HG_FLAVORS"
191 echo "================================================================================"
192 echo "(checking flavors)" > $DB_DIR/running
193 for flavor in $(cd $HG_FLAVORS ; ls)
194 do
195 [ "$2" = "--verbose" ] && echo "Flavor : $flavor"
196 if [ ! -s $PACKAGES_REPOSITORY/$flavor.flavor ]; then
197 echo $flavor >> $DB_DIR/packlist
198 [ "$1" = "report" ] && echo "Missing : $flavor"
199 echo "Missing flavor : $flavor" >> $DB_DIR/report
200 continue
201 fi
202 for i in $(find $HG_FLAVORS/$flavor -type f); do
203 [ $PACKAGES_REPOSITORY/$flavor.flavor -nt \
204 $i ] && continue
205 echo $flavor >> $DB_DIR/packlist
206 [ "$1" = "report" ] && echo "Refresh : $flavor for $i"
207 echo "Refresh flavor : $flavor" >> $DB_DIR/report
208 continue 2
209 done
210 [ -s $HG_FLAVORS/$flavor/packages.list ] &&
211 for i in $(cat $HG_FLAVORS/$flavor/packages.list); do
212 if [ ! -d $BUILD_WOK/$i ]; then
213 [ "$1" = "report" ] &&
214 echo "Fix flavor for $i: $flavor"
215 echo "Fix flavor for $i: $flavor" >> $DB_DIR/report
216 continue
217 fi
218 [ $PACKAGES_REPOSITORY/$flavor.flavor -nt \
219 $BUILD_WOK/$i/taz ] && continue
220 echo $flavor >> $DB_DIR/packlist
221 [ "$1" = "report" ] && echo "Repack : $flavor for $i"
222 echo "Repack flavor : $flavor" >> $DB_DIR/report
223 continue 2
224 done
225 done
226 }
228 # Here we pack all flavors found in the packlist.
229 pack_flavors()
230 {
231 [ -s $DB_DIR/packlist ] || return
232 [ $PACKAGES_REPOSITORY/packages.list -nt /var/lib/tazpkg/packages.list ] &&
233 cp -a $PACKAGES_REPOSITORY/packages.list /var/lib/tazpkg/packages.list
234 cd $PACKAGES_REPOSITORY
235 for flavor in $(cat $DB_DIR/packlist)
236 do
237 tazlito pack-flavor $flavor
238 # Remove flavor from the packlist and empty lines for HTML <pre>.
239 sed -i /"^$flavor$"/d $DB_DIR/packlist
240 sed -i '/^$/d' $DB_DIR/packlist
241 done
242 cd - > /dev/null
243 }
245 # Running 'tazbb report' should not cook anything and --verbose option
246 # can be used to display more messages.
247 check_wok()
248 {
249 # Clean up last results.
250 rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
251 rm -f $DB_DIR/report && touch $DB_DIR/report
252 rm -f $DB_DIR/unbuilt && touch $DB_DIR/unbuilt
253 echo "Checking all files in: $HG_WOK"
254 echo "================================================================================"
255 echo "(checking wok)" > $DB_DIR/running
256 for pkg in $HG_WOK/*
257 do
258 EXTRAVERSION=""
259 WANTED=""
260 . $pkg/receipt
261 [ "$2" = "--verbose" ] && echo "Package : $PACKAGE"
262 # Skip blocked packages.
263 if grep -qs "^$PACKAGE$" $DB_DIR/blocked; then
264 echo "Blocked : $PACKAGE ($VERSION)" && continue
265 fi
267 # Some packages may compute VERSION at cook time (bristuff)
268 if grep -q ^get_version $pkg/receipt; then
269 . $BUILD_WOK/$PACKAGE/taz/*/receipt
270 fi
272 # First check if package exit. Package naming _must_ be in the form of:
273 # $PACKAGE-$VERSION or $PACKAGE-${VERSION}$EXTRAVERSION (Kernel string).
274 if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then
275 [ -z "$EXTRAVERSION" ] && EXTRAVERSION="_$KERNEL"
276 if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg ]; then
277 [ "$1" = "report" ] && echo "Missing : $PACKAGE ($VERSION)"
278 echo "Missing : $PACKAGE ($VERSION)" >> $DB_DIR/report
279 echo "$PACKAGE" >> $DB_DIR/cooklist
280 fi
281 else
282 # Check if package is up-to-date.
283 PKG_DATE=`date -u -r $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg '+%Y%m%d%H%M'`
284 for file in `find $pkg -type f`
285 do
286 FILE_DATE=`date -u -r $file '+%Y%m%d%H%M'`
287 [ "$2" = "--verbose" ] && echo " -> Checking: $file"
288 if [ "$FILE_DATE" -gt "$PKG_DATE" ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
289 [ "$1" = "report" ] && echo "Refresh : $PACKAGE ($VERSION)"
290 echo "Refresh : $PACKAGE ($VERSION)" >> $DB_DIR/report
291 echo "$PACKAGE" >> $DB_DIR/cooklist
292 fi
293 done
294 fi
295 # Now check if package is built and not already in the list.
296 if [ ! -d $BUILD_WOK/$PACKAGE/taz ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
297 [ "$1" = "report" ] && echo "Unbuilt : $PACKAGE ($VERSION)"
298 echo "Unbuilt : $PACKAGE ($VERSION)" >> $DB_DIR/report
299 echo "$PACKAGE" >> $DB_DIR/cooklist
300 fi
301 # Rebuild unbuilt packages list with link to log file. This list
302 # is also generated by cook_inslall to have real time stats.
303 if [ ! -d $BUILD_WOK/$PACKAGE/taz ]; then
304 echo "<a href=\"log.php?package=$(escape $PACKAGE)\">$PACKAGE</a>" \
305 >> $DB_DIR/unbuilt
306 fi
307 done
308 packages_summary
309 }
311 # Create a new cooklist and summary (dont modify report) so 'tazbb cook-commit'
312 # can cook last changes.
313 check_commit()
314 {
315 echo "(checking commit)" > $DB_DIR/running
316 cd $HG_WOK
317 # Clean up last results.
318 rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
319 # Get the name of modified packages by the revision range. +1 last
320 # commit was build by the previous build.
321 LAST_REV=$(($LAST_REV+1))
322 echo -e "Will cook from revision $LAST_REV to $NEW_REV\n"
323 for file in `hg log --rev=$LAST_REV:$NEW_REV --template '{files}\n'`
324 do
325 pkg=`echo $file | cut -d "/" -f 1`
326 if ! grep -q ^$pkg$ $DB_DIR/cooklist; then
327 . $pkg/receipt
328 echo "Commit : $PACKAGE ($VERSION)" >> $DB_DIR/report
329 echo "$PACKAGE" >> $DB_DIR/cooklist
330 fi
331 done
332 packages_summary
333 }
335 # Cook one package
336 cook_package()
337 {
338 EXTRAVERSION=""
339 DEPENDS=""
340 BUILD_DEPENDS=""
341 SOURCE=""
342 WANTED=""
343 echo "(cooking <a href=\"log.php?package=$(escape $pkg)\">$pkg</a>)" > $DB_DIR/running
344 tazwok clean $pkg
345 script -c "echo 'install' | tazwok cook $pkg" $LOG_DIR/$pkg.log
346 # Install new package (important for new shared libs). Note
347 # that tests are done separatly with 'test_packages' and should
348 # be done by tazwok.
349 if [ -f $BUILD_WOK/$pkg/taz/*/receipt ]; then
350 . $BUILD_WOK/$pkg/taz/*/receipt
351 echo "(installing $PACKAGE-${VERSION}$EXTRAVERSION.tazpkg)" \
352 > $DB_DIR/running
353 yes | tazpkg install \
354 $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg \
355 --forced
356 return 0
357 fi
358 return 1
359 }
361 # Sort list according WANTED and BUILD_DEPENDS
362 sort_cook_list()
363 {
364 sort | while read pkg; do
365 echo -n "$pkg"
366 WANTED=""
367 BUILD_DEPENDS=""
368 . $BUILD_WOK/$pkg/receipt
369 MISSING=""
370 for i in $WANTED $BUILD_DEPENDS ; do
371 if [ ! -f $BUILD_WOK/$i/taz/*/receipt ]; then
372 case " $MISSING " in
373 *\ $i\ *);;
374 *) echo -n " $i";;
375 esac
376 MISSING="$MISSING $i"
377 fi
378 done
379 echo ""
380 done | awk '
381 function show(name)
382 {
383 print name;
384 got[name]++;
385 if (revdepcnt[name] > 0)
386 for (i = split(revdep[name], pkg, " "); i > 0; i--)
387 if (--depcnt[pkg[i]] == 0) show(pkg[i]);
388 }
390 {
391 if ($2 == "") show($1);
392 else {
393 depcnt[$1] = NF - 1;
394 unres = unres " " $1;
395 for (i = 2; i <= NF; i++) {
396 if (got[$i] > 0) continue;
397 revdepcnt[$i]++;
398 revdep[$i] = revdep[$i] " " $1;
399 }
400 }
401 }
402 END {
403 for (i = split(unres, pkg, " "); i > 0; i--)
404 if (depcnt[pkg[i]] > 0) print pkg[i];
405 }
406 '
407 }
409 # Here we cook all packages found in the cooklist.
410 cook_install()
411 {
412 echo "" > $DB_DIR/unbuilt
413 for pkg in `cat $DB_DIR/cooklist | sort_cook_list`
414 do
415 if ! cook_package $pkg; then
416 # Link to build log.
417 echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
418 $DB_DIR/unbuilt
419 fi
420 # Remove package from the cooklist and empty lines for HTML <pre>.
421 sed -i /"^$pkg$"/d $DB_DIR/cooklist
422 sed -i '/^$/d' $DB_DIR/cooklist
423 packages_summary_update
424 done
425 }
427 # Remove old packages in the build wok and clean pkgs repository. The
428 # Hg wok is copied into the build wok so packages removed by hg must be
429 # removed. To remove old packages in the repository we look into the
430 # build wok and dont remove unbuilt packages. Clean-up will also remove
431 # all corrupted packages.
432 clean_up()
433 {
434 touch $DB_DIR/removed
435 echo -e "\nCleaning the build wok, old and corrupted packages...\n"
436 echo "(cleaning)" > $DB_DIR/running
437 for pkg in `ls $BUILD_WOK`
438 do
439 if [ ! -d $HG_WOK/$pkg ]; then
440 case $2 in
441 --dry-run)
442 echo "Removing directory : $pkg" ;;
443 --verbose)
444 echo "Removing directory : $pkg"
445 rm -rf $BUILD_WOK/$pkg ;;
446 *)
447 rm -rf $BUILD_WOK/$pkg ;;
448 esac
449 fi
450 done
451 # Build a packages list with EXTRAVERSION so we can grep into it.
452 rm -f $DB_DIR/packaged && touch $DB_DIR/packaged
453 for receipt in $BUILD_WOK/*/taz/*/receipt
454 do
455 EXTRAVERSION=""
456 . $receipt
457 echo "$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg" >> $DB_DIR/packaged
458 done
459 for pkg in `cd $PACKAGES_REPOSITORY && ls *.tazpkg`
460 do
461 if ! grep -q "^$pkg$" $DB_DIR/packaged; then
462 case $2 in
463 --dry-run)
464 echo "Removing package : $pkg" ;;
465 --verbose)
466 echo "Removing package : $pkg"
467 echo "$pkg" >> $DB_DIR/removed
468 rm -f $PACKAGES_REPOSITORY/$pkg ;;
469 *)
470 echo "$pkg" >> $DB_DIR/removed
471 rm -f $PACKAGES_REPOSITORY/$pkg ;;
472 esac
473 fi
474 done
475 # Remove all corrupted packages
476 for pkg in `cat $DB_DIR/corrupted | awk '{ print $3 }'`
477 do
478 case $2 in
479 --dry-run)
480 echo "Removing corrupted: $pkg" ;;
481 --verbose)
482 echo "Removing corrupted: $pkg"
483 echo "$pkg" >> $DB_DIR/removed
484 rm -rf $PACKAGES_REPOSITORY/$pkg ;;
485 *)
486 echo "$pkg" >> $DB_DIR/removed
487 rm -rf $PACKAGES_REPOSITORY/$pkg ;;
488 esac
489 done
490 echo ""
491 # Keep the 20 last removed packages list.
492 cat $DB_DIR/removed | tail -n 20 > /tmp/removed.tail
493 mv -f /tmp/removed.tail $DB_DIR/removed
494 }
496 blocked_urls()
497 {
498 rm -f $DB_DIR/blocked.urls
499 for pkg in `cat $DB_DIR/blocked`
500 do
501 if [ -f $LOG_DIR/$pkg.log ]; then
502 echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
503 $DB_DIR/blocked.urls
504 else
505 echo "$pkg" >> $DB_DIR/blocked.urls
506 fi
507 done
508 }
510 # 4k, not a meta or a get-* package and no files = buggy package
511 test_packages()
512 {
513 echo -e "\nTesting all packages in: $PACKAGES_REPOSITORY"
514 echo "================================================================================"
515 echo "(testing packages)" > $DB_DIR/running
516 rm -f $DB_DIR/corrupted && touch $DB_DIR/corrupted
517 for pkg in $PACKAGES_REPOSITORY/*.tazpkg
518 do
519 tmp=/tmp/bb-test.$$
520 CATEGORY=""
521 if du $pkg | grep -qw '^4' && ! echo `basename $pkg` | grep -q '^get-'; then
522 mkdir -p $tmp && cd $tmp
523 cpio -i receipt >/dev/null 2>&1 < $pkg
524 . ./receipt
525 if [ "$CATEGORY" != "meta" ]; then
526 [ "$2" = "--verbose" ] && echo "Testing: $PACKAGE"
527 cpio -i fs.cpio.gz fs.cpio.lzma >/dev/null 2>&1 < $pkg
528 if [ ! -f fs.cpio.gz -a ! -f fs.cpio.lzma ]; then
529 echo "Missing filesystem `basename $pkg`"
530 if [ -f $LOG_DIR/$PACKAGE.log ];then
531 echo "Missing filesystem `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
532 >> $DB_DIR/corrupted
533 else
534 echo "Missing filesystem `basename $pkg`" \
535 >> $DB_DIR/corrupted
536 fi
537 else
538 ( zcat fs.cpio.gz 2> /dev/null || \
539 unlzma -c fs.cpio.lzma ) | \
540 cpio -id >/dev/null 2>&1
541 files=`find fs -type f -o -type l`
542 if [ -z "$files" ]; then
543 echo "Empty filesystem `basename $pkg`"
544 if [ -f $LOG_DIR/$PACKAGE.log ]; then
545 echo "Empty filesystem `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
546 >> $DB_DIR/corrupted
547 else
548 echo "Empty filesystem `basename $pkg`" \
549 >> $DB_DIR/corrupted
550 fi
551 fi
552 fi
553 fi
554 cd .. && rm -rf $tmp
555 fi
556 done
557 packages_summary_update
558 echo ""
559 }
561 # Generate flavor list
562 gen_flavor_list()
563 {
564 cd $PACKAGES_REPOSITORY
565 noheader=""
566 for i in *.flavor; do
567 tazlito show-flavor $i --brief $noheader
568 noheader="--noheader"
569 done > flavors.list
570 cd - > /dev/null
571 }
573 case "$1" in
574 list-pkgs)
575 # List last cooked packages.
576 list_packages ;;
577 report)
578 # Run in report mode. If an update is done we must cook-all to
579 # rebuild all updated packages.
580 [ "$2" == "--update" ] && update_wok $@ || echo ""
581 check_wok $@
582 check_flavors $@
583 test_packages $@
584 show_report ;;
585 cook)
586 # Cook, install and log a single package build.
587 if [ -z $2 ]; then
588 echo "Please specify a package on the command line."
589 rm -f $LOCK_FILE && exit 0
590 fi
591 pkg=$2
592 echo "Starting to cook and install: $pkg"
593 if ! cook_package $pkg; then
594 echo "Unable to install: $pkg"
595 fi ;;
596 cook-all)
597 # Update wok, gen report (with cooklist), cook all packages, test,
598 # clean, gen new report and lists.
599 update_wok $@
600 check_wok $@
601 cook_install
602 test_packages $@
603 clean_up $@
604 check_wok $@
605 echo "(generating lists)" > $DB_DIR/running
606 tazwok gen-list --text
607 check_flavors $@
608 pack_flavors
609 gen_flavor_list
610 echo "" ;;
611 cook-commit)
612 # Cook all packages affected by the last commits in the wok.
613 # Clean up is done only by cook-all to avoid rebuild of corrupted
614 # packages on each commit.
615 update_wok $@
616 check_commit
617 cook_install
618 test_packages $@
619 check_wok $@
620 echo "(generating lists)" > $DB_DIR/running
621 tazwok gen-list --text
622 check_flavors $@
623 pack_flavors
624 gen_flavor_list
625 echo "" ;;
626 block)
627 # Add a pkg name to the list of blocked packages.
628 echo ""
629 if grep -qs "^$2$" $DB_DIR/blocked; then
630 echo -e "$2 is already in the blocked packages list."
631 else
632 echo -n "Adding $2 to : $DB_DIR/blocked... "
633 echo "$2" >> $DB_DIR/blocked && echo "Done"
634 if grep -q "^$2$" $DB_DIR/cooklist; then
635 echo -n "Removing $2 from : $DB_DIR/cooklist... "
636 sed -i /"^$2$"/d $DB_DIR/cooklist && echo "Done"
637 packages_summary_update
638 fi
639 fi
640 blocked_urls
641 echo "" ;;
642 unblock)
643 # Remove a pkg name from the list of blocked packages.
644 echo ""
645 if grep -qs "^$2$" $DB_DIR/blocked; then
646 echo -n "Removing $2 from : $DB_DIR/blocked... "
647 sed -i /"^$2$"/d $DB_DIR/blocked
648 sed -i '/^$/d' $DB_DIR/blocked && echo "Done"
649 echo -n "Adding $2 to : $DB_DIR/cooklist... "
650 echo "$2" >> $DB_DIR/cooklist && echo "Done"
651 packages_summary_update
652 else
653 echo -e "$2 is not in the blocked packages list."
654 fi
655 blocked_urls
656 echo "" ;;
657 test-pkgs)
658 # Start a test suite on all builded packages.
659 test_packages $@ ;;
660 test-suite)
661 # Start a test suite on all builded package and the wok using
662 # the great 'tazwok check'.
663 #
664 # test_packages > $LOG_DIR/test-suite.log
665 # tazwok check >> $LOG_DIR/test-suite.log
666 #
667 test_packages $@
668 script -c "tazwok check" $LOG_DIR/test-suite.log ;;
669 mail)
670 # Tazbbmail Pythom script wrapper.
671 PACKAGE=$2
672 tazbbmail $PACKAGE ;;
673 clean-up)
674 # Remove old packages and generate new packages lists.
675 update_wok $@
676 clean_up $@
677 packages_summary_update
678 [ "$2" != "--dry-run" ] && tazwok gen-list --text ;;
679 clean-log)
680 logs=`ls $LOG_DIR | wc -l`
681 echo -n "Cleaning: $LOG_DIR... "
682 rm -rf $LOG_DIR/*
683 echo "$logs log removed" ;;
684 *)
685 usage ;;
686 esac
688 echo "" > $DB_DIR/running
689 rm -f $LOCK_FILE
691 exit 0