aboutsummaryrefslogtreecommitdiffhomepage
path: root/compile.sh
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-27 13:07:43 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-27 14:58:17 +0000
commit9f7180fc5211f9c381a57a940975390c825a7d90 (patch)
tree8cc06362fa862d3ccce8b994eca8b66f03902efb /compile.sh
parentbb5901ba0474eb2ddd035502663026bcb0c05b7c (diff)
Bootstrapping: don't use convenience symlinks
When `compile.sh` builds bazel using bazel, it copies the resulting binary to `output/bazel`. However sometimes the convenience symlink `bazel-bin` is not created, probably because an old one is still around and cannot be deleted. That is clearly a bug, but to work around it, the bootstrap builder shouldn't attempt to rely on the creation of these symlinks in the first place. This change updates compile.sh to use `bazel info` to locate the `bazel-bin` directory's real path, and attempt to copy the bazel binary from there. This works around https://github.com/bazelbuild/bazel/issues/1827 -- MOS_MIGRATED_REVID=134398451
Diffstat (limited to 'compile.sh')
-rwxr-xr-xcompile.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/compile.sh b/compile.sh
index 53fc4127b9..484b043a57 100755
--- a/compile.sh
+++ b/compile.sh
@@ -99,8 +99,13 @@ if [ $DO_COMPILE ]; then
new_step 'Building Bazel with Bazel'
display "."
log "Building output/bazel"
- bazel_build "src:bazel${EXE_EXT}"
- cp -f "bazel-bin/src/bazel${EXE_EXT}" "output/bazel${EXE_EXT}"
+ bazel_build "src:bazel${EXE_EXT}" \
+ || fail "Could not build Bazel"
+ bazel_bin_path="$(get_bazel_bin_path)/src/bazel${EXE_EXT}"
+ [ -e "$bazel_bin_path" ] \
+ || fail "Could not find freshly built Bazel binary at '$bazel_bin_path'"
+ cp -f "$bazel_bin_path" "output/bazel${EXE_EXT}" \
+ || fail "Could not copy '$bazel_bin_path' to 'output/bazel${EXE_EXT}'"
chmod 0755 "output/bazel${EXE_EXT}"
BAZEL="$(pwd)/output/bazel${EXE_EXT}"
fi