cookutils annotate cook @ rev 446

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