cookutils view cook @ rev 1114

lighttpd/index.cgi: [downloads]: fix display when package listed is packages*.info but absent
modules/pack: fix "false negative" when RSUM is absent in the receipt inside package
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Dec 09 23:24:05 2018 +0200 (2018-12-09)
parents 461c3da71257
children 77272271e283
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 fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}')
365 arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch)
366 pkgname="$i-$version-$arch.tazpkg"
367 size=$(ls -lh $PKGS/$pkgname | awk '{print $5}')
368 files=$(wc -l < $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION/files.list)
369 printf "%2d : %7s : %10s : %5s : %s\n" "$pkgi" "$fs" "$size" "$files" "$pkgname"
370 pkgi=$((pkgi + 1))
371 done
372 separator
373 }
376 # Display debugging error info.
378 debug_info() {
379 title 'Debug information %s.' "$1"
380 # L10n: specify your format of date and time (to help: man date)
381 # L10n: not bad one is '+%x %R'
382 _ 'Cook date: %s' "$(date "$(_ '+%%F %%R')")"
383 if [ -n "$time" ]; then
384 times="$(($(date +%s) - $time))"
385 _ 'Wasted time : %s' "$(disp_time "$times")"
386 fi
387 for error in \
388 ERROR 'No package' "cp: can't" "can't open" "can't cd" \
389 'error:' 'fatal error:' 'undefined reference to' \
390 'Unable to connect to' 'link: cannot find the library' \
391 'CMake Error' ': No such file or directory' \
392 'Could not read symbols: File in wrong format'
393 do
394 # format "line number:line content"
395 fgrep -n "$error" $LOGS/$pkg.log
396 done > $LOGS/$pkg.log.debug_info 2>&1
397 # sort by line number, remove duplicates
398 sort -gk1,1 -t: -u $LOGS/$pkg.log.debug_info
399 rm -f $LOGS/$pkg.log.debug_info
400 footer
401 }
404 # A bit smarter function than the classic `cp` command
406 scopy() {
407 if [ "$(stat -c %h -- "$1")" -eq 1 ]; then
408 cp -a "$1" "$2" # copy generic files
409 else
410 cp -al "$1" "$2" # copy hardlinks
411 fi
412 }
415 # Copy all generic files (locale, pixmaps, .desktop) from $install to $fs.
416 # We use standard paths, so some packages need to copy these files with the
417 # receipt and genpkg_rules.
418 # This function executes inside the packaging process, before compressor call.
420 copy_generic_files() {
421 # Proceed only for "main" package (for v2), and for any packages (v1)
422 [ "$pkg" == "$PACKAGE" ] || return 0
424 # $LOCALE is set in cook.conf
425 if [ -n "$LOCALE" -a -z "$WANTED" ]; then
426 if [ -d "$install/usr/share/locale" ]; then
427 mkdir -p "$fs/usr/share/locale"
428 for i in $LOCALE; do
429 if [ -d "$install/usr/share/locale/$i" ]; then
430 cp -r $install/usr/share/locale/$i $fs/usr/share/locale
431 fi
432 done
433 fi
434 fi
436 # Generic pixmaps copy can be disabled with COOKOPTS="!pixmaps" (or GENERIC_PIXMAPS="no")
437 if [ "${COOKOPTS/!pixmaps/}" == "$COOKOPTS" -a "$GENERIC_PIXMAPS" != 'no' ]; then
438 if [ -d "$install/usr/share/pixmaps" ]; then
439 mkdir -p "$fs/usr/share/pixmaps"
440 for i in png xpm; do
441 [ -f "$install/usr/share/pixmaps/$PACKAGE.$i" -a ! -f "$fs/usr/share/pixmaps/$PACKAGE.$i" ] &&
442 cp -r $install/usr/share/pixmaps/$PACKAGE.$i $fs/usr/share/pixmaps
443 done
444 fi
445 fi
447 # Desktop entry (.desktop).
448 # Generic desktop entry copy can be disabled with COOKOPTS="!menus" (or GENERIC_MENUS="no")
449 if [ "${COOKOPTS/!menus/}" == "$COOKOPTS" -a "$GENERIC_MENUS" != 'no' ]; then
450 if [ -d "$install/usr/share/applications" -a -z "$WANTED" ]; then
451 mkdir -p "$fs/usr/share"
452 cp -r $install/usr/share/applications $fs/usr/share
453 fi
454 fi
455 }
458 # Copy pixmaps, desktop files and licenses from $stuff to $install.
459 # This function executes after the main compile_rules() is done.
461 copy_generic_stuff() {
462 # Custom or homemade PNG pixmap can be in stuff.
463 if [ -f "$stuff/$PACKAGE.png" ]; then
464 mkdir -p $install/usr/share/pixmaps
465 cp $stuff/$PACKAGE.png $install/usr/share/pixmaps
466 fi
468 # Homemade desktop file(s) can be in stuff.
469 if [ -d "$stuff/applications" ]; then
470 mkdir -p $install/usr/share
471 cp -r $stuff/applications $install/usr/share
472 fi
473 if [ -f "$stuff/$PACKAGE.desktop" ]; then
474 mkdir -p $install/usr/share/applications
475 cp $stuff/$PACKAGE.desktop $install/usr/share/applications
476 fi
478 # Add custom licenses
479 if [ -d "$stuff/licenses" ]; then
480 mkdir -p $install/usr/share/licenses
481 cp -r $stuff/licenses $install/usr/share/licenses/$PACKAGE
482 fi
483 }
486 # Update installed.cook.diff
488 update_installed_cook_diff() {
489 # If a cook failed deps are removed.
490 cd $root$INSTALLED; ls -1 > $CACHE/installed.cook
491 cd $CACHE
492 [ "$1" == 'force' -o ! -s '/tmp/installed.cook.diff' ] && \
493 busybox diff installed.list installed.cook > /tmp/installed.cook.diff
494 deps=$(grep ^+[a-zA-Z0-9] /tmp/installed.cook.diff | wc -l)
495 }
498 # Remove installed deps.
500 remove_deps() {
501 # Now remove installed build deps.
502 diff='/tmp/installed.cook.diff'
503 [ -s "$diff" ] || return
505 deps=$(grep ^+[a-zA-Z0-9] $diff | sed 's|^+||')
506 nb=$(grep ^+[a-zA-Z0-9] $diff | wc -l)
507 newline
508 _n 'Build dependencies to remove:'; echo " $nb"
509 [ -n "$root" ] && echo "root=\"$root\""
511 _n 'Removing:'
512 for dep in $deps; do
513 echo -n " $dep"
514 # Do not waste time uninstalling the packages if we are inside
515 # aufs chroot - unmounting chroot will "uninstall" all packages.
516 [ -s /aufs-umount.sh ] ||
517 echo 'y' | tazpkg remove $dep --root=$root >/dev/null
518 done
520 newline; newline
521 # Keep the last diff for debug and info.
522 mv -f $diff $CACHE/installed.diff
523 }
526 # Automatically patch the sources.
528 patchit() {
529 [ -f "$stuff/patches/series" ] || return
531 local done="$pkgdir/.patch.done"
532 IFS=$'\n'
533 while read i; do
534 patchname=$(echo ${i%%#*} | cut -d' ' -f1) # allow comments (anything after the # or space)
535 case $patchname in # allow patch options in form <options_no_spaces>|<file_name>
536 *\|*) patchopts="${patchname%|*}"; patchname="${patchname#*|}";;
537 *) patchopts='-Np1';;
538 esac
539 [ -n "$patchname" ] || continue # allow empty lines
540 touch $done
541 grep -q "^${patchname}$" $done && continue # already applied (useful with `cook --continue`)
542 newline
543 _ 'Applying patch %s' "$patchname"
544 patch $patchopts -i $stuff/patches/$patchname | sed 's|^| |'
545 echo $patchname >> $done
546 done < $stuff/patches/series
547 newline
548 unset IFS
549 }
552 # Check source tarball integrity.
554 check_integrity() {
555 for i in sha1 sha3 sha256 sha512 md5; do
556 I=$(echo $i | tr 'a-z' 'A-Z')
557 eval sum=\$TARBALL_$I
558 if [ -n "$sum" ]; then
559 newline
560 _ 'Checking %ssum of source tarball...' "$i"
561 echo "$sum $SRC/$TARBALL" | ${i}sum -c || exit 1
562 fi
563 done
564 newline
565 }
568 # Misc fix functions
570 fix() {
571 case $1 in
572 # https://bugzilla.gnome.org/show_bug.cgi?id=655517
573 # https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed
574 ld)
575 export LDFLAGS="$LDFLAGS -Wl,-Os,--as-needed"
576 ;;
577 libtool)
578 if [ -e 'libtool' ]; then
579 sed -i 's| -shared | -Wl,-Os,--as-needed\0|g' libtool
580 echo "fix.libtool" >> $pkgdir/.patch.done
581 else
582 echo "fix libtool: warning: libtool absent, nothing to fix."
583 fi
584 ;;
585 math)
586 # fix C++ math issue introduced in Glibc 2.26:
587 # error: '__builtin_isnan' is not a member of 'std'
588 # if (std::isnan(N)) {
589 # ^
590 find $src -type f -exec sed -i '
591 s|std::signbit|__builtin_signbit|g;
592 s|std::isnan|__builtin_isnan|g;
593 s|std::isinf|__builtin_isinf_sign|g;
594 s|std::isfinite|__builtin_isfinite|g;
595 s|std::isnormal|__builtin_isnormal|g
596 ' '{}' \;
597 ;;
598 symlinks)
599 # make absolute symlinks relative
600 echo "fix symlinks"
601 local ifs="$IFS" link target
602 IFS=$'\n'
603 # step 1: fast job, prefix all the absolute symlinks with "$install"
604 for link in $(find $install -type l); do
605 target="$(readlink $link)"
606 case "$target" in
607 /*) ln -sfv "$install$target" "$link";;
608 esac
609 done
610 IFS="$ifs"
611 # step 2: fine tuning, make symlinks relative
612 tazpkg -gi --quiet --local --cookmode symlinks
613 symlinks -cr $install
614 ;;
615 gem)
616 # some useful operations while Ruby gems cooking
617 _gems="$(ruby -e'puts Gem.default_dir')"
619 # remove unwanted empty folders
620 rmdir --ignore-fail-on-non-empty \
621 $install/$_gems/build_info/ \
622 $install/$_gems/cache/ \
623 $install/$_gems/doc/ \
624 $install/$_gems/extensions/
626 # move files to docdir
627 docdir=$install/usr/share/doc/$PACKAGE-$VERSION
628 for i in $(ls -ap $install/$_gems/gems/${PACKAGE#*-}-$VERSION/ | sed '
629 /\/$/d; /^\./d; /gemspec$/d; /Rakefile*/d; /Gemfile*/d; /Makefile/d;
630 /\.c$/d; /\.h$/d; /\.o$/d; /\.rb$/d; /\.so$/d; /\.yml$/d;
631 /Manifest/d; /\.inc$/d; /depend/d;
632 '); do
633 mkdir -p $docdir # docdir will not be created when nothing to move
634 mv $install/$_gems/gems/${PACKAGE#*-}-$VERSION/$i $docdir
635 done
636 if [ -d $install/$_gems/gems/${PACKAGE#*-}-$VERSION/doc/ ]; then
637 mkdir -p $docdir
638 mv $install/$_gems/gems/${PACKAGE#*-}-$VERSION/doc/ $docdir
639 fi
641 if [ -d $docdir ]; then
642 # move man pages
643 unset man_to_copy
644 for i in $(seq 1 8); do
645 for j in $(find $docdir -type f -name "*.$i" | sed '/LGPL-2\.1/d'); do
646 man_to_copy="$man_to_copy $j"
647 done
648 done
649 if [ -n "$man_to_copy" ]; then
650 cook_pick_manpages $man_to_copy
651 rm $man_to_copy
652 fi
654 # convert rdoc to markdown (thanks https://gist.github.com/teeparham/8a99e308884e1c32735a)
655 for i in $(find $docdir -type f -name '*.rdoc'); do
656 fix utf-8
657 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
658 done
659 fi
661 # move man pages (from the different place)
662 rubyman=$install/$_gems/gems/${PACKAGE#*-}-$VERSION/man
663 if [ -d $rubyman ]; then
664 unset man_to_copy
665 for i in $(seq 1 8); do
666 for j in $(find $rubyman -type f -name "*.$i" | sed '/LGPL-2\.1/d'); do
667 man_to_copy="$man_to_copy $j"
668 done
669 done
670 if [ -n "$man_to_copy" ]; then
671 cook_pick_manpages $man_to_copy
672 fi
673 rm -r $rubyman
674 fi
675 ;;
676 utf-8)
677 # Install UTF-8 locale
678 tazpkg -gi --quiet --local --cookmode locale-en-base
679 mkdir -p /usr/lib/locale
680 localedef -i 'en_US' -c -f 'UTF-8' /usr/lib/locale/en_US.UTF-8
681 ;;
682 esac
683 }
686 # Store timestamps, log jobs length
688 timestamp() {
689 local ts_file="$WOK/$pkg/.ts"
690 local curr_ts=$(date '+%s')
691 case $1 in
692 init)
693 rm $ts_file 2>/dev/null
694 echo $curr_ts > $prev_ts
695 ;;
696 job*)
697 # calculate time from the last timestamp
698 echo "$1='$(( $curr_ts - $(cat $prev_ts) ))'" >> $ts_file
699 echo $curr_ts > $prev_ts
700 ;;
701 sets)
702 echo "sets='$2'" >> $ts_file
703 ;;
704 esac
705 }
708 # Store time statsistics to the cache
710 store_timestats() {
711 # see doc/timestats.txt for file format
712 temp=$(mktemp)
713 {
714 for i in $(seq 1 30); do echo "job$i=0"; done
715 cat $WOK/$pkg/.ts
716 echo -n 'total=$(( 0'
717 for i in $(seq 1 30); do echo -n " + job$i"; done
718 echo ' ))'
719 } > $temp
720 . $temp
721 {
722 echo -n "$pkg $sets "
723 for i in $(seq 1 30); do echo -n "$((job$i)) "; done
724 echo "$total"
725 } >> /home/slitaz/cache/timestats
726 rm $temp $WOK/$pkg/.ts # clean
727 }
730 # Internal function to cook specified SET
732 cook_set() {
733 # Switch to the specified source set
734 set_paths
735 local suffix=''
736 [ -n "$SET" ] && suffix="-$SET"
737 export src="$WOK/$pkg/source/$PACKAGE-$VERSION$suffix"
738 export install="$WOK/$pkg/install$suffix"
739 export DESTDIR="$install"
741 if [ -n "$SETS" ]; then
742 if [ -n "$SET" ]; then
743 title "Switching to the set '$SET'"
744 else
745 title "Switching to the default set"
746 fi
747 echo "src : $src"
748 echo "install: $install"
749 fi
750 [ -d "$src" ] && cd $src # packages without sources exists
751 echo
753 [ -d "$install" ] && rm -r $install
754 #mkdir -p $install
756 compile_rules $@ || { broken; exit 1; }
758 # Stay compatible with _pkg
759 [ -d "$src/_pkg" ] && mv $src/_pkg $install
761 copy_generic_stuff
763 timestamp job$job_counter # compiling (set '$SET')
765 # Actions to do after compiling the package
766 # Skip all for split packages (already done in main package)
767 if [ -z "$WANTED" ]; then
768 footer
769 export COOKOPTS ARCH install
770 @@PREFIX@@/libexec/cookutils/compressor install
771 timestamp job$(($job_counter + 1)) # compressing (set '$SET')
772 fi
774 # Activate "instant-pack" mode
775 if [ "${COOKOPTS/instant-pack/}" != "$COOKOPTS" ]; then
776 echo " $SPLIT " | fgrep -q " $PACKAGE " || SPLIT="$PACKAGE $SPLIT"
777 export PACKAGE
778 # determine the list of the packages belongs to the current SET...
779 echo -n $SPLIT \
780 | awk -vset="$SET" '
781 BEGIN { RS = " "; FS = ":"; }
782 { if ($2 == set) print $1; }' \
783 | xargs -n1 @@PREFIX@@/libexec/cookutils/pack # ... and then pack them
784 fi
786 job_counter=$(($job_counter + 2))
787 }
790 # The main cook function.
792 cookit() {
793 if [ -n "$SETUP_MD5" -a "$SETUP_MD5" != "$(ls $root$INSTALLED | md5sum | cut -c1-32)" ]; then
794 _ 'ERROR: Broken setup. Abort.'
795 return
796 fi
798 title 'Cook: %s' "$PACKAGE $VERSION"
799 set_paths
800 timestamp init # the very start
802 # Handle cross-tools.
803 [ "$BUILD_SYSTEM" != "$HOST_SYSTEM" ] &&
804 case "$ARCH" in
805 arm*|x86_64)
806 # CROSS_COMPILE is used by at least Busybox and the kernel to set
807 # the cross-tools prefix. Sysroot is the root of our target arch
808 sysroot="$CROSS_TREE/sysroot"
809 tools="$CROSS_TREE/tools"
810 # Set root path when cross compiling. ARM tested but not x86_64
811 # When cross compiling we must install build deps in $sysroot.
812 arch="-$ARCH"
813 root="$sysroot"
814 _ '%s sysroot: %s' "$ARCH" "$sysroot"
815 _ 'Adding "%s" to PATH' "$tools/bin"
816 export PATH="$PATH:$tools/bin"
817 export PKG_CONFIG_PATH="$sysroot/usr/lib/pkgconfig"
818 export CROSS_COMPILE="$HOST_SYSTEM-"
819 _ 'Using cross-tools: %s' "$CROSS_COMPILE"
820 if [ "$ARCH" == 'x86_64' ]; then
821 export CC="$HOST_SYSTEM-gcc -m64"
822 export CXX="$HOST_SYSTEM-g++ -m64"
823 else
824 export CC="$HOST_SYSTEM-gcc"
825 export CXX="$HOST_SYSTEM-g++"
826 fi
827 export AR="$HOST_SYSTEM-ar"
828 export AS="$HOST_SYSTEM-as"
829 export RANLIB="$HOST_SYSTEM-ranlib"
830 export LD="$HOST_SYSTEM-ld"
831 export STRIP="$HOST_SYSTEM-strip"
832 export LIBTOOL="$HOST_SYSTEM-libtool"
833 ;;
834 esac
836 @@PREFIX@@/libexec/cookutils/precheck $receipt || exit 1 # former receipt_quality()
838 cd $pkgdir
839 if [ -z "$continue" ]; then
840 rm -rf source 2>/dev/null
841 rm .patch.done 2>/dev/null
842 fi
843 rm -rf install taz 2>/dev/null
845 # Disable -pipe if less than 512 MB free RAM.
846 free=$(awk '/^MemFree|^Buffers|^Cached/{s+=$2}END{print int(s/1024)}' /proc/meminfo)
847 if [ "$free" -lt 512 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then
848 _ 'Disabling -pipe compile flag: %d MB RAM free' "$free"
849 CFLAGS="${CFLAGS/-pipe}"; CFLAGS=$(echo "$CFLAGS" | tr -s ' ')
850 CXXFLAGS="${CXXFLAGS/-pipe}"; CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ')
851 fi
852 unset free
854 # Export flags and path to be used by make and receipt.
855 DESTDIR="$pkgdir/install"
856 # FIXME: L10n: Is this the right time for 'LC_ALL=C LANG=C'?
857 export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C \
858 LDFLAGS
860 timestamp job1 # pre-checks
862 # BUILD_DEPENDS may vary depending on the ARCH
863 case "$ARCH" in
864 arm*) [ -n "$BUILD_DEPENDS_arm" ] && BUILD_DEPENDS=$BUILD_DEPENDS_arm ;;
865 x86_64) [ -n "$BUILD_DEPENDS_x86_64" ] && BUILD_DEPENDS=$BUILD_DEPENDS_x86_64 ;;
866 esac
868 # Check for build deps and handle implicit depends of *-dev packages
869 # (ex: libusb-dev :: libusb).
870 [ -n "$BUILD_DEPENDS" ] && _ 'Checking build dependencies...'
871 [ -n "$root" ] && _ 'Using packages DB: %s' "$root$DB"
873 # Get the list of installed packages
874 cd $root$INSTALLED; ls > $CACHE/installed.list
876 for action in check install; do
877 for dep in $BUILD_DEPENDS; do
878 implicit="${dep%-dev}"; [ "$implicit" == "$dep" ] && implicit=''
879 for i in $dep $implicit; do
880 # Skip if package already installed
881 [ -f "$root$INSTALLED/$i/receipt" ] && continue
883 case $action in
884 check)
885 # Search for local package or local provided-package
886 name=$(awk -F$'\t' -vpkg="$i" '{
887 if (index(" " $1 " " $10 " ", " " pkg " ")) {print $1; exit}
888 }' "$PKGS/packages-$ARCH.info")
889 if [ -z "$name" ]; then
890 # Search for package in mirror
891 name="$(awk -F$'\t' -vi="$i" '$1==i{print $1; exit}' "$root$DB/packages.info")"
892 [ -z "$name" -a "$i" == "$dep" ] && die 'ERROR: unknown dep "%s"' "$i"
893 fi
894 ;;
895 install)
896 tazpkg get-install $i --root=$root --local --quiet --cookmode || { broken; exit 1; }
897 ;;
898 esac
899 done
900 done
901 done
903 update_installed_cook_diff
905 timestamp job2 # installing bdeps
907 # Get source tarball and make sure we have source dir named:
908 # $PACKAGE-$VERSION to be standard in receipts. Here we use tar.lzma
909 # tarball if it exists.
910 if [ -n "$WGET_URL" -a ! -f "$SRC/$TARBALL" ]; then
911 if [ -f "$SRC/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ]; then
912 TARBALL="${SOURCE:-$PACKAGE}-$VERSION.tar.lzma"
913 LZMA_SRC=''
914 else
915 get_source || { broken; exit 1; }
916 fi
917 fi
918 if [ -z "$WANTED" -a -n "$TARBALL" -a ! -d "$src" ]; then
919 mkdir -p $pkgdir/source/tmp; cd $pkgdir/source/tmp
920 if ! extract_source ; then
921 get_source
922 extract_source || { broken; exit 1; }
923 fi
924 if [ -n "$LZMA_SRC" ]; then
925 cd $pkgdir/source
926 if [ "$(ls -A tmp | wc -l)" -gl 1 -o -f "$(echo tmp/*)" ]; then
927 mv tmp tmp-1; mkdir tmp
928 mv tmp-1 tmp/${SOURCE:-$PACKAGE}-$VERSION
929 fi
930 if [ -d "tmp/${SOURCE:-$PACKAGE}-$VERSION" ]; then
931 cd tmp; tar -c * | lzma e $SRC/$TARBALL -si
932 fi
933 fi
935 cd $pkgdir/source/tmp
936 # Some archives are not well done and don't extract to one dir (ex lzma).
937 files=$(ls | wc -l)
938 [ "$files" -eq 1 -a -d "$(ls)" ] &&
939 mv * ../$PACKAGE-$VERSION
940 [ "$files" -eq 1 -a -f "$(ls)" ] &&
941 mkdir -p ../$PACKAGE-$VERSION &&
942 mv * ../$PACKAGE-$VERSION/$TARBALL
943 [ "$files" -gt 1 ] &&
944 mkdir -p ../$PACKAGE-$VERSION &&
945 mv * ../$PACKAGE-$VERSION
946 cd ..; rm -rf tmp
947 fi
949 # Check md5sum (or similar) for sources tarball
950 check_integrity
952 # Libtool shared libs path hack.
953 case "$ARCH" in
954 arm*) cross libhack ;;
955 esac
957 timestamp job3 # get/unpack src tarball
959 # Compiling all the sets
960 if grep -q ^compile_rules $receipt; then
961 _ 'Executing: %s' 'compile_rules'
962 echo "CFLAGS : $CFLAGS"
963 echo "CXXLAGS : $CXXFLAGS"
964 echo "CPPFLAGS : $CPPFLAGS"
965 echo "LDFLAGS : $LDFLAGS"
966 [ -d "$src" ] && cd $src
967 patchit
969 timestamp job4 # patching
971 # Get set names from $SPLIT variable, format ex. 'pkg1 pkg2:set1 pkg3:set2'
972 # Keep natural order of the sets, don't sort them alphabetically
973 SETS=$(echo -n $SPLIT \
974 | awk '
975 BEGIN { RS = " "; FS = ":"; }
976 {
977 if ($2 && ! set[$2]) { printf("%s ", $2); set[$2] = "1"; }
978 }' \
979 | sed 's| $||')
980 # Prepare specified source sets using patched sources
981 [ -n "$SETS" -a -d "$src" ] &&
982 for set in $SETS; do
983 echo "Preparing set $set" # debug
984 cp -a $src $src-$set
985 done
987 timestamp job5 # preparing sets
988 timestamp sets "$SETS"
990 job_counter='6'
992 SET='' cook_set # first run for empty SET
994 # Allow to change SETS after the first run, follow the changes
995 SETS=$(. $receipt; echo -n $SPLIT \
996 | awk '
997 BEGIN { RS = " "; FS = ":"; }
998 {
999 if ($2 && ! set[$2]) { printf("%s ", $2); set[$2] = "1"; }
1000 }' \
1001 | sed 's| $||')
1002 for SET in $SETS; do
1003 cook_set
1004 done
1005 else
1006 mkdir -p $install # allow receipts without `compile_rules()`
1007 fi
1008 footer
1010 timestamp job # reset counter
1012 # Execute testsuite.
1013 if grep -q ^testsuite $receipt; then
1014 title 'Running testsuite'
1015 testsuite $@ || { broken; exit 1; }
1016 footer
1017 fi
1019 timestamp job26 # test suite
1021 update_installed_cook_diff force
1025 # Cook quality assurance.
1027 cookit_quality() {
1028 while true; do
1029 [ ! -d "$WOK/$pkg/install" -a -z "$WANTED" ] || break
1030 _ 'ERROR: cook failed' | tee -a $LOGS/$pkg.log
1031 [ "$trials" == 'yes' ] || break
1032 title "Interactive mode"
1033 # TODO: allow commands:
1034 # q - quit; v - edit receipt here using vi;
1035 # s - search for package containing package;
1036 # <package name> - install package; [Enter] - retry
1037 _ 'You may install the packages here and/or edit the receipt there.'
1038 newline
1039 while true; do
1040 _n 'Install the package? [name/N] '; read answer
1041 [ -n "$answer" ] || break
1042 tazpkg -gi $answer --root=$root --local --quiet --cookmode
1043 done
1044 newline
1045 _n 'Try again? [Y/n] '; read answer
1046 [ "$answer" == 'n' ] && break
1047 # here you may append log if you want (">>" instead of last ">")
1048 cookit $@ 2>&1 | loglimit 50 > $LOGS/$pkg.log
1049 done
1051 [ "${COOKOPTS/skip-log-errors/}" != "$COOKOPTS" ] && return 0
1053 # ERROR can be echoed any time in cookit()
1054 if grep -Ev "(conftest|configtest)" $LOGS/$pkg.log | \
1055 grep -Eq "(^ERROR|undefined reference to)" ; then
1056 debug_info "cookit_quality" | tee -a $LOGS/$pkg.log
1057 put_status $pkg Failed
1058 # rm -f $command
1059 # broken; exit 1
1060 fi
1064 # Return all the names of packages bundled in this receipt
1066 all_names() {
1067 # Get package names from $SPLIT variable
1068 local split=$(echo -n $SPLIT \
1069 | awk '
1070 BEGIN { RS = " "; FS = ":"; }
1071 { print $1; }' \
1072 | tr '\n' ' ')
1073 local split_space=" $split "
1074 if ! head -n1 $WOK/$pkg/receipt | fgrep -q 'v2'; then
1075 # For receipts v1: $SPLIT may present in the $WANTED package,
1076 # but split packages have their own receipts
1077 echo $PACKAGE
1078 elif [ "${split_space/ $PACKAGE /}" != "$split_space" ]; then
1079 # $PACKAGE included somewhere in $SPLIT (probably in the end).
1080 # We should build packages in the order defined in the $SPLIT.
1081 echo $split
1082 else
1083 # We'll build the $PACKAGE, then all defined in the $SPLIT.
1084 echo $PACKAGE $split
1085 fi
1089 # v2: pack all packages using compiled files
1091 packall() {
1092 set_paths
1093 [ -e $pkgdir/.arch ] && rm $pkgdir/.arch
1095 if head -n1 "$pkgdir/receipt" | fgrep -q 'v2'; then
1096 for i in $(all_names); do
1097 unset TAGS DEPENDS CAT CONFIG_FILES PROVIDE SUGGESTED DATABASE_FILES TAZPANEL_DAEMON
1098 export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $i
1099 done
1100 else
1101 export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $PACKAGE
1102 fi
1106 # Reverse "cat" command: prints input lines in the reverse order
1108 tac() {
1109 sed '1!G;h;$!d' $1
1113 # Install package: update the chroot with freshly rebuilt package: keep env up-to-date.
1115 install_package() {
1116 set_paths
1117 case "$ARCH" in
1118 arm*) root="$CROSS_TREE/sysroot";;
1119 esac
1121 # Process all the package names built by this receipt (defined in $SPLIT)
1122 for i in $(PACKAGE="$pkg" all_names); do
1123 if [ -d "$root$INSTALLED/$i" ]; then
1124 pkg_file=$(awk -F$'\t' -vpkg="$i" -varch="$ARCH" '{
1125 if ($1 == pkg) {
1126 pkgarch = ($11 == "0") ? "any" : arch;
1127 printf("%s-%s-%s.tazpkg", $1, $2, pkgarch);
1128 exit
1130 }' $PKGS/packages-$ARCH.info)
1131 if [ -e "$PKGS/$pkg_file" ]; then
1132 _ 'Updating %s chroot environment...' "$ARCH"
1133 _ 'Updating chroot: %s' "${pkg_file%.tazpkg}" | log
1134 tazpkg -i "$PKGS/$pkg_file" --forced --root=$root
1135 fi
1136 fi
1137 done
1141 # remove chroot jail
1143 umount_aufs() {
1144 tac ${1}rw/aufs-umount.sh | sh
1145 rm -rf ${1}rw
1146 umount ${1}root
1147 rmdir ${1}r*
1151 # Launch the cook command into a chroot jail protected by aufs.
1152 # The current filesystems are used read-only and updates are
1153 # stored in a separate branch.
1155 try_aufs_chroot() {
1157 base="/dev/shm/aufsmnt$$"
1159 # Can we setup the chroot? Is it already done?
1160 grep -q ^AUFS_NOT_SUPPORTED $receipt && return
1161 grep -q ^AUFS_NOT_RAMFS $receipt && base="/mnt/aufsmnt$$"
1162 [ -n "$AUFS_MOUNTS" -a ! -f /aufs-umount.sh ] || return
1163 grep -q ^aufs /proc/modules || modprobe aufs 2>/dev/null || return
1164 mkdir ${base}root ${base}rw || return
1166 _ 'Setup aufs chroot...'
1168 # Sanity check
1169 for i in / /proc /sys /dev /dev/shm /home; do
1170 case " $AUFS_MOUNTS " in
1171 *\ $i\ *) ;;
1172 *) AUFS_MOUNTS="$AUFS_MOUNTS $i" ;;
1173 esac
1174 done
1175 for mnt in $(ls -d $AUFS_MOUNTS | sort | uniq); do
1176 mkdir -p ${base}root$mnt # for `mount -o bind`
1177 mount -o bind $mnt ${base}root$mnt # use `-o bind` instead of `--bind`
1178 if [ $mnt == / ] && ! mount -t aufs -o br=${base}rw:/ none ${base}root; then
1179 _ 'Aufs mount failure'
1180 umount ${base}root
1181 rm -rf ${base}r*
1182 return
1183 fi
1184 echo "umount ${base}root$mnt" >> ${base}rw/aufs-umount.sh
1185 done
1186 trap "umount_aufs ${base}" INT
1188 chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@"
1189 status=$?
1191 _ 'Leaving aufs chroot...'
1192 umount_aufs $base
1193 # Install package outside the aufs jail
1194 install_package
1195 exit $status
1199 # Encode predefined XML entities
1201 xml_ent() {
1202 sed -e 's|&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|"|\&quot;|g' -e "s|'|\&apos;|g"
1206 # Create a XML feed for freshly built packages.
1208 gen_rss() {
1209 if [ -e "$WOK/$PACKAGE/.icon.png" ]; then
1210 icon="$COOKER_URL$PACKAGE/browse/.icon.png"
1211 else
1212 icon="http://cook.slitaz.org/tazpkg.png"
1213 fi
1215 cat > $FEEDS/$pkg.xml <<EOT
1216 <item>
1217 <title>$PACKAGE $VERSION$EXTRAVERSION</title>
1218 <link>$COOKER_URL${PACKAGE//+/%2B}</link>
1219 <guid isPermaLink="false">$PACKAGE-$VERSION$EXTRAVERSION</guid>
1220 <pubDate>$(date '+%a, %d %b %Y %X GMT')</pubDate>
1221 <description><![CDATA[
1222 <table>
1223 <tr>
1224 <td vertical-align="top"><img src="$icon" alt=""/></td>
1225 <td>$(echo -n "$SHORT_DESC" | xml_ent)</td>
1226 </tr>
1227 </table>
1228 ]]></description>
1229 </item>
1230 EOT
1234 # Truncate stdout log file to $1 Mb.
1236 loglimit() {
1237 if [ -n "$DEFAULT_LOG_LIMIT" ]; then
1238 tee /dev/stderr | head -qc ${1:-$DEFAULT_LOG_LIMIT}m
1239 else
1240 tee /dev/stderr
1241 fi
1246 # Receipt functions to ease packaging
1249 get_dev_files() {
1250 action 'Getting standard devel files...'
1251 mkdir -p $fs/usr/lib
1252 cp -a $install/usr/lib/pkgconfig $fs/usr/lib
1253 cp -a $install/usr/lib/*a $fs/usr/lib
1254 cp -a $install/usr/include $fs/usr
1255 status
1259 # Function to use in compile_rules() to copy man page from $src to $install
1261 cook_pick_manpages() {
1262 local name section
1263 action 'Copying man pages...'
1265 for i in $@; do
1266 name=$(echo $i | sed 's|\.[gbx]z2*$||')
1267 section=${name##*/}; section=${section##*.}
1268 mkdir -p $install/usr/share/man/man$section
1269 scopy $i $install/usr/share/man/man$section
1270 done
1271 status
1275 # Function to use in compile_rules() to copy documentation from $src to $install
1277 cook_pick_docs() {
1278 local docdir="$install/usr/share/doc/$PACKAGE-$VERSION"
1279 action 'Copying documentation...'
1280 mkdir -p $docdir
1281 cp -r $@ $docdir
1282 chmod -R a+r $docdir
1283 status
1287 # Update split.db once for receipt
1289 update_split_db() {
1290 local db="$cache/split.db"
1291 touch $db
1292 sed -i "/^$pkg\t/d" $db
1293 echo -e "$pkg\t$(all_names)" >> $db
1297 # Recreate whole split.db from scratch
1299 recreate_split_db() {
1300 # Clean
1301 local db="$cache/split.db"
1303 cd $WOK
1304 for pkg in *; do
1305 [ -f "$WOK/$pkg/receipt" ] || continue
1306 unset PACKAGE SPLIT
1307 . $WOK/$pkg/receipt
1308 echo -e "$PACKAGE\t$(all_names)"
1309 done > $db
1313 # Recreate whole maint.db from scratch
1315 recreate_maint_db() {
1316 # Clean
1317 local db="$cache/maint.db"
1319 cd $WOK
1320 for pkg in *; do
1321 [ -f "$WOK/$pkg/receipt" ] || continue
1322 unset PACKAGE MAINTAINER
1323 . $WOK/$pkg/receipt
1324 MAINTAINER=$(echo $MAINTAINER | sed 's|.*<||; s|>.*||')
1325 echo -e "$MAINTAINER\t$PACKAGE"
1326 done | sort > $db
1330 # Put the status to the activity log
1332 put_status() {
1333 # $1: package, $2: status, one of 'Done', 'Failed'
1334 sed -i "s|>$1</a>$|& [ $2 ]|" $activity
1335 if [ "$2" == 'Done' ]; then
1336 # overstrike all previous 'Failed' to indicate package is OK now
1337 sed -i "/>$1<\/a>/ s|\[ Failed \]|[ -Failed ]|" $activity
1338 fi
1345 # Commands
1348 # cook <package> --deps
1349 [ -n "$deps" ] && {
1350 @@PREFIX@@/libexec/cookutils/deps $1
1351 exit 0
1354 # cook <package> --clean
1355 # cook <package> -c
1356 [ -n "$clean" -o "$2" == '-c' ] && {
1357 action 'Cleaning "%s"' "$1"
1358 cd $WOK/$1; rm -rf install taz source
1359 status; newline
1360 touch $activity # update $activity -> something changed -> update webstat
1361 exit 0
1364 # cook <package> --getsrc
1365 # cook <package> -gs
1366 [ -n "$getsrc" -o "$2" == '-gs' ] && {
1367 title 'Getting source for "%s"' "$1"
1368 receipt="$WOK/$pkg/receipt"
1369 check_pkg_in_wok
1370 unset_receipt
1371 . $receipt
1372 get_source
1373 _ 'Tarball: %s' "$SRC/$TARBALL"; newline
1374 exit 0
1377 # cook <package> --block
1378 # cook <package> -b
1379 [ -n "$block" -o "$2" == '-b' ] && {
1380 action 'Blocking package "%s"' "$1"
1381 [ $(grep "^$1$" $blocked) ] || echo "$1" >> $blocked
1382 status; newline
1383 touch $activity
1384 exit 0
1387 # cook <package> --unblock
1388 # cook <package> -ub
1389 [ -n "$unblock" -o "$2" == '-ub' ] && {
1390 action 'Unblocking package "%s"' "$1"
1391 sed -i "/^$1$/d" $blocked
1392 status; newline
1393 touch $activity
1394 exit 0
1400 case "$1" in
1401 usage|help|-u|-h)
1402 usage ;;
1404 list-wok)
1405 title 'List of %s packages in "%s"' "$ARCH" "$WOK"
1406 cd $WOK
1407 if [ "$ARCH" != 'i486' ]; then
1408 count=0
1409 for pkg in $(fgrep 'HOST_ARCH=' */receipt | egrep "$ARCH|any" | cut -d: -f1)
1410 do
1411 unset HOST_ARCH
1412 . ./$pkg
1413 count=$(($count + 1))
1414 colorize 34 "$PACKAGE"
1415 done
1416 else
1417 count=$(ls | wc -l)
1418 ls -1
1419 fi
1420 footer "$(_p '%s package' '%s packages' "$count" "$(colorize 32 "$count")")"
1421 ;;
1423 activity)
1424 cat $activity ;;
1426 search)
1427 # Just a simple search function, we don't need more actually.
1428 query="$2"
1429 title 'Search results for "%s"' "$query"
1430 cd $WOK; ls -1 | grep "$query"
1431 footer ;;
1433 setup)
1434 # Setup a build environment
1435 check_root
1436 _ 'Cook: setup environment' | log
1437 title 'Setting up your environment'
1438 [ -d $SLITAZ ] || mkdir -p $SLITAZ
1439 cd $SLITAZ
1440 init_db_files
1441 _ 'Checking for packages to install...'
1442 # Use setup pkgs from cross.conf or cook.conf. When cross compiling
1443 # ARCH-setup or 'cross check' should be used before: cook setup
1444 case "$ARCH" in
1445 arm*|x86_64)
1446 [ -x '/usr/bin/cross' ] || die 'ERROR: %s is not installed' 'cross'
1447 _ 'Using config file: %s' '/etc/slitaz/cross.conf'
1448 . /etc/slitaz/cross.conf ;;
1449 esac
1450 for pkg in $SETUP_PKGS; do
1451 if [ -n "$forced" ]; then
1452 tazpkg -gi $pkg --forced
1453 else
1454 [ ! -d "$INSTALLED/$pkg" ] && tazpkg get-install $pkg
1455 fi
1456 done
1458 # Handle --options
1459 case "$2" in
1460 --wok) hg clone $WOK_URL wok || exit 1 ;;
1461 --stable) hg clone $WOK_URL-stable wok || exit 1 ;;
1462 --undigest) hg clone $WOK_URL-undigest wok || exit 1 ;;
1463 --tiny) hg clone $WOK_URL-tiny wok || exit 1 ;;
1464 esac
1466 # SliTaz group and permissions
1467 if ! grep -q ^slitaz /etc/group; then
1468 _ 'Adding group "%s"' 'slitaz'
1469 addgroup slitaz
1470 fi
1471 _ 'Setting permissions for group "%s"...' 'slitaz'
1472 find $SLITAZ -maxdepth 2 -exec chown root.slitaz {} \;
1473 find $SLITAZ -maxdepth 2 -exec chmod g+w {} \;
1474 footer "$(_ 'All done, ready to cook packages :-)')" ;;
1476 *-setup)
1477 # Setup for cross compiling.
1478 arch="${1%-setup}"
1479 check_root
1480 . /etc/slitaz/cook.conf
1481 for pkg in $CROSS_SETUP; do
1482 if [ -n "$forced" ]; then
1483 tazpkg -gi $pkg --forced
1484 else
1485 [ ! -d "$INSTALLED/$pkg" ] && tazpkg -gi $pkg
1486 fi
1487 done
1489 _ 'Cook: setup %s cross environment' "$arch" | log
1490 title 'Setting up your %s cross environment' "$arch"
1491 init_db_files
1492 sed -i \
1493 -e "s|ARCH=.*|ARCH=\"$arch\"|" \
1494 -e "s|CROSS_TREE=.*|CROSS_TREE=\"/cross/$arch\"|" \
1495 -e 's|BUILD_SYSTEM=.*|BUILD_SYSTEM=i486-slitaz-linux|' \
1496 /etc/slitaz/cook.conf
1497 case "$arch" in
1498 arm)
1499 flags='-O2 -march=armv6'
1500 host="$ARCH-slitaz-linux-gnueabi" ;;
1501 armv6hf)
1502 flags='-O2 -march=armv6j -mfpu=vfp -mfloat-abi=hard'
1503 host="$ARCH-slitaz-linux-gnueabi" ;;
1504 armv7)
1505 flags='-Os -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -pipe'
1506 host="$ARCH-slitaz-linux-gnueabi" ;;
1507 x86_64)
1508 flags='-O2 -mtune=generic -pipe'
1509 host="$ARCH-slitaz-linux" ;;
1510 esac
1511 sed -i \
1512 -e "s|CFLAGS=.*|CFLAGS=\"$flags\"|" \
1513 -e "s|HOST_SYSTEM=.*|HOST_SYSTEM=$host|" /etc/slitaz/cook.conf
1514 . /etc/slitaz/cook.conf
1515 sysroot="$CROSS_TREE/sysroot"
1516 tools="/cross/$arch/tools"
1517 root="$sysroot"
1518 # L10n: keep the same width of translations to get a consistent view
1519 _ 'Target arch : %s' "$ARCH"
1520 _ 'Configure args : %s' "$CONFIGURE_ARGS"
1521 _ 'Build flags : %s' "$flags"
1522 _ 'Arch sysroot : %s' "$sysroot"
1523 _ 'Tools prefix : %s' "$tools/bin"
1524 # Tell the packages manager where to find packages.
1525 _ 'Packages DB : %s' "$root$DB"
1526 mkdir -p $root$INSTALLED
1527 cd $root$DB; rm -f *.bak
1528 for list in packages.list packages.desc packages.equiv packages.md5; do
1529 rm -f $list
1530 ln -s $SLITAZ/packages/$list $list
1531 done
1532 # We must have the cross compiled glibc-base installed or default
1533 # i486 package will be used as dep by tazpkg and then break the
1534 # cross environment
1535 if [ ! -f "$root$INSTALLED/glibc-base/receipt" ]; then
1536 colorize 36 $(_ 'WARNING: %s is not installed in sysroot' '(e)glibc-base')
1537 fi
1538 # Show GCC version or warn if not yet compiled.
1539 if [ -x "$tools/bin/$HOST_SYSTEM-gcc" ]; then
1540 _ 'Cross compiler : %s' "$HOST_SYSTEM-gcc"
1541 else
1542 colorize 36 $(_ 'C compiler "%s" is missing' "$HOST_SYSTEM-gcc")
1543 _ 'Run "%s" to cook a toolchain' 'cross compile'
1544 fi
1545 footer ;;
1547 test)
1548 # Test a cook environment.
1549 _ 'Cook test: testing the cook environment' | log
1550 [ ! -d "$WOK" ] && exit 1
1551 [ ! -d "$WOK/cooktest" ] && cp -r $DATA/cooktest $WOK
1552 cook cooktest ;;
1554 new)
1555 # Create the package folder and an empty receipt.
1556 pkg="$2"
1557 [ -z "$pkg" ] && usage
1558 newline
1559 [ -d "$WOK/$pkg" ] && die 'Package "%s" already exists.' "$pkg"
1561 action 'Creating folder "%s"' "$WOK/$pkg"
1562 mkdir $WOK/$pkg; cd $WOK/$pkg; status
1564 action 'Preparing the package receipt...'
1565 cp $DATA/receipt .
1566 sed -i "s|^PACKAGE=.*|PACKAGE=\"$pkg\"|" receipt
1567 status; newline
1569 # Interactive mode, asking and seding.
1570 case "$3" in
1571 --interactive|-x)
1572 _ 'Entering interactive mode...'
1573 separator
1574 _ 'Package : %s' "$pkg"
1576 _n 'Version : ' ; read answer
1577 sed -i "s|^VERSION=.*|VERSION=\"$answer\"|" receipt
1579 _n 'Category : ' ; read answer
1580 sed -i "s|^CATEGORY=.*|CATEGORY=\"$answer\"|" receipt
1582 # L10n: Short description
1583 _n 'Short desc : ' ; read answer
1584 sed -i "s|^SHORT_DESC=.*|SHORT_DESC=\"$answer\"|" receipt
1586 _n 'Maintainer : ' ; read answer
1587 sed -i "s|^MAINTAINER=.*|MAINTAINER=\"$answer\"|" receipt
1589 _n 'License : ' ; read answer
1590 sed -i "s|^LICENSE=.*|LICENSE=\"$answer\"|" receipt
1592 _n 'Web site : ' ; read answer
1593 sed -i "s|^WEB_SITE=.*|WEB_SITE=\"$answer\"|" receipt
1594 newline
1596 # Wget URL.
1597 _ 'Wget URL to download source tarball.'
1598 _n 'Example : ' ; echo '$GNU_MIRROR/$PACKAGE/$TARBALL'
1599 _n 'Wget url : ' ; read answer
1600 sed -i "s|^WGET_URL=.*|WGET_URL=\"$answer\"|" receipt
1602 # Ask for a stuff dir.
1603 confirm "$(_n 'Do you need a stuff directory? (y/N)')"
1604 if [ "$?" -eq 0 ]; then
1605 action 'Creating the stuff directory...'
1606 mkdir $WOK/$pkg/stuff; status
1607 fi
1609 # Ask for a description file.
1610 confirm "$(_n 'Are you going to write a description? (y/N)')"
1611 if [ "$?" -eq 0 ]; then
1612 action 'Creating the "%s" file...' 'description.txt'
1613 touch $WOK/$pkg/description.txt; status
1614 fi
1616 footer "$(_ 'Receipt is ready to use.')" ;;
1617 esac ;;
1619 list)
1620 # Cook a list of packages (better use the Cooker since it will order
1621 # packages before executing cook).
1622 check_root
1623 [ -z "$2" ] && die 'No list in argument.'
1624 [ -f "$2" ] || die 'List "%s" not found.' "$2"
1626 _ 'Starting cooking the list "%s"' "$2" | log
1628 while read pkg; do
1629 cook $pkg || broken
1630 done < $2
1631 ;;
1633 clean-wok)
1634 check_root
1635 newline; action 'Cleaning all packages files...'
1636 rm -rf $WOK/*/taz $WOK/*/install $WOK/*/source
1637 status; newline ;;
1639 clean-src)
1640 check_root
1641 newline; action 'Cleaning all packages sources...'
1642 rm -rf $WOK/*/source
1643 status; newline ;;
1645 uncook)
1646 cd $WOK
1647 count=0
1648 title 'Checking for uncooked packages'
1650 for i in *; do
1651 unset HOST_ARCH EXTRAVERSION
1652 [ ! -e $i/receipt ] && continue
1653 . ./$i/receipt
1654 # Source cooked pkg receipt to get EXTRAVERSION
1655 if [ -d "$WOK/$i/taz" ]; then
1656 cd $WOK/$i/taz/$(ls $WOK/$i/taz/ | head -n1)
1657 . ./receipt; cd $WOK
1658 fi
1659 case "$ARCH" in
1660 i486)
1661 debug "$(_ 'Package "%s"' "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg")"
1662 if [ ! -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" ]; then
1663 count=$(($count + 1))
1664 colorize 34 "$i"
1665 fi ;;
1666 arm*)
1667 # Check only packages included in arch
1668 if echo "$HOST_ARCH" | egrep -q "$ARCH|any"; then
1669 # *.tazpkg
1670 if [ ! -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then
1671 count=$(($count + 1))
1672 colorize 34 "$i"
1673 fi
1674 fi ;;
1675 esac
1676 done
1678 if [ "$count" -gt 0 ]; then
1679 footer "$(_p '%s uncooked package' '%s uncooked packages' "$count" "$(colorize 31 "$count")")"
1680 else
1681 _ 'All packages are cooked :-)'
1682 newline
1683 fi
1684 ;;
1686 pkgdb)
1687 # Create suitable packages list for TazPkg and only for built packages
1688 # as well as flavors files for TazLiTo. We don't need logs since we do it
1689 # manually to ensure everything is fine before syncing the mirror.
1690 recreate_split_db
1691 recreate_maint_db
1692 @@PREFIX@@/libexec/cookutils/pkgdb "$2"
1693 ;;
1695 splitdb)
1696 # File split.db is useful for searching for split packages.
1697 recreate_split_db
1698 ;;
1700 maintdb)
1701 # File maint.db is useful for searching maintainer's packages.
1702 recreate_maint_db
1703 ;;
1705 *)
1706 # Just cook and generate a package.
1707 check_root
1708 time=$(date +%s)
1709 pkg="$1"
1710 [ -z "$pkg" ] && usage
1712 # Search last successful cook time in all logs from newer to older
1713 for i in '' $(seq 0 9 | sed 's|^|.|'); do
1714 [ -f "$LOGS/$pkg.log$i" ] || break
1715 lastcooktime=$(sed '/^Cook time/!d; s|.*: *\([0-9]*\)s.*|\1|' \
1716 $LOGS/$pkg.log$i 2>/dev/null | sed '$!d')
1717 [ -n "$lastcooktime" ] && break
1718 done
1720 receipt="$WOK/$pkg/receipt"
1721 check_pkg_in_wok
1722 newline
1724 unset inst
1725 unset_receipt
1726 . $receipt
1728 # Handle cross compilation.
1729 case "$ARCH" in
1730 arm*)
1731 if [ -z "$HOST_ARCH" ]; then
1732 _ 'cook: HOST_ARCH is not set in "%s" receipt' "$pkg"
1733 error="$(_ 'package "%s" is not included in %s' "$pkg" "$ARCH")"
1734 _ 'cook: %s' "$error"
1735 [ -n "$CROSS_BUGS" ] && _ 'bugs: %s' "$CROSS_BUGS"
1736 _ 'Cook skip: %s' "$error" | log
1737 newline
1738 broken; exit 1
1739 fi ;;
1740 esac
1742 # Some packages are not included in some arch or fail to cross compile.
1743 : ${HOST_ARCH=$ARCH}
1744 debug "$(_ 'Host arch %s' "$HOST_ARCH")"
1745 # Handle arm{v6hf,v7,..}
1746 if ! $(echo "$HOST_ARCH" | egrep -q "${ARCH%v[0-9]*}|any"); then
1747 _ 'cook: %s' "HOST_ARCH=$HOST_ARCH"
1748 error="$(_ "package \"%s\" doesn't cook or is not included in %s" "$pkg" "$ARCH")"
1749 _ 'cook: %s' "error"
1750 [ -n "$CROSS_BUGS" ] && _ 'bugs: %s' "$CROSS_BUGS"
1751 _ 'Cook skip: %s' "$error" | log
1752 sed -i "/^${pkg}$/d" $broken
1753 newline
1754 exit 0
1755 fi
1757 # Remove package from broken list before cooking
1758 sed -i "/^${pkg}$/d" $broken
1760 # Skip blocked, 3 lines also for the Cooker.
1761 grep -q "^$pkg$" $blocked && [ "$2" != '--unblock' ] &&
1762 die 'Package "%s" is blocked' "$pkg"
1764 try_aufs_chroot "$@"
1766 # Log and source receipt.
1767 echo "cook:$pkg" > $command
1769 [ -n "$lastcooktime" ] && echo "cook:$pkg $lastcooktime $(date +%s)" >> $cooktime
1771 while read cmd duration start; do
1772 [ $(($start + $duration)) -lt $(date +%s) ] &&
1773 echo "sed -i '/^$cmd $duration/d' $cooktime"
1774 done < $cooktime | sh
1776 # Display and log info if cook process stopped.
1777 # FIXME: gettext not working (in single quotes) here!
1778 trap '_ "\n\nCook stopped: control-C\n\n" | \
1779 tee -a $LOGS/$pkg.log' INT
1781 update_split_db
1783 # Handle --options
1784 case "$2" in
1785 --pack)
1786 _ 'Packing %s' "<a href='cooker.cgi?pkg=${pkg//+/%2B}'>$pkg</a>" | log
1787 [ -d "$WOK/$pkg/install" ] || die 'Need to build "%s"' "$pkg"
1788 [ ! -d "$WOK/$pkg/taz" ] || rm -rf "$WOK/$pkg/taz"
1789 [ ! -f "$LOGS/$pkg-pack.log" ] || rm -f $LOGS/$pkg-pack.log
1790 packall 2>&1 | tee -a $LOGS/$pkg-pack.log
1791 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1792 clean_log "$pkg-pack"
1793 time=$(($(date +%s) - $time))
1794 summary | sed 's|^Cook |Pack |' | tee -a $LOGS/$pkg-pack.log
1795 gen_rss
1796 put_status $pkg Done
1797 rm -f $command
1798 exit 0 ;;
1800 --trials|-t)
1801 trials='yes' ;;
1802 esac
1804 _ 'Making %s' "<a href='cooker.cgi?pkg=${pkg//+/%2B}'>$pkg</a>" | log
1806 # Rotate log
1807 for i in $(seq 9 -1 1); do
1808 j=$(($i - 1))
1809 [ -e $LOGS/$pkg.log.$j ] && mv -f $LOGS/$pkg.log.$j $LOGS/$pkg.log.$i
1810 done
1811 [ -e $LOGS/$pkg.log ] && mv $LOGS/$pkg.log $LOGS/$pkg.log.0
1813 # Check if wanted is built now so we have separate log files.
1814 for wanted in $WANTED ; do
1815 if grep -q "^$wanted$" $blocked; then
1816 broken
1817 rm -f $command
1818 die 'WANTED package "%s" is blocked' "$wanted"
1819 fi
1820 if grep -q "^$wanted$" $broken; then
1821 broken
1822 rm -f $command
1823 die 'WANTED package "%s" is broken' "$wanted"
1824 fi
1825 if [ ! -d "$WOK/$wanted/install" ]; then
1826 cook "$wanted" || { broken; exit 1; }
1827 fi
1828 done
1830 # Cook and pack or exit on error and log everything.
1831 ( ( ( (cookit $@ 2>&1; echo $? >&3) | loglimit 50 > $LOGS/$pkg.log) 3>&1) | (read rq; exit $rq) )
1832 rq=$? # the return code of `cookit $@` above command
1834 if [ $rq -eq 1 ]; then
1835 broken
1836 fi
1838 # Remove build dependencies both when `cookit` done or fail
1839 remove_deps | tee -a $LOGS/$pkg.log
1840 timestamp job27 # removing bdeps
1841 # cookit_quality
1842 timestamp job28 # checking quality
1844 # Log and stop if `cookit` fails
1845 if [ $rq -eq 1 ]; then
1846 debug_info "ret1" | tee -a $LOGS/$pkg.log
1847 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1848 put_status $pkg Failed
1849 rm -f $command
1850 broken
1851 exit 1
1852 fi
1854 # Proceed only if `cookit` return code is zero-OK
1855 # If instant-pack if specified, then packages already packed in the cookit()
1856 [ "${COOKOPTS/instant-pack/}" == "$COOKOPTS" ] &&
1857 packall 2>&1 | loglimit 5 >> $LOGS/$pkg.log
1858 timestamp job29 # packing
1860 @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log
1862 clean_log
1864 # Exit if any error in packing.
1865 if [ "${COOKOPTS/skip-log-errors/}" == "$COOKOPTS" ] &&
1866 grep -Ev "(/root/.cvspass|conftest|df: /|rm: can't remove)" $LOGS/$pkg.log | \
1867 grep -Eq "(^ERROR|: No such file or directory|not remade because of errors|ake: \*\*\* .* Error)"; then
1868 debug_info "packerr" | tee -a $LOGS/$pkg.log
1869 put_status $pkg Failed
1870 rm -f $command
1871 broken; exit 1
1872 fi
1874 # Create an XML feed
1875 gen_rss
1877 # Time and summary
1878 time=$(($(date +%s) - $time))
1879 summary | tee -a $LOGS/$pkg.log
1880 newline
1882 # We may want to install/update (outside aufs jail!).
1883 [ -s /aufs-umount.sh ] || install_package
1885 put_status $pkg Done
1887 # Finally we DON'T WANT to build the *-dev or packages with WANTED="$pkg"
1888 # If you want automation, use the Cooker Build Bot.
1889 rm -f $command
1890 timestamp job30 # misc. final operations
1891 store_timestats
1893 sed -n '/^Build dependencies to remove:/,/^$/p' $LOGS/$pkg.log \
1894 | sed '/^Build/d; s|Removing: ||' \
1895 | tr ' ' '\n' \
1896 | sed '/^$/d' \
1897 > $WOK/$pkg/.bdeps
1899 ;;
1900 esac
1902 exit 0