# HG changeset patch # User Christophe Lincoln # Date 1337470843 -7200 # Node ID d9b8c75bb5bb7cc43058622b39722154e56478d4 # Parent 78bc0994b506258a758162b1f7c14ec67fe9272d move internal vars to libcook.sh and broken function diff -r 78bc0994b506 -r d9b8c75bb5bb cook --- a/cook Sun May 20 01:12:34 2012 +0200 +++ b/cook Sun May 20 01:40:43 2012 +0200 @@ -8,12 +8,6 @@ # . /usr/lib/slitaz/libcook.sh -# Share DB and status with the Cooker. -activity="$CACHE/activity" -command="$CACHE/command" -broken="$CACHE/broken" -blocked="$CACHE/blocked" - # # Functions # @@ -66,13 +60,6 @@ -e s'|\[0;39m \]||' $LOGS/$pkg.log } -# Log broken packages. -broken() { - if ! grep -q "^$pkg$" $broken; then - echo "$pkg" >> $broken - fi -} - # Be sure package exists in wok. check_pkg_in_wok() { if [ ! -d "$WOK/$pkg" ]; then @@ -134,12 +121,6 @@ done } -# Executed before sourcing a receipt. -unset_receipt() { - unset DEPENDS BUILD_DEPENDS WANTED EXTRAVERSION WGET_URL PROVIDE TARBALL - unset HOST_ARCH CROSS_BUGS -} - # Paths used in receipt and by cook itself. set_paths() { pkgdir=$WOK/$PACKAGE diff -r 78bc0994b506 -r d9b8c75bb5bb cooker --- a/cooker Sun May 20 01:12:34 2012 +0200 +++ b/cooker Sun May 20 01:40:43 2012 +0200 @@ -6,25 +6,11 @@ # here since it's not an end user tool and it's not useful, all devs should # at least understand basic English. # - -[ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf -[ -f "cook.conf" ] && . ./cook.conf +. /usr/lib/slitaz/libcook.sh # Set pkg name and use same wok as cook. pkg="$2" wok="$WOK" -flavors="$SLITAZ/flavors" - -# Cooker DB files. -activity="$CACHE/activity" -commits="$CACHE/commits" -cooklist="$CACHE/cooklist" -cookorder="$CACHE/cookorder" -command="$CACHE/command" -blocked="$CACHE/blocked" -broken="$CACHE/broken" -cooknotes="$CACHE/cooknotes" -crontabs="/var/spool/cron/crontabs/root" # PID file. pidfile='/var/run/cooker.pid' @@ -58,33 +44,12 @@ exit 0 } -separator() { - echo "================================================================================" -} - -# Lograte activity. -[ -s "$activity" ] && tail -n 60 $activity > /tmp/tail && \ - mv -f /tmp/tail $activity - -# Log activities, we want first letter capitalized. -log() { - grep ^[A-Z] | \ - sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity -} - # Some messages occur in activity but log verbose output when checking for commits # into a log file. log_commits() { sed '/^.\//'d | sed '/^.hg/'d | tee -a $LOGS/commits.log } -# Log broken packages. -broken() { - if ! grep -q "^$pkg$" $broken; then - echo "$pkg" >> $broken - fi -} - # Clean up before exit when check and cook commits finish. clean_exit() { rm -f $command && touch $command diff -r 78bc0994b506 -r d9b8c75bb5bb lib/libcook.sh --- a/lib/libcook.sh Sun May 20 01:12:34 2012 +0200 +++ b/lib/libcook.sh Sun May 20 01:40:43 2012 +0200 @@ -13,3 +13,35 @@ # System wide config can be overwriten by a cook.conf in current path. [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf [ -f "cook.conf" ] && . ./cook.conf + +# Shared DB between Cook, the Cooker and Cookiso. +# In cookiso: repo= --> flavors +flavors="$SLITAZ/flavors" +activity="$CACHE/activity" +commits="$CACHE/commits" +cooklist="$CACHE/cooklist" +cookorder="$CACHE/cookorder" +command="$CACHE/command" +blocked="$CACHE/blocked" +broken="$CACHE/broken" +cooknotes="$CACHE/cooknotes" +crontabs="/var/spool/cron/crontabs/root" + +# Lograte activity. +[ -s "$activity" ] && tail -n 60 $activity > /tmp/tail-$$ && \ + mv -f /tmp/tail-$$ $activity + +# Log activities, we want first letter capitalized. +# TODO: use /lib/libtaz.sh log() but need to change all: +# echo "Message" | log --> log "Message" +log() { + grep ^[A-Z] | \ + sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity +} + +# Log broken packages. +broken() { + if ! grep -q "^$pkg$" $broken; then + echo "$pkg" >> $broken + fi +}