OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Common utilities for all buildbot scripts that specifically don't rely | 5 """Common utilities for all buildbot scripts that specifically don't rely |
6 on having a full chromium checkout. | 6 on having a full chromium checkout. |
7 """ | 7 """ |
8 | 8 |
9 import os | 9 import os |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 | 12 |
13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
14 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) | 14 SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) |
15 SDK_DIR = os.path.dirname(SDK_SRC_DIR) | 15 SDK_DIR = os.path.dirname(SDK_SRC_DIR) |
16 SRC_DIR = os.path.dirname(SDK_DIR) | 16 SRC_DIR = os.path.dirname(SDK_DIR) |
17 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) | 17 sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) |
18 | 18 |
19 import oshelpers | 19 import oshelpers |
20 | 20 |
| 21 def IsSDKBuilder(): |
| 22 """Returns True if this script is running on an SDK builder. |
| 23 |
| 24 False means it is either running on a trybot, or a user's machine. |
| 25 |
| 26 Trybot names: |
| 27 naclsdkm-((pnacl-)?linux|mac|windows(32|64)) |
| 28 |
| 29 Builder names: |
| 30 (pnacl-)?(windows|mac|linux)-sdk-multi(rel)? |
| 31 |
| 32 except there are currently no pnacl multirel bots, and |
| 33 pnacl-windows-sdk-multi is actually called pnacl-win-sdk-multi.""" |
| 34 return '-sdk-multi' in os.getenv('BUILDBOT_BUILDERNAME', '') |
| 35 |
| 36 |
21 def ErrorExit(msg): | 37 def ErrorExit(msg): |
22 """Write and error to stderr, then exit with 1 signaling failure.""" | 38 """Write and error to stderr, then exit with 1 signaling failure.""" |
23 sys.stderr.write(msg + '\n') | 39 sys.stderr.write(msg + '\n') |
24 sys.exit(1) | 40 sys.exit(1) |
25 | 41 |
26 | 42 |
27 def BuildStep(name): | 43 def BuildStep(name): |
28 """Annotate a buildbot build step.""" | 44 """Annotate a buildbot build step.""" |
29 sys.stdout.flush() | 45 sys.stdout.flush() |
30 print '\n@@@BUILD_STEP %s@@@' % name | 46 print '\n@@@BUILD_STEP %s@@@' % name |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 118 |
103 subprocess.check_call( | 119 subprocess.check_call( |
104 '%s cp -a public-read %s %s' % (GetGsutil(), filename, full_dst), | 120 '%s cp -a public-read %s %s' % (GetGsutil(), filename, full_dst), |
105 shell=True, | 121 shell=True, |
106 cwd=cwd) | 122 cwd=cwd) |
107 url = 'https://commondatastorage.googleapis.com/'\ | 123 url = 'https://commondatastorage.googleapis.com/'\ |
108 '%s/%s' % (bucket_path, filename) | 124 '%s/%s' % (bucket_path, filename) |
109 if step_link: | 125 if step_link: |
110 print '@@@STEP_LINK@download@%s@@@' % url | 126 print '@@@STEP_LINK@download@%s@@@' % url |
111 sys.stdout.flush() | 127 sys.stdout.flush() |
OLD | NEW |