Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: go/quicksetup.sh

Issue 2071243002: infra/go: Adding setup instructions and quick setup script. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« go/README.md ('K') | « go/README.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/quicksetup.sh
diff --git a/go/quicksetup.sh b/go/quicksetup.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ef983743c4ad3b670ac261cc460c2339a1aec7bf
--- /dev/null
+++ b/go/quicksetup.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+
+mkdir cr-infra-go-area
+cd cr-infra-go-area
+
+# Download depot_tools
+echo "Getting Chromium depot_tools.."
+git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
+echo
+
+echo "Fetching the infra build..."
+"$PWD/depot_tools/fetch" infra
tandrii(chromium) 2016/06/17 09:37:26 I've just tried it with existing and dirty checkou
mithro 2016/06/18 07:13:18 Done.
+
+echo "Creating enter script..."
+# Create a bashrc include file
+ENTER_SCRIPT=$PWD/enter-env.sh
+cat > $ENTER_SCRIPT <<EOF
+#!/bin/bash
+[[ "\${BASH_SOURCE[0]}" != "\${0}" ]] && SOURCED=1 || SOURCED=0
+if [ \$SOURCED = 0 ]; then
+ exec bash --init-file $ENTER_SCRIPT
+fi
+
+if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
+
+export DEPOT_TOOLS="$PWD/depot_tools"
+export PATH="\$DEPOT_TOOLS:\$PATH"
+export PS1="[cr-infra-go-area] \$PS1"
tandrii(chromium) 2016/06/17 09:37:26 very nice!
Vadim Sh. 2016/06/17 17:38:46 we should add it to go/env.py instead, probably,
mithro 2016/06/18 07:13:17 Acknowledged.
mithro 2016/06/18 07:13:18 I'm unsure the correct way to add this to go/env.p
+
+cd $PWD/infra/go
+eval \$($PWD/infra/go/env.py)
+
+echo "Entered cr-infra-go-area setup at '$PWD'"
+cd "$PWD"
+EOF
+chmod a+x $ENTER_SCRIPT
+
+# Running the env setup for the first time
+source $ENTER_SCRIPT
+
+# Output usage instructions
tandrii(chromium) 2016/06/17 09:37:26 add extra echo here, so that instruction of what t
mithro 2016/06/18 07:13:18 Done.
+if [ -d ~/bin ]; then
+ ln -sf $ENTER_SCRIPT ~/bin/cr-infra-go-area-enter
tandrii(chromium) 2016/06/17 09:37:25 can we bail instead of overwriting existing file i
Eric Burnett 2016/06/17 17:23:31 Up until here the created environment was self-con
Vadim Sh. 2016/06/17 17:38:46 +1
mithro 2016/06/18 07:13:17 Acknowledged.
mithro 2016/06/18 07:13:18 Acknowledged.
mithro 2016/06/18 07:13:18 I've added a "DO NOT MODIFY" header and changed it
+ if which cr-infra-go-area-enter; then
+ echo "Enter the environment by running 'cr-infra-go-area-enter'"
+ exit 0
+ fi
+fi
+echo "Enter the environment by running '$PWD/enter-env.sh'"
Eric Burnett 2016/06/17 17:23:31 Reference $ENTER_SCRIPT here for consistency?
mithro 2016/06/18 07:13:18 Done.
« go/README.md ('K') | « go/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698