cookutils annotate cook @ rev 471

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