| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Utility functions used by the bisect tool. | 5 """Utility functions used by the bisect tool. |
| 6 | 6 |
| 7 This includes functions related to checking out the depot and outputting | 7 This includes functions related to checking out the depot and outputting |
| 8 annotations for the Buildbot waterfall. | 8 annotations for the Buildbot waterfall. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 'testing_rsa') | 78 'testing_rsa') |
| 79 | 79 |
| 80 REPO_PARAMS = [ | 80 REPO_PARAMS = [ |
| 81 'https://chrome-internal.googlesource.com/chromeos/manifest-internal/', | 81 'https://chrome-internal.googlesource.com/chromeos/manifest-internal/', |
| 82 '--repo-url', | 82 '--repo-url', |
| 83 'https://git.chromium.org/external/repo.git' | 83 'https://git.chromium.org/external/repo.git' |
| 84 ] | 84 ] |
| 85 | 85 |
| 86 | 86 |
| 87 def OutputAnnotationStepStart(name): | 87 def OutputAnnotationStepStart(name): |
| 88 """Outputs annotation to signal the start of a step to a trybot. | 88 """Outputs annotation to signal the start of a step to a try bot. |
| 89 | 89 |
| 90 Args: | 90 Args: |
| 91 name: The name of the step. | 91 name: The name of the step. |
| 92 """ | 92 """ |
| 93 print | 93 print |
| 94 print '@@@SEED_STEP %s@@@' % name | 94 print '@@@SEED_STEP %s@@@' % name |
| 95 print '@@@STEP_CURSOR %s@@@' % name | 95 print '@@@STEP_CURSOR %s@@@' % name |
| 96 print '@@@STEP_STARTED@@@' | 96 print '@@@STEP_STARTED@@@' |
| 97 print | 97 print |
| 98 sys.stdout.flush() | 98 sys.stdout.flush() |
| 99 | 99 |
| 100 | 100 |
| 101 def OutputAnnotationStepClosed(): | 101 def OutputAnnotationStepClosed(): |
| 102 """Outputs annotation to signal the closing of a step to a trybot.""" | 102 """Outputs annotation to signal the closing of a step to a try bot.""" |
| 103 print | 103 print |
| 104 print '@@@STEP_CLOSED@@@' | 104 print '@@@STEP_CLOSED@@@' |
| 105 print | 105 print |
| 106 sys.stdout.flush() | 106 sys.stdout.flush() |
| 107 | 107 |
| 108 | 108 |
| 109 def OutputAnnotationStepLink(label, url): | 109 def OutputAnnotationStepLink(label, url): |
| 110 """Outputs appropriate annotation to print a link. | 110 """Outputs appropriate annotation to print a link. |
| 111 | 111 |
| 112 Args: | 112 Args: |
| 113 label: The name to print. | 113 label: The name to print. |
| 114 url: The url to print. | 114 url: The URL to print. |
| 115 """ | 115 """ |
| 116 print | 116 print |
| 117 print '@@@STEP_LINK@%s@%s@@@' % (label, url) | 117 print '@@@STEP_LINK@%s@%s@@@' % (label, url) |
| 118 print | 118 print |
| 119 sys.stdout.flush() | 119 sys.stdout.flush() |
| 120 | 120 |
| 121 | 121 |
| 122 def LoadExtraSrc(path_to_file): | 122 def LoadExtraSrc(path_to_file): |
| 123 """Attempts to load an extra source file, and overrides global values. | 123 """Attempts to load an extra source file, and overrides global values. |
| 124 | 124 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 os.mkdir('bisect') | 165 os.mkdir('bisect') |
| 166 except OSError, e: | 166 except OSError, e: |
| 167 if e.errno != errno.EEXIST: # EEXIST indicates that it already exists. | 167 if e.errno != errno.EEXIST: # EEXIST indicates that it already exists. |
| 168 os.chdir(cwd) | 168 os.chdir(cwd) |
| 169 return False | 169 return False |
| 170 os.chdir('bisect') | 170 os.chdir('bisect') |
| 171 return True | 171 return True |
| 172 | 172 |
| 173 | 173 |
| 174 def _SubprocessCall(cmd, cwd=None): | 174 def _SubprocessCall(cmd, cwd=None): |
| 175 """Runs a subprocess with specified parameters. | 175 """Runs a command in a subprocess. |
| 176 | 176 |
| 177 Args: | 177 Args: |
| 178 params: A list of parameters to pass to gclient. | 178 cmd: The command to run. |
| 179 cwd: Working directory to run from. | 179 cwd: Working directory to run from. |
| 180 | 180 |
| 181 Returns: | 181 Returns: |
| 182 The return code of the call. | 182 The return code of the call. |
| 183 """ | 183 """ |
| 184 if os.name == 'nt': | 184 if os.name == 'nt': |
| 185 # "HOME" isn't normally defined on windows, but is needed | 185 # "HOME" isn't normally defined on windows, but is needed |
| 186 # for git to find the user's .netrc file. | 186 # for git to find the user's .netrc file. |
| 187 if not os.getenv('HOME'): | 187 if not os.getenv('HOME'): |
| 188 os.environ['HOME'] = os.environ['USERPROFILE'] | 188 os.environ['HOME'] = os.environ['USERPROFILE'] |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 return sys.platform.startswith('linux') | 590 return sys.platform.startswith('linux') |
| 591 | 591 |
| 592 | 592 |
| 593 def IsMacHost(): | 593 def IsMacHost(): |
| 594 """Checks whether or not the script is running on Mac. | 594 """Checks whether or not the script is running on Mac. |
| 595 | 595 |
| 596 Returns: | 596 Returns: |
| 597 True if running on Mac. | 597 True if running on Mac. |
| 598 """ | 598 """ |
| 599 return sys.platform.startswith('darwin') | 599 return sys.platform.startswith('darwin') |
| OLD | NEW |