wok view tazbb/stuff/tazbb @ rev 4864

Add: pidgin-libnotify
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Feb 04 22:20:24 2010 +0100 (2010-02-04)
parents 4911917bb50f
children 241067a9c293
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"
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 [ $PACKAGES_REPOSITORY/$flavor.flavor -nt \
213 $BUILD_WOK/$i/taz ] && continue
214 echo $flavor >> $DB_DIR/packlist
215 [ "$1" = "report" ] && echo "Repack : $flavor"
216 echo "Repack flavor : $flavor" >> $DB_DIR/report
217 continue 2
218 done
219 done
220 }
222 # Here we pack all flavors found in the packlist.
223 pack_flavors()
224 {
225 [ -s $DB_DIR/packlist ] || return
226 [ $PACKAGES_REPOSITORY/packages.list -nt /var/lib/tazpkg/packages.list ] &&
227 cp -a $PACKAGES_REPOSITORY/packages.list /var/lib/tazpkg/packages.list
228 cd $PACKAGES_REPOSITORY
229 for flavor in $(cat $DB_DIR/packlist)
230 do
231 tazlito pack-flavor $flavor
232 # Remove flavor from the packlist and empty lines for HTML <pre>.
233 sed -i /"^$flavor$"/d $DB_DIR/packlist
234 sed -i '/^$/d' $DB_DIR/packlist
235 done
236 cd - > /dev/null
237 }
239 # Running 'tazbb report' should not cook anything and --verbose option
240 # can be used to display more messages.
241 check_wok()
242 {
243 # Clean up last results.
244 rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
245 rm -f $DB_DIR/report && touch $DB_DIR/report
246 rm -f $DB_DIR/unbuilt && touch $DB_DIR/unbuilt
247 echo "Checking all files in: $HG_WOK"
248 echo "================================================================================"
249 echo "(checking wok)" > $DB_DIR/running
250 for pkg in $HG_WOK/*
251 do
252 EXTRAVERSION=""
253 WANTED=""
254 . $pkg/receipt
255 [ "$2" = "--verbose" ] && echo "Package : $PACKAGE"
256 # Skip blocked packages.
257 if grep -qs "^$PACKAGE$" $DB_DIR/blocked; then
258 echo "Blocked : $PACKAGE ($VERSION)" && continue
259 fi
261 # Some packages may compute VERSION at cook time (bristuff)
262 if grep -q ^get_version $pkg/receipt; then
263 . $BUILD_WOK/$PACKAGE/taz/*/receipt
264 fi
266 # First check if package exit. Package naming _must_ be in the form of:
267 # $PACKAGE-$VERSION or $PACKAGE-${VERSION}$EXTRAVERSION (Kernel string).
268 if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then
269 [ -z "$EXTRAVERSION" ] && EXTRAVERSION="_$KERNEL"
270 if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg ]; then
271 [ "$1" = "report" ] && echo "Missing : $PACKAGE ($VERSION)"
272 echo "Missing : $PACKAGE ($VERSION)" >> $DB_DIR/report
273 echo "$PACKAGE" >> $DB_DIR/cooklist
274 fi
275 else
276 # Check if package is up-to-date.
277 PKG_DATE=`date -u -r $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg '+%Y%m%d%H%M'`
278 for file in `find $pkg -type f`
279 do
280 FILE_DATE=`date -u -r $file '+%Y%m%d%H%M'`
281 [ "$2" = "--verbose" ] && echo " -> Checking: $file"
282 if [ "$FILE_DATE" -gt "$PKG_DATE" ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
283 [ "$1" = "report" ] && echo "Refresh : $PACKAGE ($VERSION)"
284 echo "Refresh : $PACKAGE ($VERSION)" >> $DB_DIR/report
285 echo "$PACKAGE" >> $DB_DIR/cooklist
286 fi
287 done
288 fi
289 # Now check if package is built and not already in the list.
290 if [ ! -d $BUILD_WOK/$PACKAGE/taz ] && ! grep -q $PACKAGE $DB_DIR/cooklist; then
291 [ "$1" = "report" ] && echo "Unbuilt : $PACKAGE ($VERSION)"
292 echo "Unbuilt : $PACKAGE ($VERSION)" >> $DB_DIR/report
293 echo "$PACKAGE" >> $DB_DIR/cooklist
294 fi
295 # Rebuild unbuilt packages list with link to log file. This list
296 # is also generated by cook_inslall to have real time stats.
297 if [ ! -d $BUILD_WOK/$PACKAGE/taz ]; then
298 echo "<a href=\"log.php?package=$(escape $PACKAGE)\">$PACKAGE</a>" \
299 >> $DB_DIR/unbuilt
300 fi
301 done
302 packages_summary
303 }
305 # Create a new cooklist and summary (dont modify report) so 'tazbb cook-commit'
306 # can cook last changes.
307 check_commit()
308 {
309 echo "(checking commit)" > $DB_DIR/running
310 cd $HG_WOK
311 # Clean up last results.
312 rm -f $DB_DIR/cooklist && touch $DB_DIR/cooklist
313 # Get the name of modified packages by the revision range. +1 last
314 # commit was build by the previous build.
315 LAST_REV=$(($LAST_REV+1))
316 echo -e "Will cook from revision $LAST_REV to $NEW_REV\n"
317 for file in `hg log --rev=$LAST_REV:$NEW_REV --template '{files}\n'`
318 do
319 pkg=`echo $file | cut -d "/" -f 1`
320 if ! grep -q ^$pkg$ $DB_DIR/cooklist; then
321 . $pkg/receipt
322 echo "Commit : $PACKAGE ($VERSION)" >> $DB_DIR/report
323 echo "$PACKAGE" >> $DB_DIR/cooklist
324 fi
325 done
326 packages_summary
327 }
329 # Cook one package
330 cook_package()
331 {
332 EXTRAVERSION=""
333 DEPENDS=""
334 BUILD_DEPENDS=""
335 SOURCE=""
336 WANTED=""
337 echo "(cooking <a href=\"log.php?package=$(escape $pkg)\">$pkg</a>)" > $DB_DIR/running
338 tazwok clean $pkg
339 script -c "echo 'install' | tazwok cook $pkg" $LOG_DIR/$pkg.log
340 # Install new package (important for new shared libs). Note
341 # that tests are done separatly with 'test_packages' and should
342 # be done by tazwok.
343 if [ -f $BUILD_WOK/$pkg/taz/*/receipt ]; then
344 . $BUILD_WOK/$pkg/taz/*/receipt
345 echo "(installing $PACKAGE-${VERSION}$EXTRAVERSION.tazpkg)" \
346 > $DB_DIR/running
347 yes | tazpkg install \
348 $PACKAGES_REPOSITORY/$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg \
349 --forced
350 return 0
351 fi
352 return 1
353 }
355 # Sort list according WANTED and BUILD_DEPENDS
356 sort_cook_list()
357 {
358 sort | while read pkg; do
359 echo -n "$pkg"
360 WANTED=""
361 BUILD_DEPENDS=""
362 . $BUILD_WOK/$pkg/receipt
363 MISSING=""
364 for i in $WANTED $BUILD_DEPENDS ; do
365 if [ ! -f $BUILD_WOK/$i/taz/*/receipt ]; then
366 case " $MISSING " in
367 *\ $i\ *);;
368 *) echo -n " $i";;
369 esac
370 MISSING="$MISSING $i"
371 fi
372 done
373 echo ""
374 done | awk '
375 function show(name)
376 {
377 print name;
378 got[name]++;
379 if (revdepcnt[name] > 0)
380 for (i = split(revdep[name], pkg, " "); i > 0; i--)
381 if (--depcnt[pkg[i]] == 0) show(pkg[i]);
382 }
384 {
385 if ($2 == "") show($1);
386 else {
387 depcnt[$1] = NF - 1;
388 unres = unres " " $1;
389 for (i = 2; i <= NF; i++) {
390 if (got[$i] > 0) continue;
391 revdepcnt[$i]++;
392 revdep[$i] = revdep[$i] " " $1;
393 }
394 }
395 }
396 END {
397 for (i = split(unres, pkg, " "); i > 0; i--)
398 if (depcnt[pkg[i]] > 0) print pkg[i];
399 }
400 '
401 }
403 # Here we cook all packages found in the cooklist.
404 cook_install()
405 {
406 echo "" > $DB_DIR/unbuilt
407 for pkg in `cat $DB_DIR/cooklist | sort_cook_list`
408 do
409 if ! cook_package $pkg; then
410 # Link to build log.
411 echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
412 $DB_DIR/unbuilt
413 fi
414 # Remove package from the cooklist and empty lines for HTML <pre>.
415 sed -i /"^$pkg$"/d $DB_DIR/cooklist
416 sed -i '/^$/d' $DB_DIR/cooklist
417 packages_summary_update
418 done
419 }
421 # Remove old packages in the build wok and clean pkgs repository. The
422 # Hg wok is copied into the build wok so packages removed by hg must be
423 # removed. To remove old packages in the repository we look into the
424 # build wok and dont remove unbuilt packages. Clean-up will also remove
425 # all corrupted packages.
426 clean_up()
427 {
428 touch $DB_DIR/removed
429 echo -e "\nCleaning the build wok, old and corrupted packages...\n"
430 echo "(cleaning)" > $DB_DIR/running
431 for pkg in `ls $BUILD_WOK`
432 do
433 if [ ! -d $HG_WOK/$pkg ]; then
434 case $2 in
435 --dry-run)
436 echo "Removing directory : $pkg" ;;
437 --verbose)
438 echo "Removing directory : $pkg"
439 rm -rf $BUILD_WOK/$pkg ;;
440 *)
441 rm -rf $BUILD_WOK/$pkg ;;
442 esac
443 fi
444 done
445 # Build a packages list with EXTRAVERSION so we can grep into it.
446 rm -f $DB_DIR/packaged && touch $DB_DIR/packaged
447 for receipt in $BUILD_WOK/*/taz/*/receipt
448 do
449 EXTRAVERSION=""
450 . $receipt
451 echo "$PACKAGE-${VERSION}$EXTRAVERSION.tazpkg" >> $DB_DIR/packaged
452 done
453 for pkg in `cd $PACKAGES_REPOSITORY && ls *.tazpkg`
454 do
455 if ! grep -q "^$pkg$" $DB_DIR/packaged; then
456 case $2 in
457 --dry-run)
458 echo "Removing package : $pkg" ;;
459 --verbose)
460 echo "Removing package : $pkg"
461 echo "$pkg" >> $DB_DIR/removed
462 rm -f $PACKAGES_REPOSITORY/$pkg ;;
463 *)
464 echo "$pkg" >> $DB_DIR/removed
465 rm -f $PACKAGES_REPOSITORY/$pkg ;;
466 esac
467 fi
468 done
469 # Remove all corrupted packages
470 for pkg in `cat $DB_DIR/corrupted | awk '{ print $3 }'`
471 do
472 case $2 in
473 --dry-run)
474 echo "Removing corrupted: $pkg" ;;
475 --verbose)
476 echo "Removing corrupted: $pkg"
477 echo "$pkg" >> $DB_DIR/removed
478 rm -rf $PACKAGES_REPOSITORY/$pkg ;;
479 *)
480 echo "$pkg" >> $DB_DIR/removed
481 rm -rf $PACKAGES_REPOSITORY/$pkg ;;
482 esac
483 done
484 echo ""
485 # Keep the 20 last removed packages list.
486 cat $DB_DIR/removed | tail -n 20 > /tmp/removed.tail
487 mv -f /tmp/removed.tail $DB_DIR/removed
488 }
490 blocked_urls()
491 {
492 rm -f $DB_DIR/blocked.urls
493 for pkg in `cat $DB_DIR/blocked`
494 do
495 if [ -f $LOG_DIR/$pkg.log ]; then
496 echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
497 $DB_DIR/blocked.urls
498 else
499 echo "$pkg" >> $DB_DIR/blocked.urls
500 fi
501 done
502 }
504 # 4k, not a meta or a get-* package and no files = buggy package
505 test_packages()
506 {
507 echo -e "\nTesting all packages in: $PACKAGES_REPOSITORY"
508 echo "================================================================================"
509 echo "(testing packages)" > $DB_DIR/running
510 rm -f $DB_DIR/corrupted && touch $DB_DIR/corrupted
511 for pkg in $PACKAGES_REPOSITORY/*.tazpkg
512 do
513 tmp=/tmp/bb-test.$$
514 CATEGORY=""
515 if du $pkg | grep -qw '^4' && ! echo `basename $pkg` | grep -q '^get-'; then
516 mkdir -p $tmp && cd $tmp
517 cpio -i receipt >/dev/null 2>&1 < $pkg
518 . ./receipt
519 if [ "$CATEGORY" != "meta" ]; then
520 [ "$2" = "--verbose" ] && echo "Testing: $PACKAGE"
521 cpio -i fs.cpio.gz fs.cpio.lzma >/dev/null 2>&1 < $pkg
522 if [ ! -f fs.cpio.gz -a ! -f fs.cpio.lzma ]; then
523 echo "Missing filesystem `basename $pkg`"
524 if [ -f $LOG_DIR/$PACKAGE.log ];then
525 echo "Missing filesystem `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
526 >> $DB_DIR/corrupted
527 else
528 echo "Missing filesystem `basename $pkg`" \
529 >> $DB_DIR/corrupted
530 fi
531 else
532 ( zcat fs.cpio.gz 2> /dev/null || \
533 unlzma -c fs.cpio.lzma ) | \
534 cpio -id >/dev/null 2>&1
535 files=`find fs -type f -o -type l`
536 if [ -z "$files" ]; then
537 echo "Empty filesystem `basename $pkg`"
538 if [ -f $LOG_DIR/$PACKAGE.log ]; then
539 echo "Empty filesystem `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
540 >> $DB_DIR/corrupted
541 else
542 echo "Empty filesystem `basename $pkg`" \
543 >> $DB_DIR/corrupted
544 fi
545 fi
546 fi
547 fi
548 cd .. && rm -rf $tmp
549 fi
550 done
551 packages_summary_update
552 echo ""
553 }
555 # Generate flavor list
556 gen_flavor_list()
557 {
558 cd $PACKAGES_REPOSITORY
559 noheader=""
560 for i in *.flavor; do
561 tazlito show-flavor $i --brief $noheader
562 noheader="--noheader"
563 done > flavors.list
564 cd - > /dev/null
565 }
567 case "$1" in
568 list-pkgs)
569 # List last cooked packages.
570 list_packages ;;
571 report)
572 # Run in report mode. If an update is done we must cook-all to
573 # rebuild all updated packages.
574 [ "$2" == "--update" ] && update_wok $@ || echo ""
575 check_wok $@
576 check_flavors $@
577 test_packages $@
578 show_report ;;
579 cook)
580 # Cook, install and log a single package build.
581 if [ -z $2 ]; then
582 echo "Please specify a package on the command line."
583 rm -f $LOCK_FILE && exit 0
584 fi
585 pkg=$2
586 echo "Starting to cook and install: $pkg"
587 if ! cook_package $pkg; then
588 echo "Unable to install: $pkg"
589 fi ;;
590 cook-all)
591 # Update wok, gen report (with cooklist), cook all packages, test,
592 # clean, gen new report and lists.
593 update_wok $@
594 check_wok $@
595 cook_install
596 test_packages $@
597 clean_up $@
598 check_wok $@
599 echo "(generating lists)" > $DB_DIR/running
600 tazwok gen-list --text
601 check_flavors $@
602 pack_flavors
603 gen_flavor_list
604 echo "" ;;
605 cook-commit)
606 # Cook all packages affected by the last commits in the wok.
607 # Clean up is done only by cook-all to avoid rebuild of corrupted
608 # packages on each commit.
609 update_wok $@
610 check_commit
611 cook_install
612 test_packages $@
613 check_wok $@
614 echo "(generating lists)" > $DB_DIR/running
615 tazwok gen-list --text
616 check_flavors $@
617 pack_flavors
618 gen_flavor_list
619 echo "" ;;
620 block)
621 # Add a pkg name to the list of blocked packages.
622 echo ""
623 if grep -qs "^$2$" $DB_DIR/blocked; then
624 echo -e "$2 is already in the blocked packages list."
625 else
626 echo -n "Adding $2 to : $DB_DIR/blocked... "
627 echo "$2" >> $DB_DIR/blocked && echo "Done"
628 if grep -q "^$2$" $DB_DIR/cooklist; then
629 echo -n "Removing $2 from : $DB_DIR/cooklist... "
630 sed -i /"^$2$"/d $DB_DIR/cooklist && echo "Done"
631 packages_summary_update
632 fi
633 fi
634 blocked_urls
635 echo "" ;;
636 unblock)
637 # Remove a pkg name from the list of blocked packages.
638 echo ""
639 if grep -qs "^$2$" $DB_DIR/blocked; then
640 echo -n "Removing $2 from : $DB_DIR/blocked... "
641 sed -i /"^$2$"/d $DB_DIR/blocked
642 sed -i '/^$/d' $DB_DIR/blocked && echo "Done"
643 echo -n "Adding $2 to : $DB_DIR/cooklist... "
644 echo "$2" >> $DB_DIR/cooklist && echo "Done"
645 packages_summary_update
646 else
647 echo -e "$2 is not in the blocked packages list."
648 fi
649 blocked_urls
650 echo "" ;;
651 test-pkgs)
652 # Start a test suite on all builded packages.
653 test_packages $@ ;;
654 test-suite)
655 # Start a test suite on all builded package and the wok using
656 # the great 'tazwok check'.
657 #
658 # test_packages > $LOG_DIR/test-suite.log
659 # tazwok check >> $LOG_DIR/test-suite.log
660 #
661 test_packages $@
662 script -c "tazwok check" $LOG_DIR/test-suite.log ;;
663 mail)
664 # Tazbbmail Pythom script wrapper.
665 PACKAGE=$2
666 tazbbmail $PACKAGE ;;
667 clean-up)
668 # Remove old packages and generate new packages lists.
669 update_wok $@
670 clean_up $@
671 packages_summary_update
672 [ "$2" != "--dry-run" ] && tazwok gen-list --text ;;
673 clean-log)
674 logs=`ls $LOG_DIR | wc -l`
675 echo -n "Cleaning: $LOG_DIR... "
676 rm -rf $LOG_DIR/*
677 echo "$logs log removed" ;;
678 *)
679 usage ;;
680 esac
682 echo "" > $DB_DIR/running
683 rm -f $LOCK_FILE
685 exit 0