cookutils annotate cooker @ rev 768

cookutils-doc: change icon
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Nov 07 02:30:09 2015 +0200 (2015-11-07)
parents 55614babc99a
children a098710285e2
rev   line source
pankso@4 1 #!/bin/sh
pankso@4 2 #
pankso@383 3 # SliTaz Build Bot. The Cooker is a tool to automate and test SliTaz package
pankso@383 4 # building. Please read the Cookbook documentation for more information
paul@54 5 # and discuss with the AUTHORS before adding anything here. PS: no translations
paul@495 6 # here since it's not an end user tool and it's not useful. All devs should
pankso@4 7 # at least understand basic English.
pankso@4 8 #
al@728 9
pankso@431 10 . /usr/lib/slitaz/libcook.sh
pankso@4 11
pankso@49 12 # Set pkg name and use same wok as cook.
pankso@49 13 pkg="$2"
pankso@4 14 wok="$WOK"
pankso@4 15
pankso@81 16 # PID file.
pankso@81 17 pidfile='/var/run/cooker.pid'
pankso@81 18
pankso@4 19 #
pankso@4 20 # Functions
pankso@4 21 #
pankso@4 22
pankso@4 23 usage() {
al@728 24 cat <<EOT
pankso@4 25
pankso@341 26 Usage: cooker [command] [pkg|list|note|hours]
pankso@4 27
pankso@4 28 Options:
pankso@49 29 usage|-u Display this short usage.
pankso@49 30 setup|-s Setup the Cooker environment.
pankso@341 31 setup-cron Setup a cron job for the Cooker.
pankso@383 32 arch-db Create host arch packages DB.
pankso@49 33 note|-n Add a note to the cooknotes.
pankso@49 34 notes|-ns Display all the cooknotes.
pankso@49 35 block|-b Block a package so cook will skip it.
pankso@49 36 unblock|-ub Unblock a blocked package.
pankso@49 37 pkg|-p Same as 'cook pkg' but with cooker log.
pankso@49 38 flavor|-f Cook all packages of a flavor.
paul@54 39 list|-l Cook all packages in the given list.
pankso@49 40 cat|-c Cook all packages of a category.
pankso@79 41 rev|-r Cook packages of a specific revision.
pankso@49 42 all|-a Find and cook all unbuilt packages.
pankso@4 43
pankso@4 44 EOT
pankso@4 45 exit 0
pankso@4 46 }
pankso@4 47
al@728 48
paul@54 49 # Some messages occur in activity but log verbose output when checking for commits
pankso@14 50 # into a log file.
al@728 51
pankso@14 52 log_commits() {
pankso@35 53 sed '/^.\//'d | sed '/^.hg/'d | tee -a $LOGS/commits.log
pankso@14 54 }
pankso@14 55
al@728 56
pankso@81 57 # Clean up before exit when check and cook commits finish.
al@728 58
pankso@81 59 clean_exit() {
al@728 60 rm -f $command; touch $command
pascal@766 61 [ "$previous_command" ] && ps | grep -q "${previous_command/:/ }" &&
pascal@766 62 echo -n "$previous_command" > $command
pankso@81 63 rm -f $pidfile
pankso@14 64 }
pankso@14 65
al@728 66
pankso@35 67 # Summary for commits.
al@728 68
pankso@35 69 commits_summary() {
pankso@35 70 msg="from revision $cur to $new"
pankso@35 71 [ "$new" == "$cur" ] && msg="revision $new"
pankso@35 72 echo "Will cook $msg"
pankso@35 73 separator
pankso@35 74 echo -e "\nSummary for commits"
pankso@35 75 separator
pankso@35 76 echo "Hg wok revision : $cur"
pankso@35 77 echo "Pulled revision : $new"
al@728 78 echo "Check date : $(date '+%F %T')"
pankso@35 79 }
pankso@35 80
al@728 81
paul@54 82 # Scan packages build deps and fill up cookorder list.
al@728 83
pankso@4 84 cook_order_scan() {
pankso@124 85 rm -f $cookorder
pankso@383 86 touch $cookorder
al@728 87 for pkg in $(cat $cooklist); do
pascal@273 88 unset WANTED BUILD_DEPENDS
pankso@14 89 . $wok/$pkg/receipt
pankso@29 90 # The :: is for web interface color.
pascal@273 91 [ "$WANTED$BUILD_DEPENDS" ] && echo "$pkg :: $WANTED $BUILD_DEPENDS"
al@728 92 for dep in $WANTED $BUILD_DEPENDS; do
pankso@4 93 if grep -q "^$dep$" $cooklist; then
pankso@4 94 if ! grep -q "^$dep$" $cookorder; then
pankso@4 95 echo "$dep" >> $cookorder
pankso@4 96 fi
pankso@4 97 fi
pankso@4 98 done
pankso@4 99 done
pankso@383 100
paul@54 101 # Append unordered packages to cookorder.
al@728 102 for pkg in $(cat $cooklist); do
pankso@4 103 if ! grep -q "^$pkg$" $cookorder; then
pankso@4 104 echo "$pkg" >> $cookorder
pankso@4 105 fi
pankso@4 106 done
pankso@4 107 }
pankso@4 108
al@728 109
paul@54 110 # Scan and rescan until the cooklist is ordered then handle WANTED.
al@728 111
pankso@4 112 cook_order() {
pankso@4 113 time=$(date +%s)
pankso@4 114 scan=0
pankso@4 115
pankso@4 116 # Keep an original cooklist so we do a diff when ordering is finished.
pankso@4 117 cp -f $cooklist $cooklist.0
al@728 118 echo 'cookorder' > $command
al@728 119 echo -e '\nInitial Cooker order scan'
pankso@4 120 separator
pankso@4 121 cook_order_scan
pankso@383 122
pankso@4 123 # Diff between the cooklist and new ordered list ? So copy the last
pankso@4 124 # cookorder to cooklist and rescan it.
al@728 125 while /bin/true; do
pankso@4 126 diff $cooklist $cookorder > $cookorder.diff
pankso@4 127 if [ -s "$cookorder.diff" ]; then
pankso@4 128 scan=$(($scan + 1))
pankso@4 129 echo -e "\nDiff scan: $scan"
pankso@4 130 separator
pankso@4 131 mv -f $cookorder $cooklist
pankso@4 132 cook_order_scan
pankso@4 133 else
pankso@4 134 break
pankso@4 135 fi
pankso@4 136 done
pankso@4 137
paul@647 138 # Keep a diff between submitted cooklist and the ordered.
pankso@4 139 diff $cooklist.0 $cooklist > $cooklist.diff
pankso@4 140 rm -f $cookorder $cookorder.diff $cooklist.0
pankso@4 141
pankso@107 142 # Scan finished: append pkg to WANTED or leave it in the ordered cooklist.
paul@214 143 # TODO: grep the line number to get pkg position and keep it higher.
al@728 144 echo -e '\nHandle WANTED package'
pankso@4 145 separator
al@728 146 for pkg in $(cat $cooklist); do
pankso@4 147 unset WANTED
pankso@14 148 . $wok/$pkg/receipt
al@728 149 for wanted in $WANTED; do
pascal@291 150 echo "$pkg :: $wanted"
pascal@291 151 if grep -q ^${wanted}$ $cooklist; then
pankso@107 152 sed -i -e "/^$pkg$/"d \
pascal@291 153 -e "/^$wanted$/ a $pkg" $cooklist
pankso@107 154 fi
pascal@291 155 done
pankso@4 156 done
pankso@4 157
pankso@4 158 # Show ordered cooklist
al@728 159 echo -e '\nCooklist order'
pankso@4 160 separator
pankso@4 161 cat $cooklist
pankso@4 162 separator
al@728 163
pankso@4 164 time=$(($(date +%s) - $time))
pankso@4 165 pkgs=$(cat $cooklist | wc -l)
al@728 166 echo -e '\nSummary for cookorder'
pankso@4 167 separator
al@728 168 cat <<EOT
pankso@4 169 Ordered packages : $pkgs
pankso@4 170 Scans executed : $scan
pankso@4 171 Scan duration : ${time}s
pankso@4 172 EOT
al@728 173 separator
al@728 174
al@728 175 rm -f $command
pankso@4 176 }
pankso@4 177
al@728 178
pankso@14 179 # Remove blocked (faster this way than grepping before).
al@728 180
pankso@14 181 strip_blocked() {
al@728 182 for pkg in $(cat $blocked); do
pankso@14 183 sed -i /^${pkg}$/d $cooklist
al@728 184 done
al@728 185 sed -i /^$/d $cooklist
pankso@14 186 }
pankso@14 187
al@728 188
paul@54 189 # Use in default mode and with all cmd.
al@728 190
pankso@4 191 cook_commits() {
pankso@4 192 if [ -s "$commits" ]; then
al@728 193 for pkg in $(cat $commits); do
pascal@765 194 ps | grep -q "cook $pkg$" && continue
pankso@14 195 echo "cook:$pkg" > $command
pankso@394 196 cook $pkg || broken
pankso@4 197 sed -i /^${pkg}$/d $commits
pankso@4 198 done
pankso@4 199 fi
pankso@4 200 }
pankso@4 201
al@728 202
paul@54 203 # Cook all packages in a cooklist.
al@728 204
pankso@14 205 cook_list() {
al@728 206 for pkg in $(cat $cooklist); do
pascal@765 207 ps | grep -q "cook $pkg$" && continue
pankso@79 208 cook $pkg || broken
pankso@79 209 sed -i /^${pkg}$/d $cooklist
pankso@14 210 done
pankso@14 211 }
pankso@14 212
al@728 213
paul@388 214 # Create a arch.$ARCH file for each package cooked for the target host
pankso@383 215 # architecture
pankso@383 216 #
pankso@383 217 # The deal: we dont want all packages handled by cooker commands and stats,
pankso@383 218 # since we dont cross compile all packages for each arch but only a set of
paul@388 219 # packages to provide one full featured desktop, servers and goodies useful
pankso@383 220 # for the host system.
pankso@383 221 #
al@728 222
pankso@383 223 arch_db() {
pankso@383 224 count=0
pankso@391 225 echo "Cleaning packages DB : arch.$ARCH"
pankso@390 226 rm -f $wok/*/arch.$ARCH && cd $wok
pankso@383 227 echo "Creating $ARCH packages DB..."
al@728 228 for pkg in *; do
pascal@693 229 HOST_ARCH=
pascal@693 230 . $wok/$pkg/receipt
pascal@693 231 if [ -n "$HOST_ARCH" ]; then
pankso@678 232 if $(echo "$HOST_ARCH" | egrep -q "$ARCH|any"); then
pankso@678 233 count=$(($count + 1))
pankso@678 234 echo "Adding: $pkg"
pankso@678 235 touch $pkg/arch.$ARCH
pankso@678 236 fi
pankso@678 237 unset HOST_ARCH
pankso@678 238 else
pankso@678 239 # HOST_ARCH not set --> in i486
al@728 240 if [ "$ARCH" == 'i486' ]; then
pankso@678 241 count=$(($count + 1))
pankso@678 242 echo "Adding: $pkg"
pankso@678 243 touch $pkg/arch.$ARCH
pankso@678 244 fi
pankso@383 245 fi
pankso@383 246 done
pankso@391 247 echo "Packages for $ARCH : $count"
pankso@383 248 }
pankso@383 249
al@728 250
pankso@4 251 #
pankso@4 252 # Commands
pankso@4 253 #
al@728 254
pascal@764 255 previous_command="$(cat $command)"
pankso@4 256 case "$1" in
pankso@31 257 usage|help|-u|-h)
pankso@4 258 usage ;;
al@728 259
pankso@31 260 setup|-s)
pankso@4 261 # Setup the Cooker environment.
al@728 262 echo -e '\nSetting up the Cooker'
pankso@349 263 mkdir -p $CACHE
pankso@31 264 echo "Cooker setup using: $SLITAZ" | log
pankso@4 265 separator
al@728 266 for pkg in $SETUP_PKGS mercurial rsync tazlito; do
pankso@4 267 [ ! -d "$INSTALLED/$pkg" ] && tazpkg get-install $pkg
pankso@4 268 done
pankso@4 269 mkdir -p $SLITAZ && cd $SLITAZ
al@728 270 if [ -d "${wok}-hg" ]; then
al@728 271 echo -e 'Hg wok already exists.\n'
al@728 272 exit 1
al@728 273 fi
al@728 274 if [ -d "$wok" ]; then
al@728 275 echo -e 'Build wok already exists.\n'
al@728 276 exit 1
al@728 277 fi
pankso@4 278
pankso@4 279 # Directories and files
pankso@4 280 echo "mkdir's and touch files in: $SLITAZ"
pankso@311 281 mkdir -p $PKGS $LOGS $FEEDS $CACHE $SRC
al@728 282 for f in $activity $blocked $broken $commits $cooklist $command; do
pankso@4 283 touch $f
pankso@4 284 done
pankso@14 285 hg clone $WOK_URL ${wok}-hg || exit 1
pankso@60 286 [ -d "$flavors" ] || hg clone $FLAVORS_URL flavors
pankso@4 287 cp -a ${wok}-hg $wok
al@728 288 separator; newline ;;
al@728 289
pankso@383 290 arch-db)
pankso@383 291 # Manually create arch packages DB.
pankso@383 292 arch_db ;;
al@728 293
pankso@341 294 setup-cron)
pankso@341 295 # Create cron job for the cooker.
pankso@341 296 [ "$2" ] || hours=2
pankso@341 297 if [ ! -f "$crontabs" ]; then
pankso@341 298 mkdir -p /var/spool/cron/crontabs
pankso@341 299 fi
pankso@341 300 if ! fgrep -q /usr/bin/cooker $crontabs; then
pascal@760 301 cat > $crontabs << EOT
pascal@760 302 # Run SliTaz Cooker every $hours hours
pascal@760 303 0 */$hours * * * /usr/bin/cooker --output=html
pascal@760 304 */5 * * * * [ $CACHE/cooker-request -nt $CACHE/activity ] && /usr/bin/cooker --output=html
pascal@760 305 EOT
pascal@760 306 touch $CACHE/cooker-request
pascal@761 307 chmod 666 $CACHE/cooker-request
pankso@341 308 killall crond 2>/dev/null && /etc/init.d/crond start
pankso@341 309 fi ;;
al@728 310
pankso@341 311 check-cron)
al@728 312 if [ ! -f "$crontabs" ]; then
al@728 313 echo "There is no $crontabs here. Use setup-cron option."
al@728 314 exit 1
al@728 315 fi
pankso@341 316 fgrep /usr/bin/cooker $crontabs ;;
al@728 317
pankso@31 318 note|-n)
al@728 319 # Blocked a pkg and want others to know why? Post a note!
al@728 320 [ -n "$2" ] && echo "$(date '+%F %R') : $2" >> $cooknotes ;;
al@728 321
pankso@31 322 notes|-ns)
pankso@29 323 # View cooknotes.
al@728 324 echo -e '\nCooknotes'
pankso@29 325 separator
pankso@29 326 cat $cooknotes
al@728 327 separator; newline ;;
al@728 328
pankso@49 329 block|-b)
pankso@49 330 # Block a package.
pankso@49 331 [ "$pkg" ] && cook $pkg --block ;;
al@728 332
pankso@49 333 unblock|-ub)
pankso@49 334 # Unblock a package.
pankso@49 335 [ "$pkg" ] && cook $pkg --unblock ;;
al@728 336
pankso@31 337 reverse|-r)
paul@54 338 # Cook all reverse dependencies for a package. This command lets us
paul@54 339 # control the Cooker manually for commits that will cook a lot of packages.
pankso@14 340 #
al@728 341 # Use hg commit? Ex: hg commit -m "Message bla bla | cooker:reverse"
pankso@14 342 #
al@728 343 if [ ! -d "$wok/$pkg" ]; then
al@728 344 echo -e "\nNo package $2 found.\n"
al@728 345 exit 0
al@728 346 fi
al@728 347 rm -f $cooklist; touch $cooklist
pankso@32 348 echo -e "\nReverse cooklist for: $pkg"
al@728 349 separator
al@728 350
al@728 351 cd $wok
al@728 352 for rev in *; do
al@728 353 unset WANTED DEPENDS BUILD_DEPENDS; . $wok/$rev/receipt
pascal@273 354 if echo "$WANTED $DEPENDS $BUILD_DEPENDS" | fgrep -q $pkg; then
pankso@32 355 echo "$rev" | tee -a $cooklist
pankso@4 356 fi
al@728 357 done
al@728 358 separator
pankso@32 359 echo -e "Reverse dependencies found: $(cat $cooklist | wc -l)\n"
pankso@32 360 strip_blocked
pankso@32 361 cook_order | tee $LOGS/cookorder.log
pankso@32 362 cook_list ;;
al@728 363
pankso@31 364 pkg|-p)
pankso@12 365 # Same as 'cook pkg' but with log for web interface.
pascal@765 366 ps | grep -q "cook $pkg$" && echo 'Already running' && continue
pankso@394 367 cook $pkg || broken
pankso@81 368 clean_exit ;;
al@728 369
pankso@31 370 cat|-c)
pankso@4 371 # Cook all packages of a category.
pankso@31 372 cat="$2"
al@728 373 rm -f $cooklist; touch $cooklist
al@728 374
al@728 375 cd $wok
al@728 376 for pkg in *; do
al@728 377 unset CATEGORY; . $pkg/receipt
pankso@4 378 [ "$CATEGORY" == "$cat" ] && echo $pkg >> $cooklist
pankso@4 379 done
pankso@14 380 strip_blocked
pankso@14 381 cook_order | tee $LOGS/cookorder.log
pankso@26 382 cook_list ;;
al@728 383
pankso@31 384 flavor|-f)
pankso@21 385 # Cook all packages of a flavor.
pankso@31 386 name="$2"
al@728 387 if [ ! -d "$flavors/$name" ]; then
al@728 388 echo -e "\nSpecified flavor does not exist: $name\n"
al@728 389 exit 1
al@728 390 fi
al@728 391 if [ -d "$flavors/.hg" ]; then
al@728 392 cd $flavors; hg pull -u
al@728 393 fi
al@728 394 list="$flavors/$name/packages.list"
pankso@21 395 cp -a $list $cooklist
pankso@21 396 strip_blocked
pankso@21 397 cook_order | tee $LOGS/cookorder.log
pankso@32 398 cook_list ;;
al@728 399
pankso@31 400 list|-l)
paul@54 401 # Cook a list of packages given in argument.
pankso@31 402 list="$2"
al@728 403 if [ ! -f "$list" ]; then
al@728 404 echo -e "\nSpecified list does not exist: $list\n"
al@728 405 exit 1
al@728 406 fi
pankso@26 407 cp -a $list $cooklist
pankso@26 408 strip_blocked
pankso@98 409 cook_order | tee $LOGS/cookorder.log
pankso@98 410 cook_list ;;
al@728 411
pankso@79 412 rev|-r)
pankso@79 413 # Cook or recook a specific Hg revision.
pankso@79 414 rev="$2"
pankso@79 415 [ "$rev" ] || exit 0
al@728 416 rm -f $cooklist; touch $cooklist
al@728 417
pankso@79 418 cd $wok
al@728 419 for pkg in $(hg log --rev=$rev --template "{files}"); do
al@728 420 echo "$pkg" | cut -d/ -f1 >> $cooklist
pankso@79 421 done
pankso@79 422 strip_blocked
pankso@26 423 cook_order | tee $LOGS/cookorder.log
pankso@26 424 cook_list ;;
al@728 425
pankso@31 426 all|-a)
pankso@4 427 # Try to build all unbuilt packages except blocked's.
al@728 428 echo 'cooker:all' > $command
al@728 429 rm -f $cooklist; touch $cooklist
al@728 430 newline
al@728 431 echo 'Cooker cooklist'
pankso@4 432 separator
pankso@383 433
pankso@118 434 # Find all unbuilt packages. Get EXTRAVERSION from packed receipt
paul@132 435 # if it exists since extra version is added when packing the package.
al@728 436 echo 'Searching for all unbuilt packages' | log
al@728 437
al@728 438 cd $wok
al@728 439 for pkg in *; do
pankso@118 440 unset EXTRAVERSION
pankso@4 441 . $pkg/receipt
pankso@118 442 [ -f "$pkg/taz/$PACKAGE-$VERSION/receipt" ] && \
pankso@118 443 . $pkg/taz/$PACKAGE-$VERSION/receipt
al@728 444 if [ ! -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" ]; then
al@728 445 echo $pkg; echo $pkg >> $cooklist
pankso@118 446 fi
pankso@4 447 done
pankso@14 448 strip_blocked
pankso@99 449 cook_order | tee $LOGS/cookorder.log
pankso@13 450 echo "Packages to cook: $(cat $cooklist | wc -l)" | log
pankso@79 451 cook_list ;;
al@728 452
pankso@4 453 *)
pankso@81 454 # Default is to cook all commits if not yet running.
al@728 455 [ -n "$1" ] && usage
slaxemulator@489 456 cooklist=$commits
pankso@81 457 if [ -f "$pidfile" ]; then
slaxemulator@488 458 pid=$(cat $pidfile)
pascal@274 459 if [ -s /proc/$pid/status ]; then
al@728 460 echo -e "\nStill cooking latest commits with pid:"
al@728 461 echo -e " $pid\n"
al@728 462 exit 0
pascal@274 463 fi
pascal@274 464 rm -f "$pidfile"
pankso@81 465 fi
pankso@81 466
pankso@81 467 # Start and get a PID file.
pankso@14 468 rm -f $LOGS/commits.log
slaxemulator@486 469 newline
al@728 470 echo 'Checking for commits' | log_commits
pankso@14 471 separator | tee -a $LOGS/commits.log
pankso@383 472
pankso@82 473 echo $$ > $pidfile
pankso@233 474 trap 'echo -e "\nCooker stopped: PID $$\n" && \
pankso@233 475 rm -f $pidfile $command && exit 1' INT TERM
pankso@383 476
pankso@82 477 echo "Cooker PID : $$" | log_commits
al@728 478 echo "Cooker date : $(date '+%F %T')" | log_commits
pankso@383 479
paul@132 480 # Get revisions. Here we have 2 echoes since we want a msg on screen,
paul@132 481 # in commits log and activity DB without a space before.
pankso@60 482 cd $wok || exit 1
pankso@4 483 cur=$(hg head --template '{rev}\n')
pankso@82 484 echo "Updating wok : ${wok}-hg (rev $cur)" | log_commits
pankso@82 485 echo "Updating wok: ${wok}-hg" | log
al@728 486 echo 'hg:pull' > $command
al@728 487 cd $wok-hg; hg pull -u | log_commits
pankso@4 488 new=$(hg head --template '{rev}\n')
paul@168 489 # Store last rev to be used by CGI so it doesn't need to call hg head
pankso@164 490 # on each load.
slaxemulator@488 491 echo "$new" > $wokrev
pankso@383 492
paul@54 493 # Sync build wok with rsync so we don't take care about removing old
pankso@4 494 # files as before.
pankso@4 495 if [ "$new" -gt "$cur" ]; then
pankso@4 496 echo "Changes found from: $cur to $new" | log
al@728 497 echo 'Syncing build wok with Hg wok...' | log_commits
al@728 498 rsync -r -t -c -l -u -v -D -E $wok-hg/ $wok/ | \
pankso@35 499 sed '/^$/'d | log_commits
pankso@4 500 else
pankso@13 501 echo "No revision changes: $cur vs $new" | log
pankso@14 502 separator | log_commits
al@728 503 clean_exit; newline
al@728 504 exit 0
pankso@4 505 fi
pankso@383 506
pankso@35 507 # Get and display modifications.
al@728 508 cd $wok-hg
pankso@110 509 commits_summary | log_commits
pankso@14 510 cur=$(($cur + 1))
al@728 511 rm -f $commits.tmp; touch $commits.tmp
al@728 512 for rev in $(seq $cur $new); do
al@728 513 for file in $(hg log --rev=$rev --template "{files}"); do
al@728 514 pkg=$(echo $file | cut -d/ -f1)
pankso@36 515 desc=$(hg log --rev=$rev --template "{desc}" $file)
paul@388 516 echo "Committed package : $pkg - $desc" | log_commits
pankso@80 517 echo $pkg >> $commits.tmp
pankso@4 518 done
pankso@4 519 done
pankso@248 520
pankso@248 521 # We may have deleted packages and files in stuff/. Remove it and
pankso@248 522 # clean DB as well as log file.
pankso@248 523 cd $wok
al@728 524 for pkg in *; do
pankso@248 525 if [ ! -d "${wok}-hg/$pkg" ]; then
pankso@248 526 echo "Removing package: $pkg" | log_commits
pankso@248 527 . $wok/$pkg/receipt
pankso@248 528 rm -rf $PKGS/$PACKAGE-$VERSION* $wok/$pkg $LOGS/$pkg.log
slaxemulator@489 529 sed -i "/^${pkg}$/"d $blocked $broken $commits.tmp
pankso@248 530 fi
pankso@248 531 done
pankso@383 532
paul@54 533 # Keep previous commit and discard duplicate lines
pankso@4 534 cat $commits $commits.tmp | sed /"^$"/d > $commits.new
al@728 535 uniq $commits.new > $commits; rm $commits.*
pankso@383 536
paul@388 537 # Handle cross compilation. Create arch packages DB and remove pkgs
pankso@383 538 # not cooked for this arch from the commits list.
pankso@677 539 arch_db
al@728 540 for pkg in $(cat $commits); do
pankso@677 541 if [ ! -f "$wok/$pkg/arch.$ARCH" ]; then
pankso@677 542 echo "Cooker arch : skip $pkg (not included in: $ARCH)" | \
pankso@677 543 log_commits
pankso@677 544 sed -i "/^${pkg}$/"d $commits
pankso@677 545 else
pankso@677 546 echo "Cooker arch : $ARCH" | log_commits
pankso@677 547 fi
pankso@677 548 done
al@728 549
pankso@383 550 # Stats
pankso@109 551 pkgs=$(cat $commits | wc -l)
pankso@100 552 echo "Packages to cook: $pkgs" | log
pankso@109 553 echo "Packages to cook : $pkgs" | log_commits
pankso@35 554 separator | log_commits
slaxemulator@486 555 newline
pankso@14 556 strip_blocked
pankso@14 557 cook_order | tee $LOGS/cookorder.log
pankso@81 558 cook_commits
pankso@81 559 clean_exit ;;
pankso@4 560 esac
pankso@4 561
pankso@4 562 exit 0