3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by scripts/Create-CopyPatch.
6 # T2 SDE: scripts/Build-Job
7 # Copyright (C) 2004 - 2020 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 ROCK Linux Project
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- T2-COPYRIGHT-NOTE-END ---
29 config
=$2; shift; shift ;;
31 echo "Usage: $0 [ -cfg config ] { -daemon | job(s) }"
38 .
scripts
/parse-config
39 qdir
="build/$SDECFG_ID/TOOLCHAIN/queue"
41 build_logs
="build/$SDECFG_ID/TOOLCHAIN/logs"
42 mkdir
-p "${build_logs}"
44 if [ $daemon = 1 ]; then
45 if [ -f $qdir/queue.txt
]; then
46 if [ -f $qdir/use_build_job_daemon
]; then
47 nohup
$0 -cfg $config -xdaemon > /dev
/null
&
51 echo "The build has been configured to use a command for"
52 echo "adding jobs (useing another job scheduler)."
59 echo "Queue not found! Please start 'Build-Target -cfg $config'"
60 echo "first on the master node ..."
66 if [ $xdaemon = 1 ]; then
67 echo "Writing output to $build_logs/build_job_${HOSTNAME}_$$.log." >&2
68 exec > "$build_logs/build_job_${HOSTNAME}_$$.log" 2>&1 < /dev
/null
70 echo -e "Build-Job (daemon mode)\trunning on ${HOSTNAME} with PID $$" \
71 > "$qdir/build_job_${HOSTNAME}_$$.stat"
72 date "+%H:%M ${HOSTNAME} new build-job daemon with PID $$" \
75 while [ -f $qdir/queue.txt
-a -f $qdir/use_build_job_daemon
-a \
76 -f "$qdir/build_job_${HOSTNAME}_$$.stat" ]; do
78 while read next
&& [ "$next" ]; do
79 set $next; qid
="$1-$6"
80 if [ -f $qdir/$qid.job
-a ! -f $qdir/$qid.lock
]; then
84 done < $qdir/queue.txt
85 [ $didsomething = 1 ] ||
sleep 3
88 rm -f "$qdir/build_job_${HOSTNAME}_$$.stat"
89 if [ -f $qdir/queue.txt
]; then
90 date "+%H:%M ${HOSTNAME}%tbuild-job daemon ended ($$)" \
93 echo "Queue has been removed. exit now."
98 if [ -f $qdir/$qid.job
]; then
99 if ! mv $qdir/$qid.todo
$qdir/$qid.lock
2> /dev
/null
; then
100 echo "Job locked by other build proc:" \
101 "$qid ($qdir/$qid.lock)!"
106 date "+Job $qid%t$HOSTNAME ($PPID) since %H:%M %Y-%m-%d" \
108 date "+%H:%M ${HOSTNAME}:%tbuilding job '$qid' ($PPID) .." \
110 pkgloop_package
$next
111 if [ -f "${build_root}/var/adm/logs/$qid.log" ]; then
112 date "+%H:%M ${HOSTNAME}:%tfinished job '$qid' `
113 `(ok)" >> $qdir/3_
$qid.msg
115 date "+%H:%M ${HOSTNAME}:%tfinished job '$qid' `
116 `(ERROR)" >> $qdir/3_
$qid.msg
118 rm -f $qdir/$qid.lock
$qdir/$qid.job
120 echo "No such job: $qid ($qdir/$qid.job)!"; exit 1