| OLD | NEW |
| 1 """ | 1 """ |
| 2 This module defines the GitKernel class | 2 This module defines the GitKernel class |
| 3 | 3 |
| 4 @author: Ryan Harper (ryanh@us.ibm.com) | 4 @author: Ryan Harper (ryanh@us.ibm.com) |
| 5 @copyright: IBM 2007 | 5 @copyright: IBM 2007 |
| 6 """ | 6 """ |
| 7 | 7 |
| 8 import os, logging | 8 import os, logging |
| 9 import git, source_kernel | 9 import git, source_kernel |
| 10 | 10 |
| 11 | 11 |
| 12 class GitKernel(git.InstallableGitRepo): | 12 class GitKernel(git.InstallableGitRepo): |
| 13 """ | 13 """ |
| 14 This class represents an installable git kernel repo. | 14 This class represents an installable git kernel repo. |
| 15 | 15 |
| 16 It is used to pull down a local copy of a git repo, check if the local repo | 16 It is used to pull down a local copy of a git repo, check if the local repo |
| 17 is up-to-date, if not update and then build the kernel from the git repo. | 17 is up-to-date, if not update and then build the kernel from the git repo. |
| 18 """ | 18 """ |
| 19 def __init__(self, repodir, giturl, weburl): | 19 def __init__(self, repodir, giturl, weburl=None): |
| 20 super(GitKernel, self).__init__(repodir, giturl, weburl) | 20 super(GitKernel, self).__init__(repodir, giturl, weburl) |
| 21 self._patches = [] | 21 self._patches = [] |
| 22 self._config = None | 22 self._config = None |
| 23 self._build = None | 23 self._build = None |
| 24 self._branch = None | 24 self._branch = None |
| 25 self._revision = None | 25 self._revision = None |
| 26 | 26 |
| 27 | 27 |
| 28 def configure(self, config): | 28 def configure(self, config): |
| 29 self._config = config | 29 self._config = config |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 """ | 89 """ |
| 90 if revision: | 90 if revision: |
| 91 self.checkout(revision) | 91 self.checkout(revision) |
| 92 self._revision = super(GitKernel, self).get_revision() | 92 self._revision = super(GitKernel, self).get_revision() |
| 93 logging.info('Checked out revision: %s', self._revision) | 93 logging.info('Checked out revision: %s', self._revision) |
| 94 | 94 |
| 95 if not builddir: | 95 if not builddir: |
| 96 self._build = os.path.join(host.get_tmp_dir(), "build") | 96 self._build = os.path.join(host.get_tmp_dir(), "build") |
| 97 logging.warning('Builddir %s is not persistent (it will be erased ' | 97 logging.warning('Builddir %s is not persistent (it will be erased ' |
| 98 'in future jobs)', self._build) | 98 'in future jobs)', self._build) |
| 99 else: |
| 100 self._build = builddir |
| 99 | 101 |
| 100 # push source to host for install | 102 # push source to host for install |
| 101 logging.info('Pushing %s to host', self.source_material) | 103 logging.info('Pushing %s to host', self.source_material) |
| 102 host.send_file(self.source_material, self._build) | 104 host.send_file(self.source_material, self._build) |
| 105 remote_source_material= os.path.join(self._build, |
| 106 os.path.basename(self.source_material)) |
| 103 | 107 |
| 104 # use a source_kernel to configure, patch, build and install. | 108 # use a source_kernel to configure, patch, build and install. |
| 105 sk = source_kernel.SourceKernel(self._build) | 109 sk = source_kernel.SourceKernel(remote_source_material) |
| 106 | 110 |
| 107 if build: | 111 if build: |
| 108 # apply patches | 112 # apply patches |
| 109 for p in self._patches: | 113 for p in self._patches: |
| 110 sk.patch(p) | 114 sk.patch(p) |
| 111 | 115 |
| 112 # configure | 116 # configure |
| 113 sk.configure(self._config) | 117 sk.configure(self._config) |
| 114 | 118 |
| 115 # build | 119 # build |
| 116 sk.build(host) | 120 sk.build(host) |
| 117 | 121 |
| 118 # install | 122 # install |
| 119 sk.install(host) | 123 sk.install(host) |
| OLD | NEW |