cookutils annotate lib/libcook.sh @ rev 1076

lighttpd/index.cgi: show icon for all sub-packages (like *-dev, etc.); better handle "debug" query; fix display commits.log
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Jun 12 01:38:59 2018 +0300 (2018-06-12)
parents dc6b6e10da97
children e58a083722aa
rev   line source
pankso@422 1 #!/bin/sh
pankso@422 2 #
pankso@422 3 # Cook library - Shared configs and functions between cook, the cooker and
paul@647 4 # cookiso. Read the README before adding or modifying any code in libcook.sh!
pankso@422 5 #
pankso@422 6 # Copyright (C) SliTaz GNU/Linux - GNU gpl v3
pankso@422 7 # Author: Christophe Lincoln <pankso@slitaz.org>
pankso@422 8 #
pankso@422 9 . /lib/libtaz.sh
pankso@422 10 . /usr/lib/slitaz/libpkg.sh
pankso@422 11 . /etc/slitaz/slitaz.conf
pankso@422 12
al@728 13
paul@647 14 # System wide config can be overwritten by a cook.conf in current path.
al@728 15
pankso@422 16 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
pankso@422 17 [ -f "cook.conf" ] && . ./cook.conf
pankso@431 18
al@728 19
pankso@431 20 # Shared DB between Cook, the Cooker and Cookiso.
pankso@431 21 # In cookiso: repo= --> flavors
al@728 22
al@728 23 if [ "$(basename $0)" = 'cookiso' ]; then
slaxemulator@457 24 cache="$CACHE/cookiso"
slaxemulator@457 25 #cookiso variables
slaxemulator@457 26 repo="$SLITAZ/flavors"
slaxemulator@457 27 iso="$SLITAZ/iso"
slaxemulator@457 28 rollog="$cache/rolling.log"
slaxemulator@457 29 synclog="$cache/rsync.log"
slaxemulator@457 30 else
slaxemulator@457 31 cache="$CACHE"
slaxemulator@457 32 fi
slaxemulator@457 33
pankso@431 34 flavors="$SLITAZ/flavors"
slaxemulator@457 35 activity="$cache/activity"
slaxemulator@457 36 commits="$cache/commits"
slaxemulator@457 37 cooklist="$cache/cooklist"
slaxemulator@457 38 cookorder="$cache/cookorder"
slaxemulator@457 39 command="$cache/command"
slaxemulator@457 40 blocked="$cache/blocked"
slaxemulator@457 41 broken="$cache/broken"
slaxemulator@485 42 wokrev="$cache/wokrev"
slaxemulator@457 43 cooknotes="$cache/cooknotes"
pascal@751 44 cooktime="$cache/cooktime"
pankso@431 45 crontabs="/var/spool/cron/crontabs/root"
al@942 46 tasks="$SLITAZ/tasks"
pankso@431 47
al@728 48
pankso@431 49 # Lograte activity.
al@728 50
al@1037 51 [ -s "$activity" ] && tail -n 1000 $activity > /tmp/tail-$$ && \
pankso@431 52 mv -f /tmp/tail-$$ $activity
pankso@431 53
al@728 54
pankso@431 55 # Log activities, we want first letter capitalized.
pankso@431 56 # TODO: use /lib/libtaz.sh log() but need to change all:
pankso@431 57 # echo "Message" | log --> log "Message"
al@728 58
pankso@431 59 log() {
pankso@431 60 grep ^[A-Z] | \
al@734 61 sed s"#^[A-Z]\([^']*\)#$(date -u '+%F %R') : \0#" >> $activity
pankso@431 62 }
pankso@431 63
al@728 64
pankso@431 65 # Log broken packages.
al@728 66
pankso@431 67 broken() {
pankso@431 68 if ! grep -q "^$pkg$" $broken; then
pankso@431 69 echo "$pkg" >> $broken
pankso@431 70 fi
pankso@431 71 }