diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-11-20 13:57:31 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-03-25 21:02:33 +0000 |
commit | ddb8b27d5056074013a89d8ab277e39fdc1f069d (patch) | |
tree | 5ecf61560608dbea1ec1895e5cff2622959556b7 /morphlib/buildcommand.py | |
parent | 9404317020ff0455cbfd3ca7976d546af823759b (diff) | |
download | morph-ddb8b27d5056074013a89d8ab277e39fdc1f069d.tar.gz |
WIP Add support for multiple sources per chunk
TODO:
- Add API to the cache server to retrieve a submodule commit from a
given path.
- Fix cross-bootstrap command.
Change-Id: I3475c2bcb648a272fee33bc878a521f79d4e6581
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index e185a808..6edd8ced 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -95,6 +95,7 @@ class BuildCommand(object): self.repo_cache, repo_name, ref, filenames, original_ref=original_ref, status_cb=self.app.status) + self.source_pool = srcpool return srcpool def validate_sources(self, srcpool): @@ -388,10 +389,28 @@ class BuildCommand(object): def fetch_sources(self, source): '''Update the local git repository cache with the sources.''' + def fetch_extra_sources(repo_cache, parent_repo, parent_ref, + extra_sources): + + for extra_source in extra_sources: + ref = extra_source.get('ref') + if not ref: + ref = parent_repo.get_submodule_commit( + parent_ref, extra_source['path']) + repo = repo_cache.get_updated_repo(extra_source['repo'], + ref=ref) + fetch_extra_sources(repo_cache, repo, ref, + extra_source.get('extra-sources', [])) + repo_name = source.repo_name source.repo = self.repo_cache.get_updated_repo(repo_name, ref=source.sha1) - self.repo_cache.ensure_submodules(source.repo, source.sha1) + if source.morphology['kind'] == 'chunk': + if self.source_pool.definitions_version >= 8: + fetch_extra_sources(self.repo_cache, source.repo, source.sha1, + source.extra_sources) + else: + self.repo_cache.ensure_submodules(source.repo, source.sha1) def cache_artifacts_locally(self, artifacts): '''Get artifacts missing from local cache from remote cache.''' @@ -537,7 +556,8 @@ class BuildCommand(object): name=source.name, sha1=source.sha1[:7]) builder = morphlib.builder.Builder( self.app, staging_area, self.lac, self.rac, self.repo_cache, - self.app.settings['max-jobs'], setup_mounts) + self.app.settings['max-jobs'], setup_mounts, + self.source_pool.definitions_version) return builder.build_and_cache(source) class InitiatorBuildCommand(BuildCommand): |