aboutsummaryrefslogtreecommitdiff
path: root/ssh-cc.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-01-27 17:32:35 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-01-27 17:32:35 +0000
commite45ff3dd1b0602e9752ecf8e5f65a5e530050870 (patch)
treefd17820cf466100c0979b784e785b0150b797c47 /ssh-cc.sh
parent64750fea10354458fbaba896b7996ac8ad1f7203 (diff)
Reindent ssh-cc.sh
Change-Id: I2daf963e7fe401a71a546558ae6f1d8b859eec66
Diffstat (limited to 'ssh-cc.sh')
-rw-r--r--ssh-cc.sh80
1 files changed, 39 insertions, 41 deletions
diff --git a/ssh-cc.sh b/ssh-cc.sh
index a4fe7db..fc00695 100644
--- a/ssh-cc.sh
+++ b/ssh-cc.sh
@@ -5,58 +5,56 @@ set -e
cmd=$(echo "$@" | sed -e 's#"#\\"#g' -e "s#'#\\'#g")
dir=$(pwd)
-if echo $dir | grep -q @spec@/benchspec; then
- (
- flock -s 123
+if ! echo $dir | grep -q @spec@/benchspec; then
+ exec ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd"
+fi
- if [ -f @count@ ] && [ "$(cat @count@)" -gt "0" ]; then
- # Fast-track no-exclusive locking case.
- ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd"
- exit $?
- fi
+(
+ flock -s 123
- flock -x 123
+ if [ -f @count@ ] && [ "$(cat @count@)" -gt "0" ]; then
+ # Fast-track no-exclusive locking case.
+ ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd"
+ exit $?
+ fi
- touch @count@
- n=$(cat @count@)
- if [ x"$n" = x"" ]; then n="0"; fi
+ flock -x 123
- if [ x"$n" = x"0" ]; then
- rsync -e "ssh @build_port@" --rsync-path "mkdir -p $dir; rsync" -az --delete $dir/ @build_host@:$dir/
- fi
+ touch @count@
+ n=$(cat @count@)
+ if [ x"$n" = x"" ]; then n="0"; fi
- n=$(($n+1))
- echo $n > @count@
+ if [ x"$n" = x"0" ]; then
+ rsync -e "ssh @build_port@" --rsync-path "mkdir -p $dir; rsync" -az --delete $dir/ @build_host@:$dir/
+ fi
- exit 123
- ) 123>@lock@ | cat
+ n=$(($n+1))
+ echo $n > @count@
- res=${PIPESTATUS[0]}
- if [ x"$res" != x"123" ]; then
- exit $res
- fi
+ exit 123
+) 123>@lock@ | cat
- (
- flock -s 123
+res=${PIPESTATUS[0]}
+if [ x"$res" != x"123" ]; then
+ exit $res
+fi
- ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd" | cat
- res=${PIPESTATUS[0]}
+(
+ flock -s 123
- flock -x 123
+ ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd" | cat
+ res=${PIPESTATUS[0]}
- n=$(cat @count@)
- if ! [ $n -gt 0 ]; then exit 123; fi
+ flock -x 123
- n=$(($n-1))
- echo $n > @count@
+ n=$(cat @count@)
+ if ! [ $n -gt 0 ]; then exit 123; fi
- if [ x"$n" = x"0" ]; then
- rsync -e "ssh @build_port@" -az --delete @build_host@:$dir/ $dir/
- fi
- exit $res
- ) 123>@lock@
-else
- exec ssh @build_port@ @build_host@ "cd $(pwd); exec @cc_prefix@@cc@ $cmd"
-fi
+ n=$(($n-1))
+ echo $n > @count@
-exit $res
+ if [ x"$n" = x"0" ]; then
+ rsync -e "ssh @build_port@" -az --delete @build_host@:$dir/ $dir/
+ fi
+ exit $res
+) 123>@lock@