aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-25 15:42:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-25 15:42:56 +0200
commit4f02d7866709d630d9e1ff09319507a1247d3d3e (patch)
treebba762a26ee64b08a0f6fa4775225fb409916865
parent45c9fbacc4b21efd54173bad11998ceffd175676 (diff)
Set network timeouts for curl, bpkg
-rwxr-xr-xbuildos19
1 files changed, 13 insertions, 6 deletions
diff --git a/buildos b/buildos
index 0845ed1..c1e6f7e 100755
--- a/buildos
+++ b/buildos
@@ -29,6 +29,13 @@ function error ()
exit 1
}
+# Network timeouts: 30 seconds to connect, 10 minutes to complete. Note that
+# the toolchain archives can be quite sizable.
+#
+curl=(curl -f -L -s -S --connect-timeout 30 --max-time 600)
+bpkg=(bpkg --fetch curl --fetch-option --connect-timeout --fetch-option 30 \
+ --fetch-option --max-time --fetch-option 600)
+
info "starting build os monitor..."
# Parse the kernel command line. This is complicated by the fact that the
@@ -529,7 +536,7 @@ function toolchain_fetch () # <toolchain-name> <line>
#
info "fetching $u [$l]"
- if ! curl -f -L -s -S -o "$tr/$f" "$u"; then
+ if ! "${curl[@]}" -o "$tr/$f" "$u"; then
info "unable to fetch $u"
return 1
fi
@@ -659,7 +666,7 @@ function bbot_check () # <toolchain-name>
l_stat="$(bpkg status libbbot)"
b_stat="$(bpkg status bbot)"
- if ! bpkg fetch -q; then
+ if ! "${bpkg[@]}" fetch -q; then
info "failed to fetch package information"
break
fi
@@ -736,8 +743,8 @@ function bbot_start () # <toolchain-name> <toolchain-index>
# Build and install the bbot agent.
#
- if ! bpkg build --build-option --jobs --build-option "$cpu_slice" \
- --yes libbbot bbot; then
+ if ! "${bpkg[@]}" --build-option --jobs --build-option "$cpu_slice" \
+ build --yes libbbot bbot; then
info "failed to build bbot-agent@$tn"
break
fi
@@ -855,7 +862,7 @@ while true; do
f="$p"
fi
- if curl -f -L -s -S -o "$f" "$tu"; then
+ if "${curl[@]}" -o "$f" "$tu"; then
# Take care of change detection.
#
@@ -1096,7 +1103,7 @@ EOF
# Fetch the current id. While normally it will be a TFTP URL, it could also
# be HTTP(S) so we configure sensible behavior for that.
#
- if id="$(curl -f -L -s -S "$buildid_url")"; then
+ if id="$("${curl[@]}" "$buildid_url")"; then
if [ "$id" != "$buildid" ]; then
email "rebooting because of new os build" <<EOF
old_buildid: $buildid