summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-05-18 15:11:14 +0200
committerErich Eckner <git@eckner.net>2017-05-18 15:11:14 +0200
commit4a5612e00223059815368221e6abfb0a297127e8 (patch)
tree55c62e768ac1b010de64412bf32ddab7cea748c0
parent268ca019aeaaa8fe2c192a2d2f11cb62a64ff7cc (diff)
downloadbuilder-4a5612e00223059815368221e6abfb0a297127e8.tar.xz
bin/build-packages: add timeout option -t
-rwxr-xr-xbin/build-packages17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/build-packages b/bin/build-packages
index b960404..160b9a8 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -19,12 +19,13 @@ usage() {
>&2 echo ' -n count: Build $count packages (if available), then exit.'
>&2 echo ' $count=0 is interpreted as infinity.'
>&2 echo ' The default is $count=1.'
+ >&2 echo ' -t seconds: Do not request new assignment(s) $seconds seconds after start.'
>&2 echo ' -x: If package build fails, do not request new assignment(s).'
[ -z "$1" ] && exit 1 || exit $1
}
eval set -- "$(
- getopt -o hn:x \
+ getopt -o hn:t:x \
--long help \
-n "$(basename "$0")" -- "$@" || \
echo usage
@@ -32,6 +33,7 @@ eval set -- "$(
count=1
exit_after_failure=false
+timeout=0
while true
do
@@ -45,6 +47,10 @@ do
[ ${count} -eq 0 ] && \
count=-1
;;
+ -t)
+ shift
+ timeout="$1"
+ ;;
-x)
exit_after_failure=true
;;
@@ -65,8 +71,17 @@ if [ $# -ne 0 ]; then
usage
fi
+if [ ${timeout} -ne 0 ]; then
+ timeout=$[${timeout}+$(date +%s)]
+fi
+
while [ ${count} -ne 0 ]; do
+ if [ ${timeout} -ne 0 ] && [ ${timeout} -lt $(date +%s) ];
+ then
+ break
+ fi
+
package="$(
ssh \
-i "${master_build_server_identity}" \