cookutils rev 479 slitaz-tank
cook: Updated fully to what slitaz-tank needs.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Mon Jun 11 12:11:55 2012 +0000 (2012-06-11) |
parents | 30cf8624de6d |
children | ff51df709a1c |
files | cook |
line diff
1.1 --- a/cook Sat Jun 09 14:26:00 2012 +0000 1.2 +++ b/cook Mon Jun 11 12:11:55 2012 +0000 1.3 @@ -6,7 +6,21 @@ 1.4 # Copyright (C) SliTaz GNU/Linux - GNU gpl v3 1.5 # Author: Christophe Lincoln <pankso@slitaz.org> 1.6 # 1.7 -. /usr/lib/slitaz/libcook.sh 1.8 +. /lib/libtaz.sh 1.9 + 1.10 +# SliTaz working directory 1.11 +[ -f "/etc/slitaz/slitaz.conf" ] && . /etc/slitaz/slitaz.conf 1.12 +[ -f "slitaz.conf" ] && . ./slitaz.conf 1.13 +[ -f "/lib/libtaz.sh" ] && . /lib/libtaz.sh 1.14 +[ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf 1.15 +[ -f "cook.conf" ] && . ./cook.conf 1.16 +[ -f "$DATA/libcook" ] && . $DATA/libcook 1.17 +[ -f "$DATA/libcookorder" ] && . $DATA/libcookorder 1.18 + 1.19 +[ "$wan_db" ] && touch $wan_db 1.20 +[ "$dep_db" ] && touch $dep_db 1.21 + 1.22 +COMMAND="$1" 1.23 1.24 # 1.25 # Functions 1.26 @@ -28,46 +42,45 @@ 1.27 list $(gettext "Cook a list of packages.") 1.28 clean-wok $(gettext "Clean-up all packages files.") 1.29 clean-src $(gettext "Clean-up all packages sources.") 1.30 + upwok $(gettext "Update wok.") 1.31 + gen-wok-db $(gettext "Build cook order files.") 1.32 + gen-src $(gettext "Build source list.") 1.33 + check-incoming $(gettext "Move incoming packages to packages folder.") 1.34 + gen-cooklist $(gettext "Make cook order list.") 1.35 + check-src $(gettext "Check upstream tarball for package in the wok.") 1.36 + maintainers $(gettext "List all maintainers in the wok.") 1.37 + maintained-by $(gettext "List packages maintained by a contributor.") 1.38 + tags $(gettext "List all tags used in wok receipts.") 1.39 pkgdb $(gettext "Create packages DB lists and flavors.") 1.40 + unbuild $(gettext "List all unbuild packages.") 1.41 1.42 $(echo -e "\033[1m$(gettext "Options:")\033[0m") 1.43 - --clean|-c Cook : $(gettext "clean the package in the wok.") 1.44 - --install|-i Cook : $(gettext "cook and install the package.") 1.45 - --getsrc|-gs Cook : $(gettext "get the package source tarball.") 1.46 - --block|-b Cook : $(gettext "Block a package so cook will skip it.") 1.47 - --unblock|-ub Cook : $(gettext "Unblock a blocked package.") 1.48 - --interactive|-x New : $(gettext "create a receipt interactively.") 1.49 - --wok Setup: $(gettext "clone the cooking wok from Hg repo.") 1.50 - --stable Setup: $(gettext "clone the stable wok from Hg repo.") 1.51 - --undigest Setup: $(gettext "clone the undigest wok from Hg repo.") 1.52 + --clean|-c Cook : $(gettext "clean the package in the wok.") 1.53 + --install|-i Cook : $(gettext "cook and install the package.") 1.54 + --getsrc|-gs Cook : $(gettext "get the package source tarball.") 1.55 + --block|-b Cook : $(gettext "Block a package so cook will skip it.") 1.56 + --unblock|-ub Cook : $(gettext "Unblock a blocked package.") 1.57 + --interactive|-x New : $(gettext "create a receipt interactively.") 1.58 + --local Upwok : $(gettext "update wok local changes in wok-hg.") 1.59 + --wok|-w Setup : $(gettext "clone the cooking wok from Hg repo.") 1.60 + --stable Setup : $(gettext "clone the stable wok from Hg repo.") 1.61 + --undigest Setup : $(gettext "clone the undigest wok from Hg repo.") 1.62 --tiny Setup: $(gettext "clone the tiny SliTaz wok from Hg repo.") 1.63 --forced Setup: $(gettext "force reinstall of chroot packages.") 1.64 - --flavors Pkgdb: $(gettext "create up-to-date flavors files.") 1.65 + --flavors Pkgdb : $(gettext "create up-to-date flavors files.") 1.66 + --full Unbuild : $(gettext "create a full unbuild list.") 1.67 + --list Unbuild : $(gettext "Copy unbuild list into your cooklist.") 1.68 1.69 EOT 1.70 exit 0 1.71 } 1.72 1.73 -# Log activities, we want first letter capitalized. 1.74 -log() { 1.75 - grep ^[A-Z] | \ 1.76 - sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity 1.77 -} 1.78 - 1.79 # We don't want these escapes in web interface. 1.80 clean_log() { 1.81 sed -i -e s'|\[70G\[ \[1;32m| |' \ 1.82 -e s'|\[0;39m \]||' $LOGS/$pkg.log 1.83 } 1.84 1.85 -# Be sure package exists in wok. 1.86 -check_pkg_in_wok() { 1.87 - if [ ! -d "$WOK/$pkg" ]; then 1.88 - gettext -e "\nUnable to find package in the wok:" 1.89 - echo -e " $pkg\n" && exit 1 1.90 - fi 1.91 -} 1.92 - 1.93 if_empty_value() { 1.94 if [ -z "$value" ]; then 1.95 gettext "QA: empty variable:"; echo -e " ${var}=\"\"\n" 1.96 @@ -117,13 +130,13 @@ 1.97 [ -z "$online" ] || break 1.98 case $value in 1.99 https://*) 1.100 - if ! wget -T $TIMEOUT --spider --no-check-certificate $value 2>/dev/null; then 1.101 - gettext "QA: Unable to reach:"; echo -e " $value" 1.102 - fi ;; 1.103 + if ! wget -T $TIMEOUT --spider --no-check-certificate $value 2>/dev/null; then 1.104 + gettext "QA: Unable to reach:"; echo -e " $value" 1.105 + fi ;; 1.106 http://*|ftp://*) 1.107 - if ! busybox wget -T $TIMEOUT -s $value 2>/dev/null; then 1.108 - gettext "QA: Unable to reach:"; echo -e " $value" 1.109 - fi ;; 1.110 + if ! busybox wget -T $TIMEOUT -s $value 2>/dev/null; then 1.111 + gettext "QA: Unable to reach:"; echo -e " $value" 1.112 + fi ;; 1.113 esac 1.114 esac 1.115 done 1.116 @@ -428,8 +441,8 @@ 1.117 1.118 # Display cooked package summary. 1.119 summary() { 1.120 - cd $WOK/$pkg 1.121 [ -d $WOK/$pkg/install ] && prod=$(du -sh $WOK/$pkg/install | awk '{print $1}' 2>/dev/null) 1.122 + [ -d $WOK/$pkg/source ] && srcdir=$(du -sh $WOK/$pkg/source | awk '{print $1}' 2>/dev/null) 1.123 fs=$(du -sh $WOK/$pkg/taz/* | awk '{print $1}') 1.124 size=$(du -sh $INCOMING/$pkg-${VERSION}*.tazpkg | awk '{print $1}') 1.125 files=$(cat $WOK/$pkg/taz/$pkg-*/files.list | wc -l) 1.126 @@ -443,7 +456,7 @@ 1.127 [ "$srcdir" ] && echo "Source dir : $srcdir" 1.128 [ "$TARBALL" ] && echo "Src file : $TARBALL" 1.129 [ "$srcsize" ] && echo "Src size : $srcsize" 1.130 - [ "$prod" ] && echo "Produced : $prod" 1.131 + [ "$prod" ] && echo "Produced : $prod" 1.132 cat << EOT 1.133 Packed : $fs 1.134 Compressed : $size 1.135 @@ -462,7 +475,7 @@ 1.136 echo "Cook date: $(date '+%Y-%m-%d %H:%M')" 1.137 for error in \ 1.138 ERROR "No package" "cp: can't" "can't open" "can't cd" \ 1.139 - "error:" "fatal error:" 1.140 + "error:" "fatal error:" "rm: can't remove" "cp: can't stat" 1.141 do 1.142 fgrep "$error" $LOGS/$pkg.log 1.143 done 1.144 @@ -471,9 +484,10 @@ 1.145 1.146 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths, 1.147 # so some packages need to copy these files with the receipt and genpkg_rules. 1.148 -copy_generic_files() { 1.149 +copy_generic_files() 1.150 +{ 1.151 # $LOCALE is set in cook.conf 1.152 - if [ "$LOCALE" ]; then 1.153 + if [ "$LOCALE" -a "$WANTED" = "" ]; then 1.154 if [ -d "$install/usr/share/locale" ]; then 1.155 mkdir -p $fs/usr/share/locale 1.156 for i in $LOCALE 1.157 @@ -489,10 +503,13 @@ 1.158 if [ "$GENERIC_PIXMAPS" != "no" ]; then 1.159 if [ -d "$install/usr/share/pixmaps" ]; then 1.160 mkdir -p $fs/usr/share/pixmaps 1.161 - cp -a $install/usr/share/pixmaps/$PACKAGE.png \ 1.162 - $fs/usr/share/pixmaps 2>/dev/null || continue 1.163 - cp -a $install/usr/share/pixmaps/$PACKAGE.xpm \ 1.164 - $fs/usr/share/pixmaps 2>/dev/null || continue 1.165 + if [ -f "$install/usr/share/pixmaps/$PACKAGE.png" ]; then 1.166 + cp -a $install/usr/share/pixmaps/$PACKAGE.png \ 1.167 + $fs/usr/share/pixmaps 1.168 + elif [ -f "$install/usr/share/pixmaps/$PACKAGE.xpm" ]; then 1.169 + cp -a $install/usr/share/pixmaps/$PACKAGE.xpm \ 1.170 + $fs/usr/share/pixmaps 1.171 + fi 1.172 fi 1.173 1.174 # Custom or homemade PNG pixmap can be in stuff. 1.175 @@ -506,6 +523,7 @@ 1.176 # Generic desktop entry copy can be disabled with GENERIC_MENUS="no" 1.177 if [ "$GENERIC_MENUS" != "no" ]; then 1.178 if [ -d "$install/usr/share/applications" ] && [ "$WANTED" == "" ]; then 1.179 + mkdir -p $fs/usr/share 1.180 cp -a $install/usr/share/applications $fs/usr/share 1.181 fi 1.182 fi 1.183 @@ -519,12 +537,19 @@ 1.184 mkdir -p $fs/usr/share/applications 1.185 cp -a $stuff/$PACKAGE.desktop $fs/usr/share/applications 1.186 fi 1.187 + 1.188 + # Add custom licenses 1.189 + if [ -d "$stuff/licenses" ]; then 1.190 + mkdir -p $fs/usr/share/licenses 1.191 + cp -a $stuff/licenses $fs/usr/share/licenses/$PACKAGE 1.192 + fi 1.193 } 1.194 1.195 # Find and strip : --strip-all (-s) or --strip-debug on static libs as well 1.196 # as removing uneeded files like in Python packages. Cross compiled binaries 1.197 # must be stripped with cross-tools aka $ARCH-slitaz-*-strip 1.198 -strip_package() { 1.199 +strip_package() 1.200 +{ 1.201 case "$ARCH" in 1.202 arm|x86_64) export STRIP=${HOST_SYSTEM}-strip ;; 1.203 *) export STRIP=strip ;; 1.204 @@ -564,17 +589,35 @@ 1.205 if [ -s "$CACHE/installed.cook.diff" ]; then 1.206 deps=$(cat $diff | grep ^+[a-zA-Z0-9] | sed s/^+//) 1.207 nb=$(cat $diff | grep ^+[a-zA-Z0-9] | wc -l) 1.208 - gettext "Build dependencies to remove:"; echo " $nb $root" 1.209 + gettext "Build dependencies to remove:"; echo " $nb" 1.210 gettext "Removing:" 1.211 for dep in $deps 1.212 do 1.213 echo -n " $dep" 1.214 - echo 'y' | tazpkg remove $dep --root=$root >/dev/null 1.215 + tazpkg remove $dep --auto --root=/ >/dev/null 1.216 done 1.217 echo -e "\n" 1.218 # Keep the last diff for debug and info. 1.219 mv -f $CACHE/installed.cook.diff $CACHE/installed.diff 1.220 fi 1.221 + clean_chroot 1.222 +} 1.223 + 1.224 +extract_path() 1.225 +{ 1.226 + # Some archives are not well done and don't extract to one dir (ex lzma). 1.227 + files=$(ls | wc -l) 1.228 + [ "$files" == 1 ] && [ -d "$(ls)" ] && mv * ../$PACKAGE-$VERSION 1.229 + [ "$files" == 1 ] && [ -f "$(ls)" ] && mkdir -p ../$PACKAGE-$VERSION && \ 1.230 + mv * ../$PACKAGE-$VERSION/$TARBALL 1.231 + [ "$files" -gt 1 ] && mkdir -p ../$PACKAGE-$VERSION && \ 1.232 + mv * ../$PACKAGE-$VERSION 1.233 + cd .. && rm -rf tmp 1.234 + if [ "$TOUCH_FILES" ]; then 1.235 + echo "Touching source files to update timestamp" 1.236 + echo "May take a bit" 1.237 + find $src -type f -exec touch "{}" \; 1.238 + fi 1.239 } 1.240 1.241 # The main cook function. 1.242 @@ -587,6 +630,7 @@ 1.243 case "$ARCH" in 1.244 arm|x86_64) 1.245 # CROSS_COMPILE is used by at least Busybox and the kernel to set 1.246 + # the cross-tools prefix but first check if sysroot is used. 1.247 # the cross-tools prefix. Sysroot the the root of our target arch 1.248 sysroot=$CROSS_TREE/sysroot 1.249 tools=$CROSS_TREE/tools 1.250 @@ -612,6 +656,8 @@ 1.251 export RANLIB=${HOST_SYSTEM}-ranlib 1.252 export LD=${HOST_SYSTEM}-ld 1.253 export STRIP=${HOST_SYSTEM}-strip ;; 1.254 + *) 1.255 + root="/" ;; 1.256 esac 1.257 1.258 [ "$QA" ] && receipt_quality 1.259 @@ -631,31 +677,43 @@ 1.260 # Export flags and path to be used by make and receipt. 1.261 DESTDIR=$pkgdir/install 1.262 export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C 1.263 - #LDFLAGS 1.264 + #export LDFLAGS 1.265 + 1.266 + if [ ! "$WANTED" ] && [ "$TARBALL" ]; then 1.267 + getsrc --extract 1.268 + fi 1.269 1.270 # Check for build deps and handle implicit depends of *-dev packages 1.271 # (ex: libusb-dev :: libusb). 1.272 rm -f $CACHE/installed.local $CACHE/installed.web $CACHE/missing.dep 1.273 touch $CACHE/installed.local $CACHE/installed.web 1.274 - [ "$BUILD_DEPENDS" ] && gettext -e "Checking build dependencies...\n" 1.275 + look_for_cookopt !auto_dep && AUTO_DEP="" 1.276 + if [ "$AUTO_DEP" -a ! "$WANTED" ]; then 1.277 + BDEPS=$(scan $PACKAGE --look_for=bdep --with_dev | \ 1.278 + grep -v $(for i in $(look_for_rwanted) $PACKAGE; do echo " -e ^$i$"; done)) 1.279 + else 1.280 + BDEPS="$BUILD_DEPENDS" 1.281 + fi 1.282 + [ "$BDEPS" ] && gettext -e "Checking build dependencies...\n" 1.283 [ "$root" ] && echo "Using packages DB: ${root}$DB" 1.284 - for dep in $BUILD_DEPENDS 1.285 + for dep in $BDEPS 1.286 do 1.287 - implicit=${dep%-dev} 1.288 - for i in $dep $implicit 1.289 + for i in $dep 1.290 do 1.291 if [ ! -f "${root}$INSTALLED/$i/receipt" ]; then 1.292 # Try local package first. In some cases implicit doesn't exist, ex: 1.293 # libboost-dev exists but not libboost, so check if we got vers. 1.294 unset vers 1.295 + [ -f $WOK/$i/receipt ] || continue 1.296 vers=$(. $WOK/$i/receipt 2>/dev/null ; echo $VERSION) 1.297 - # We may have a local package. 1.298 - if [ ! "$vers" ]; then 1.299 - vers=$(grep "^$i |" $PKGS/packages.desc | awk '{print $3}') 1.300 - fi 1.301 - debug "bdep: $i version: $vers" 1.302 - if [ -f "$PKGS/$i-${vers}${arch}.tazpkg" ]; then 1.303 - echo $i-${vers}${arch}.tazpkg >> $CACHE/installed.local 1.304 + if [ -f "$INCOMING/$i-${vers}_${kbasevers}.tazpkg" ]; then 1.305 + echo $i-${vers}_${kbasevers}.tazpkg >> $CACHE/installed.local 1.306 + elif [ -f "$PKGS/$i-${vers}_${kbasevers}.tazpkg" ]; then 1.307 + echo $i-${vers}_${kbasevers}.tazpkg >> $CACHE/installed.local 1.308 + elif [ -f "$INCOMING/$i-$vers.tazpkg" ]; then 1.309 + echo $i-$vers.tazpkg >> $CACHE/installed.local 1.310 + elif [ -f "$PKGS/$i-$vers.tazpkg" ]; then 1.311 + echo $i-$vers.tazpkg >> $CACHE/installed.local 1.312 else 1.313 # Priority to package version in wok (maybe more up-to-date) 1.314 # than the mirrored one. 1.315 @@ -681,7 +739,7 @@ 1.316 done 1.317 1.318 # Get the list of installed packages 1.319 - cd ${root}$INSTALLED && ls -1 > $CACHE/installed.list 1.320 + ls -l ${root}$INSTALLED > $CACHE/installed.list 1.321 1.322 # Have we a missing build dep to cook ? 1.323 if [ -s "$CACHE/missing.dep" ] && [ "$AUTO_COOK" ]; then 1.324 @@ -709,11 +767,15 @@ 1.325 fi 1.326 1.327 # Install local packages: package-version${arch} 1.328 - cd $PKGS 1.329 for i in $(uniq $CACHE/installed.local) 1.330 do 1.331 - gettext "Installing dep (pkg/local):"; echo " $i" 1.332 - tazpkg install $i --root=$root >/dev/null 1.333 + if [ -f "$INCOMING/$i" ]; then 1.334 + gettext "Installing dep (pkg/local):"; echo " $i" 1.335 + tazpkg install $INCOMING/$i --root=$root >/dev/null 1.336 + elif [ -f "$PKGS/$i" ]; then 1.337 + gettext "Installing dep (pkg/local):"; echo " $i" 1.338 + tazpkg install $PKGS/$i --root=$root >/dev/null 1.339 + fi 1.340 done 1.341 1.342 # Install web or cached packages (if mirror is set to $PKGS we only 1.343 @@ -725,56 +787,29 @@ 1.344 done 1.345 1.346 # If a cook failed deps are removed. 1.347 - cd ${root}$INSTALLED && ls -1 > $CACHE/installed.cook && cd $CACHE 1.348 - [ ! -s "installed.cook.diff" ] && \ 1.349 - busybox diff installed.list installed.cook > installed.cook.diff 1.350 - deps=$(cat installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l) 1.351 - 1.352 - # Get source tarball and make sure we have source dir named: 1.353 - # $PACKAGE-$VERSION to be standard in receipts. Here we use tar.lzma 1.354 - # tarball if it exists. 1.355 - if [ "$WGET_URL" ] && [ ! -f "$SRC/$TARBALL" ]; then 1.356 - if [ -f "$SRC/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ]; then 1.357 - TARBALL=${SOURCE:-$PACKAGE}-$VERSION.tar.lzma 1.358 - LZMA_SRC="" 1.359 - else 1.360 - get_source || exit 1 1.361 + ls -1 ${root}$INSTALLED > $CACHE/installed.cook 1.362 + [ ! -s "$CACHE/installed.cook.diff" ] && \ 1.363 + busybox diff $CACHE/installed.list $CACHE/installed.cook > $CACHE/installed.cook.diff 1.364 + deps=$(cat $CACHE/installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l) 1.365 + 1.366 + if [ ! "$WANTED" ] && [ "$TARBALL" ] && [ ! -d "$src" ]; then 1.367 + look_for_cookopt !unpack && unpack="no" 1.368 + if [ ! "$unpack" ] && [ "$cook_code" = "" ]; then 1.369 + extract_source || exit 1 1.370 + look_for_cookopt !repack_src && LZMA_SRC="" 1.371 + [ "$LZMA_SRC" ] && repack_source 1.372 + extract_path 1.373 fi 1.374 fi 1.375 - if [ ! "$WANTED" ] && [ "$TARBALL" ] && [ ! -d "$src" ]; then 1.376 - mkdir -p $pkgdir/source/tmp && cd $pkgdir/source/tmp 1.377 - if ! extract_source ; then 1.378 - get_source 1.379 - extract_source || exit 1 1.380 - fi 1.381 - if [ "$LZMA_SRC" ]; then 1.382 - cd $pkgdir/source 1.383 - if [ "$(ls -A tmp | wc -l)" -gl 1 ] || [ -f "$(echo tmp/*)" ]; then 1.384 - mv tmp tmp-1 && mkdir tmp 1.385 - mv tmp-1 tmp/${SOURCE:-$PACKAGE}-$VERSION 1.386 - fi 1.387 - if [ -d "tmp/${SOURCE:-$PACKAGE}-$VERSION" ]; then 1.388 - cd tmp && tar -c * | lzma e $SRC/$TARBALL -si 1.389 - fi 1.390 - fi 1.391 - cd $pkgdir/source/tmp 1.392 - # Some archives are not well done and don't extract to one dir (ex lzma). 1.393 - files=$(ls | wc -l) 1.394 - [ "$files" == 1 ] && [ -d "$(ls)" ] && mv * ../$PACKAGE-$VERSION 1.395 - [ "$files" == 1 ] && [ -f "$(ls)" ] && mkdir -p ../$PACKAGE-$VERSION && \ 1.396 - mv * ../$PACKAGE-$VERSION/$TARBALL 1.397 - [ "$files" -gt 1 ] && mkdir -p ../$PACKAGE-$VERSION && \ 1.398 - mv * ../$PACKAGE-$VERSION 1.399 - cd .. && rm -rf tmp 1.400 - fi 1.401 1.402 # Execute receipt rules. 1.403 - if grep -q ^compile_rules $receipt; then 1.404 + if [ $(grep ^compile_rules $receipt) ] && [ "$cook_code" = "" ]; then 1.405 echo "Executing: compile_rules" 1.406 echo "CFLAGS : $CFLAGS" 1.407 #echo "LDFLAGS : $LDFLAGS" 1.408 [ -d "$src" ] && cd $src 1.409 - compile_rules $@ || exit 1 1.410 + compile_rules $@ || broken 1.411 + [ "$cook_code" ] && exit 1 1.412 # Stay compatible with _pkg 1.413 [ -d "$src/_pkg" ] && mv $src/_pkg $install 1.414 # QA: compile_rules success so valid. 1.415 @@ -822,8 +857,8 @@ 1.416 if grep -q ^genpkg_rules $receipt; then 1.417 gettext -e "Executing: genpkg_rules\n" 1.418 set -e && cd $pkgdir && mkdir -p $fs 1.419 - genpkg_rules || echo -e "\nERROR: genpkg_rules failed\n" >> \ 1.420 - $LOGS/$pkg.log 1.421 + genpkg_rules || (broken && echo -e "\nERROR: genpkg_rules failed\n" >> \ 1.422 + $LOGS/$pkg.log) 1.423 else 1.424 gettext "No packages rules: meta package"; echo 1.425 mkdir -p $fs 1.426 @@ -831,7 +866,7 @@ 1.427 1.428 # First QA check to stop now if genpkg_rules failed. 1.429 if fgrep -q ERROR: $LOGS/$pkg.log; then 1.430 - exit 1 1.431 + broken && exit 1 1.432 fi 1.433 1.434 cd $taz 1.435 @@ -851,30 +886,40 @@ 1.436 status 1.437 1.438 # Strip and stuff files. 1.439 - strip_package 1.440 + look_for_cookopt !strip && STRIP="n" 1.441 + [ "$STRIP" ] || strip_package 1.442 1.443 # Md5sum of files. 1.444 - gettext "Creating md5sum of files..." 1.445 + gettext "Creating $CHECKSUM of files..." 1.446 while read file; do 1.447 [ -L "fs$file" ] && continue 1.448 [ -f "fs$file" ] || continue 1.449 case "$file" in 1.450 /lib/modules/*/modules.*|*.pyc) continue ;; 1.451 esac 1.452 - md5sum "fs$file" | sed 's/ fs/ /' 1.453 - done < files.list > md5sum 1.454 + $CHECKSUM "fs$file" | sed 's/ fs/ /' 1.455 + done < files.list > "$CHECKSUM" 1.456 status 1.457 - UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum \ 1.458 + UNPACKED_SIZE=$(du -chs fs receipt files.list $CHECKSUM \ 1.459 description.txt 2> /dev/null | awk \ 1.460 '{ sz=$1 } END { print sz }') 1.461 - 1.462 + 1.463 + if [ "$UPCOOKLIST" ]; then 1.464 + check_so_files 1.465 + fi 1.466 + 1.467 + # Generate md5 of cooking stuff to look for commit later. 1.468 + gen_cookmd5 1.469 + echo -e "\n# md5sum of cooking stuff :" >> receipt 1.470 + cat $WOK/$PACKAGE/md5 | sed 's/^/# /' >> receipt 1.471 + 1.472 # Build cpio archives. 1.473 gettext "Compressing the fs... " 1.474 - find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si 1.475 + find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si $LZMA_SET_DIR 1.476 rm -rf fs 1.477 status 1.478 PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \ 1.479 - md5sum description.txt 2> /dev/null | awk \ 1.480 + $CHECKSUM description.txt 2> /dev/null | awk \ 1.481 '{ sz=$1 } END { print sz }') 1.482 gettext "Updating receipt sizes..." 1.483 sed -i s/^PACKED_SIZE.*$// receipt 1.484 @@ -899,7 +944,11 @@ 1.485 unlzma -c fs.cpio.lzma | cpio -idm --quiet 1.486 status 1.487 rm fs.cpio.lzma && cd .. 1.488 - 1.489 + 1.490 + if [ "$UPCOOKLIST" ]; then 1.491 + check_recook_rdeps 1.492 + fi 1.493 + 1.494 # QA and give info. 1.495 tazpkg=$(ls *.tazpkg) 1.496 packit_quality 1.497 @@ -925,56 +974,94 @@ 1.498 rm -f $command && exit 1 1.499 else 1.500 # Ls sort by name so the first file is the one we want. 1.501 - old=$(ls $PKGS/$pkg-*.tazpkg 2>/dev/null | head -n 1) 1.502 + old=$(ls $INCOMING/$pkg-[0-9]*.tazpkg 2>/dev/null | head -n 1) 1.503 status 1.504 if [ -f "$old" ]; then 1.505 gettext "Removing old: $(basename $old)" 1.506 rm -f $old && status 1.507 fi 1.508 - mv -f $pkgdir/taz/$pkg-*.tazpkg $PKGS 1.509 + mv -f $pkgdir/taz/$pkg-*.tazpkg $INCOMING 1.510 sed -i /^${pkg}$/d $broken 1.511 - #gettext "Removing source tree..." 1.512 - #rm -f $WOK/$pkg/source && status 1.513 fi 1.514 } 1.515 1.516 -# Tic tac, tic tac... 1.517 -tac() { 1.518 - sed '1!G;h;$!d' $1 1.519 -} 1.520 - 1.521 # Install package on --install or update the chroot. 1.522 -install_package() { 1.523 +install_package() 1.524 +{ 1.525 + local pkg build 1.526 case "$ARCH" in 1.527 arm|x86_64) 1.528 arch="-${ARCH}" 1.529 root=$CROSS_TREE/sysroot ;; 1.530 + *) 1.531 + root="/" ;; 1.532 esac 1.533 # Install package if requested but skip install if target host doesn't 1.534 # match build system or it will break the build chroot. 1.535 build=$(echo $BUILD_SYSTEM | cut -d "-" -f 1) 1.536 - if [ "$inst" ] && [ "$build" == "$ARCH" ]; then 1.537 - if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.538 - cd $PKGS && tazpkg install \ 1.539 - $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced 1.540 - else 1.541 - gettext -e "Unable to install package, build has failed.\n\n" 1.542 - exit 1 1.543 + for pkg in $PACKAGE; do 1.544 + if [ -f "$inst" ] && [ "$build" == "$ARCH" ]; then 1.545 + if [ -f "$INCOMING/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg" ]; then 1.546 + echo "Updating $ARCH chroot environment..." 1.547 + echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION}${arch})" | log 1.548 + tazpkg install \ 1.549 + $INCOMING/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg --root=$root --forced 1.550 + else 1.551 + gettext -e "Unable to install package, build has failed.\n\n" 1.552 + exit 1 1.553 + fi 1.554 fi 1.555 - fi 1.556 - 1.557 + done 1.558 + 1.559 # Install package if part of the chroot to keep env up-to-date. 1.560 - if [ -d "${root}$INSTALLED/$pkg" ]; then 1.561 + if [ -f "${root}$INSTALLED/$pkg/receipt" ]; then 1.562 . /etc/slitaz/cook.conf 1.563 . $WOK/$pkg/taz/$pkg-*/receipt 1.564 echo "Updating $ARCH chroot environment..." 1.565 echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION}${arch})" | log 1.566 - cd $PKGS && tazpkg install \ 1.567 - $pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg \ 1.568 - --forced --root=$root 1.569 + if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}${arch}.tazpkg" ]; then 1.570 + tazpkg install \ 1.571 + $PKGS/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg \ 1.572 + --forced --root=$root 1.573 + elif [ -f "$INCOMING/$PACKAGE-${VERSION}${EXTRAVERSION}${arch}.tazpkg" ]; then 1.574 + tazpkg install \ 1.575 + $INCOMING/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg \ 1.576 + --forced --root=$root 1.577 + fi 1.578 fi 1.579 } 1.580 1.581 +tac() 1.582 +{ 1.583 + sed '1!G;h;$!d' $1 1.584 +} 1.585 + 1.586 +unbuild() 1.587 +{ 1.588 + check_root 1.589 + get_options_list="full list" 1.590 + get_options 1.591 + [ -f $unbuild ] && rm -rf $unbuild 1.592 + LIST="$fullco" 1.593 + [ -f "$1" ] && LIST="$1" 1.594 + #[ "$full" ] && LIST=$(ls $WOK) 1.595 + if [ -f "$1" -a "$full" ]; then 1.596 + COMMAND=gen-cooklist 1.597 + gen_cook_list 1.598 + LIST="$tmp/cooklist" 1.599 + fi 1.600 + for pkg in $(cat $LIST | grep -v ^#); do 1.601 + unset VERSION PACKAGE 1.602 + [ -f $WOK/$pkg/receipt ] || continue 1.603 + . $WOK/$pkg/receipt 1.604 + if [ ! -f $INCOMING/$PACKAGE-${VERSION}*.tazpkg -a ! -f $PKGS/$PACKAGE-${VERSION}*.tazpkg ]; then 1.605 + echo "$PACKAGE" && echo "$PACKAGE" >> $unbuild 1.606 + fi 1.607 + done 1.608 + unset pkg 1.609 + [ "$list" ] && cp -a $unbuild $cooklist 1.610 +} 1.611 + 1.612 # Launch the cook command into a chroot jail protected by aufs. 1.613 # The current filesystems are used read-only and updates are 1.614 # stored in a separate branch. 1.615 @@ -991,7 +1078,7 @@ 1.616 echo "Setup aufs chroot..." 1.617 1.618 # Sanity check 1.619 - for i in / /proc /sys /dev/shm /home ; do 1.620 + for i in / /proc /sys /dev/shm /dev/pts /home ; do 1.621 case " $AUFS_MOUNTS " in 1.622 *\ $i\ *) ;; 1.623 *) AUFS_MOUNTS="$AUFS_MOUNTS $i" ;; 1.624 @@ -1016,12 +1103,13 @@ 1.625 rm -rf ${base}rw 1.626 umount ${base}root 1.627 rmdir $base* 1.628 - # Dont install pkg twice... it's done after 1.629 - #install_package 1.630 + 1.631 + # Install package if requested 1.632 + install_package 1.633 exit $status 1.634 } 1.635 1.636 -# Create a XML feed for freshly built packages. 1.637 +# Create a XML feed for freshly built package. 1.638 gen_rss() { 1.639 pubdate=$(date "+%a, %d %b %Y %X") 1.640 cat > $FEEDS/$pkg.xml << EOT 1.641 @@ -1035,11 +1123,13 @@ 1.642 EOT 1.643 } 1.644 1.645 + 1.646 + 1.647 # 1.648 # Commands 1.649 # 1.650 1.651 -case "$1" in 1.652 +case "$COMMAND" in 1.653 usage|help|-u|-h) 1.654 usage ;; 1.655 list-wok) 1.656 @@ -1091,15 +1181,17 @@ 1.657 # Handle --options 1.658 case "$2" in 1.659 --wok) 1.660 - hg clone $WOK_URL wok || exit 1 ;; 1.661 + hg clone $WOK_URL $WOKHG || exit 1 ;; 1.662 --stable) 1.663 - hg clone $WOK_URL-stable wok || exit 1 ;; 1.664 + hg clone $WOK_URL-stable $WOKHG || exit 1 ;; 1.665 --undigest) 1.666 - hg clone $WOK_URL-undigest wok || exit 1 ;; 1.667 + hg clone $WOK_URL-undigest $WOKHG || exit 1 ;; 1.668 --tiny) 1.669 - hg clone $WOK_URL-tiny wok || exit 1 ;; 1.670 + hg clone $WOK_URL-tiny $WOKHG || exit 1 ;; 1.671 esac 1.672 1.673 + rsync_wok 1.674 + 1.675 # SliTaz group and permissions 1.676 if ! grep -q ^slitaz /etc/group; then 1.677 gettext -e "Adding group: slitaz\n" 1.678 @@ -1168,6 +1260,21 @@ 1.679 echo "Run 'cross compile' to cook a toolchain" 1.680 fi 1.681 separator && newline ;; 1.682 + upwok) 1.683 + case "$2" in 1.684 + --local) 1.685 + gettext -e "Updating local chanages in wok-hg to wok...\n" 1.686 + rsync_wok || exit 1 1.687 + exit 1 ;; 1.688 + esac 1.689 + 1.690 + gettext -e "Updating wok-hg...\n" 1.691 + if [ -d $WOKHG/.hg ]; then 1.692 + cd $WOKHG 1.693 + hg pull -u || exit 1 1.694 + fi 1.695 + cd $SLITAZ 1.696 + rsync_wok || exit 1 ;; 1.697 test) 1.698 # Test a cook environment. 1.699 echo "Cook test: testing the cook environment" | log 1.700 @@ -1179,12 +1286,12 @@ 1.701 pkg="$2" 1.702 [ "$pkg" ] || usage 1.703 newline 1.704 - if [ -d "$WOK/$pkg" ]; then 1.705 + if [ -d "$WOKHG/$pkg" ]; then 1.706 echo -n "$pkg " && gettext "package already exists." 1.707 echo -e "\n" && exit 1 1.708 fi 1.709 - gettext "Creating"; echo -n " $WOK/$pkg" 1.710 - mkdir -p $WOK/$pkg && cd $WOK/$pkg && status 1.711 + gettext "Creating"; echo -n " $WOKHG/$pkg" 1.712 + mkdir $WOKHG/$pkg && cd $WOKHG/$pkg && status 1.713 gettext "Preparing the package receipt..." 1.714 cp $DATA/receipt . 1.715 sed -i s"/^PACKAGE=.*/PACKAGE=\"$pkg\"/" receipt 1.716 @@ -1224,13 +1331,13 @@ 1.717 echo -n "Do you need a stuff directory ? (y/N) : " ; read anser 1.718 if [ "$anser" = "y" ]; then 1.719 echo -n "Creating the stuff directory..." 1.720 - mkdir -p $WOK/$pkg/stuff && status 1.721 + mkdir -p $WOKHG/$pkg/stuff && status 1.722 fi 1.723 # Ask for a description file. 1.724 echo -n "Are you going to write a description ? (y/N) : " ; read anser 1.725 if [ "$anser" = "y" ]; then 1.726 echo -n "Creating the description.txt file..." 1.727 - newline > $WOK/$pkg/description.txt && status 1.728 + newline > $WOKHG/$pkg/description.txt && status 1.729 fi 1.730 separator 1.731 gettext -e "Receipt is ready to use.\n" 1.732 @@ -1258,128 +1365,156 @@ 1.733 gettext -e "\nCleaning all packages sources..." 1.734 rm -rf $WOK/*/source 1.735 status && newline ;; 1.736 + gen-cooklist) 1.737 + check_root 1.738 + [ -f "$2" ] && LIST="$2" 1.739 + get_options_list="pkg wok missing" 1.740 + get_options 1.741 + if ! [ "$pkg" ]; then 1.742 + if [ ! "$LIST" ] || [ "$LIST" = "toolchain" ]; then 1.743 + pkg="$TOOLCHAIN $TOOLCHAIN_EXTRA" 1.744 + else 1.745 + check_for_list 1.746 + fi 1.747 + fi 1.748 + gen_cook_list 1.749 + if [ "$missing" ]; then 1.750 + cooklist=${LIST:-$cooklist} 1.751 + for pkgname in $(cat $cooklist) 1.752 + do 1.753 + unset EXTRAVERSION 1.754 + [ -f $wok/$pkgname/receipt ] || continue 1.755 + . $wok/$pkgname/receipt 1.756 + if [ -f $INCOMING/$PACKAGE-${VERSION}*.tazpkg -o -f $PKGS/$PACKAGE-${VERSION}*.tazpkg ]; then 1.757 + if grep "^$pkgname" $cooklist; then 1.758 + sed -i "s|^$pkgname$||g" $cooklist 1.759 + sed -i /^$/d $cooklist 1.760 + fi 1.761 + fi 1.762 + done 1.763 + fi 1.764 + 1.765 + #rm -f $command 1.766 + ;; 1.767 + gen-wok-db) 1.768 + check_root 1.769 + #echo "cook:gen-wok-db" > $command 1.770 + [ -d "$WOKHG" ] && WOK="$WOKHG" 1.771 + [ "$2" ] && WOK="$2" 1.772 + gen_wok_db ;; 1.773 + check-incoming) 1.774 + check_root 1.775 + get_options_list="forced" 1.776 + get_options 1.777 + echo "cook:check-incoming" > $command 1.778 + check_for_incoming 1.779 + rm -f $command ;; 1.780 + gen-src) 1.781 + check_root 1.782 + [ "$2" ] && src_repository="$2" 1.783 + [ -d "$src_repository" ] || src_repository="$SRC" 1.784 + gettext -e "Rebulding sources.list file: $src_repository" 1.785 + gen_sources_list $src_repository 1.786 + status ;; 1.787 + maintainers) 1.788 + check_root 1.789 + newline 1.790 + echo "List of maintainers for: $WOK" 1.791 + separator 1.792 + tmp="/tmp/slitaz-maintainers" 1.793 + touch $tmp 1.794 + for pkg in $WOK/* 1.795 + do 1.796 + [ -f $pkg/receipt ] || continue 1.797 + . $pkg/receipt 1.798 + if ! fgrep -q "$MAINTAINER" $tmp; then 1.799 + echo "$MAINTAINER" >> $tmp 1.800 + echo "$MAINTAINER" 1.801 + fi 1.802 + done 1.803 + separator 1.804 + echo "Maintainers: `cat $tmp | wc -l`" 1.805 + newline 1.806 + # Remove tmp files 1.807 + [ -f $tmp ] && rm -f $tmp 1.808 + ;; 1.809 + tags) 1.810 + check_root 1.811 + echo -e "\n\033[1mTags list :\033[0m" 1.812 + separator 1.813 + tmp="/tmp/tags" 1.814 + touch $tmp 1.815 + for pkg in $WOK/*; do 1.816 + unset TAGS 1.817 + [ -f $pkg/receipt ] || continue 1.818 + source $pkg/receipt 1.819 + for t in $TAGS; do 1.820 + grep -q ^$t$ $tmp && continue 1.821 + echo $t | tee -a $tmp 1.822 + done 1.823 + done 1.824 + separator 1.825 + echo "$(wc -l $tmp | cut -f1 -d ' ') tags listed." 1.826 + [ -f $tmp ] && rm -rf $tmp 1.827 + ;; 1.828 + maintained-by) 1.829 + # Search for packages maintained by a contributor. 1.830 + check_root 1.831 + if [ ! -n "$2" ]; then 1.832 + echo "Specify a name or email of a maintainer." >&2 1.833 + exit 1 1.834 + fi 1.835 + echo "Maintainer packages" 1.836 + separator 1.837 + for pkg in $WOK/* 1.838 + do 1.839 + [ -f $pkg/receipt ] || continue 1.840 + . $pkg/receipt 1.841 + if echo "$MAINTAINER" | fgrep -q "$2"; then 1.842 + echo "$PACKAGE" 1.843 + packages=$(($packages+1)) 1.844 + fi 1.845 + done 1.846 + separator 1.847 + echo "Packages maintained by $2: $packages" 1.848 + newline 1.849 + ;; 1.850 + check-src) 1.851 + # Verify if upstream package is still available. 1.852 + # 1.853 + check_root 1.854 + PACKAGE="$2" 1.855 + receipt="$WOK/$PACKAGE/receipt" 1.856 + if [ ! -f $receipt ]; then 1.857 + gettext -e "\nUnable to find package in the wok:" 1.858 + echo -e " $PACKAGE\n" && exit 1 1.859 + fi 1.860 + unset_receipt 1.861 + source $receipt 1.862 + check_src() 1.863 + { 1.864 + for url in $@; do 1.865 + busybox wget -s $url 2>/dev/null && break 1.866 + done 1.867 + } 1.868 + if [ "$WGET_URL" ];then 1.869 + echo -n "$PACKAGE : " 1.870 + check_src $WGET_URL 1.871 + status 1.872 + else 1.873 + echo "No tarball to check for $PACKAGE" 1.874 + fi 1.875 + ;; 1.876 + unbuild) 1.877 + unbuild "$2" "$3" ;; 1.878 pkgdb) 1.879 # Create suitable packages list for TazPKG and only for built packages 1.880 # as well as flavors files for TazLiTo. We dont need logs since we do it 1.881 # manually to ensure everything is fine before syncing the mirror. 1.882 - case "$2" in 1.883 - --flavors) 1.884 - continue ;; 1.885 - *) 1.886 - [ "$2" ] && PKGS="$2" 1.887 - [ ! -d "$PKGS" ] && \ 1.888 - gettext -e "\nPackages directory doesn't exist\n\n" && exit 1 ;; 1.889 - esac 1.890 - time=$(date +%s) 1.891 - flavors=$SLITAZ/flavors 1.892 - live=$SLITAZ/live 1.893 - echo "cook:pkgdb" > $command 1.894 - echo "Cook pkgdb: Creating all packages lists" | log 1.895 - newline 1.896 - gettext "Creating lists for: "; echo "$PKGS" 1.897 - separator 1.898 - gettext "Cook pkgdb started: "; date "+%Y-%m-%d %H:%M" 1.899 - cd $PKGS 1.900 - rm -f packages.* 1.901 - gettext -e "Creating: packages.list\n" 1.902 - ls -1 *.tazpkg | sed s'/.tazpkg//' > $PKGS/packages.list 1.903 - gettext -e "Creating: packages.md5\n" 1.904 - md5sum *.tazpkg > $PKGS/packages.md5 1.905 - md5sum packages.md5 | cut -f1 -d' ' > ID 1.906 - gettext -e "Creating lists from: "; echo "$WOK" 1.907 - cd $WOK 1.908 - for pkg in * 1.909 - do 1.910 - unset_receipt 1.911 - . $pkg/receipt 1.912 - if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then 1.913 - # PACKED_SIZE and UNPACKED_SIZE are only in built receipt 1.914 - if [ -s $pkg/taz/*/receipt ]; then 1.915 - . $pkg/taz/*/receipt 1.916 - fi 1.917 - # packages.desc lets us search easily in DB 1.918 - cat >> $PKGS/packages.desc << EOT 1.919 -$PACKAGE | ${VERSION}$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE 1.920 -EOT 1.921 - # packages.txt used by tazpkg and tazpkg-web also to provide 1.922 - # a human readable package list with version and description. 1.923 - cat >> $PKGS/packages.txt << EOT 1.924 -$PACKAGE 1.925 -${VERSION}$EXTRAVERSION 1.926 -$SHORT_DESC 1.927 -$PACKED_SIZE ($UNPACKED_SIZE installed) 1.928 - 1.929 -EOT 1.930 - # packages.equiv is used by tazpkg install to check depends. 1.931 - for i in $PROVIDE; do 1.932 - DEST="" 1.933 - echo $i | fgrep -q : && DEST="${i#*:}:" 1.934 - if grep -qs ^${i%:*}= $PKGS/packages.equiv; then 1.935 - sed -i "s/^${i%:*}=/${i%:*}=$DEST$PACKAGE /" \ 1.936 - $PKGS/packages.equiv 1.937 - else 1.938 - echo "${i%:*}=$DEST$PACKAGE" >> $PKGS/packages.equiv 1.939 - fi 1.940 - done 1.941 - # files.list provides a list of all packages files. 1.942 - cat $pkg/taz/*/files.list | sed s/^/"$pkg: \0"/ >> \ 1.943 - $PKGS/files.list 1.944 - fi 1.945 - done 1.946 - 1.947 - # Display list size. 1.948 - gettext -e "Done: packages.desc\n" 1.949 - gettext -e "Done: packages.txt\n" 1.950 - gettext -e "Done: packages.equiv\n" 1.951 - 1.952 - # files.list.lzma 1.953 - gettext -e "Creating: files.list.lzma\n" 1.954 - cd $PKGS && lzma e files.list files.list.lzma 1.955 - rm -f files.list 1.956 - 1.957 - # Display some info. 1.958 - separator 1.959 - nb=$(ls $PKGS/*.tazpkg | wc -l) 1.960 - time=$(($(date +%s) - $time)) 1.961 - echo -e "Packages: $nb - Time: ${time}s\n" 1.962 - 1.963 - # Create all flavors files at once. Do we really need code to monitor 1.964 - # flavors changes ? Lets just build them with packages lists before 1.965 - # syncing the mirror. 1.966 - [ "$2" == "--flavors" ] || exit 1 1.967 - [ ! -d "$flavors" ] && echo -e "Missing flavors: $flavors\n" && exit 1 1.968 - [ -d "$live" ] || mkdir -p $live 1.969 - gettext "Creating flavors files in:"; echo " $live" 1.970 - echo "Cook pkgdb: Creating all flavors" | log 1.971 - separator 1.972 - gettext -e "Recharging lists to use latest packages...\n" 1.973 - tazpkg recharge >/dev/null 2>/dev/null 1.974 - 1.975 - # We need a custom tazlito config to set working dir to /home/slitaz. 1.976 - if [ ! -f "$live/tazlito.conf" ]; then 1.977 - echo "Creating configuration file: tazlito.conf" 1.978 - cp /etc/tazlito/tazlito.conf $live 1.979 - sed -i s@WORK_DIR=.*@WORK_DIR=\"/home/slitaz\"@ \ 1.980 - $live/tazlito.conf 1.981 - fi 1.982 - 1.983 - # Update Hg flavors repo and pack. 1.984 - [ -d "$flavors/.hg" ] && cd $flavors && hg pull -u 1.985 - 1.986 - cd $live 1.987 - echo "Starting to generate flavors..." 1.988 - rm -f flavors.list *.flavor 1.989 - for i in $flavors/* 1.990 - do 1.991 - fl=$(basename $i) 1.992 - echo "Packing flavor: $(basename $i)" 1.993 - tazlito pack-flavor $fl >/dev/null || exit 1 1.994 - tazlito show-flavor $fl --brief --noheader 2> \ 1.995 - /dev/null >> flavors.list 1.996 - done 1.997 - cp -f $live/*.flavor $live/flavors.list $PKGS 1.998 - separator && gettext "Flavors size: "; du -sh $live | awk '{print $1}' 1.999 - newline && rm -f $command ;; 1.1000 + pkgdb "$2" 1.1001 + exit 0 ;; 1.1002 + clean-chroot) 1.1003 + clean_chroot ;; 1.1004 *) 1.1005 # Just cook and generate a package. 1.1006 check_root 1.1007 @@ -1441,6 +1576,8 @@ 1.1008 trap 'gettext -e "\n\nCook stopped: control-C\n\n" | \ 1.1009 tee -a $LOGS/$pkg.log' INT 1.1010 1.1011 + set_paths 1.1012 + 1.1013 # Handle --options 1.1014 case "$2" in 1.1015 --clean|-c) 1.1016 @@ -1449,10 +1586,13 @@ 1.1017 status && newline && exit 0 ;; 1.1018 --install|-i) 1.1019 inst='yes' ;; 1.1020 + --noupdate|-nu) 1.1021 + UPCHROOT="" ;; 1.1022 + --nocleanchroot|-ncc) 1.1023 + CLEAN_CHROOT="" ;; 1.1024 --getsrc|-gs) 1.1025 - gettext "Getting source for:"; echo " $pkg" 1.1026 - separator && get_source 1.1027 - echo -e "Tarball: $SRC/$TARBALL\n" && exit 0 ;; 1.1028 + getsrc "$3" 1.1029 + exit 0 ;; 1.1030 --block|-b) 1.1031 gettext "Blocking:"; echo -n " $pkg" 1.1032 [ $(grep "^$pkg$" $blocked) ] || echo "$pkg" >> $blocked 1.1033 @@ -1461,27 +1601,54 @@ 1.1034 gettext "Unblocking:"; echo -n " $pkg" 1.1035 sed -i "/^${pkg}$/"d $blocked 1.1036 status && newline && exit 0 ;; 1.1037 - 1.1038 + --pack) 1.1039 + if [ -d $WOK/$pkg/taz ]; then 1.1040 + rm -rf $WOK/$pkg/taz 1.1041 + [ -f $LOGS/$pkg-pack.log ] && rm -rf $LOGS/$pkg-pack.log 1.1042 + packit 2>&1 | tee -a $LOGS/$pkg-pack.log 1.1043 + clean_log 1.1044 + else 1.1045 + gettext "Need to build $pkg." && exit 0 1.1046 + fi 1.1047 + exit 0 ;; 1.1048 esac 1.1049 1.1050 # Check if wanted is built now so we have separate log files. 1.1051 - for wanted in $WANTED ; do 1.1052 - if grep -q "^$wanted$" $blocked; then 1.1053 - echo "WANTED package is blocked: $wanted" | tee $LOGS/$pkg.log 1.1054 + if [ "$WANTED" ]; then 1.1055 + if grep -q "^$WANTED$" $blocked; then 1.1056 + echo "WANTED package $PACKAGE is blocked: $WANTED" | tee $LOGS/$pkg.log 1.1057 newline && rm -f $command && exit 1 1.1058 fi 1.1059 - if grep -q "^$wanted$" $broken; then 1.1060 - echo "WANTED package is broken: $wanted" | tee $LOGS/$pkg.log 1.1061 + if grep -q "^$WANTED$" $broken; then 1.1062 + echo "WANTED package $PACKAGE is broken: $WANTED" | tee $LOGS/$pkg.log 1.1063 newline && rm -f $command && exit 1 1.1064 fi 1.1065 - if [ ! -d "$WOK/$wanted/install" ]; then 1.1066 - cook "$wanted" || exit 1 1.1067 + if [ ! "$COOK_WANTED" ]; then 1.1068 + if [ ! -d "$WOK/$WANTED/install" ]; then 1.1069 + cook "$WANTED" || exit 1 1.1070 + fi 1.1071 fi 1.1072 - done 1.1073 - 1.1074 + fi 1.1075 + 1.1076 + if [ "$UPCOOKLIST" ]; then 1.1077 + db_md5=$(md5sum $dep_db $wan_db) 1.1078 + echo "update_wok_db" 1.1079 + update_wan_db 1.1080 + echo "check_for_commit" 1.1081 + check_for_commit 1.1082 + sort -o $dep_db $dep_db 1.1083 + sort -o $wan_db $wan_db 1.1084 + if [ "$db_md5" != "$(md5sum $dep_db $wan_db)" ]; then 1.1085 + grep -q "^#" $fullco || sed 1i"#PlanSort" -i $fullco 1.1086 + fi 1.1087 + fi 1.1088 + 1.1089 # Cook and pack or exit on error and log everything. 1.1090 cookit $@ 2>&1 | tee $LOGS/$pkg.log 1.1091 remove_deps | tee -a $LOGS/$pkg.log 1.1092 + if [ "$CLEAN_CHROOT" ]; then 1.1093 + clean_chroot | tee -a $LOGS/$pkg.log 1.1094 + fi 1.1095 cookit_quality 1.1096 packit 2>&1 | tee -a $LOGS/$pkg.log 1.1097 clean_log 1.1098 @@ -1489,9 +1656,15 @@ 1.1099 # Exit if any error in packing. 1.1100 if grep -q ^ERROR $LOGS/$pkg.log; then 1.1101 debug_info | tee -a $LOGS/$pkg.log 1.1102 + broken 1.1103 rm -f $command && exit 1 1.1104 fi 1.1105 1.1106 + # This is needed cause unset and source receipt again 1.1107 + if [ -f "$SRC/$lzma_tarball" ]; then 1.1108 + TARBALL="$lzma_tarball" 1.1109 + fi 1.1110 + 1.1111 # Create an XML feed 1.1112 gen_rss 1.1113 1.1114 @@ -1500,9 +1673,32 @@ 1.1115 summary | tee -a $LOGS/$pkg.log 1.1116 newline 1.1117 1.1118 - # We may want to install/update. 1.1119 + if [ "$AUTO_PURGE_SRC" ]; then 1.1120 + if [ -f "$SRC/$TARBALL" ]; then 1.1121 + previous_tarball=$(grep ^$PACKAGE:incoming $SRC/sources.list | cut -f2) 1.1122 + if [ -f "$SRC/$previous_tarball" ]; then 1.1123 + sed "/^$PACKAGE:incoming/ s/.*/$PACKAGE:incoming\t$TARBALL/" \ 1.1124 + -i $SRC/sources.list 1.1125 + grep -q $'\t'$previous_tarball$ $SRC/sources.list || \ 1.1126 + rm -f $SRC/$previous_tarball 1.1127 + else 1.1128 + echo -e "$PACKAGE:incoming\t$TARBALL" >> $SRC/sources.list 1.1129 + fi 1.1130 + fi 1.1131 + fi 1.1132 + 1.1133 + # remove source folder if its not used in 1.1134 + # genpkg_rules in all wanted packages 1.1135 + remove_src 1.1136 + 1.1137 install_package 1.1138 - 1.1139 + 1.1140 + # Regen the cooklist if it was planned and command is not cook. 1.1141 + [ "$regen_cooklist" -a "$UPCOOKLIST" ] && unset regen_cooklist && sort_cooklist 1.1142 + 1.1143 + if [ $(grep -l "^$pkg$" $broken) ]; then 1.1144 + sed -i "^$pkg$" $broken 1.1145 + fi 1.1146 # Finally we DONT WANT to build the *-dev or packages with WANTED="$pkg" 1.1147 # You want automation: use the Cooker Build Bot. 1.1148 rm -f $command ;;