| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 """Set of utilities to build the chromium master.""" | 5 """Set of utilities to build the chromium master.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 from buildbot.steps import trigger, shell | 9 from buildbot.steps import trigger, shell |
| 10 from buildbot.process.properties import WithProperties | 10 from buildbot.process.properties import WithProperties |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 Args: | 77 Args: |
| 78 repo: ssh: uri for the repo to be checked out | 78 repo: ssh: uri for the repo to be checked out |
| 79 patch: object with url and ref to patch on top | 79 patch: object with url and ref to patch on top |
| 80 """ | 80 """ |
| 81 git_bin = '/usr/bin/git' | 81 git_bin = '/usr/bin/git' |
| 82 git_checkout_dir = os.path.basename(repo).replace('.git', '') | 82 git_checkout_dir = os.path.basename(repo).replace('.git', '') |
| 83 clear_and_clone_cmd = 'rm -rf %s ; sleep 10 ;' % git_checkout_dir | 83 clear_and_clone_cmd = 'rm -rf %s ; sleep 10 ;' % git_checkout_dir |
| 84 clear_and_clone_cmd += '%s clone %s;cd %s;' % (git_bin, repo, | 84 clear_and_clone_cmd += '%s clone %s;cd %s;' % (git_bin, repo, |
| 85 git_checkout_dir) | 85 git_checkout_dir) |
| 86 # It's possible that branch can be coming from WithProperites set | |
| 87 # If the branch is master, then even if the branch is empty, it amounts | |
| 88 # to the same 'git checkout' or 'git checkout master' | |
| 89 # If self.branch is set to something otherthan master, that means, branch | |
| 90 # has been passed in and we want to honor the explicitly passed in branch | |
| 91 clear_and_clone_cmd += '%s checkout ' % git_bin | |
| 92 if self.branch == 'master': | |
| 93 clear_and_clone_cmd += '%(branch)s' | |
| 94 else: | |
| 95 clear_and_clone_cmd += self.branch | |
| 96 | 86 |
| 87 # We ignore branches coming from buildbot triggers and rely on those in the |
| 88 # config. This is because buildbot branch names do not match up with |
| 89 # cros builds. |
| 90 clear_and_clone_cmd += '%s checkout %s' % (git_bin, self.branch) |
| 97 msg = 'Clear and Clone %s' % git_checkout_dir | 91 msg = 'Clear and Clone %s' % git_checkout_dir |
| 98 if patch: | 92 if patch: |
| 99 clear_and_clone_cmd += ('; %s pull %s %s' % | 93 clear_and_clone_cmd += ('; %s pull %s %s' % |
| 100 (git_bin, patch['url'], patch['ref'])) | 94 (git_bin, patch['url'], patch['ref'])) |
| 101 msg = 'Clear, Clone and Patch %s' % git_checkout_dir | 95 msg = 'Clear, Clone and Patch %s' % git_checkout_dir |
| 102 | 96 |
| 103 self.f_cbuild.addStep(shell.ShellCommand, | 97 self.f_cbuild.addStep(shell.ShellCommand, |
| 104 command=WithProperties(clear_and_clone_cmd), | 98 command=clear_and_clone_cmd, |
| 105 name=msg, | 99 name=msg, |
| 106 description=msg) | 100 description=msg) |
| 107 | 101 |
| 108 def add_bootstrap_steps(self): | 102 def add_bootstrap_steps(self): |
| 109 """Bootstraps Chromium OS Build by syncing pre-requisite repositories. | 103 """Bootstraps Chromium OS Build by syncing pre-requisite repositories. |
| 110 | 104 |
| 111 * gclient sync of /b | 105 * gclient sync of /b |
| 112 * clearing of chromite[& crostools] | 106 * clearing of chromite[& crostools] |
| 113 * clean checkout of chromite[& crostools] | 107 * clean checkout of chromite[& crostools] |
| 114 """ | 108 """ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 self.f_cbuild.addStep(chromium_step.AnnotatedCommand, | 162 self.f_cbuild.addStep(chromium_step.AnnotatedCommand, |
| 169 command=cmd, | 163 command=cmd, |
| 170 timeout=self.timeout, | 164 timeout=self.timeout, |
| 171 name='cbuildbot', | 165 name='cbuildbot', |
| 172 description=description, | 166 description=description, |
| 173 usePTY=False) | 167 usePTY=False) |
| 174 | 168 |
| 175 def get_factory(self): | 169 def get_factory(self): |
| 176 """Returns the produced factory.""" | 170 """Returns the produced factory.""" |
| 177 return self.f_cbuild | 171 return self.f_cbuild |
| OLD | NEW |