{veyron,scripts}: removing the REPO_ROOT logic from veyron build and
test scripts

Prior to this CL, our Go build wrapper checked if it is being invoked
form within a git repository. If that was the case, the wrapper used
approximate (and currently incorrect) logic to compute the GOPATH,
shadowing a git repository in VEYRON_ROOT with the current
repository. This feature was needed for old Jenkins setup; the new
setup does not need it and this CL removes it. As a consequence, any
developers that keep multiple copies of the same repository of
VEYRON_ROOT will need to provide their own means to building code in
copies that do not have the default path (e.g. $VEYRON_ROOT/veyron).

In addition, this code removes the computation (and use) of REPO_ROOT
from a number of build and test scripts so that these scripts can be
run from outside of a git repository.

Change-Id: Ife19f8bc172bc19e809f566e6597fb4bf9b2c446
diff --git a/runtimes/google/ipc/stream/crypto/tls_generate_old.sh b/runtimes/google/ipc/stream/crypto/tls_generate_old.sh
index 0560c33..c66c2e8 100755
--- a/runtimes/google/ipc/stream/crypto/tls_generate_old.sh
+++ b/runtimes/google/ipc/stream/crypto/tls_generate_old.sh
@@ -25,8 +25,7 @@
     sed -e 's|// +build go1.4|// +build !go1.4|' |
     sed -e 's|"crypto/tls"|tls "veyron/runtimes/google/ipc/stream/crypto/tlsfork"|' >>$OUTFILE
 
-  local -r REPO_ROOT="$(git rev-parse --show-toplevel)"
-  "${REPO_ROOT}/scripts/build/go" fmt "${OUTFILE}"
+  "${VEYRON_ROOT}/veyron/scripts/build/go" fmt "${OUTFILE}"
 }
 
 main "$@"
diff --git a/services/mgmt/application/applicationd/test.sh b/services/mgmt/application/applicationd/test.sh
index 3f7206a..3b1a56f 100755
--- a/services/mgmt/application/applicationd/test.sh
+++ b/services/mgmt/application/applicationd/test.sh
@@ -9,7 +9,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/services/mgmt/application/applicationd || shell_test::fail "line ${LINENO}: failed to build 'applicationd'"
   "${GO}" build veyron/tools/application || shell_test::fail "line ${LINENO}: failed to build 'application'"
 }
diff --git a/services/mgmt/binary/binaryd/test.sh b/services/mgmt/binary/binaryd/test.sh
index 3763245..8252e36 100755
--- a/services/mgmt/binary/binaryd/test.sh
+++ b/services/mgmt/binary/binaryd/test.sh
@@ -9,7 +9,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/services/mgmt/binary/binaryd || shell_test::fail "line ${LINENO}: failed to build 'binaryd'"
   "${GO}" build veyron/tools/binary || shell_test::fail "line ${LINENO}: failed to build 'binary'"
 }
diff --git a/services/mgmt/build/buildd/test.sh b/services/mgmt/build/buildd/test.sh
index 0cfce9b..68906d5 100755
--- a/services/mgmt/build/buildd/test.sh
+++ b/services/mgmt/build/buildd/test.sh
@@ -17,7 +17,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/services/mgmt/build/buildd || shell_test::fail "line ${LINENO}: failed to build 'buildd'"
   "${GO}" build veyron/tools/build || shell_test::fail "line ${LINENO}: failed to build 'build'"
 }
diff --git a/services/mgmt/profile/profiled/test.sh b/services/mgmt/profile/profiled/test.sh
index 48c87fe..eccf535 100755
--- a/services/mgmt/profile/profiled/test.sh
+++ b/services/mgmt/profile/profiled/test.sh
@@ -10,7 +10,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/services/mgmt/profile/profiled || shell_test::fail "line ${LINENO}: failed to build 'profiled'"
   "${GO}" build veyron/tools/profile || shell_test::fail "line ${LINENO}: failed to build 'profile'"
 }
diff --git a/services/mounttable/mounttabled/test.sh b/services/mounttable/mounttabled/test.sh
index 0f447e4..c0c60d1 100755
--- a/services/mounttable/mounttabled/test.sh
+++ b/services/mounttable/mounttabled/test.sh
@@ -12,7 +12,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/services/mounttable/mounttabled || shell_test::fail "line ${LINENO}: failed to build mounttabled"
   "${GO}" build veyron/tools/mounttable || shell_test::fail "line ${LINENO}: failed to build mounttable"
 }
diff --git a/tools/identity/test.sh b/tools/identity/test.sh
index e5b4277..30e6ecc 100755
--- a/tools/identity/test.sh
+++ b/tools/identity/test.sh
@@ -11,7 +11,7 @@
 main() {
   # Build binaries.
   cd "${TMPDIR}"
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/tools/identity || shell_test::fail "line ${LINENO}: failed to build identity"
 
   ./identity print >/dev/null || shell_test::fail "line ${LINENO}: print failed"
diff --git a/tools/playground/test.sh b/tools/playground/test.sh
index ccf8d3c..214570d 100755
--- a/tools/playground/test.sh
+++ b/tools/playground/test.sh
@@ -5,7 +5,7 @@
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
 
 build() {
-  local -r GO="${REPO_ROOT}/scripts/build/go"
+  local -r GO="${VEYRON_ROOT}/veyron/scripts/build/go"
   "${GO}" build veyron/tools/identity || shell_test::fail "line ${LINENO}: failed to build 'identity'"
   "${GO}" build veyron/services/proxy/proxyd || shell_test::fail "line ${LINENO}: failed to build 'proxyd'"
   "${GO}" build veyron/services/mounttable/mounttabled || shell_test::fail "line ${LINENO}: failed to build 'mounttabled'"
@@ -36,9 +36,9 @@
   cd $(shell::tmp_dir)
   build
 
-  local -r DIR="${REPO_ROOT}/go/src/veyron/tools/playground/testdata"
+  local -r DIR="${VEYRON_ROOT}/veyron/go/src/veyron/tools/playground/testdata"
 
-  export GOPATH="$(pwd)":$VEYRON_ROOT/veyron/go
+  export GOPATH="$(pwd)":"${VEYRON_ROOT}/veyron/go"
   export PATH="$(pwd):$PATH"
 
   # Test without identities