cookutils view cook @ rev 1121

modules/pack: typo
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Dec 22 13:54:08 2018 +0200 (2018-12-22)
parents 77272271e283
children e0fb0c452bf1
line source
1 #!/bin/sh
2 #
3 # Cook - A tool to cook and generate SliTaz packages. Read the README
4 # before adding or modifying any code in cook!
5 #
6 # Copyright (C) SliTaz GNU/Linux - GNU GPL v3
7 # Author: Christophe Lincoln <pankso@slitaz.org>
8 #
10 . /usr/lib/slitaz/libcook.sh
12 VERSION="3.2"
13 export output=raw
14 prev_ts="/home/slitaz/cache/prev_ts"; touch $prev_ts
17 # Internationalization.
19 export TEXTDOMAIN='cook'
22 #
23 # Functions
24 #
26 usage() {
27 cat <<EOT
29 $(boldify "$(_ 'Usage:')") $(_ 'cook [package|command] [list|--option]')
31 $(boldify "$(_ 'Commands:')")
32 usage|help $(_ 'Display this short usage.')
33 setup $(_ 'Setup your build environment.')
34 *-setup $(_ 'Setup a cross environment.')
35 * = {arm|armv6hf|armv7|x86_64}
36 test $(_ 'Test environment and cook a package.')
37 list-wok $(_ 'List packages in the wok.')
38 search $(_ 'Simple packages search function.')
39 new $(_ 'Create a new package with a receipt.')
40 list $(_ 'Cook a list of packages.')
41 clean-wok $(_ 'Clean-up all packages files.')
42 clean-src $(_ 'Clean-up all packages sources.')
43 uncook $(_ 'Check for uncooked packages')
44 pkgdb $(_ 'Create packages DB lists and flavors.')
46 $(boldify "$(_ 'Options:')")
47 cook <pkg>
48 --clean -c $(_ 'clean the package in the wok.')
49 --getsrc -gs $(_ 'get the package source tarball.')
50 --block -b $(_ 'block a package so cook will skip it.')
51 --unblock -ub $(_ 'unblock a blocked package.')
52 --cdeps $(_ 'check dependencies of cooked package.')
53 --pack $(_ 'repack an already built package.')
54 --debug $(_ 'display debugging messages.')
55 --continue $(_ 'continue running compile_rules.')
56 cook new <pkg>
57 --interactive -x $(_ 'create a receipt interactively.')
58 cook setup
59 --wok $(_ 'clone the cooking wok from Hg repo.')
60 --stable $(_ 'clone the stable wok from Hg repo.')
61 --undigest $(_ 'clone the undigest wok from Hg repo.')
62 --tiny $(_ 'clone the tiny SliTaz wok from Hg repo.')
63 --forced $(_ 'force reinstall of chroot packages.')
64 cook pkgdb
65 --flavors $(_ 'create up-to-date flavors files.')
66 cook splitdb $(_ 'create up-to-date split.db file.')
68 EOT
69 exit 0
70 }
73 # We don't want these escapes in web interface.
75 clean_log() {
76 sed -i -e 's|\[70G\[ \[1;32m| |' \
77 -e 's|\[0;39m \]||' $LOGS/${1:-$pkg}.log
78 }
81 # Be sure package exists in wok.
83 check_pkg_in_wok() {
84 [ -d "$WOK/$pkg" ] || die 'Unable to find package "%s" in the wok' "$pkg"
85 }
88 # Find the package, return the receipt name where it was found
89 # for example, libpcreposix -> pcre
91 find_pkg_in_wok() {
92 awk -F$'\t' -vi=" $1 " '{
93 if (index(" " $2 " ", i)) {print $1; exit}
94 }' $cache/split.db
95 }
98 # Initialize files used in $CACHE
100 init_db_files() {
101 _ 'Creating directories structure in "%s"' "$SLITAZ"
102 mkdir -p $WOK $PKGS $SRC $CACHE $LOGS $FEEDS
103 _ 'Creating DB files in "%s"' "$CACHE"
104 touch $activity $command $broken $blocked $CACHE/webstat
105 chown www:www $cache/webstat
106 }
109 # Paths used in receipt and by cook itself.
111 set_paths() {
112 # Kernel version is set from wok/linux or installed/linux-api-headers(wok-undigest)
113 if [ -f "$WOK/linux/receipt" ]; then
114 kvers=$(. $WOK/linux/receipt; echo $VERSION)
115 kbasevers=$(echo $kvers | cut -d. -f1,2)
116 elif [ -f "$INSTALLED/linux-api-headers/receipt" ]; then
117 kvers=$(. $INSTALLED/linux-api-headers/receipt; echo $VERSION)
118 kbasevers=$(echo $kvers | cut -d. -f1,2)
119 fi
121 # Python version
122 [ -f "$WOK/python/receipt" ] && pyvers=$(. $WOK/python/receipt; echo $VERSION)
123 # Perl version for some packages needed it
124 [ -f "$WOK/perl/receipt" ] && perlvers=$(. $WOK/perl/receipt; echo $VERSION)
126 pkgdir="$WOK/$pkg"
127 . "$pkgdir/receipt"
128 basesrc="$pkgdir/source"
129 tmpsrc="$basesrc/tmp"
130 src="$basesrc/$PACKAGE-$VERSION"
131 taz="$pkgdir/taz"
132 pack="$taz/${1:-$PACKAGE}-$VERSION$EXTRAVERSION" # v2: multiple taz/* folders
133 fs="$pack/fs"
134 stuff="$pkgdir/stuff"
135 install="$pkgdir/install"
137 pkgsrc="${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}"
138 lzma_tarball="$pkgsrc.tar.lzma"
140 [ -n "$PATCH" -a -z "$PTARBALL" ] && PTARBALL="$(basename $PATCH)"
142 if [ -n "$WANTED" ]; then
143 basesrc="$WOK/$WANTED/source"
144 src="$basesrc/$WANTED-$VERSION"
145 install="$WOK/$WANTED/install"
146 wanted_stuff="$WOK/$WANTED/stuff"
147 fi
149 [ -n "$SOURCE" ] && source_stuff="$WOK/$SOURCE/stuff"
151 # Old way compatibility.
152 _pkg="$install"
153 }
156 # Create source tarball when URL is a SCM.
158 create_tarball() {
159 local tarball
160 tarball="$pkgsrc.tar.bz2"
161 [ -n "$LZMA_SRC" ] && tarball="$lzma_tarball"
162 _ 'Creating tarball "%s"' "$tarball"
163 if [ -n "$LZMA_SRC" ]; then
164 tar -c $pkgsrc | lzma e $SRC/$tarball -si $LZMA_SET_DIR || exit 1
165 LZMA_SRC=''
166 else
167 tar -cjf $tarball $pkgsrc || exit 1
168 mv $tarball $SRC; rm -rf $pkgsrc
169 fi
170 TARBALL="$tarball"
171 }
174 # Get package source. For SCM we are in cache so clone here and create a
175 # tarball here.
177 get_source() {
178 local url
179 url=${WGET_URL#*|}
180 set_paths
181 pwd=$(pwd)
182 case "$WGET_URL" in
183 http://*|ftp://*|https://*)
184 url="$MIRROR_URL/sources/packages/${TARBALL:0:1}/$TARBALL"
185 wget -T 60 -c -O $SRC/$TARBALL $WGET_URL ||
186 wget -T 60 -c -O $SRC/$TARBALL $url ||
187 die 'ERROR: %s' "wget $WGET_URL"
188 ;;
190 hg*|mercurial*)
191 _ 'Getting source from %s...' 'Hg'
192 _ 'URL: %s' "$url"
193 _ 'Cloning to "%s"' "$pwd/$pkgsrc"
194 if [ -n "$BRANCH" ]; then
195 _ 'Hg branch: %s' "$BRANCH"
196 hg clone $url --rev $BRANCH $pkgsrc ||
197 die 'ERROR: %s' "hg clone $url --rev $BRANCH"
198 else
199 hg clone $url $pkgsrc || die 'ERROR: %s' "hg clone $url"
200 fi
201 rm -rf $pkgsrc/.hg
202 create_tarball
203 ;;
205 git*)
206 _ 'Getting source from %s...' 'Git'
207 _ 'URL: %s' "$url"
208 cd $SRC
209 git clone $url $pkgsrc || die 'ERROR: %s' "git clone $url"
210 if [ -n "$BRANCH" ]; then
211 _ 'Git branch: %s' "$BRANCH"
212 cd $pkgsrc; git checkout $BRANCH; cd ..
213 fi
214 cd $SRC
215 create_tarball
216 ;;
218 cvs*)
219 mod=$PACKAGE
220 [ -n "$CVS_MODULE" ] && mod=$CVS_MODULE
221 _ 'Getting source from %s...' 'CVS'
222 _ 'URL: %s' "$url"
223 [ -n "$CVS_MODULE" ] && _ 'CVS module: %s' "$mod"
224 _ 'Cloning to "%s"' "$pwd/$mod"
225 cvs -d:$url co $mod && mv $mod $pkgsrc
226 create_tarball
227 ;;
229 svn*|subversion*)
230 _ 'Getting source from %s...' 'SVN'
231 _ 'URL: %s' "$url"
232 if [ -n "$BRANCH" ]; then
233 echo t | svn co $url -r $BRANCH $pkgsrc
234 else
235 echo t | svn co $url $pkgsrc
236 fi
237 create_tarball
238 ;;
240 bzr*)
241 _ 'Getting source from %s...' 'bazaar'
242 cd $SRC
243 pkgsrc=${url#*:}
244 if [ -n "$BRANCH" ]; then
245 echo "bzr -Ossl.cert_reqs=none branch $url -r $BRANCH"
246 bzr -Ossl.cert_reqs=none branch $url -r $BRANCH
247 else
248 echo "bzr -Ossl.cert_reqs=none branch $url"
249 bzr -Ossl.cert_reqs=none branch $url
250 cd $pkgsrc; BRANCH=$(bzr revno); cd ..
251 _ "Don't forget to add to receipt:"
252 echo -e "BRANCH=\"$BRANCH\"\n"
253 fi
254 mv $pkgsrc $pkgsrc-$BRANCH
255 pkgsrc="$pkgsrc-$BRANCH"
256 create_tarball
257 ;;
259 *)
260 broken; die 'ERROR: Unable to handle "%s"' "$WGET_URL"
261 ;;
262 esac
263 }
266 # Extract source package.
268 extract_source() {
269 if [ ! -s "$SRC/$TARBALL" ]; then
270 local url
271 url="$MIRROR_URL/sources/packages"
272 url="$url/${TARBALL:0:1}/$TARBALL"
273 _ 'Getting source from %s...' 'mirror'
274 _ 'URL: %s' "$url"
275 busybox wget -c -P $SRC $url || _ 'ERROR: %s' "wget $url"
276 fi
277 _ 'Extracting source archive "%s"' "$TARBALL"
278 case "$TARBALL" in
279 *.tar.gz|*.tgz) tar -xzf $SRC/$TARBALL 2>/dev/null ;;
280 *.tar.bz2|*.tbz|*.tbz2) tar -xjf $SRC/$TARBALL 2>/dev/null ;;
281 *.tar.lzma) tar -xaf $SRC/$TARBALL ;;
282 *.tar.lz|*.tlz) lzip -d < $SRC/$TARBALL | tar -xf - 2>/dev/null ;;
283 *.tar) tar -xf $SRC/$TARBALL ;;
284 *.zip|*.xpi) unzip -o $SRC/$TARBALL 2>/dev/null >&2;;
285 *.xz) unxz -c $SRC/$TARBALL | tar -xf - || \
286 tar -xf $SRC/$TARBALL 2>/dev/null;;
287 *.7z) 7zr x $SRC/$TARBALL 2>/dev/null >&2 ;;
288 *.Z|*.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 }
296 # Display time.
298 disp_time_old() {
299 local sec div min
300 sec="$1"
301 div=$(( ($1 + 30) / 60))
302 case $div in
303 0) min='';;
304 # L10n: 'm' is for minutes (approximate cooking time)
305 *) min=$(_n ' ~ %dm' "$div");;
306 esac
308 # L10n: 's' is for seconds (cooking time)
309 _ '%ds%s' "$sec" "$min"
310 }
313 # Display time.
315 disp_time() {
316 local sec="$1" day hour min out=''
318 day=$(( sec / 86400 )); sec=$(( sec % 86400 ))
319 hour=$(( sec / 3600 )); sec=$(( sec % 3600 ))
320 min=$(( sec / 60 )); sec=$(( sec % 60 ))
322 [ $day -gt 0 ] && out="${day}d "
323 [ -n "$out" -o $hour -gt 0 ] && out="$out$(printf '%02dh ' $hour)"
324 [ -n "$out" -o $min -gt 0 ] && out="$out$(printf '%02dm ' $min)"
325 [ -n "$out" ] && out=" ~ $out$(printf '%02ds' $sec)"
327 echo "${1}s$out"
328 }
331 # Display cooked package summary.
333 summary() {
334 # local arch=''
335 # case "$ARCH" in
336 # arm*|x86_64) arch="-$ARCH" ;;
337 # esac
339 set_paths
340 cd $WOK/$pkg
341 [ -d $WOK/$pkg/install ] && prod=$(du -sh $WOK/$pkg/install | awk '{print $1}' 2>/dev/null)
342 [ -d $WOK/$pkg/source ] && srcdir=$(du -sh $WOK/$pkg/source | awk '{print $1}' 2>/dev/null)
343 [ -n "$TARBALL" ] && srcsize=$(du -sh $SRC/$TARBALL | awk '{print $1}')
345 title 'Summary for: %s' "$PACKAGE $VERSION$EXTRAVERSION"
347 # L10n: keep the same width of translations to get a consistent view
348 [ -n "$TARBALL" ] && _ 'Src file : %s' "$TARBALL"
349 [ -n "$srcsize" ] && _ 'Src size : %s' "$srcsize"
350 [ -n "$srcdir" ] && _ 'Source dir : %s' "$srcdir"
351 [ -n "$prod" ] && _ 'Produced : %s' "$prod"
352 _ 'Cook time : %s' "$(disp_time "$time")"
353 _ 'Cook date : %s' "$(date "$(_ '+%%F %%R')")"
354 _ 'Target arch : %s' "$(cut -d$'\t' -f2 $pkgdir/.arch | sort -u | tr '\n' ' ' | sed 's| $||; s| |, |g')"
356 separator -
357 _ ' # : Packed : Compressed : Files : Package name'
358 separator -
359 pkgi=1
360 for i in $(all_names); do
361 version=$(awk -F$'\t' -vpkg="$i" '{
362 if ($1 == pkg) {print $2; exit}
363 }' "$PKGS/packages-$ARCH.info")
364 [ -n "$version" ] || continue
365 fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}')
366 arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch)
367 pkgname="$i-$version-$arch.tazpkg"
368 size=$(ls -lh $PKGS/$pkgname | awk '{print $5}')
369 files=$(wc -l < $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION/files.list)
370 printf "%2d : %7s : %10s : %5s : %s\n" "$pkgi" "$fs" "$size" "$files" "$pkgname"
371 pkgi=$((pkgi + 1))
372 done
373 separator
374 }
377 # Display debugging error info.
379 debug_info() {
380 title 'Debug information %s.' "$1"
381 # L10n: specify your format of date and time (to help: man date)
382 # L10n: not bad one is '+%x %R'
383 _ 'Cook date: %s' "$(date "$(_ '+%%F %%R')")"
384 if [ -n "$time" ]; then
385 times="$(($(date +%s) - $time))"
386 _ 'Wasted time : %s' "$(disp_time "$times")"
387 fi
388 for error in \
389 ERROR 'No package' "cp: can't" "can't open" "can't cd" \
390 'error:' 'fatal error:' 'undefined reference to' \
391 'Unable to connect to' 'link: cannot find the library' \
392 'CMake Error' ': No such file or directory' \
393 'Could not read symbols: File in wrong format'
394 do
395 # format "line number:line content"
396 fgrep -n "$error" $LOGS/$pkg.log
397 done > $LOGS/$pkg.log.debug_info 2>&1
398 # sort by line number, remove duplicates
399 sort -gk1,1 -t: -u $LOGS/$pkg.log.debug_info
400 rm -f $LOGS/$pkg.log.debug_info
401 footer
402 }
405 # A bit smarter function than the classic `cp` command
407 scopy() {
408 if [ "$(stat -c %h -- "$1")" -eq 1 ]; then
409 cp -a "$1" "$2" # copy generic files
410 else
411 cp -al "$1" "$2" # copy hardlinks
412 fi
413 }
416 # Copy all generic files (locale, pixmaps, .desktop) from $install to $fs.
417 # We use standard paths, so some packages need to copy these files with the
418 # receipt and genpkg_rules.
419 # This function executes inside the packaging process, before compressor call.
421 copy_generic_files() {
422 # Proceed only for "main" package (for v2), and for any packages (v1)
423 [ "$pkg" == "$PACKAGE" ] || return 0
425 # $LOCALE is set in cook.conf
426 if [ -n "$LOCALE" -a -z "$WANTED" ]; then
427 if [ -d "$install/usr/share/locale" ]; then
428 mkdir -p "$fs/usr/share/locale"
429 for i in $LOCALE; do
430 if [ -d "$install/usr/share/locale/$i" ]; then
431 cp -r $install/usr/share/locale/$i $fs/usr/share/locale
432 fi
433 done
434 fi
435 fi
437 # Generic pixmaps copy can be disabled with COOKOPTS="!pixmaps" (or GENERIC_PIXMAPS="no")
438 if [ "${COOKOPTS/!pixmaps/}" == "$COOKOPTS" -a "$GENERIC_PIXMAPS" != 'no' ]; then
439 if [ -d "$install/usr/share/pixmaps" ]; then
440 mkdir -p "$fs/usr/share/pixmaps"
441 for i in png xpm; do
442 [ -f "$install/usr/share/pixmaps/$PACKAGE.$i" -a ! -f "$fs/usr/share/pixmaps/$PACKAGE.$i" ] &&
443 cp -r $install/usr/share/pixmaps/$PACKAGE.$i $fs/usr/share/pixmaps
444 done
445 fi
446 fi
448 # Desktop entry (.desktop).
449 # Generic desktop entry copy can be disabled with COOKOPTS="!menus" (or GENERIC_MENUS="no")
450 if [ "${COOKOPTS/!menus/}" == "$COOKOPTS" -a "$GENERIC_MENUS" != 'no' ]; then
451 if [ -d "$install/usr/share/applications" -a -z "$WANTED" ]; then
452 mkdir -p "$fs/usr/share"
453 cp -r $install/usr/share/applications $fs/usr/share
454 fi
455 fi
456 }
459 # Copy pixmaps, desktop files and licenses from $stuff to $install.
460 # This function executes after the main compile_rules() is done.
462 copy_generic_stuff() {
463 # Custom or homemade PNG pixmap can be in stuff.
464 if [ -f "$stuff/$PACKAGE.png" ]; then
465 mkdir -p $install/usr/share/pixmaps
466 cp $stuff/$PACKAGE.png $install/usr/share/pixmaps
467 fi
469 # Homemade desktop file(s) can be in stuff.
470 if [ -d "$stuff/applications" ]; then
471 mkdir -p $install/usr/share
472 cp -r $stuff/applications $install/usr/share
473 fi
474 if [ -f "$stuff/$PACKAGE.desktop" ]; then
475 mkdir -p $install/usr/share/applications
476 cp $stuff/$PACKAGE.desktop $install/usr/share/applications
477 fi
479 # Add custom licenses
480 if [ -d "$stuff/licenses" ]; then
481 mkdir -p $install/usr/share/licenses
482 cp -r $stuff/licenses $install/usr/share/licenses/$PACKAGE
483 fi
484 }
487 # Update installed.cook.diff
489 update_installed_cook_diff() {
490 # If a cook failed deps are removed.
491 cd $root$INSTALLED; ls -1 > $CACHE/installed.cook
492 cd $CACHE
493 [ "$1" == 'force' -o ! -s '/tmp/installed.cook.diff' ] && \
494 busybox diff installed.list installed.cook > /tmp/installed.cook.diff
495 deps=$(grep ^+[a-zA-Z0-9] /tmp/installed.cook.diff | wc -l)
496 }
499 # Remove installed deps.
501 remove_deps() {
502 # Now remove installed build deps.
503 diff='/tmp/installed.cook.diff'
504 [ -s "$diff" ] || return
506 deps=$(grep ^+[a-zA-Z0-9] $diff | sed 's|^+||')
507 nb=$(grep ^+[a-zA-Z0-9] $diff | wc -l)
508 newline
509 _n 'Build dependencies to remove:'; echo " $nb"
510 [ -n "$root" ] && echo "root=\"$root\""
512 _n 'Removing:'
513 for dep in $deps; do
514 echo -n " $dep"
515 # Do not waste time uninstalling the packages if we are inside
516 # aufs chroot - unmounting chroot will "uninstall" all packages.
517 [ -s /aufs-umount.sh ] ||
518 echo 'y' | tazpkg remove $dep --root=$root >/dev/null
519 done
521 newline; newline
522 # Keep the last diff for debug and info.
523 mv -f $diff $CACHE/installed.diff
524 }
527 # Automatically patch the sources.
529 patchit() {
530 [ -f "$stuff/patches/series" ] || return
532 local done="$pkgdir/.patch.done"
533 IFS=$'\n'
534 while read i; do
535 patchname=$(echo ${i%%#*} | cut -d' ' -f1) # allow comments (anything after the # or space)
536 case $patchname in # allow patch options in form <options_no_spaces>|<file_name>
537 *\|*) patchopts="${patchname%|*}"; patchname="${patchname#*|}";;
538 *) patchopts='-Np1';;
539 esac
540 [ -n "$patchname" ] || continue # allow empty lines
541 touch $done
542 grep -q "^${patchname}$" $done && continue # already applied (useful with `cook --continue`)
543 newline
544 _ 'Applying patch %s' "$patchname"
545 patch $patchopts -i $stuff/patches/$patchname | sed 's|^| |'
546 echo $patchname >> $done
547 done < $stuff/patches/series
548 newline
549 unset IFS
550 }
553 # Check source tarball integrity.
555 check_integrity() {
556 for i in sha1 sha3 sha256 sha512 md5; do
557 I=$(echo $i | tr 'a-z' 'A-Z')
558 eval sum=\$TARBALL_$I
559 if [ -n "$sum" ]; then
560 newline
561 _ 'Checking %ssum of source tarball...' "$i"
562 echo "$sum $SRC/$TARBALL" | ${i}sum -c || exit 1
563 fi
564 done
565 newline
566 }
569 # Misc fix functions
571 fix() {
572 case $1 in
573 # https://bugzilla.gnome.org/show_bug.cgi?id=655517
574 # https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed
575 ld)
576 export LDFLAGS="$LDFLAGS -Wl,-Os,--as-needed"
577 ;;
578 libtool)
579 if [ -e 'libtool' ]; then
580 sed -i 's| -shared | -Wl,-Os,--as-needed\0|g' libtool
581 echo "fix.libtool" >> $pkgdir/.patch.done
582 else
583 echo "fix libtool: warning: libtool absent, nothing to fix."
584 fi
585 ;;
586 math)
587 # fix C++ math issue introduced in Glibc 2.26:
588 # error: '__builtin_isnan' is not a member of 'std'
589 # if (std::isnan(N)) {
590 # ^
591 find $src -type f -exec sed -i '
592 s|std::signbit|__builtin_signbit|g;
593 s|std::isnan|__builtin_isnan|g;
594 s|std::isinf|__builtin_isinf_sign|g;
595 s|std::isfinite|__builtin_isfinite|g;
596 s|std::isnormal|__builtin_isnormal|g
597 ' '{}' \;
598 ;;
599 symlinks)
600 # make absolute symlinks relative
601 echo "fix symlinks"
602 local ifs="$IFS" link target
603 IFS=$'\n'
604 # step 1: fast job, prefix all the absolute symlinks with "$install"
605 for link in $(find $install -type l); do
606 target="$(readlink $link)"
607 case "$target" in
608 /*) ln -sfv "$install$target" "$link";;
609 esac
610 done
611 IFS="$ifs"
612 # step 2: fine tuning, make symlinks relative
613 tazpkg -gi --quiet --local --cookmode symlinks
614 symlinks -cr $install
615 ;;
616 gem)
617 # some useful operations while Ruby gems cooking
618 _gems="$(ruby -e'puts Gem.default_dir')"
620 # remove unwanted empty folders
621 rmdir --ignore-fail-on-non-empty \
622 $install/$_gems/build_info/ \
623 $install/$_gems/cache/ \
624 $install/$_gems/doc/ \
625 $install/$_gems/extensions/
627 # move files to docdir
628 docdir=$install/usr/share/doc/$PACKAGE-$VERSION
629 for i in $(ls -ap $install/$_gems/gems/${PACKAGE#*-}-$VERSION/ | sed '
630 /\/$/d; /^\./d; /gemspec$/d; /Rakefile*/d; /Gemfile*/d; /Makefile/d;
631 /\.c$/d; /\.h$/d; /\.o$/d; /\.rb$/d; /\.so$/d; /\.yml$/d;
632 /Manifest/d; /\.inc$/d; /depend/d;
633 '); do
634 mkdir -p $docdir # docdir will not be created when nothing to move
635 mv $install/$_gems/gems/${PACKAGE#*-}-$VERSION/$i $docdir
636 done
637 if [ -d $install/$_gems/gems/${PACKAGE#*-}-$VERSION/doc/ ]; then
638 mkdir -p $docdir
639 mv $install/$_gems/gems/${PACKAGE#*-}-$VERSION/doc/ $docdir
640 fi
642 if [ -d $docdir ]; then
643 # move man pages
644 unset man_to_copy
645 for i in $(seq 1 8); do
646 for j in $(find $docdir -type f -name "*.$i" | sed '/LGPL-2\.1/d'); do
647 man_to_copy="$man_to_copy $j"
648 done
649 done
650 if [ -n "$man_to_copy" ]; then
651 cook_pick_manpages $man_to_copy
652 rm $man_to_copy
653 fi
655 # convert rdoc to markdown (thanks https://gist.github.com/teeparham/8a99e308884e1c32735a)
656 for i in $(find $docdir -type f -name '*.rdoc'); do
657 fix utf-8
658 LC_ALL=en_US.UTF-8 ruby -r rdoc -e 'puts RDoc::Markup::ToMarkdown.new.convert File.read(ARGV[0] || "'$i'")' >$i.md && rm $i || rm $i.md
659 done
660 fi
662 # move man pages (from the different place)
663 rubyman=$install/$_gems/gems/${PACKAGE#*-}-$VERSION/man
664 if [ -d $rubyman ]; then
665 unset man_to_copy
666 for i in $(seq 1 8); do
667 for j in $(find $rubyman -type f -name "*.$i" | sed '/LGPL-2\.1/d'); do
668 man_to_copy="$man_to_copy $j"
669 done
670 done
671 if [ -n "$man_to_copy" ]; then
672 cook_pick_manpages $man_to_copy
673 fi
674 rm -r $rubyman
675 fi
676 ;;
677 utf-8)
678 # Install UTF-8 locale
679 tazpkg -gi --quiet --local --cookmode locale-en-base
680 mkdir -p /usr/lib/locale
681 localedef -i 'en_US' -c -f 'UTF-8' /usr/lib/locale/en_US.UTF-8
682 ;;
683 esac
684 }
687 # Typical function used in compile_rules() to make perl modules packages
689 cook_perl() {
690 if [ -e "Makefile.PL" ]; then
691 # Up to 3 optional parameters supported
692 PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor $1 &&
693 make $2 &&
694 make $3 PERL_MM_USE_DEFAULT=1 DESTDIR=$install install &&
695 chmod -R u+w $install
696 elif [ -e "Build.PL" ]; then
697 echo "Not implemented yet"
698 return 1
699 else
700 echo "Unable to cook Perl module"
701 return 1
702 fi
703 }
706 # Store timestamps, log jobs length
708 timestamp() {
709 local ts_file="$WOK/$pkg/.ts"
710 local curr_ts=$(date '+%s')
711 case $1 in
712 init)
713 rm $ts_file 2>/dev/null
714 echo $curr_ts > $prev_ts
715 ;;
716 job*)
717 # calculate time from the last timestamp
718 echo "$1='$(( $curr_ts - $(cat $prev_ts) ))'" >> $ts_file
719 echo $curr_ts > $prev_ts
720 ;;
721 sets)
722 echo "sets='$2'" >> $ts_file
723 ;;
724 esac
725 }
728 # Store time statsistics to the cache
730 store_timestats() {
731 # see doc/timestats.txt for file format
732 temp=$(mktemp)
733 {
734 for i in $(seq 1 30); do echo "job$i=0"; done
735 cat $WOK/$pkg/.ts
736 echo -n 'total=$(( 0'
737 for i in $(seq 1 30); do echo -n " + job$i"; done
738 echo ' ))'
739 } > $temp
740 . $temp
741 {
742 echo -n "$pkg $sets "
743 for i in $(seq 1 30); do echo -n "$((job$i)) "; done
744 echo "$total"
745 } >> /home/slitaz/cache/timestats
746 rm $temp $WOK/$pkg/.ts # clean
747 }
750 # Internal function to cook specified SET
752 cook_set() {
753 # Switch to the specified source set
754 set_paths
755 local suffix=''
756 [ -n "$SET" ] && suffix="-$SET"
757 export src="$WOK/$pkg/source/$PACKAGE-$VERSION$suffix"
758 export install="$WOK/$pkg/install$suffix"
759 export DESTDIR="$install"
761 if [ -n "$SETS" ]; then
762 if [ -n "$SET" ]; then
763 title "Switching to the set '$SET'"
764 else
765 title "Switching to the default set"
766 fi
767 echo "src : $src"
768 echo "install: $install"
769 fi
770 [ -d "$src" ] && cd $src # packages without sources exists
771 echo
773 [ -d "$install" ] && rm -r $install
774 #mkdir -p $install
776 compile_rules $@ || { broken; exit 1; }
778 # Stay compatible with _pkg
779 [ -d "$src/_pkg" ] && mv $src/_pkg $install
781 copy_generic_stuff
783 timestamp job$job_counter # compiling (set '$SET')
785 # Actions to do after compiling the package
786 # Skip all for split packages (already done in main package)
787 if [ -z "$WANTED" ]; then
788 footer
789 export COOKOPTS ARCH install
790 @@PREFIX@@/libexec/cookutils/compressor install
791 timestamp job$(($job_counter + 1)) # compressing (set '$SET')
792 fi
794 # Activate "instant-pack" mode
795 if [ "${COOKOPTS/instant-pack/}" != "$COOKOPTS" ]; then
796 echo " $SPLIT " | fgrep -q " $PACKAGE " || SPLIT="$PACKAGE $SPLIT"
797 export PACKAGE
798 # determine the list of the packages belongs to the current SET...
799 echo -n $SPLIT \
800 | awk -vset="$SET" '
801 BEGIN { RS = " "; FS = ":"; }
802 { if ($2 == set) print $1; }' \
803 | xargs -n1 @@PREFIX@@/libexec/cookutils/pack # ... and then pack them
804 fi
806 job_counter=$(($job_counter + 2))
807 }
810 # The main cook function.
812 cookit() {
813 if [ -n "$SETUP_MD5" -a "$SETUP_MD5" != "$(ls $root$INSTALLED | md5sum | cut -c1-32)" ]; then
814 _ 'ERROR: Broken setup. Abort.'
815 return
816 fi
818 title 'Cook: %s' "$PACKAGE $VERSION"
819 set_paths
820 timestamp init # the very start
822 # Handle cross-tools.
823 [ "$BUILD_SYSTEM" != "$HOST_SYSTEM" ] &&
824 case "$ARCH" in
825 arm*|x86_64)
826 # CROSS_COMPILE is used by at least Busybox and the kernel to set
827 # the cross-tools prefix. Sysroot is the root of our target arch
828 sysroot="$CROSS_TREE/sysroot"
829 tools="$CROSS_TREE/tools"
830 # Set root path when cross compiling. ARM tested but not x86_64
831 # When cross compiling we must install build deps in $sysroot.
832 arch="-$ARCH"
833 root="$sysroot"
834 _ '%s sysroot: %s' "$ARCH" "$sysroot"
835 _ 'Adding "%s" to PATH' "$tools/bin"
836 export PATH="$PATH:$tools/bin"
837 export PKG_CONFIG_PATH="$sysroot/usr/lib/pkgconfig"
838 export CROSS_COMPILE="$HOST_SYSTEM-"
839 _ 'Using cross-tools: %s' "$CROSS_COMPILE"
840 if [ "$ARCH" == 'x86_64' ]; then
841 export CC="$HOST_SYSTEM-gcc -m64"
842 export CXX="$HOST_SYSTEM-g++ -m64"
843 else
844 export CC="$HOST_SYSTEM-gcc"
845 export CXX="$HOST_SYSTEM-g++"
846 fi
847 export AR="$HOST_SYSTEM-ar"
848 export AS="$HOST_SYSTEM-as"
849 export RANLIB="$HOST_SYSTEM-ranlib"
850 export LD="$HOST_SYSTEM-ld"
851 export STRIP="$HOST_SYSTEM-strip"
852 export LIBTOOL="$HOST_SYSTEM-libtool"
853 ;;
854 esac
856 @@PREFIX@@/libexec/cookutils/precheck $receipt || exit 1 # former receipt_quality()
858 cd $pkgdir
859 if [ -z "$continue" ]; then
860 rm -rf source 2>/dev/null
861 rm .patch.done 2>/dev/null
862 fi
863 rm -rf install taz 2>/dev/null
865 # Disable -pipe if less than 512 MB free RAM.
866 free=$(awk '/^MemFree|^Buffers|^Cached/{s+=$2}END{print int(s/1024)}' /proc/meminfo)
867 if [ "$free" -lt 512 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then
868 _ 'Disabling -pipe compile flag: %d MB RAM free' "$free"
869 CFLAGS="${CFLAGS/-pipe}"; CFLAGS=$(echo "$CFLAGS" | tr -s ' ')
870 CXXFLAGS="${CXXFLAGS/-pipe}"; CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ')
871 fi
872 unset free
874 # Export flags and path to be used by make and receipt.
875 DESTDIR="$pkgdir/install"
876 # FIXME: L10n: Is this the right time for 'LC_ALL=C LANG=C'?
877 export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C \
878 LDFLAGS
880 timestamp job1 # pre-checks
882 # BUILD_DEPENDS may vary depending on the ARCH
883 case "$ARCH" in
884 arm*) [ -n "$BUILD_DEPENDS_arm" ] && BUILD_DEPENDS=$BUILD_DEPENDS_arm ;;
885 x86_64) [ -n "$BUILD_DEPENDS_x86_64" ] && BUILD_DEPENDS=$BUILD_DEPENDS_x86_64 ;;
886 esac
888 # Check for build deps and handle implicit depends of *-dev packages
889 # (ex: libusb-dev :: libusb).
890 [ -n "$BUILD_DEPENDS" ] && _ 'Checking build dependencies...'
891 [ -n "$root" ] && _ 'Using packages DB: %s' "$root$DB"
893 # Get the list of installed packages
894 cd $root$INSTALLED; ls > $CACHE/installed.list
896 for action in check install; do
897 for dep in $BUILD_DEPENDS; do
898 implicit="${dep%-dev}"; [ "$implicit" == "$dep" ] && implicit=''
899 for i in $dep $implicit; do
900 # Skip if package already installed
901 [ -f "$root$INSTALLED/$i/receipt" ] && continue
903 case $action in
904 check)
905 # Search for local package or local provided-package
906 name=$(awk -F$'\t' -vpkg="$i" '{
907 if (index(" " $1 " " $10 " ", " " pkg " ")) {print $1; exit}
908 }' "$PKGS/packages-$ARCH.info")
909 if [ -z "$name" ]; then
910 # Search for package in mirror
911 name="$(awk -F$'\t' -vi="$i" '$1==i{print $1; exit}' "$root$DB/packages.info")"
912 [ -z "$name" -a "$i" == "$dep" ] && die 'ERROR: unknown dep "%s"' "$i"
913 fi
914 ;;
915 install)
916 tazpkg get-install $i --root=$root --local --quiet --cookmode || { broken; exit 1; }
917 ;;
918 esac
919 done
920 done
921 done
923 update_installed_cook_diff
925 timestamp job2 # installing bdeps
927 # Get source tarball and make sure we have source dir named:
928 # $PACKAGE-$VERSION to be standard in receipts. Here we use tar.lzma
929 # tarball if it exists.
930 if [ -n "$WGET_URL" -a ! -f "$SRC/$TARBALL" ]; then
931 if [ -f "$SRC/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ]; then
932 TARBALL="${SOURCE:-$PACKAGE}-$VERSION.tar.lzma"
933 LZMA_SRC=''
934 else
935 get_source || { broken; exit 1; }
936 fi
937 fi
938 if [ -z "$WANTED" -a -n "$TARBALL" -a ! -d "$src" ]; then
939 mkdir -p $pkgdir/source/tmp; cd $pkgdir/source/tmp
940 if ! extract_source ; then
941 get_source
942 extract_source || { broken; exit 1; }
943 fi
944 if [ -n "$LZMA_SRC" ]; then
945 cd $pkgdir/source
946 if [ "$(ls -A tmp | wc -l)" -gl 1 -o -f "$(echo tmp/*)" ]; then
947 mv tmp tmp-1; mkdir tmp
948 mv tmp-1 tmp/${SOURCE:-$PACKAGE}-$VERSION
949 fi
950 if [ -d "tmp/${SOURCE:-$PACKAGE}-$VERSION" ]; then
951 cd tmp; tar -c * | lzma e $SRC/$TARBALL -si
952 fi
953 fi
955 cd $pkgdir/source/tmp
956 # Some archives are not well done and don't extract to one dir (ex lzma).
957 files=$(ls | wc -l)
958 [ "$files" -eq 1 -a -d "$(ls)" ] &&
959 mv * ../$PACKAGE-$VERSION
960 [ "$files" -eq 1 -a -f "$(ls)" ] &&
961 mkdir -p ../$PACKAGE-$VERSION &&
962 mv * ../$PACKAGE-$VERSION/$TARBALL
963 [ "$files" -gt 1 ] &&
964 mkdir -p ../$PACKAGE-$VERSION &&
965 mv * ../$PACKAGE-$VERSION
966 cd ..; rm -rf tmp
967 fi
969 # Check md5sum (or similar) for sources tarball
970 check_integrity
972 # Libtool shared libs path hack.
973 case "$ARCH" in
974 arm*) cross libhack ;;
975 esac
977 timestamp job3 # get/unpack src tarball
979 # Compiling all the sets
980 if grep -q ^compile_rules $receipt; then
981 _ 'Executing: %s' 'compile_rules'
982 echo "CFLAGS : $CFLAGS"
983 echo "CXXLAGS : $CXXFLAGS"
984 echo "CPPFLAGS : $CPPFLAGS"
985 echo "LDFLAGS : $LDFLAGS"
986 [ -d "$src" ] && cd $src
987 patchit
989 timestamp job4 # patching
991 # Get set names from $SPLIT variable, format ex. 'pkg1 pkg2:set1 pkg3:set2'
992 # Keep natural order of the sets, don't sort them alphabetically
993 SETS=$(echo -n $SPLIT \
994 | awk '
995 BEGIN { RS = " "; FS = ":"; }
996 {
997 if ($2 && ! set[$2]) { printf("%s ", $2); set[$2] = "1"; }
998 }' \
999 | sed 's| $||')
1000 # Prepare specified source sets using patched sources
1001 [ -n "$SETS" -a -d "$src" ] &&
1002 for set in $SETS; do
1003 echo "Preparing set $set" # debug
1004 cp -a $src $src-$set
1005 done
1007 timestamp job5 # preparing sets
1008 timestamp sets "$SETS"
1010 job_counter='6'
1012 SET='' cook_set # first run for empty SET
1014 # Allow to change SETS after the first run, follow the changes
1015 SETS=$(. $receipt; echo -n $SPLIT \
1016 | awk '
1017 BEGIN { RS = " "; FS = ":"; }
1019 if ($2 && ! set[$2]) { printf("%s ", $2); set[$2] = "1"; }
1020 }' \
1021 | sed 's| $||')
1022 for SET in $SETS; do
1023 cook_set
1024 done
1025 else
1026 mkdir -p $install # allow receipts without `compile_rules()`
1027 fi
1028 footer
1030 timestamp job # reset counter
1032 # Execute testsuite.
1033 if grep -q ^testsuite $receipt; then
1034 title 'Running testsuite'
1035 testsuite $@ || { broken; exit 1; }
1036 footer
1037 fi
1039 timestamp job26 # test suite
1041 update_installed_cook_diff force
1045 # Cook quality assurance.
1047 cookit_quality() {
1048 while true; do
1049 [ ! -d "$WOK/$pkg/install" -a -z "$WANTED" ] || break
1050 _ 'ERROR: cook failed' | tee -a $LOGS/$pkg.log
1051 [ "$trials" == 'yes' ] || break
1052 title "Interactive mode"
1053 # TODO: allow commands:
1054 # q - quit; v - edit receipt here using vi;
1055 # s - search for package containing package;
1056 # <package name> - install package; [Enter] - retry
1057 _ 'You may install the packages here and/or edit the receipt there.'
1058 newline
1059 while true; do
1060 _n 'Install the package? [name/N] '; read answer
1061 [ -n "$answer" ] || break
1062 tazpkg -gi $answer --root=$root --local --quiet --cookmode
1063 done
1064 newline
1065 _n 'Try again? [Y/n] '; read answer
1066 [ "$answer" == 'n' ] && break
1067 # here you may append log if you want (">>" instead of last ">")
1068 cookit $@ 2>&1 | loglimit 50 > $LOGS/$pkg.log
1069 done
1071 [ "${COOKOPTS/skip-log-errors/}" != "$COOKOPTS" ] && return 0
1073 # ERROR can be echoed any time in cookit()
1074 if grep -Ev "(conftest|configtest)" $LOGS/$pkg.log | \
1075 grep -Eq "(^ERROR|undefined reference to)" ; then
1076 debug_info "cookit_quality" | tee -a $LOGS/$pkg.log
1077 put_status $pkg Failed
1078 # rm -f $command
1079 # broken; exit 1
1080 fi
1084 # Return all the names of packages bundled in this receipt
1086 all_names() {
1087 # Get package names from $SPLIT variable
1088 local split=$(echo -n $SPLIT \
1089 | awk '
1090 BEGIN { RS = " "; FS = ":"; }
1091 { print $1; }' \
1092 | tr '\n' ' ')
1093 local split_space=" $split "
1094 if ! head -n1 $WOK/$pkg/receipt | fgrep -q 'v2'; then
1095 # For receipts v1: $SPLIT may present in the $WANTED package,
1096 # but split packages have their own receipts
1097 echo $PACKAGE
1098 elif [ "${split_space/ $PACKAGE /}" != "$split_space" ]; then
1099 # $PACKAGE included somewhere in $SPLIT (probably in the end).
1100 # We should build packages in the order defined in the $SPLIT.
1101 echo $split
1102 else
1103 # We'll build the $PACKAGE, then all defined in the $SPLIT.
1104 echo $PACKAGE $split
1105 fi
1109 # v2: pack all packages using compiled files
1111 packall() {
1112 set_paths
1113 [ -e $pkgdir/.arch ] && rm $pkgdir/.arch
1115 if head -n1 "$pkgdir/receipt" | fgrep -q 'v2'; then
1116 for i in $(all_names); do
1117 unset TAGS DEPENDS CAT CONFIG_FILES PROVIDE SUGGESTED DATABASE_FILES TAZPANEL_DAEMON
1118 export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $i
1119 done
1120 else
1121 export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $PACKAGE
1122 fi
1126 # Reverse "cat" command: prints input lines in the reverse order
1128 tac() {
1129 sed '1!G;h;$!d' $1
1133 # Install package: update the chroot with freshly rebuilt package: keep env up-to-date.
1135 install_package() {
1136 set_paths
1137 case "$ARCH" in
1138 arm*) root="$CROSS_TREE/sysroot";;
1139 esac
1141 # Process all the package names built by this receipt (defined in $SPLIT)
1142 for i in $(PACKAGE="$pkg" all_names); do
1143 if [ -d "$root$INSTALLED/$i" ]; then
1144 pkg_file=$(awk -F$'\t' -vpkg="$i" -varch="$ARCH" '{
1145 if ($1 == pkg) {
1146 pkgarch = ($11 == "0") ? "any" : arch;
1147 printf("%s-%s-%s.tazpkg", $1, $2, pkgarch);
1148 exit
1150 }' $PKGS/packages-$ARCH.info)
1151 if [ -e "$PKGS/$pkg_file" ]; then
1152 _ 'Updating %s chroot environment...' "$ARCH"
1153 _ 'Updating chroot: %s' "${pkg_file%.tazpkg}" | log
1154 tazpkg -i "$PKGS/$pkg_file" --forced --root=$root
1155 fi
1156 fi
1157 done
1161 # remove chroot jail
1163 umount_aufs() {
1164 tac ${1}rw/aufs-umount.sh | sh
1165 rm -rf ${1}rw
1166 umount ${1}root
1167 rmdir ${1}r*
1171 # Launch the cook command into a chroot jail protected by aufs.
1172 # The current filesystems are used read-only and updates are
1173 # stored in a separate branch.
1175 try_aufs_chroot() {
1177 base="/dev/shm/aufsmnt$$"
1179 # Can we setup the chroot? Is it already done?
1180 grep -q ^AUFS_NOT_SUPPORTED $receipt && return
1181 grep -q ^AUFS_NOT_RAMFS $receipt && base="/mnt/aufsmnt$$"
1182 [ -n "$AUFS_MOUNTS" -a ! -f /aufs-umount.sh ] || return
1183 grep -q ^aufs /proc/modules || modprobe aufs 2>/dev/null || return
1184 mkdir ${base}root ${base}rw || return
1186 _ 'Setup aufs chroot...'
1188 # Sanity check
1189 for i in / /proc /sys /dev /dev/shm /home; do
1190 case " $AUFS_MOUNTS " in
1191 *\ $i\ *) ;;
1192 *) AUFS_MOUNTS="$AUFS_MOUNTS $i" ;;
1193 esac
1194 done
1195 for mnt in $(ls -d $AUFS_MOUNTS | sort | uniq); do
1196 mkdir -p ${base}root$mnt # for `mount -o bind`
1197 mount -o bind $mnt ${base}root$mnt # use `-o bind` instead of `--bind`
1198 if [ $mnt == / ] && ! mount -t aufs -o br=${base}rw:/ none ${base}root; then
1199 _ 'Aufs mount failure'
1200 umount ${base}root
1201 rm -rf ${base}r*
1202 return
1203 fi
1204 echo "umount ${base}root$mnt" >> ${base}rw/aufs-umount.sh
1205 done
1206 trap "umount_aufs ${base}" INT
1208 chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@"
1209 status=$?
1211 _ 'Leaving aufs chroot...'
1212 umount_aufs $base
1213 # Install package outside the aufs jail
1214 install_package
1215 exit $status
1219 # Encode predefined XML entities
1221 xml_ent() {
1222 sed -e 's|&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|"|\&quot;|g' -e "s|'|\&apos;|g"
1226 # Create a XML feed for freshly built packages.
1228 gen_rss() {
1229 if [ -e "$WOK/$PACKAGE/.icon.png" ]; then
1230 icon="$COOKER_URL$PACKAGE/browse/.icon.png"
1231 else
1232 icon="http://cook.slitaz.org/tazpkg.png"
1233 fi
1235 cat > $FEEDS/$pkg.xml <<EOT
1236 <item>
1237 <title>$PACKAGE $VERSION$EXTRAVERSION</title>
1238 <link>$COOKER_URL${PACKAGE//+/%2B}</link>
1239 <guid isPermaLink="false">$PACKAGE-$VERSION$EXTRAVERSION</guid>
1240 <pubDate>$(date '+%a, %d %b %Y %X GMT')</pubDate>
1241 <description><![CDATA[
1242 <table>
1243 <tr>
1244 <td vertical-align="top"><img src="$icon" alt=""/></td>
1245 <td>$(echo -n "$SHORT_DESC" | xml_ent)</td>
1246 </tr>
1247 </table>
1248 ]]></description>
1249 </item>
1250 EOT
1254 # Truncate stdout log file to $1 Mb.
1256 loglimit() {
1257 if [ -n "$DEFAULT_LOG_LIMIT" ]; then
1258 tee /dev/stderr | head -qc ${1:-$DEFAULT_LOG_LIMIT}m
1259 else
1260 tee /dev/stderr
1261 fi
1266 # Receipt functions to ease packaging
1269 get_dev_files() {
1270 action 'Getting standard devel files...'
1271 mkdir -p $fs/usr/lib
1272 cp -a $install/usr/lib/pkgconfig $fs/usr/lib
1273 cp -a $install/usr/lib/*a $fs/usr/lib
1274 cp -a $install/usr/include $fs/usr
1275 status
1279 # Function to use in compile_rules() to copy man page from $src to $install
1281 cook_pick_manpages() {
1282 local name section
1283 action 'Copying man pages...'
1285 for i in $@; do
1286 name=$(echo $i | sed 's|\.[gbx]z2*$||')
1287 section=${name##*/}; section=${section##*.}
1288 mkdir -p $install/usr/share/man/man$section
1289 scopy $i $install/usr/share/man/man$section
1290 done
1291 status
1295 # Function to use in compile_rules() to copy documentation from $src to $install
1297 cook_pick_docs() {
1298 local docdir="$install/usr/share/doc/$PACKAGE-$VERSION"
1299 action 'Copying documentation...'
1300 mkdir -p $docdir
1301 cp -r $@ $docdir
1302 chmod -R a+r $docdir
1303 status
1307 # Update split.db once for receipt
1309 update_split_db() {
1310 local db="$cache/split.db"
1311 touch $db
1312 sed -i "/^$pkg\t/d" $db
1313 echo -e "$pkg\t$(all_names)" >> $db
1317 # Recreate whole split.db from scratch
1319 recreate_split_db() {
1320 # Clean
1321 local db="$cache/split.db"
1323 cd $WOK
1324 for pkg in *; do
1325 [ -f "$WOK/$pkg/receipt" ] || continue
1326 unset PACKAGE SPLIT
1327 . $WOK/$pkg/receipt
1328 echo -e "$PACKAGE\t$(all_names)"
1329 done > $db
1333 # Recreate whole maint.db from scratch
1335 recreate_maint_db() {
1336 # Clean
1337 local db="$cache/maint.db"
1339 cd $WOK
1340 for pkg in *; do
1341 [ -f "$WOK/$pkg/receipt" ] || continue
1342 unset PACKAGE MAINTAINER
1343 . $WOK/$pkg/receipt
1344 MAINTAINER=$(echo $MAINTAINER | sed 's|.*<||; s|>.*||')
1345 echo -e "$MAINTAINER\t$PACKAGE"
1346 done | sort > $db
1350 # Put the status to the activity log
1352 put_status() {
1353 # $1: package, $2: status, one of 'Done', 'Failed'
1354 sed -i "s|>$1</a>$|& [ $2 ]|" $activity
1355 if [ "$2" == 'Done' ]; then
1356 # overstrike all previous 'Failed' to indicate package is OK now
1357 sed -i "/>$1<\/a>/ s|\[ Failed \]|[ -Failed ]|" $activity
1358 fi
1365 # Commands
1368 # cook <package> --deps
1369 [ -n "$deps" ] && {
1370 @@PREFIX@@/libexec/cookutils/deps $1
1371 exit 0
1374 # cook <package> --clean
1375 # cook <package> -c
1376 [ -n "$clean" -o "$2" == '-c' ] && {
1377 action 'Cleaning "%s"' "$1"
1378 cd $WOK/$1; rm -rf install taz source
1379 status; newline
1380 touch $activity # update $activity -> something changed -> update webstat
1381 exit 0
1384 # cook <package> --getsrc
1385 # cook <package> -gs
1386 [ -n "$getsrc" -o "$2" == '-gs' ] && {
1387 title 'Getting source for "%s"' "$1"
1388 receipt="$WOK/$pkg/receipt"
1389 check_pkg_in_wok
1390 unset_receipt
1391 . $receipt
1392 get_source
1393 _ 'Tarball: %s' "$SRC/$TARBALL"; newline
1394 exit 0
1397 # cook <package> --block
1398 # cook <package> -b
1399 [ -n "$block" -o "$2" == '-b' ] && {
1400 action 'Blocking package "%s"' "$1"
1401 [ $(grep "^$1$" $blocked) ] || echo "$1" >> $blocked
1402 status; newline
1403 touch $activity
1404 exit 0
1407 # cook <package> --unblock
1408 # cook <package> -ub
1409 [ -n "$unblock" -o "$2" == '-ub' ] && {
1410 action 'Unblocking package "%s"' "$1"
1411 sed -i "/^$1$/d" $blocked
1412 status; newline
1413 touch $activity
1414 exit 0
1420 case "$1" in
1421 usage|help|-u|-h)
1422 usage ;;
1424 list-wok)
1425 title 'List of %s packages in "%s"' "$ARCH" "$WOK"
1426 cd $WOK
1427 if [ "$ARCH" != 'i486' ]; then
1428 count=0
1429 for pkg in $(fgrep 'HOST_ARCH=' */receipt | egrep "$ARCH|any" | cut -d: -f1)
1430 do
1431 unset HOST_ARCH
1432 . ./$pkg
1433 count=$(($count + 1))
1434 colorize 34 "$PACKAGE"
1435 done
1436 else
1437 count=$(ls | wc -l)
1438 ls -1
1439 fi
1440 footer "$(_p '%s package' '%s packages' "$count" "$(colorize 32 "$count")")"
1441 ;;
1443 activity)
1444 cat $activity ;;
1446 search)
1447 # Just a simple search function, we don't need more actually.
1448 query="$2"
1449 title 'Search results for "%s"' "$query"
1450 cd $WOK; ls -1 | grep "$query"
1451 footer ;;
1453 setup)
1454 # Setup a build environment
1455 check_root
1456 _ 'Cook: setup environment' | log
1457 title 'Setting up your environment'
1458 [ -d $SLITAZ ] || mkdir -p $SLITAZ
1459 cd $SLITAZ
1460 init_db_files
1461 _ 'Checking for packages to install...'
1462 # Use setup pkgs from cross.conf or cook.conf. When cross compiling
1463 # ARCH-setup or 'cross check' should be used before: cook setup
1464 case "$ARCH" in
1465 arm*|x86_64)
1466 [ -x '/usr/bin/cross' ] || die 'ERROR: %s is not installed' 'cross'
1467 _ 'Using config file: %s' '/etc/slitaz/cross.conf'
1468 . /etc/slitaz/cross.conf ;;
1469 esac
1470 for pkg in $SETUP_PKGS; do
1471 if [ -n "$forced" ]; then
1472 tazpkg -gi $pkg --forced
1473 else
1474 [ ! -d "$INSTALLED/$pkg" ] && tazpkg get-install $pkg
1475 fi
1476 done
1478 # Handle --options
1479 case "$2" in
1480 --wok) hg clone $WOK_URL wok || exit 1 ;;
1481 --stable) hg clone $WOK_URL-stable wok || exit 1 ;;
1482 --undigest) hg clone $WOK_URL-undigest wok || exit 1 ;;
1483 --tiny) hg clone $WOK_URL-tiny wok || exit 1 ;;
1484 esac
1486 # SliTaz group and permissions
1487 if ! grep -q ^slitaz /etc/group; then
1488 _ 'Adding group "%s"' 'slitaz'
1489 addgroup slitaz
1490 fi
1491 _ 'Setting permissions for group "%s"...' 'slitaz'
1492 find $SLITAZ -maxdepth 2 -exec chown root.slitaz {} \;
1493 find $SLITAZ -maxdepth 2 -exec chmod g+w {} \;
1494 footer "$(_ 'All done, ready to cook packages :-)')" ;;
1496 *-setup)
1497 # Setup for cross compiling.
1498 arch="${1%-setup}"
1499 check_root
1500 . /etc/slitaz/cook.conf
1501 for pkg in $CROSS_SETUP; do
1502 if [ -n "$forced" ]; then
1503 tazpkg -gi $pkg --forced
1504 else
1505 [ ! -d "$INSTALLED/$pkg" ] && tazpkg -gi $pkg
1506 fi
1507 done
1509 _ 'Cook: setup %s cross environment' "$arch" | log
1510 title 'Setting up your %s cross environment' "$arch"
1511 init_db_files
1512 sed -i \
1513 -e "s|ARCH=.*|ARCH=\"$arch\"|" \
1514 -e "s|CROSS_TREE=.*|CROSS_TREE=\"/cross/$arch\"|" \
1515 -e 's|BUILD_SYSTEM=.*|BUILD_SYSTEM=i486-slitaz-linux|' \
1516 /etc/slitaz/cook.conf
1517 case "$arch" in
1518 arm)
1519 flags='-O2 -march=armv6'
1520 host="$ARCH-slitaz-linux-gnueabi" ;;
1521 armv6hf)
1522 flags='-O2 -march=armv6j -mfpu=vfp -mfloat-abi=hard'
1523 host="$ARCH-slitaz-linux-gnueabi" ;;
1524 armv7)
1525 flags='-Os -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -pipe'
1526 host="$ARCH-slitaz-linux-gnueabi" ;;
1527 x86_64)
1528 flags='-O2 -mtune=generic -pipe'
1529 host="$ARCH-slitaz-linux" ;;
1530 esac
1531 sed -i \
1532 -e "s|CFLAGS=.*|CFLAGS=\"$flags\"|" \
1533 -e "s|HOST_SYSTEM=.*|HOST_SYSTEM=$host|" /etc/slitaz/cook.conf
1534 . /etc/slitaz/cook.conf
1535 sysroot="$CROSS_TREE/sysroot"
1536 tools="/cross/$arch/tools"
1537 root="$sysroot"
1538 # L10n: keep the same width of translations to get a consistent view
1539 _ 'Target arch : %s' "$ARCH"
1540 _ 'Configure args : %s' "$CONFIGURE_ARGS"
1541 _ 'Build flags : %s' "$flags"
1542 _ 'Arch sysroot : %s' "$sysroot"
1543 _ 'Tools prefix : %s' "$tools/bin"
1544 # Tell the packages manager where to find packages.
1545 _ 'Packages DB : %s' "$root$DB"
1546 mkdir -p $root$INSTALLED
1547 cd $root$DB; rm -f *.bak
1548 for list in packages.list packages.desc packages.equiv packages.md5; do
1549 rm -f $list
1550 ln -s $SLITAZ/packages/$list $list
1551 done
1552 # We must have the cross compiled glibc-base installed or default
1553 # i486 package will be used as dep by tazpkg and then break the
1554 # cross environment
1555 if [ ! -f "$root$INSTALLED/glibc-base/receipt" ]; then
1556 colorize 36 $(_ 'WARNING: %s is not installed in sysroot' '(e)glibc-base')
1557 fi
1558 # Show GCC version or warn if not yet compiled.
1559 if [ -x "$tools/bin/$HOST_SYSTEM-gcc" ]; then
1560 _ 'Cross compiler : %s' "$HOST_SYSTEM-gcc"
1561 else
1562 colorize 36 $(_ 'C compiler "%s" is missing' "$HOST_SYSTEM-gcc")
1563 _ 'Run "%s" to cook a toolchain' 'cross compile'
1564 fi
1565 footer ;;
1567 test)
1568 # Test a cook environment.
1569 _ 'Cook test: testing the cook environment' | log
1570 [ ! -d "$WOK" ] && exit 1
1571 [ ! -d "$WOK/cooktest" ] && cp -r $DATA/cooktest $WOK
1572 cook cooktest ;;
1574 new)
1575 # Create the package folder and an empty receipt.
1576 pkg="$2"
1577 [ -z "$pkg" ] && usage
1578 newline
1579 [ -d "$WOK/$pkg" ] && die 'Package "%s" already exists.' "$pkg"
1581 action 'Creating folder "%s"' "$WOK/$pkg"
1582 mkdir $WOK/$pkg; cd $WOK/$pkg; status
1584 action 'Preparing the package receipt...'
1585 cp $DATA/receipt .
1586 sed -i "s|^PACKAGE=.*|PACKAGE=\"$pkg\"|" receipt
1587 status; newline
1589 # Interactive mode, asking and seding.
1590 case "$3" in
1591 --interactive|-x)
1592 _ 'Entering interactive mode...'
1593 separator
1594 _ 'Package : %s' "$pkg"
1596 _n 'Version : ' ; read answer
1597 sed -i "s|^VERSION=.*|VERSION=\"$answer\"|" receipt
1599 _n 'Category : ' ; read answer
1600 sed -i "s|^CATEGORY=.*|CATEGORY=\"$answer\"|" receipt
1602 # L10n: Short description
1603 _n 'Short desc : ' ; read answer
1604 sed -i "s|^SHORT_DESC=.*|SHORT_DESC=\"$answer\"|" receipt
1606 _n 'Maintainer : ' ; read answer
1607 sed -i "s|^MAINTAINER=.*|MAINTAINER=\"$answer\"|" receipt
1609 _n 'License : ' ; read answer
1610 sed -i "s|^LICENSE=.*|LICENSE=\"$answer\"|" receipt
1612 _n 'Web site : ' ; read answer
1613 sed -i "s|^WEB_SITE=.*|WEB_SITE=\"$answer\"|" receipt
1614 newline
1616 # Wget URL.
1617 _ 'Wget URL to download source tarball.'
1618 _n 'Example : ' ; echo '$GNU_MIRROR/$PACKAGE/$TARBALL'
1619 _n 'Wget url : ' ; read answer
1620 sed -i "s|^WGET_URL=.*|WGET_URL=\"$answer\"|" receipt
1622 # Ask for a stuff dir.
1623 confirm "$(_n 'Do you need a stuff directory? (y/N)')"
1624 if [ "$?" -eq 0 ]; then
1625 action 'Creating the stuff directory...'
1626 mkdir $WOK/$pkg/stuff; status
1627 fi
1629 # Ask for a description file.
1630 confirm "$(_n 'Are you going to write a description? (y/N)')"
1631 if [ "$?" -eq 0 ]; then
1632 action 'Creating the "%s" file...' 'description.txt'
1633 touch $WOK/$pkg/description.txt; status
1634 fi
1636 footer "$(_ 'Receipt is ready to use.')" ;;
1637 esac ;;
1639 list)
1640 # Cook a list of packages (better use the Cooker since it will order
1641 # packages before executing cook).
1642 check_root
1643 [ -z "$2" ] && die 'No list in argument.'
1644 [ -f "$2" ] || die 'List "%s" not found.' "$2"
1646 _ 'Starting cooking the list "%s"' "$2" | log
1648 while read pkg; do
1649 cook $pkg || broken
1650 done < $2
1651 ;;
1653 clean-wok)
1654 check_root
1655 newline; action 'Cleaning all packages files...'
1656 rm -rf $WOK/*/taz $WOK/*/install $WOK/*/source
1657 status; newline ;;
1659 clean-src)
1660 check_root
1661 newline; action 'Cleaning all packages sources...'
1662 rm -rf $WOK/*/source
1663 status; newline ;;
1665 uncook)
1666 cd $WOK
1667 count=0
1668 title 'Checking for uncooked packages'
1670 for i in *; do
1671 unset HOST_ARCH EXTRAVERSION
1672 [ ! -e $i/receipt ] && continue
1673 . ./$i/receipt
1674 # Source cooked pkg receipt to get EXTRAVERSION
1675 if [ -d "$WOK/$i/taz" ]; then
1676 cd $WOK/$i/taz/$(ls $WOK/$i/taz/ | head -n1)
1677 . ./receipt; cd $WOK
1678 fi
1679 case "$ARCH" in
1680 i486)
1681 debug "$(_ 'Package "%s"' "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg")"
1682 if [ ! -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" ]; then
1683 count=$(($count + 1))
1684 colorize 34 "$i"
1685 fi ;;
1686 arm*)
1687 # Check only packages included in arch
1688 if echo "$HOST_ARCH" | egrep -q "$ARCH|any"; then
1689 # *.tazpkg
1690 if [ ! -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then
1691 count=$(($count + 1))
1692 colorize 34 "$i"
1693 fi
1694 fi ;;
1695 esac
1696 done
1698 if [ "$count" -gt 0 ]; then
1699 footer "$(_p '%s uncooked package' '%s uncooked packages' "$count" "$(colorize 31 "$count")")"
1700 else
1701 _ 'All packages are cooked :-)'
1702 newline
1703 fi
1704 ;;
1706 pkgdb)
1707 # Create suitable packages list for TazPkg and only for built packages
1708 # as well as flavors files for TazLiTo. We don't need logs since we do it
1709 # manually to ensure everything is fine before syncing the mirror.
1710 recreate_split_db
1711 recreate_maint_db
1712 @@PREFIX@@/libexec/cookutils/pkgdb "$2"
1713 ;;
1715 splitdb)
1716 # File split.db is useful for searching for split packages.
1717 recreate_split_db
1718 ;;
1720 maintdb)
1721 # File maint.db is useful for searching maintainer's packages.
1722 recreate_maint_db
1723 ;;
1725 *)
1726 # Just cook and generate a package.
1727 check_root
1728 time=$(date +%s)
1729 pkg="$1"
1730 [ -z "$pkg" ] && usage
1732 # Search last successful cook time in all logs from newer to older
1733 for i in '' $(seq 0 9 | sed 's|^|.|'); do
1734 [ -f "$LOGS/$pkg.log$i" ] || break
1735 lastcooktime=$(sed '/^Cook time/!d; s|.*: *\([0-9]*\)s.*|\1|' \
1736 $LOGS/$pkg.log$i 2>/dev/null | sed '$!d')
1737 [ -n "$lastcooktime" ] && break
1738 done
1740 receipt="$WOK/$pkg/receipt"
1741 check_pkg_in_wok
1742 newline
1744 unset inst
1745 unset_receipt
1746 . $receipt
1748 # Handle cross compilation.
1749 case "$ARCH" in
1750 arm*)
1751 if [ -z "$HOST_ARCH" ]; then
1752 _ 'cook: HOST_ARCH is not set in "%s" receipt' "$pkg"
1753 error="$(_ 'package "%s" is not included in %s' "$pkg" "$ARCH")"
1754 _ 'cook: %s' "$error"
1755 [ -n "$CROSS_BUGS" ] && _ 'bugs: %s' "$CROSS_BUGS"
1756 _ 'Cook skip: %s' "$error" | log
1757 newline
1758 broken; exit 1
1759 fi ;;
1760 esac
1762 # Some packages are not included in some arch or fail to cross compile.
1763 : ${HOST_ARCH=$ARCH}
1764 debug "$(_ 'Host arch %s' "$HOST_ARCH")"
1765 # Handle arm{v6hf,v7,..}
1766 if ! $(echo "$HOST_ARCH" | egrep -q "${ARCH%v[0-9]*}|any"); then
1767 _ 'cook: %s' "HOST_ARCH=$HOST_ARCH"
1768 error="$(_ "package \"%s\" doesn't cook or is not included in %s" "$pkg" "$ARCH")"
1769 _ 'cook: %s' "error"
1770 [ -n "$CROSS_BUGS" ] && _ 'bugs: %s' "$CROSS_BUGS"
1771 _ 'Cook skip: %s' "$error" | log
1772 sed -i "/^${pkg}$/d" $broken
1773 newline
1774 exit 0
1775 fi
1777 # Remove package from broken list before cooking
1778 sed -i "/^${pkg}$/d" $broken
1780 # Skip blocked, 3 lines also for the Cooker.
1781 grep -q "^$pkg$" $blocked && [ "$2" != '--unblock' ] &&
1782 die 'Package "%s" is blocked' "$pkg"
1784 try_aufs_chroot "$@"
1786 # Log and source receipt.
1787 echo "cook:$pkg" > $command
1789 [ -n "$lastcooktime" ] && echo "cook:$pkg $lastcooktime $(date +%s)" >> $cooktime
1791 while read cmd duration start; do
1792 [ $(($start + $duration)) -lt $(date +%s) ] &&
1793 echo "sed -i '/^$cmd $duration/d' $cooktime"
1794 done < $cooktime | sh
1796 # Display and log info if cook process stopped.
1797 # FIXME: gettext not working (in single quotes) here!
1798 trap '_ "\n\nCook stopped: control-C\n\n" | \
1799 tee -a $LOGS/$pkg.log' INT
1801 update_split_db
1803 # Handle --options
1804 case "$2" in
1805 --pack)
1806 _ 'Packing %s' "<a href='cooker.cgi?pkg=${pkg//+/%2B}'>$pkg</a>" | log
1807 [ -d "$WOK/$pkg/install" ] || die 'Need to build "%s"' "$pkg"
1808 [ ! -d "$WOK/$pkg/taz" ] || rm -rf "$WOK/$pkg/taz"
1809 [ ! -f "$LOGS/$pkg-pack.log" ] || rm -f $LOGS/$pkg-pack.log
1810 packall 2>&1 | tee -a $LOGS/$pkg-pack.log
1811 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1812 clean_log "$pkg-pack"
1813 time=$(($(date +%s) - $time))
1814 summary | sed 's|^Cook |Pack |' | tee -a $LOGS/$pkg-pack.log
1815 gen_rss
1816 put_status $pkg Done
1817 rm -f $command
1818 exit 0 ;;
1820 --trials|-t)
1821 trials='yes' ;;
1822 esac
1824 _ 'Making %s' "<a href='cooker.cgi?pkg=${pkg//+/%2B}'>$pkg</a>" | log
1826 # Rotate log
1827 for i in $(seq 9 -1 1); do
1828 j=$(($i - 1))
1829 [ -e $LOGS/$pkg.log.$j ] && mv -f $LOGS/$pkg.log.$j $LOGS/$pkg.log.$i
1830 done
1831 [ -e $LOGS/$pkg.log ] && mv $LOGS/$pkg.log $LOGS/$pkg.log.0
1833 # Check if wanted is built now so we have separate log files.
1834 for wanted in $WANTED ; do
1835 if grep -q "^$wanted$" $blocked; then
1836 broken
1837 rm -f $command
1838 die 'WANTED package "%s" is blocked' "$wanted"
1839 fi
1840 if grep -q "^$wanted$" $broken; then
1841 broken
1842 rm -f $command
1843 die 'WANTED package "%s" is broken' "$wanted"
1844 fi
1845 if [ ! -d "$WOK/$wanted/install" ]; then
1846 cook "$wanted" || { broken; exit 1; }
1847 fi
1848 done
1850 # Cook and pack or exit on error and log everything.
1851 ( ( ( (cookit $@ 2>&1; echo $? >&3) | loglimit 50 > $LOGS/$pkg.log) 3>&1) | (read rq; exit $rq) )
1852 rq=$? # the return code of `cookit $@` above command
1854 if [ $rq -eq 1 ]; then
1855 broken
1856 fi
1858 # Remove build dependencies both when `cookit` done or fail
1859 remove_deps | tee -a $LOGS/$pkg.log
1860 timestamp job27 # removing bdeps
1861 # cookit_quality
1862 timestamp job28 # checking quality
1864 # Log and stop if `cookit` fails
1865 if [ $rq -eq 1 ]; then
1866 debug_info "ret1" | tee -a $LOGS/$pkg.log
1867 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1868 put_status $pkg Failed
1869 rm -f $command
1870 broken
1871 exit 1
1872 fi
1874 # Proceed only if `cookit` return code is zero-OK
1875 # If instant-pack if specified, then packages already packed in the cookit()
1876 [ "${COOKOPTS/instant-pack/}" == "$COOKOPTS" ] &&
1877 packall 2>&1 | loglimit 5 >> $LOGS/$pkg.log
1878 timestamp job29 # packing
1880 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1882 clean_log
1884 # Exit if any error in packing.
1885 if [ "${COOKOPTS/skip-log-errors/}" == "$COOKOPTS" ] &&
1886 grep -Ev "(/root/.cvspass|conftest|df: /|rm: can't remove)" $LOGS/$pkg.log | \
1887 grep -Eq "(^ERROR|: No such file or directory|not remade because of errors|ake: \*\*\* .* Error)"; then
1888 debug_info "packerr" | tee -a $LOGS/$pkg.log
1889 put_status $pkg Failed
1890 rm -f $command
1891 broken; exit 1
1892 fi
1894 # Create an XML feed
1895 gen_rss
1897 # Time and summary
1898 time=$(($(date +%s) - $time))
1899 summary | tee -a $LOGS/$pkg.log
1900 newline
1902 # We may want to install/update (outside aufs jail!).
1903 [ -s /aufs-umount.sh ] || install_package
1905 put_status $pkg Done
1907 # Finally we DON'T WANT to build the *-dev or packages with WANTED="$pkg"
1908 # If you want automation, use the Cooker Build Bot.
1909 rm -f $command
1910 timestamp job30 # misc. final operations
1911 store_timestats
1913 sed -n '/^Build dependencies to remove:/,/^$/p' $LOGS/$pkg.log \
1914 | sed '/^Build/d; s|Removing: ||' \
1915 | tr ' ' '\n' \
1916 | sed '/^$/d' \
1917 > $WOK/$pkg/.bdeps
1919 ;;
1920 esac
1922 exit 0