cookutils view cook @ rev 353

cook: CFLAGS is usefull not configure args
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 16 11:26:06 2012 +0200 (2012-04-16)
parents ce7d26144786
children 4662001db93f
line source
1 #!/bin/sh
2 #
3 # Cook - A tool to cook and generate SliTaz packages. Read the README
4 # before adding or modifing any code in cook!
5 #
6 # Copyright (C) SliTaz GNU/Linux - GNU gpl v3
7 # Author: Christophe Lincoln <pankso@slitaz.org>
8 #
10 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
11 [ -f "cook.conf" ] && . ./cook.conf
13 # Share DB and status with the Cooker.
14 activity="$CACHE/activity"
15 command="$CACHE/command"
16 broken="$CACHE/broken"
17 blocked="$CACHE/blocked"
19 # Old style compatibility
20 SOURCES_REPOSITORY=$SRC
22 #
23 # Functions
24 #
26 usage() {
27 cat << EOT
29 $(echo -e "\033[1m$(gettext "Usage:")\033[0m") cook [package|command] [list|--option]
31 $(echo -e "\033[1m$(gettext "Commands:")\033[0m")
32 usage|help $(gettext "Display this short usage.")
33 setup $(gettext "Setup your build environment.")
34 test $(gettext "Test environment and cook a package.")
35 list-wok $(gettext "List packages in the wok.")
36 search $(gettext "Simple packages search function.")
37 new $(gettext "Create a new package with a receipt".)
38 list $(gettext "Cook a list of packages.")
39 clean-wok $(gettext "Clean-up all packages files.")
40 clean-src $(gettext "Clean-up all packages sources.")
41 pkgdb $(gettext "Create packages DB lists and flavors.")
43 $(echo -e "\033[1m$(gettext "Options:")\033[0m")
44 --clean|-c Cook : $(gettext "clean the package in the wok.")
45 --install|-i Cook : $(gettext "cook and install the package.")
46 --getsrc|-gs Cook : $(gettext "get the package source tarball.")
47 --block|-b Cook : $(gettext "Block a package so cook will skip it.")
48 --unblock|-ub Cook : $(gettext "Unblock a blocked package.")
49 --interactive|-x New : $(gettext "create a receipt interactively.")
50 --wok|-w Setup: $(gettext "clone the cooking wok from Hg repo.")
51 --stable Setup: $(gettext "clone the stable wok from Hg repo.")
52 --undigest Setup: $(gettext "clone the undigest wok from Hg repo.")
53 --flavors Pkgdb: $(gettext "create up-to-date flavors files.")
55 EOT
56 exit 0
57 }
59 # Be sure we're root.
60 check_root() {
61 [ $(id -u) != 0 ] && gettext -e "\nYou must be root to cook.\n\n" && exit 0
62 }
64 separator() {
65 echo "================================================================================"
66 }
68 status() {
69 echo -en "\\033[70G[ "
70 if [ $? = 0 ]; then
71 echo -en "\\033[1;32mOK"
72 else
73 echo -en "\\033[1;31mFailed"
74 fi
75 echo -e "\\033[0;39m ]"
76 }
78 # Log activities, we want first letter capitalized.
79 log() {
80 grep ^[A-Z] | \
81 sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity
82 }
84 # We don't want these escapes in web interface.
85 clean_log() {
86 sed -i -e s'|\[70G\[ \[1;32m| |' \
87 -e s'|\[0;39m \]||' $LOGS/$pkg.log
88 }
90 # Log broken packages.
91 broken() {
92 if ! grep -q "^$pkg$" $broken; then
93 echo "$pkg" >> $broken
94 fi
95 }
97 # Be sure package exists in wok.
98 check_pkg_in_wok() {
99 if [ ! -d "$WOK/$pkg" ]; then
100 gettext -e "\nUnable to find package in the wok:"
101 echo -e " $pkg\n" && exit 1
102 fi
103 }
105 if_empty_value() {
106 if [ -z "$value" ]; then
107 gettext "QA: empty variable:"; echo -e " ${var}=\"\"\n"
108 exit 1
109 fi
110 }
112 # Initialize files used in $CACHE
113 init_db_files() {
114 gettext "Creating directories structure in:"; echo " $SLITAZ"
115 mkdir -p $WOK $PKGS $SRC $CACHE $LOGS
116 gettext "Creating DB files in:"; echo " $CACHE"
117 for f in $activity $command $broken $blocked
118 do
119 touch $f
120 done
121 }
123 # QA: check a receipt consistency before building.
124 receipt_quality() {
125 gettext -e "QA: checking package receipt...\n"
126 unset online
127 if ifconfig | grep -q -A 1 "^[a-z]*[0-9]" | fgrep 'addr:'; then
128 online="online"
129 fi
130 for var in PACKAGE VERSION CATEGORY SHORT_DESC MAINTAINER WEB_SITE
131 do
132 unset value
133 value="$(. $receipt ; eval echo \$$var)"
134 case "$var" in
135 PACKAGE|VERSION|SHORT_DESC)
136 if_empty_value ;;
137 CATEGORY)
138 [ -z "$value" ] && value="empty"
139 valid="base-system x-window utilities network graphics \
140 multimedia office development system-tools security games \
141 misc meta non-free"
142 if ! echo "$valid" | grep -q -w "$value"; then
143 gettext "QA: unknown category:"; echo -e " $value\n"
144 exit 1
145 fi ;;
146 WEB_SITE)
147 # We don't check WGET_URL since if dl is needed it will fail.
148 # Break also if we're not online. Here error is not fatal.
149 if_empty_value
150 [ -z "$online" ] || break
151 if ! busybox wget -T 12 -s $value 2>/dev/null; then
152 gettext "QA: Unable to reach:"; echo -e " $value"
153 fi ;;
154 esac
155 done
156 }
158 # Executed before sourcing a receipt.
159 unset_receipt() {
160 unset DEPENDS BUILD_DEPENDS WANTED EXTRAVERSION WGET_URL PROVIDE TARBALL
161 }
163 # Paths used in receipt and by cook itself.
164 set_paths() {
165 pkgdir=$WOK/$PACKAGE
166 src=$pkgdir/source/$PACKAGE-$VERSION
167 taz=$pkgdir/taz
168 pack=$taz/$PACKAGE-${VERSION}${EXTRAVERSION}
169 fs=$pack/fs
170 stuff=$pkgdir/stuff
171 install=$pkgdir/install
172 if [ "$WANTED" ]; then
173 wanted=${WANTED%% *}
174 src=$WOK/$wanted/source/$wanted-$VERSION
175 install=$WOK/$wanted/install
176 wanted_stuff=$WOK/$wanted/stuff
177 fi
178 # Kernel version is set from linux-api-headers since it is part of toolchain.
179 if [ -f "$INSTALLED/linux-api-headers/receipt" ]; then
180 kvers=$(grep ^VERSION= $INSTALLED/linux-api-headers/receipt | cut -d '"' -f 2)
181 fi
182 # Old way compatibility.
183 _pkg=$install
184 }
186 # Create source tarball when URL is a SCM.
187 create_tarball() {
188 gettext "Creating tarball: "; echo "$tarball"
189 if [ "$LZMA_SRC" ]; then
190 tar -c $pkgsrc | lzma e $SRC/$tarball -si || exit 1
191 else
192 tar cjf $tarball $pkgsrc || exit 1
193 mv $tarball $SRC && rm -rf $pkgsrc
194 fi
195 }
197 # Get package source. For SCM we are in cache so clone here and create a
198 # tarball here.
199 get_source() {
200 pwd=$(pwd)
201 pkgsrc=${SOURCE:-$PACKAGE}-$VERSION
202 tarball=$pkgsrc.tar.bz2
203 [ "$LZMA_SRC" ] && tarball=$pkgsrc.tar.lzma
204 case "$WGET_URL" in
205 http://*|ftp://*)
206 # Busybox Wget is better!
207 busybox wget -T 60 -c -O $SRC/$TARBALL $WGET_URL || \
208 (echo -e "ERROR: wget $WGET_URL" && exit 1) ;;
209 https://*)
210 wget -c --no-check-certificate -O $SRC/$TARBALL $WGET_URL || \
211 (echo -e "ERROR: wget $WGET_URL" && exit 1) ;;
212 hg*|mercurial*)
213 if $(echo "$WGET_URL" | fgrep -q "hg|"); then
214 url=${WGET_URL#hg|}
215 else
216 url=${WGET_URL#mercurial|}
217 fi
218 gettext -e "Getting source from Hg...\n"
219 echo "URL: $url"
220 gettext "Cloning to: "; echo "$pwd/$pkgsrc"
221 if [ "$BRANCH" ]; then
222 echo "Hg branch: $BRANCH"
223 hg clone $url --rev $BRANCH $pkgsrc || \
224 (echo "ERROR: hg clone $url --rev $BRANCH" && exit 1)
225 else
226 hg clone $url $pkgsrc || (echo "ERROR: hg clone $url" && exit 1)
227 fi
228 rm -rf $pkgsrc/.hg
229 create_tarball ;;
230 git*)
231 url=${WGET_URL#git|}
232 gettext -e "Getting source from Git...\n"
233 echo "URL: $url"
234 git clone $url $pkgsrc || (echo "ERROR: git clone $url" && exit 1)
235 if [ "$BRANCH" ]; then
236 echo "Git branch: $BRANCH"
237 cd $pkgsrc && git checkout $BRANCH && cd ..
238 fi
239 create_tarball ;;
240 cvs*)
241 url=${WGET_URL#cvs|}
242 mod=$PACKAGE
243 [ "$CVS_MODULE" ] && mod=$CVS_MODULE
244 gettext -e "Getting source from CVS...\n"
245 echo "URL: $url"
246 [ "$CVS_MODULE" ] && echo "CVS module: $mod"
247 gettext "Cloning to: "; echo "$pwd/$mod"
248 cvs -d:$url co $mod && mv $mod $pkgsrc
249 create_tarball ;;
250 svn*|subversion*)
251 if $(echo "$WGET_URL" | fgrep -q "svn|"); then
252 url=${WGET_URL#svn|}
253 else
254 url=${WGET_URL#subversion|}
255 fi
256 gettext -e "Getting source from SVN...\n"
257 echo "URL: $url"
258 if [ "$BRANCH" ]; then
259 echo t | svn co $url -r $BRANCH $pkgsrc
260 else
261 echo t | svn co $url $pkgsrc
262 fi
263 create_tarball ;;
264 *)
265 gettext -e "\nERROR: Unable to handle:"; echo -e " $WGET_URL \n" | \
266 tee -a $LOGS/$PACKAGE.log
267 exit 1 ;;
268 esac
269 }
271 # Extract source package.
272 extract_source() {
273 if [ ! -s "$SRC/$TARBALL" ]; then
274 local url
275 url="http://mirror.slitaz.org/sources/packages"
276 url=$url/${TARBALL:0:1}/$TARBALL
277 gettext "Getting source from mirror:"; echo " $url"
278 busybox wget -c -P $SRC $url || echo -e "ERROR: wget $url"
279 fi
280 gettext "Extracting:"; echo " $TARBALL"
281 case "$TARBALL" in
282 *.tar.gz|*.tgz) tar xzf $SRC/$TARBALL 2>/dev/null ;;
283 *.tar.bz2|*.tbz|*.tbz2) tar xjf $SRC/$TARBALL 2>/dev/null ;;
284 *.tar.lzma) tar xaf $SRC/$TARBALL ;;
285 *.tar) tar xf $SRC/$TARBALL ;;
286 *.zip|*.xpi) unzip -o $SRC/$TARBALL ;;
287 *.xz) unxz -c $SRC/$TARBALL | tar xf - ;;
288 *.Z) uncompress -c $SRC/$TARBALL | tar xf - ;;
289 *.rpm) rpm2cpio $SRC/$TARBALL | cpio -idm --quiet ;;
290 *.run) /bin/sh $SRC/$TARBALL $RUN_OPTS ;;
291 *) cp $SRC/$TARBALL $(pwd) ;;
292 esac
293 }
295 # Display cooked package summary.
296 summary() {
297 cd $WOK/$pkg
298 [ -d install ] && prod=$(du -sh install | awk '{print $1}' 2>/dev/null)
299 fs=$(du -sh taz/* | awk '{print $1}')
300 size=$(du -sh $PKGS/$pkg-${VERSION}*.tazpkg | awk '{print $1}')
301 files=$(cat taz/$pkg-*/files.list | wc -l)
302 cookdate=$(date "+%Y-%m-%d %H:%M")
303 sec=$time
304 div=$(( ($time + 30) / 60))
305 [ "$div" != 0 ] && min="~ ${div}m"
306 gettext "Summary for:"; echo " $PACKAGE $VERSION"
307 separator
308 [ "$prod" ] && echo "Produced : $prod"
309 cat << EOT
310 Packed : $fs
311 Compressed : $size
312 Files : $files
313 Cook time : ${sec}s $min
314 Cook date : $cookdate
315 $(separator)
316 EOT
317 }
319 # Display debugging error info.
320 debug_info() {
321 echo -e "\nDebug information"
322 separator
323 echo "Cook date: $(date '+%Y-%m-%d %H:%M')"
324 for error in \
325 ERROR "No package" "cp: can't" "can't open" "can't cd" \
326 "error:" "fatal error:"
327 do
328 fgrep "$error" $LOGS/$pkg.log
329 done
330 separator && echo ""
331 }
333 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths,
334 # so some packages need to copy these files with the receipt and genpkg_rules.
335 copy_generic_files()
336 {
337 # $LOCALE is set in cook.conf
338 if [ "$LOCALE" ]; then
339 if [ -d "$install/usr/share/locale" ]; then
340 mkdir -p $fs/usr/share/locale
341 for i in $LOCALE
342 do
343 if [ -d "$install/usr/share/locale/$i" ]; then
344 cp -a $install/usr/share/locale/$i $fs/usr/share/locale
345 fi
346 done
347 fi
348 fi
350 # Generic pixmaps copy can be disabled with GENERIC_PIXMAPS="no"
351 if [ "$GENERIC_PIXMAPS" != "no" ]; then
352 if [ -d "$install/usr/share/pixmaps" ]; then
353 mkdir -p $fs/usr/share/pixmaps
354 cp -a $install/usr/share/pixmaps/$PACKAGE.png \
355 $fs/usr/share/pixmaps 2>/dev/null || continue
356 cp -a $install/usr/share/pixmaps/$PACKAGE.xpm \
357 $fs/usr/share/pixmaps 2>/dev/null || continue
358 fi
360 # Custom or homemade PNG pixmap can be in stuff.
361 if [ -f "$stuff/$PACKAGE.png" ]; then
362 mkdir -p $fs/usr/share/pixmaps
363 cp -a $stuff/$PACKAGE.png $fs/usr/share/pixmaps
364 fi
365 fi
367 # Desktop entry (.desktop).
368 # Generic desktop entry copy can be disabled with GENERIC_MENUS="no"
369 if [ "$GENERIC_MENUS" != "no" ]; then
370 if [ -d "$install/usr/share/applications" ] && [ "$WANTED" == "" ]; then
371 cp -a $install/usr/share/applications $fs/usr/share
372 fi
373 fi
375 # Homemade desktop file(s) can be in stuff.
376 if [ -d "$stuff/applications" ]; then
377 mkdir -p $fs/usr/share
378 cp -a $stuff/applications $fs/usr/share
379 fi
380 if [ -f "$stuff/$PACKAGE.desktop" ]; then
381 mkdir -p $fs/usr/share/applications
382 cp -a $stuff/$PACKAGE.desktop $fs/usr/share/applications
383 fi
384 }
386 # Find and strip : --strip-all (-s) or --strip-debug on static libs as well
387 # as removing uneeded files like in Python packages.
388 strip_package()
389 {
390 gettext "Executing strip on all files..."
391 for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games
392 do
393 if [ -d "$dir" ]; then
394 find $dir -type f -exec strip -s '{}' 2>/dev/null \;
395 fi
396 done
397 find $fs -name "*.so*" -exec strip -s '{}' 2>/dev/null \;
398 find $fs -name "*.a" -exec strip --strip-debug '{}' 2>/dev/null \;
399 status
401 # Remove Python .pyc and .pyo from packages.
402 if echo "$PACKAGE $DEPENDS" | fgrep -q "python"; then
403 gettext "Removing Python compiled files..."
404 find $fs -type f -name "*.pyc" -delete 2>/dev/null
405 find $fs -type f -name "*.pyo" -delete 2>/dev/null
406 status
407 fi
409 # Remove Perl perllocal.pod and .packlist from packages.
410 if echo "$DEPENDS" | fgrep -q "perl"; then
411 gettext "Removing Perl compiled files..."
412 find $fs -type f -name "perllocal.pod" -delete 2>/dev/null
413 find $fs -type f -name ".packlist" -delete 2>/dev/null
414 status
415 fi
416 }
418 # Remove installed deps.
419 remove_deps() {
420 # Now remove installed build deps.
421 diff="$CACHE/installed.cook.diff"
422 if [ -s "$CACHE/installed.cook.diff" ]; then
423 deps=$(cat $diff | grep ^+[a-zA-Z0-9] | sed s/^+//)
424 nb=$(cat $diff | grep ^+[a-zA-Z0-9] | wc -l)
425 gettext "Build dependencies to remove:"; echo " $nb"
426 gettext "Removing:"
427 for dep in $deps
428 do
429 echo -n " $dep"
430 echo 'y' | tazpkg remove $dep >/dev/null
431 done
432 echo -e "\n"
433 # Keep the last diff for debug and info.
434 mv -f $CACHE/installed.cook.diff $CACHE/installed.diff
435 fi
436 }
438 # The main cook function.
439 cookit() {
440 echo "Cook: $PACKAGE $VERSION"
441 separator
442 set_paths
443 [ "$QA" ] && receipt_quality
444 cd $pkgdir
445 rm -rf install taz source
447 # Disable -pipe if less than 512Mb free RAM.
448 free=$(free | fgrep '/+ buffers' | tr -s ' ' | cut -f 4 -d ' ')
449 if [ "$free" -lt 524288 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then
450 gettext -e "Disabling -pipe compile flag: $free RAM\n"
451 CFLAGS="${CFLAGS/-pipe}" && CFLAGS=$(echo "$CFLAGS" | tr -s ' ')
452 CXXFLAGS="${CXXFLAGS/-pipe}" && \
453 CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ')
454 fi
455 unset free
457 # Export flags and path to be used by make and receipt.
458 DESTDIR=$pkgdir/install
459 export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C
461 # Check for build deps and handle implicit depends of *-dev packages
462 # (ex: libusb-dev :: libusb).
463 rm -f $CACHE/installed.local $CACHE/installed.web $CACHE/missing.dep
464 touch $CACHE/installed.local $CACHE/installed.web
465 [ "$BUILD_DEPENDS" ] && gettext -e "Checking build dependencies...\n"
466 for dep in $BUILD_DEPENDS
467 do
468 implicit=${dep%-dev}
469 for i in $dep $implicit
470 do
471 if [ ! -f "$INSTALLED/$i/receipt" ]; then
472 # Try local package first. In some cases implicit doesn't exist, ex:
473 # libboost-dev exists but not libboost, so check if we got vers.
474 unset vers
475 vers=$(. $WOK/$i/receipt 2>/dev/null ; echo $VERSION)
476 if [ -f "$PKGS/$i-$vers.tazpkg" ]; then
477 echo $i-$vers.tazpkg >> $CACHE/installed.local
478 else
479 # Priority to package version in wok (maybe more up-to-date)
480 # than the mirrored one.
481 if [ "$vers" ]; then
482 if fgrep -q $i-$vers $DB/packages.list; then
483 echo $i >> $CACHE/installed.web
484 else
485 # So package exists in wok but not available.
486 gettext "Missing dep (wok/pkg):"; echo " $i $vers"
487 echo $i >> $CACHE/missing.dep
488 fi
489 else
490 # Package is not in wok but may be in repo.
491 if fgrep -q $i-$vers $DB/packages.list; then
492 echo $i >> $CACHE/installed.web
493 else
494 echo "ERROR: unknown dep $i" && exit 1
495 fi
496 fi
497 fi
498 fi
499 done
500 done
502 # Get the list of installed packages
503 cd $INSTALLED && ls -1 > $CACHE/installed.list
505 # Have we a missing build dep to cook ?
506 if [ -s "$CACHE/missing.dep" ] && [ "$AUTO_COOK" ]; then
507 gettext -e "Auto cook config is set : AUTO_COOK\n"
508 cp -f $LOGS/$PACKAGE.log $LOGS/$PACKAGE.log.$$
509 for i in $(uniq $CACHE/missing.dep)
510 do
511 (gettext "Building dep (wok/pkg) :"; echo " $i $vers") | \
512 tee -a $LOGS/$PACKAGE.log.$$
513 cook $i || (echo -e "ERROR: can't cook dep '$i'\n" && \
514 fgrep "remove: " $LOGS/$i.log && \
515 fgrep "Removing: " $LOGS/$i.log && echo "") | \
516 tee -a $LOGS/$PACKAGE.log.$$ && break
517 done
518 rm -f $CACHE/missing.dep
519 mv $LOGS/$PACKAGE.log.$$ $LOGS/$PACKAGE.log
520 fi
522 # QA: Exit on missing dep errors. We exit in both cases, if AUTO_COOK
523 # is enabled and cook fails we have ERROR in log, if no auto cook we have
524 # missing dep in cached file.
525 if fgrep -q "ERROR:" $LOGS/$pkg.log || [ -s "$CACHE/missing.dep" ]; then
526 [ -s "$CACHE/missing.dep" ] && nb=$(cat $CACHE/missing.dep | wc -l)
527 echo "ERROR: missing dep $nb" && exit 1
528 fi
530 # Install local packages.
531 cd $PKGS
532 for i in $(uniq $CACHE/installed.local)
533 do
534 gettext "Installing dep (pkg/local):"; echo " $i"
535 tazpkg install $i >/dev/null
536 done
538 # Install web or cached packages (if mirror is set to $PKGS we only
539 # use local packages).
540 for i in $(uniq $CACHE/installed.web)
541 do
542 gettext "Installing dep (web/cache):"; echo " $i"
543 tazpkg get-install $i >/dev/null
544 done
546 # If a cook failed deps are removed.
547 cd $INSTALLED && ls -1 > $CACHE/installed.cook && cd $CACHE
548 [ ! -s "installed.cook.diff" ] && \
549 busybox diff installed.list installed.cook > installed.cook.diff
550 deps=$(cat installed.cook.diff | grep ^+[a-zA-Z0-9] | wc -l)
552 # Get source tarball and make sure we have source dir named:
553 # $PACKAGE-$VERSION to be standard in receipts. Here we use tar.lzma
554 # tarball if it exists.
555 if [ "$WGET_URL" ] && [ ! -f "$SRC/$TARBALL" ]; then
556 if [ -f "$SRC/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ]; then
557 TARBALL=${SOURCE:-$PACKAGE}-$VERSION.tar.lzma
558 LZMA_SRC=""
559 else
560 get_source || exit 1
561 fi
562 fi
563 if [ ! "$WANTED" ] && [ "$TARBALL" ] && [ ! -d "$src" ]; then
564 mkdir -p $pkgdir/source/tmp && cd $pkgdir/source/tmp
565 if ! extract_source ; then
566 get_source
567 extract_source || exit 1
568 fi
569 if [ "$LZMA_SRC" ]; then
570 cd $pkgdir/source
571 if [ "$(ls -A tmp | wc -l)" -gl 1 ] || [ -f "$(echo tmp/*)" ]; then
572 mv tmp tmp-1 && mkdir tmp
573 mv tmp-1 tmp/${SOURCE:-$PACKAGE}-$VERSION
574 fi
575 if [ -d "tmp/${SOURCE:-$PACKAGE}-$VERSION" ]; then
576 cd tmp && tar -c * | lzma e $SRC/$TARBALL -si
577 fi
578 fi
579 cd $pkgdir/source/tmp
580 # Some archives are not well done and don't extract to one dir (ex lzma).
581 files=$(ls | wc -l)
582 [ "$files" == 1 ] && [ -d "$(ls)" ] && mv * ../$PACKAGE-$VERSION
583 [ "$files" == 1 ] && [ -f "$(ls)" ] && mkdir -p ../$PACKAGE-$VERSION && \
584 mv * ../$PACKAGE-$VERSION/$TARBALL
585 [ "$files" -gt 1 ] && mkdir -p ../$PACKAGE-$VERSION && \
586 mv * ../$PACKAGE-$VERSION
587 cd .. && rm -rf tmp
588 fi
590 # Execute receipt rules.
591 if grep -q ^compile_rules $receipt; then
592 echo "Executing: compile_rules"
593 echo "CFLAGS : $CFLAGS"
594 [ -d "$src" ] && cd $src
595 compile_rules $@ || exit 1
596 # Stay compatible with _pkg
597 [ -d "$src/_pkg" ] && mv $src/_pkg $install
598 # QA: compile_rules success so valid.
599 mkdir -p $install
600 else
601 # QA: No compile_rules so no error, valid.
602 mkdir -p $install
603 fi
604 separator && echo ""
605 }
607 # Cook quality assurance.
608 cookit_quality() {
609 if [ ! -d "$WOK/$pkg/install" ] && [ ! "$WANTED" ]; then
610 echo -e "ERROR: cook failed" | tee -a $LOGS/$pkg.log
611 fi
612 # ERROR can be echoed any time in cookit()
613 if fgrep -q ERROR: $LOGS/$pkg.log; then
614 debug_info | tee -a $LOGS/$pkg.log
615 rm -f $command && exit 1
616 fi
617 }
619 # Create the package. Wanted to use Tazpkg to create a tazpkg package at first,
620 # but it doesn't handle EXTRAVERSION.
621 packit() {
622 set_paths
623 echo "Pack: $PACKAGE $VERSION"
624 separator
625 if grep -q ^genpkg_rules $receipt; then
626 gettext -e "Executing: genpkg_rules\n"
627 set -e && cd $pkgdir && mkdir -p $fs
628 genpkg_rules || echo -e "\nERROR: genpkg_rules failed\n" >> \
629 $LOGS/$pkg.log
630 else
631 gettext "No packages rules: meta package"; echo
632 mkdir -p $fs
633 fi
635 # First QA check to stop now if genpkg_rules failed.
636 if fgrep -q ERROR: $LOGS/$pkg.log; then
637 exit 1
638 fi
640 cd $taz
641 for file in receipt description.txt
642 do
643 [ ! -f "../$file" ] && continue
644 gettext "Copying"; echo -n " $file..."
645 cp -f ../$file $pack && chown 0.0 $pack/$file && status
646 done
647 copy_generic_files
649 # Create files.list with redirecting find output.
650 gettext "Creating the list of files..." && cd $fs
651 find . -type f -print > ../files.list
652 find . -type l -print >> ../files.list
653 cd .. && sed -i s/'^.'/''/ files.list
654 status
656 # Strip and stuff files.
657 strip_package
659 # Md5sum of files.
660 gettext "Creating md5sum of files..."
661 while read file; do
662 [ -L "fs$file" ] && continue
663 [ -f "fs$file" ] || continue
664 case "$file" in
665 /lib/modules/*/modules.*|*.pyc) continue ;;
666 esac
667 md5sum "fs$file" | sed 's/ fs/ /'
668 done < files.list > md5sum
669 status
670 UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum \
671 description.txt 2> /dev/null | awk \
672 '{ sz=$1 } END { print sz }')
674 # Build cpio archives.
675 gettext "Compressing the fs... "
676 find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si
677 rm -rf fs
678 status
679 PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \
680 md5sum description.txt 2> /dev/null | awk \
681 '{ sz=$1 } END { print sz }')
682 gettext "Updating receipt sizes..."
683 sed -i s/^PACKED_SIZE.*$// receipt
684 sed -i s/^UNPACKED_SIZE.*$// receipt
685 sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt
686 status
688 # Set extra version.
689 if [ "$EXTRAVERSION" ]; then
690 gettext "Updating receipt EXTRAVERSION: "; echo -n "$EXTRAVERSION"
691 sed -i s/^EXTRAVERSION.*$// receipt
692 sed -i "s/^VERSION=/EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=/" receipt
693 status
694 fi
696 # Compress.
697 gettext "Creating full cpio archive... "
698 find . -print | cpio -o -H newc --quiet > \
699 ../$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg
700 status
701 gettext "Restoring original package tree... "
702 unlzma -c fs.cpio.lzma | cpio -idm --quiet
703 status
704 rm fs.cpio.lzma && cd ..
706 # QA and give info.
707 tazpkg=$(ls *.tazpkg)
708 packit_quality
709 separator && gettext "Package:"; echo -e " $tazpkg\n"
710 }
712 # Verify package quality and consistency.
713 packit_quality() {
714 #gettext "QA: Checking for broken link..."
715 #link=$(find $fs/usr -type l -follow)
716 #[ "$link" ] && echo -e "\nERROR: broken link in filesystem"
717 #status
719 # Exit if any error found in log file.
720 if fgrep -q ERROR: $LOGS/$pkg.log; then
721 rm -f $command && exit 1
722 fi
724 gettext "QA: Checking for empty package..."
725 files=$(cat $WOK/$pkg/taz/$pkg-*/files.list | wc -l)
726 if [ "$files" == 0 ] && [ "$CATEGORY" != "meta" ]; then
727 echo -e "\nERROR: empty package"
728 rm -f $command && exit 1
729 else
730 # Ls sort by name so the first file is the one we want.
731 old=$(ls $PKGS/$pkg-*.tazpkg 2>/dev/null | head -n 1)
732 status
733 if [ -f "$old" ]; then
734 gettext "Removing old: $(basename $old)"
735 rm -f $old && status
736 fi
737 mv -f $pkgdir/taz/$pkg-*.tazpkg $PKGS
738 sed -i /^${pkg}$/d $broken
739 #gettext "Removing source tree..."
740 #rm -f $WOK/$pkg/source && status
741 fi
742 }
744 mkinstall_list() {
745 local pkg
746 for pkg in $@ ; do
747 case " $INSTALL_LIST " in
748 *\ $pkg\ *) continue ;;
749 *) if [ -s /home/slitaz/wok/$pkg/receipt ]; then
750 unset DEPENDS
751 . /home/slitaz/wok/$pkg/receipt
752 INSTALL_LIST="$INSTALL_LIST $pkg"
753 [ -n "$DEPENDS" ] && mkinstall_list $DEPENDS
754 fi
755 echo $pkg
756 esac
757 done
758 }
760 tac()
761 {
762 sed '1!G;h;$!d' $1
763 }
765 # Launch the cook command into a chroot jail protected by aufs.
766 # The current filesystems are used read-only and updates are
767 # stored in a separate branch.
768 try_aufs_chroot() {
770 base=/dev/shm/aufsmnt$$
772 # Can we setup the chroot ? Is it already done ?
773 grep -q ^AUFS_NOT_SUPPORTED $receipt && return
774 [ -n "$AUFS_MOUNTS" -a ! -f /aufs-umount.sh ] || return
775 lsmod | grep -q aufs || modprobe aufs 2> /dev/null || return
776 mkdir ${base}root ${base}rw || return
778 echo "Setup aufs chroot..."
780 # Sanity check
781 for i in / /proc /sys /dev/shm /home ; do
782 case " $AUFS_MOUNTS " in
783 *\ $i\ *) ;;
784 *) AUFS_MOUNTS="$AUFS_MOUNTS $i" ;;
785 esac
786 done
787 for mnt in $(echo $AUFS_MOUNTS | sort | uniq); do
788 mount --bind $mnt ${base}root$mnt
789 if [ $mnt == / ] && ! mount -t aufs -o br=${base}rw:/ none ${base}root; then
790 echo "Aufs mountage failure"
791 umount ${base}root
792 rmdir ${base}*
793 return
794 fi
795 echo "umount ${base}root$mnt" >> ${base}rw/aufs-umount.sh
796 done
798 chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@"
799 status=$?
801 echo "Leaving aufs chroot..."
802 tac ${base}rw/aufs-umount.sh | sh
803 rm -rf ${base}rw
804 umount ${base}root
805 rmdir $base*
807 # Install package if requested
808 if [ "$inst" ]; then
809 if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then
810 cd $PKGS && tazpkg install \
811 $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced
812 else
813 gettext -e "Unable to install package, build has failed.\n\n"
814 exit 1
815 fi
816 fi
818 # Install package if part of the chroot to keep env up-to-date.
819 if [ -d "$INSTALLED/$pkg" ]; then
820 . /etc/slitaz/cook.conf
821 . $WOK/$pkg/taz/$pkg-*/receipt
822 echo "Updating chroot environment..."
823 echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION})" | log
824 cd $PKGS && tazpkg install \
825 $pkg-${VERSION}${EXTRAVERSION}.tazpkg --forced
826 fi
827 exit $status
828 }
830 # Create a XML feed for freshly builded package.
831 gen_rss() {
832 pubdate=$(date "+%a, %d %b %Y %X")
833 cat > $FEEDS/$pkg.xml << EOT
834 <item>
835 <title>$PACKAGE $VERSION${EXTRAVERSION}</title>
836 <link>${COOKER_URL}?pkg=$PACKAGE</link>
837 <guid>$PACKAGE-$VERSION${EXTRAVERSION}</guid>
838 <pubDate>$pubdate</pubDate>
839 <description>$SHORT_DESC</description>
840 </item>
841 EOT
842 }
844 #
845 # Commands
846 #
848 case "$1" in
849 usage|help|-u|-h)
850 usage ;;
851 list-wok)
852 gettext -e "\nList of packages in:"; echo " $WOK"
853 separator
854 cd $WOK && ls -1
855 separator
856 echo -n "Packages: " && ls | wc -l
857 echo "" ;;
858 search)
859 # Just a simple search function, we dont need more actually.
860 query="$2"
861 gettext -e "\nSearch results for:"; echo " $query"
862 separator
863 cd $WOK && ls -1 | grep "$query"
864 separator && echo "" ;;
865 setup)
866 # Setup a build environment
867 check_root
868 echo "Cook: setting up the environment" | log
869 gettext -e "\nSetting up your environment\n"
870 separator && cd $SLITAZ
871 init_db_files
872 gettext -e "Checking for packages to install...\n"
873 case " $@ " in
874 *\ --reinstall\ *)
875 INSTALL_LIST=""
876 for pkg in $(mkinstall_list $SETUP_PKGS); do
877 tazpkg get-install $pkg --forced
878 done ;;
879 *)
880 for pkg in $SETUP_PKGS
881 do
882 [ ! -f "$INSTALLED/$pkg/receipt" ] &&
883 tazpkg get-install $pkg
884 done ;;
885 esac
887 # Handle --options
888 case "$2" in
889 --wok|-w)
890 hg clone $WOK_URL wok || exit 1 ;;
891 --stable)
892 hg clone $WOK_URL-stable wok || exit 1 ;;
893 --undigest)
894 hg clone $WOK_URL-undigest wok || exit 1 ;;
895 esac
897 # SliTaz group and permissions
898 if ! grep -q ^slitaz /etc/group; then
899 gettext -e "Adding group: slitaz\n"
900 addgroup slitaz
901 fi
902 gettext -e "Setting permissions for slitaz group...\n"
903 find $SLITAZ -maxdepth 2 -exec chown root.slitaz {} \;
904 find $SLITAZ -maxdepth 2 -exec chmod g+w {} \;
905 separator
906 gettext -e "All done, ready to cook packages :-)\n\n" ;;
907 test)
908 # Test a cook environment.
909 echo "Cook test: testing the cook environment" | log
910 [ ! -d "$WOK" ] && exit 1
911 [ ! -d "$WOK/cooktest" ] && cp -r $DATA/cooktest $WOK
912 cook cooktest ;;
913 new)
914 # Create the package folder and an empty receipt.
915 pkg="$2"
916 [ "$pkg" ] || usage
917 echo ""
918 if [ -d "$WOK/$pkg" ]; then
919 echo -n "$pkg " && gettext "package already exists."
920 echo -e "\n" && exit 1
921 fi
922 gettext "Creating"; echo -n " $WOK/$pkg"
923 mkdir $WOK/$pkg && cd $WOK/$pkg && status
924 gettext "Preparing the package receipt..."
925 cp $DATA/receipt .
926 sed -i s"/^PACKAGE=.*/PACKAGE=\"$pkg\"/" receipt
927 status && echo ""
929 # Interactive mode, asking and seding.
930 case "$3" in
931 --interactive|-x)
932 gettext -e "Entering interactive mode...\n"
933 separator
934 echo "Package : $pkg"
935 # Version.
936 echo -n "Version : " ; read anser
937 sed -i s/'VERSION=\"\"'/"VERSION=\"$anser\""/ receipt
938 # Category.
939 echo -n "Category : " ; read anser
940 sed -i s/'CATEGORY=\"\"'/"CATEGORY=\"$anser\""/ receipt
941 # Short description.
942 echo -n "Short desc : " ; read anser
943 sed -i s/'SHORT_DESC=\"\"'/"SHORT_DESC=\"$anser\""/ receipt
944 # Maintainer.
945 echo -n "Maintainer : " ; read anser
946 sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$anser\""/ receipt
947 # Web site.
948 echo -n "Web site : " ; read anser
949 sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt
950 echo ""
951 # Wget URL.
952 echo "Wget URL to download source tarball."
953 echo "Example : \$GNU_MIRROR/\$PACKAGE/\$TARBALL"
954 echo -n "Wget url : " ; read anser
955 sed -i s#'WGET_URL=\"$TARBALL\"'#"WGET_URL=\"$anser\""# receipt
956 # Ask for a stuff dir.
957 echo -n "Do you need a stuff directory ? (y/N) : " ; read anser
958 if [ "$anser" = "y" ]; then
959 echo -n "Creating the stuff directory..."
960 mkdir $WOK/$pkg/stuff && status
961 fi
962 # Ask for a description file.
963 echo -n "Are you going to write a description ? (y/N) : " ; read anser
964 if [ "$anser" = "y" ]; then
965 echo -n "Creating the description.txt file..."
966 echo "" > $WOK/$pkg/description.txt && status
967 fi
968 separator
969 gettext -e "Receipt is ready to use.\n"
970 echo "" ;;
971 esac ;;
972 list)
973 # Cook a list of packages (better use the Cooker since it will order
974 # packages before executing cook).
975 check_root
976 [ -z "$2" ] && gettext -e "\nNo list in argument.\n\n" && exit 1
977 [ ! -f "$2" ] && gettext -e "\nNo list found:" && \
978 echo -e " $2\n" && exit 1
979 echo "Cook list starting: $2" | log
980 for pkg in $(cat $2)
981 do
982 cook $pkg || broken
983 done ;;
984 clean-wok)
985 check_root
986 gettext -e "\nCleaning all packages files..."
987 rm -rf $WOK/*/taz $WOK/*/install $WOK/*/source
988 status && echo "" ;;
989 clean-src)
990 check_root
991 gettext -e "\nCleaning all packages sources..."
992 rm -rf $WOK/*/source
993 status && echo "" ;;
994 pkgdb)
995 # Create suitable packages list for TazPKG and only for built packages
996 # as well as flavors files for TazLiTo. We dont need logs since we do it
997 # manually to ensure everything is fine before syncing the mirror.
998 case "$2" in
999 --flavors)
1000 continue ;;
1001 *)
1002 [ "$2" ] && PKGS="$2"
1003 [ ! -d "$PKGS" ] && \
1004 gettext -e "\nPackages directory doesn't exist\n\n" && exit 1 ;;
1005 esac
1006 time=$(date +%s)
1007 flavors=$SLITAZ/flavors
1008 live=$SLITAZ/live
1009 echo "cook:pkgdb" > $command
1010 echo "Cook pkgdb: Creating all packages lists" | log
1011 echo ""
1012 gettext "Creating lists for: "; echo "$PKGS"
1013 separator
1014 gettext "Cook pkgdb started: "; date "+%Y-%m-%d %H:%M"
1015 cd $PKGS
1016 rm -f packages.*
1017 gettext -e "Creating: packages.list\n"
1018 ls -1 *.tazpkg | sed s'/.tazpkg//' > $PKGS/packages.list
1019 gettext -e "Creating: packages.md5\n"
1020 md5sum *.tazpkg > $PKGS/packages.md5
1021 md5sum packages.md5 | cut -f1 -d' ' > ID
1022 gettext -e "Creating lists from: "; echo "$WOK"
1023 cd $WOK
1024 for pkg in *
1025 do
1026 unset_receipt
1027 . $pkg/receipt
1028 if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then
1029 # PACKED_SIZE and UNPACKED_SIZE are only in built receipt
1030 if [ -s $pkg/taz/*/receipt ]; then
1031 . $pkg/taz/*/receipt
1032 fi
1033 # packages.desc lets us search easily in DB
1034 cat >> $PKGS/packages.desc << EOT
1035 $PACKAGE | ${VERSION}$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE
1036 EOT
1037 # packages.txt used by tazpkg and tazpkg-web also to provide
1038 # a human readable package list with version and description.
1039 cat >> $PKGS/packages.txt << EOT
1040 $PACKAGE
1041 ${VERSION}$EXTRAVERSION
1042 $SHORT_DESC
1043 $PACKED_SIZE ($UNPACKED_SIZE installed)
1045 EOT
1046 # packages.equiv is used by tazpkg install to check depends.
1047 for i in $PROVIDE; do
1048 DEST=""
1049 echo $i | fgrep -q : && DEST="${i#*:}:"
1050 if grep -qs ^${i%:*}= $PKGS/packages.equiv; then
1051 sed -i "s/^${i%:*}=/${i%:*}=$DEST$PACKAGE /" \
1052 $PKGS/packages.equiv
1053 else
1054 echo "${i%:*}=$DEST$PACKAGE" >> $PKGS/packages.equiv
1055 fi
1056 done
1057 # files.list provides a list of all packages files.
1058 cat $pkg/taz/*/files.list | sed s/^/"$pkg: \0"/ >> \
1059 $PKGS/files.list
1060 fi
1061 done
1063 # Display list size.
1064 gettext -e "Done: packages.desc\n"
1065 gettext -e "Done: packages.txt\n"
1066 gettext -e "Done: packages.equiv\n"
1068 # files.list.lzma
1069 gettext -e "Creating: files.list.lzma\n"
1070 cd $PKGS && lzma e files.list files.list.lzma
1071 rm -f files.list
1073 # Display some info.
1074 separator
1075 nb=$(ls $PKGS/*.tazpkg | wc -l)
1076 time=$(($(date +%s) - $time))
1077 echo -e "Packages: $nb - Time: ${time}s\n"
1079 # Create all flavors files at once. Do we really need code to monitor
1080 # flavors changes ? Lets just build them with packages lists before
1081 # syncing the mirror.
1082 [ "$2" == "--flavors" ] || exit 1
1083 [ ! -d "$flavors" ] && echo -e "Missing flavors: $flavors\n" && exit 1
1084 [ -d "$live" ] || mkdir -p $live
1085 gettext "Creating flavors files in:"; echo " $live"
1086 echo "Cook pkgdb: Creating all flavors" | log
1087 separator
1088 gettext -e "Recharging lists to use latest packages...\n"
1089 tazpkg recharge >/dev/null 2>/dev/null
1091 # We need a custom tazlito config to set working dir to /home/slitaz.
1092 if [ ! -f "$live/tazlito.conf" ]; then
1093 echo "Creating configuration file: tazlito.conf"
1094 cp /etc/tazlito/tazlito.conf $live
1095 sed -i s@WORK_DIR=.*@WORK_DIR=\"/home/slitaz\"@ \
1096 $live/tazlito.conf
1097 fi
1099 # Update Hg flavors repo and pack.
1100 [ -d "$flavors/.hg" ] && cd $flavors && hg pull -u
1102 cd $live
1103 echo "Starting to generate flavors..."
1104 rm -f flavors.list *.flavor
1105 for i in $flavors/*
1106 do
1107 fl=$(basename $i)
1108 echo "Packing flavor: $(basename $i)"
1109 tazlito pack-flavor $fl >/dev/null || exit 1
1110 tazlito show-flavor $fl --brief --noheader 2> \
1111 /dev/null >> flavors.list
1112 done
1113 cp -f $live/*.flavor $live/flavors.list $PKGS
1114 separator && gettext "Flavors size: "; du -sh $live | awk '{print $1}'
1115 echo "" && rm -f $command ;;
1116 *)
1117 # Just cook and generate a package.
1118 check_root
1119 time=$(date +%s)
1120 pkg="$1"
1121 [ -z "$pkg" ] && usage
1122 receipt="$WOK/$pkg/receipt"
1123 check_pkg_in_wok && echo ""
1125 # Skip blocked, 3 lines also for the Cooker.
1126 if grep -q "^$pkg$" $blocked && [ "$2" != "--unblock" ]; then
1127 gettext -e "Blocked package:"; echo -e " $pkg\n" && exit 0
1128 fi
1130 try_aufs_chroot "$@"
1132 # Log and source receipt.
1133 echo "Cook started for: <a href='cooker.cgi?pkg=$pkg'>$pkg</a>" | log
1134 echo "cook:$pkg" > $command
1136 # Display and log info if cook process stopped.
1137 trap 'gettext -e "\n\nCook stopped: control-C\n\n" | \
1138 tee -a $LOGS/$pkg.log' INT
1140 unset inst
1141 unset_receipt
1142 . $receipt
1144 # Handle --options
1145 case "$2" in
1146 --clean|-c)
1147 gettext -e "Cleaning:"; echo -n " $pkg"
1148 cd $WOK/$pkg && rm -rf install taz source
1149 status && echo "" && exit 0 ;;
1150 --install|-i)
1151 inst='yes' ;;
1152 --getsrc|-gs)
1153 gettext "Getting source for:"; echo " $pkg"
1154 separator && get_source
1155 echo -e "Tarball: $SRC/$TARBALL\n" && exit 0 ;;
1156 --block|-b)
1157 gettext "Blocking:"; echo -n " $pkg"
1158 [ $(grep "^$pkg$" $blocked) ] || echo "$pkg" >> $blocked
1159 status && echo "" && exit 0 ;;
1160 --unblock|-ub)
1161 gettext "Unblocking:"; echo -n " $pkg"
1162 sed -i "/^${pkg}$/"d $blocked
1163 status && echo "" && exit 0 ;;
1165 esac
1167 # Check if wanted is built now so we have separate log files.
1168 for wanted in $WANTED ; do
1169 if grep -q "^$wanted$" $blocked; then
1170 echo "WANTED package is blocked: $wanted" | tee $LOGS/$pkg.log
1171 echo "" && rm -f $command && exit 1
1172 fi
1173 if grep -q "^$wanted$" $broken; then
1174 echo "WANTED package is broken: $wanted" | tee $LOGS/$pkg.log
1175 echo "" && rm -f $command && exit 1
1176 fi
1177 if [ ! -d "$WOK/$wanted/install" ]; then
1178 cook "$wanted" || exit 1
1179 fi
1180 done
1182 # Cook and pack or exit on error and log everything.
1183 cookit $@ 2>&1 | tee $LOGS/$pkg.log
1184 remove_deps | tee -a $LOGS/$pkg.log
1185 cookit_quality
1186 packit 2>&1 | tee -a $LOGS/$pkg.log
1187 clean_log
1189 # Exit if any error in packing.
1190 if grep -q ^ERROR $LOGS/$pkg.log; then
1191 debug_info | tee -a $LOGS/$pkg.log
1192 rm -f $command && exit 1
1193 fi
1195 # Create an XML feed
1196 gen_rss
1198 # Time and summary
1199 time=$(($(date +%s) - $time))
1200 summary | tee -a $LOGS/$pkg.log
1201 echo ""
1203 # Install package if requested
1204 if [ "$inst" ]; then
1205 if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg" ]; then
1206 cd $PKGS && tazpkg install \
1207 $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced
1208 else
1209 gettext -e "Unable to install package, build has failed.\n\n"
1210 exit 1
1211 fi
1212 fi
1214 # Install package if part of the chroot to keep env up-to-date.
1215 if [ -d "$INSTALLED/$PACKAGE" ] && [ -z "$AUFS_MOUNTS" ]; then
1216 echo "Updating chroot environment..."
1217 echo "Updating chroot: $PACKAGE (${VERSION}${EXTRAVERSION})" | log
1218 cd $PKGS && tazpkg install \
1219 $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg --forced
1220 fi
1222 # Finally we DONT WANT to build the *-dev or packages with WANTED="$pkg"
1223 # You want automation: use the Cooker Build Bot.
1224 #[ -d "$WOK/$pkg-dev" ] && cook $pkg-dev
1225 rm -f $command ;;
1226 esac
1228 exit 0