aboutsummaryrefslogtreecommitdiff
path: root/buildos
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-06 12:43:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-06 12:43:08 +0200
commit74308ab241d265c4cf270d1758ecd85f3ea726e4 (patch)
treeebde9c9a54421a41c41f325693ed8056c98f423f /buildos
parente6b196fc6df51fe6465914a00950c03550992232 (diff)
Pass toolchain id and number to bbot agent
Diffstat (limited to 'buildos')
-rwxr-xr-xbuildos13
1 files changed, 11 insertions, 2 deletions
diff --git a/buildos b/buildos
index b0095a0..0461e68 100755
--- a/buildos
+++ b/buildos
@@ -610,9 +610,13 @@ function bbot_check () # <toolchain-name>
# Build and start bbot agent using the bpkg configuration created by
# toolchain_bootstrap().
#
-function bbot_start () # <toolchain-name>
+function bbot_start () # <toolchain-name> <toolchain-index>
{
local tn="$1"
+ local ti="$2"
+
+ local tp="${toolchains["$tn"]}"
+ local ts="$(toolchain_value "$tp" toolchain_file_csum)"
local id="/build/bbot/$tn"
mkdir -p "$id"
@@ -668,6 +672,8 @@ function bbot_start () # <toolchain-name>
-e "s/%[iI]/$tn/g" \
-e "s/^(Environment=CPU)=.*/\1=$cpu_slice/" \
-e "s/^(Environment=RAM)=.*/\1=$ram_slice/" \
+ -e "s/^(Environment=TOOLCHAIN_ID)=.*/\1=$ts/" \
+ -e "s/^(Environment=TOOLCHAIN_NUM)=.*/\1=$ti/" \
"$id/lib/systemd/system/bbot-agent@.service"
sudo ln -sf "$id/lib/systemd/system/bbot-agent@.service" \
@@ -804,8 +810,11 @@ EOF
#
if [ "${#toolchain_names[@]}" -eq "${#toolchain_boots[@]}" ]; then
+ ti=0 # Toolchain index.
for tn in "${toolchain_boots[@]}"; do
+ ti=$(($ti + 1))
+
# Skip those that failed to bootstrap.
#
if [ -z "$tn" ]; then
@@ -846,7 +855,7 @@ EOF
# Note: appending to the same log.
#
- bbot_start "$tn" 2>&1 | tee -a "$tr/bbot-$count.log" 1>&2
+ bbot_start "$tn" "$ti" 2>&1 | tee -a "$tr/bbot-$count.log" 1>&2
if [ "${PIPESTATUS[0]}" -eq 0 ]; then
s="${s}started bbot-agent@$tn"