wok-stable rev 4447
tazbb: generate flavors
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Nov 07 16:24:17 2009 +0100 (2009-11-07) |
parents | 233ec9b6af94 |
children | 07f545025e36 |
files | tazbb/receipt tazbb/stuff/tazbb tazbb/stuff/tazbb.conf tazbb/stuff/web/index.php |
line diff
1.1 --- a/tazbb/receipt Thu Nov 05 19:41:12 2009 +0000 1.2 +++ b/tazbb/receipt Sat Nov 07 16:24:17 2009 +0100 1.3 @@ -32,9 +32,9 @@ 1.4 cp -a $1/var/lib/tazbb/web/* $1/home/slitaz/www/bb 1.5 chown www.www $1/home/slitaz/www/bb 1.6 else 1.7 - mkdir -p $1/var/www/vhosts 1.8 - ln -s $1/var/lib/tazbb/web $1/var/www/vhosts/bb 1.9 -cat << _EOT_ 1.10 + mkdir -p $1/var/www/vhosts 1.11 + ln -s $1/var/lib/tazbb/web $1/var/www/vhosts/bb 1.12 + cat << _EOT_ 1.13 1.14 To have a Tazbb web interface on your local system, you can add a vhost 1.15 to Lighttpd (or Apache) and the hostname to /etc/hosts. Example for Lighty:
2.1 --- a/tazbb/stuff/tazbb Thu Nov 05 19:41:12 2009 +0000 2.2 +++ b/tazbb/stuff/tazbb Sat Nov 07 16:24:17 2009 +0100 2.3 @@ -118,6 +118,9 @@ 2.4 echo "Cooklist" 2.5 echo "================================================================================" 2.6 cat $DB_DIR/cooklist && echo "" 2.7 + echo "Packlist" 2.8 + echo "================================================================================" 2.9 + cat $DB_DIR/packlist && echo "" 2.10 echo "Blocked" 2.11 echo "================================================================================" 2.12 cat $DB_DIR/blocked && echo "" 2.13 @@ -132,7 +135,22 @@ 2.14 2.15 update_wok() 2.16 { 2.17 + local forced 2.18 + forced="" 2.19 echo "" 2.20 + echo "(updating flavors)" > $DB_DIR/running 2.21 + cd $HG_FLAVORS 2.22 + LAST_REV=`hg head --template '{rev}\n'` 2.23 + hg pull && hg update 2.24 + NEW_REV=`hg head --template '{rev}\n'` 2.25 + if [ "$NEW_REV" != "$LAST_REV" ]; then 2.26 + size=`du -sh $HG_FLAVORS | awk '{ print $1 }'` 2.27 + echo -n "Copying Hg flavors to the build flavors ($size)... " 2.28 + cp -a $HG_FLAVORS/* $BUILD_FLAVORS 2.29 + cp -a $HG_FLAVORS/.hg $BUILD_FLAVORS 2.30 + echo -e "Done\n" 2.31 + forced="yes" 2.32 + fi 2.33 echo "(updating wok)" > $DB_DIR/running 2.34 cd $HG_WOK 2.35 LAST_REV=`hg head --template '{rev}\n'` 2.36 @@ -153,7 +171,7 @@ 2.37 echo -e "Done\n" 2.38 else 2.39 if [ "$1" = "cook-all" ] || [ "$1" = "cook-commit" ]; then 2.40 - if [ "$2" != "--forced" ]; then 2.41 + if [ "$2" != "--forced" -a -z "$forced" ]; then 2.42 echo -e "Nothing to cook...\n" 2.43 packages_summary 2.44 rm -f $LOCK_FILE && exit 0 2.45 @@ -162,6 +180,62 @@ 2.46 fi 2.47 } 2.48 2.49 +# Running 'tazbb report' should not pack anything and --verbose option 2.50 +# can be used to display more messages. 2.51 +check_flavors() 2.52 +{ 2.53 + # Clean up last results. 2.54 + rm -f $DB_DIR/packlist && touch $DB_DIR/packlist 2.55 + echo "" 2.56 + echo "Checking all files in: $HG_FLAVORS" 2.57 + echo "================================================================================" 2.58 + echo "(checking flavors)" > $DB_DIR/running 2.59 + for flavor in $(cd $HG_FLAVORS ; ls) 2.60 + do 2.61 + [ "$2" = "--verbose" ] && echo "Flavor : $flavor" 2.62 + if [ ! -s $PACKAGES_REPOSITORY/$flavor.flavor ]; then 2.63 + echo $flavor >> $DB_DIR/packlist 2.64 + [ "$1" = "report" ] && echo "Missing : $flavor" 2.65 + echo "Missing flavor : $flavor" >> $DB_DIR/report 2.66 + continue 2.67 + fi 2.68 + for i in $(find $HG_FLAVORS -type f); do 2.69 + [ $PACKAGES_REPOSITORY/$flavor.flavor -nt \ 2.70 + $i ] && continue 2.71 + echo $flavor >> $DB_DIR/packlist 2.72 + [ "$1" = "report" ] && echo "Refresh : $flavor" 2.73 + echo "Refresh flavor : $flavor" >> $DB_DIR/report 2.74 + continue 2 2.75 + done 2.76 + [ -s $HG_FLAVORS/$flavor/packages.list ] && 2.77 + for i in $(cat $HG_FLAVORS/$flavor/packages.list); do 2.78 + [ $PACKAGES_REPOSITORY/$flavor.flavor -nt \ 2.79 + $BUILD_WOK/$i/taz ] && continue 2.80 + echo $flavor >> $DB_DIR/packlist 2.81 + [ "$1" = "report" ] && echo "Repack : $flavor" 2.82 + echo "Repack flavor : $flavor" >> $DB_DIR/report 2.83 + continue 2 2.84 + done 2.85 + done 2.86 +} 2.87 + 2.88 +# Here we pack all flavors found in the packlist. 2.89 +pack_flavors() 2.90 +{ 2.91 + [ -s $DB_DIR/packlist ] || return 2.92 + [ $PACKAGES_REPOSITORY/packages.list -nt /var/lib/tazpkg/packages.list ] && 2.93 + cp -a $PACKAGES_REPOSITORY/packages.list /var/lib/tazpkg/packages.list 2.94 + cd $PACKAGES_REPOSITORY 2.95 + for flavor in $(cat $DB_DIR/packlist) 2.96 + do 2.97 + tazlito pack-flavor $flavor 2.98 + # Remove flavor from the packlist and empty lines for HTML <pre>. 2.99 + sed -i /"^$flavor$"/d $DB_DIR/packlist 2.100 + sed -i '/^$/d' $DB_DIR/packlist 2.101 + done 2.102 + cd - > /dev/null 2.103 +} 2.104 + 2.105 # Running 'tazbb report' should not cook anything and --verbose option 2.106 # can be used to display more messages. 2.107 check_wok() 2.108 @@ -184,9 +258,8 @@ 2.109 echo "Blocked : $PACKAGE ($VERSION)" && continue 2.110 fi 2.111 2.112 - # Bristuff hack until the receipt are improved... 2.113 - #[ "$VERSION" = "bristuff" ] && VERSION=`get_version` 2.114 - if [ "$VERSION" = "bristuff" ]; then 2.115 + # Some packages may compute VERSION at cook time (bristuff) 2.116 + if grep -q ^get_version $pkg/receipt; then 2.117 . $BUILD_WOK/$PACKAGE/taz/*/receipt 2.118 fi 2.119 2.120 @@ -477,6 +550,18 @@ 2.121 echo "" 2.122 } 2.123 2.124 +# Generate flavor list 2.125 +gen_flavor_list() 2.126 +{ 2.127 + cd $PACKAGES_REPOSITORY 2.128 + noheader="" 2.129 + for i in *.flavor; do 2.130 + tazlito show-flavor $i --brief $noheader 2.131 + noheader="--noheader" 2.132 + done > flavors.list 2.133 + cd - > /dev/null 2.134 +} 2.135 + 2.136 case "$1" in 2.137 list-pkgs) 2.138 # List last cooked packages. 2.139 @@ -486,6 +571,7 @@ 2.140 # rebuild all updated packages. 2.141 [ "$2" == "--update" ] && update_wok $@ || echo "" 2.142 check_wok $@ 2.143 + check_flavors $@ 2.144 test_packages $@ 2.145 show_report ;; 2.146 cook) 2.147 @@ -510,6 +596,9 @@ 2.148 check_wok $@ 2.149 echo "(generating lists)" > $DB_DIR/running 2.150 tazwok gen-list --text 2.151 + check_flavors $@ 2.152 + pack_flavors 2.153 + gen_flavor_list 2.154 echo "" ;; 2.155 cook-commit) 2.156 # Cook all packages affected by the last commits in the wok. 2.157 @@ -522,6 +611,9 @@ 2.158 check_wok $@ 2.159 echo "(generating lists)" > $DB_DIR/running 2.160 tazwok gen-list --text 2.161 + check_flavors $@ 2.162 + pack_flavors 2.163 + gen_flavor_list 2.164 echo "" ;; 2.165 block) 2.166 # Add a pkg name to the list of blocked packages.
3.1 --- a/tazbb/stuff/tazbb.conf Thu Nov 05 19:41:12 2009 +0000 3.2 +++ b/tazbb/stuff/tazbb.conf Sat Nov 07 16:24:17 2009 +0100 3.3 @@ -4,6 +4,8 @@ 3.4 # Wok's and packages path. 3.5 HG_WOK="/home/slitaz/hg/wok" 3.6 BUILD_WOK="/home/slitaz/wok" 3.7 +HG_FLAVORS="/home/slitaz/hg/flavors" 3.8 +BUILD_FLAVORS="/home/slitaz/flavors" 3.9 PACKAGES_REPOSITORY="/home/slitaz/packages" 3.10 3.11 # Log files, database and lock file.
4.1 --- a/tazbb/stuff/web/index.php Thu Nov 05 19:41:12 2009 +0000 4.2 +++ b/tazbb/stuff/web/index.php Sat Nov 07 16:24:17 2009 +0100 4.3 @@ -129,6 +129,14 @@ 4.4 ?> 4.5 </pre> 4.6 4.7 +<h3>Last cooked flavors</h3> 4.8 +<pre class="package"> 4.9 +<?php 4.10 +system("cd $packages && ls -1t *.flavor | head -20 | \ 4.11 + while read file; do echo -n \$(stat -c '%y' $packages/\$file | \ 4.12 + cut -d. -f1); echo ' '\$file; done"); ?> 4.13 +</pre> 4.14 + 4.15 <!-- End of content with round corner --> 4.16 </div> 4.17 <div id="content_bottom">