diff options
author | jcgregorio <jcgregorio@google.com> | 2016-08-10 08:44:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-10 08:44:44 -0700 |
commit | 9d155afef4b562ead72b71d3a59c05b6461351df (patch) | |
tree | 419833bb9c2f9b3b0d41fe2c453fe82e10564ed7 /infra | |
parent | 3f0e6945f89036068fc3cb36f4ac9e9e0631d245 (diff) |
Package Go 1.6.2 in CIPD
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2230853003
Review-Url: https://codereview.chromium.org/2230853003
Diffstat (limited to 'infra')
-rw-r--r-- | infra/bots/assets/go/VERSION | 1 | ||||
-rwxr-xr-x | infra/bots/assets/go/common.py | 26 | ||||
-rwxr-xr-x | infra/bots/assets/go/create.py | 33 | ||||
-rwxr-xr-x | infra/bots/assets/go/create_and_upload.py | 42 | ||||
-rwxr-xr-x | infra/bots/assets/go/download.py | 16 | ||||
-rwxr-xr-x | infra/bots/assets/go/upload.py | 16 |
6 files changed, 134 insertions, 0 deletions
diff --git a/infra/bots/assets/go/VERSION b/infra/bots/assets/go/VERSION new file mode 100644 index 0000000000..c227083464 --- /dev/null +++ b/infra/bots/assets/go/VERSION @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/infra/bots/assets/go/common.py b/infra/bots/assets/go/common.py new file mode 100755 index 0000000000..4920c9b4fb --- /dev/null +++ b/infra/bots/assets/go/common.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Common vars used by scripts in this directory.""" + + +import os +import sys + +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) +INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) + +sys.path.insert(0, INFRA_BOTS_DIR) +from assets import assets + +ASSET_NAME = os.path.basename(FILE_DIR) + + +def run(cmd): + """Run a command, eg. "upload" or "download". """ + assets.main([cmd, ASSET_NAME] + sys.argv[1:]) diff --git a/infra/bots/assets/go/create.py b/infra/bots/assets/go/create.py new file mode 100755 index 0000000000..6ea94147e5 --- /dev/null +++ b/infra/bots/assets/go/create.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset.""" + + +import argparse +import subprocess + +GO_URL = "https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz" + +def create_asset(target_dir): + """Create the asset.""" + p1 = subprocess.Popen(["curl", GO_URL], stdout=subprocess.PIPE) + p2 = subprocess.Popen(["tar", "-C", target_dir, "-xzf" "-"], stdin=p1.stdout) + p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. + _,_ = p2.communicate() + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--target_dir', '-t', required=True) + args = parser.parse_args() + create_asset(args.target_dir) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/go/create_and_upload.py b/infra/bots/assets/go/create_and_upload.py new file mode 100755 index 0000000000..1356447477 --- /dev/null +++ b/infra/bots/assets/go/create_and_upload.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset and upload it.""" + + +import argparse +import common +import os +import subprocess +import sys +import utils + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--gsutil') + args = parser.parse_args() + + with utils.tmp_dir(): + cwd = os.getcwd() + create_script = os.path.join(common.FILE_DIR, 'create.py') + upload_script = os.path.join(common.FILE_DIR, 'upload.py') + + try: + subprocess.check_call(['python', create_script, '-t', cwd]) + cmd = ['python', upload_script, '-t', cwd] + if args.gsutil: + cmd.extend(['--gsutil', args.gsutil]) + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + # Trap exceptions to avoid printing two stacktraces. + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/go/download.py b/infra/bots/assets/go/download.py new file mode 100755 index 0000000000..96cc87d43f --- /dev/null +++ b/infra/bots/assets/go/download.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Download the current version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('download') diff --git a/infra/bots/assets/go/upload.py b/infra/bots/assets/go/upload.py new file mode 100755 index 0000000000..ba7fc8b6a1 --- /dev/null +++ b/infra/bots/assets/go/upload.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upload a new version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('upload') |