cookutils rev 235
cook: handle flavors file creation
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 27 13:34:28 2011 +0200 (2011-05-27) |
parents | cf605dd5c193 |
children | 77037ae33127 |
files | cook |
line diff
1.1 --- a/cook Fri May 27 10:54:30 2011 +0200 1.2 +++ b/cook Fri May 27 13:34:28 2011 +0200 1.3 @@ -38,7 +38,7 @@ 1.4 list $(gettext "Cook a list of packages.") 1.5 clean-wok $(gettext "Clean-up all packages files.") 1.6 clean-src $(gettext "Clean-up all packages sources.") 1.7 - pkglist $(gettext "Create all packages.* lists.") 1.8 + pkgdb $(gettext "Create packages lists and pack flavors.") 1.9 1.10 $(echo -e "\033[1m$(gettext "Options:")\033[0m") 1.11 --clean|-c Cook : $(gettext "clean the package in the wok.") 1.12 @@ -859,26 +859,27 @@ 1.13 gettext -e "\nCleaning all packages sources..." 1.14 rm -rf $WOK/*/source 1.15 status && echo "" ;; 1.16 - pkglist) 1.17 - # Create suitable packages list for TazPKG and only for built packages. 1.18 + pkgdb) 1.19 + # Create suitable packages list for TazPKG and only for built packages 1.20 + # as well as flavors files for TazLiTo. We dont need logs since we do it 1.21 + # manualy to ensure everything is fine before syncing the mirror. 1.22 [ "$2" ] && PKGS="$2" 1.23 [ ! -d "$PKGS" ] && \ 1.24 gettext -e "\nPackages directory doesn't exist\n\n" && exit 1 1.25 time=$(date +%s) 1.26 - echo "cook:pkglist" > $command 1.27 - echo "Cook pkglist: Creating all packages lists" | log 1.28 - gettext -e "\nCreating lists for:"; echo " $PKGS" 1.29 + echo "cook:pkgdb" > $command 1.30 + echo "Cook pkgdb: Creating all packages lists" | log 1.31 + echo "" 1.32 + gettext "Creating lists for: "; echo "$PKGS" 1.33 separator 1.34 - gettext "Cook pkglist started at: "; date "+%H:%M" 1.35 + gettext "Cook pkgdb started: "; date "+%Y-%m-%d %H:%M" 1.36 cd $PKGS 1.37 rm -f packages.* 1.38 - gettext "Creating: packages.list " 1.39 + gettext -e "Creating: packages.list\n" 1.40 ls -1 *.tazpkg | sed s'/.tazpkg//' > $PKGS/packages.list 1.41 - echo $(du -sh $PKGS/packages.list | awk '{print $1}') 1.42 - gettext "Creating: packages.md5 " 1.43 + gettext -e "Creating: packages.md5\n" 1.44 md5sum *.tazpkg > $PKGS/packages.md5 1.45 - echo $(du -sh $PKGS/packages.md5 | awk '{print $1}') 1.46 - gettext -e "Creating lists from:"; echo " $WOK" 1.47 + gettext -e "Creating lists from: "; echo "$WOK" 1.48 cd $WOK 1.49 for pkg in * 1.50 do 1.51 @@ -887,16 +888,16 @@ 1.52 if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.53 # packages.desc lets us search easily in DB 1.54 cat >> $PKGS/packages.desc << EOT 1.55 -$PACKAGE | $VERSION$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE 1.56 +$PACKAGE | ${VERSION}$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE 1.57 EOT 1.58 # packages.txt used by tazpkg and tazpkg-web also to provide 1.59 # a human readable package list with version and description. 1.60 cat >> $PKGS/packages.txt << EOT 1.61 $PACKAGE 1.62 - ${VERSION}$EXTRAVERSION 1.63 - $SHORT_DESC 1.64 - $PACKED_SIZE ($UNPACKED_SIZE installed) 1.65 - 1.66 +${VERSION}$EXTRAVERSION 1.67 +$SHORT_DESC 1.68 +$PACKED_SIZE ($UNPACKED_SIZE installed) 1.69 + 1.70 EOT 1.71 # packages.equiv is used by tazpkg install to check depends. 1.72 for i in $PROVIDE; do 1.73 @@ -914,27 +915,56 @@ 1.74 $PKGS/files.list 1.75 fi 1.76 done 1.77 - cd $PKGS 1.78 - 1.79 + 1.80 # Display list size. 1.81 - gettext "Done: packages.desc " 1.82 - echo $(du -sh $PKGS/packages.desc | awk '{print $1}') 1.83 - gettext "Done: packages.txt " 1.84 - echo $(du -sh $PKGS/packages.txt | awk '{print $1}') 1.85 - gettext "Done: packages.equiv " 1.86 - echo $(du -sh $PKGS/packages.equiv | awk '{print $1}') 1.87 + gettext -e "Done: packages.desc\n" 1.88 + gettext -e "Done: packages.txt\n" 1.89 + gettext -e "Done: packages.equiv\n" 1.90 1.91 # files.list.lzma 1.92 - gettext "Creating: files.list.lzma " 1.93 - lzma e files.list files.list.lzma 1.94 + gettext -e "Creating: files.list.lzma\n" 1.95 + cd $PKGS && lzma e files.list files.list.lzma 1.96 rm -f files.list 1.97 - echo $(du -sh $PKGS/files.list.lzma | awk '{print $1}') 1.98 1.99 + # Display some info. 1.100 separator 1.101 nb=$(ls $PKGS/*.tazpkg | wc -l) 1.102 time=$(($(date +%s) - $time)) 1.103 - echo -e "Packages: $nb - Time: $time\n" 1.104 - rm -f $command ;; 1.105 + echo -e "Packages: $nb - Time: ${time}s\n" 1.106 + 1.107 + # Create all flavors files at once. Do we realy need code to monitor 1.108 + # flavors changes ? Let just build them with packages lists before 1.109 + # syncing the mirror. 1.110 + flavors=$SLITAZ/flavors 1.111 + live=$SLITAZ/live 1.112 + [ -d "$flavors" ] || exit 0 1.113 + echo "Creating flavors files in: $live" 1.114 + separator 1.115 + 1.116 + # We need a custom tazlito config to set working dir to /home/slitaz. 1.117 + if [ ! -f "$live/tazlito.conf" ]; then 1.118 + echo "Creating configuration file: tazlito.conf" 1.119 + cp /etc/tazlito/tazlito.conf $live 1.120 + sed -i s@WORK_DIR=.*@WORK_DIR=\"/home/slitaz\"@ \ 1.121 + $live/tazlito.conf 1.122 + fi 1.123 + 1.124 + # Update flavors repo and pack. 1.125 + cd $flavors && hg pull -u 1.126 + mkdir -p $live && cd $live 1.127 + echo "Starting to generate flavors..." 1.128 + rm -f flavors.list *.flavor 1.129 + for i in $flavors/* 1.130 + do 1.131 + fl=$(basename $i) 1.132 + echo "Packing flavor: $(basename $i)" 1.133 + tazlito pack-flavor $fl >/dev/null || exit 1 1.134 + tazlito show-flavor $fl --brief --noheader 2> \ 1.135 + /dev/null >> flavors.list 1.136 + done 1.137 + cp -f *.flavor flavors.list $PKGS 1.138 + separator && gettext "Flavors size: "; du -sh $live | awk '{print $1}' 1.139 + echo "" && rm -f $command ;; 1.140 *) 1.141 # Just cook and generate a package. 1.142 check_root