diff options
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder.py | 13 | ||||
-rw-r--r-- | morphlib/sourceresolver.py | 28 |
2 files changed, 8 insertions, 33 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index e2abee9e..eb7fdfc1 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -60,18 +60,22 @@ def extract_sources(app, definitions_version, repo_cache, repo, sha1, return tuples return [] - def extract_repo_version_8(repo, ref, extra_sources, + def extract_repo_version_8(repo, sha1, extra_sources, rootdir, destdir): app.status(msg='Extracting %(source)s into %(path)s', source=repo.original_name, path=destdir) - repo.checkout(ref, destdir) + morphlib.gitdir.checkout_from_cached_repo(repo, sha1, destdir) morphlib.git.reset_workdir(app.runcmd, destdir) for extra_source in extra_sources: - subrepo = repo_cache.get_repo(extra_source['repo']) + subref = extra_source.get('ref') path = os.path.normpath(extra_source['path']) + if not subref: + subref = repo.get_submodule_commit(sha1, path) + subrepo = repo_cache.get_updated_repo(extra_source['repo'], + subref) checkout_dir = os.path.join(destdir, path) if os.path.exists(checkout_dir): if os.listdir(checkout_dir): @@ -82,9 +86,6 @@ def extract_sources(app, definitions_version, repo_cache, repo, sha1, rootdir, path))) else: os.makedirs(checkout_dir) - subref = extra_source.get('ref') - if not subref: - subref = repo.get_submodule_commit(ref, path) extract_repo_version_8(subrepo, subref, extra_source.get('extra-sources', []), diff --git a/morphlib/sourceresolver.py b/morphlib/sourceresolver.py index a56b6594..0b6e1409 100644 --- a/morphlib/sourceresolver.py +++ b/morphlib/sourceresolver.py @@ -273,22 +273,7 @@ class SourceResolver(object): else: subref = extra_source.get('ref') if not subref: - if self.lrc.has_repo(reponame): - repo = self.lrc.get_repo(reponame) - if self.update and ( - repo.requires_update_for_ref(ref)): - self.status(msg='Updating cached git ' - 'repository %(reponame)s for ' - 'ref %(ref)s', - reponame=reponame, ref=ref) - repo.update() - else: - # TODO Add support to the cache server for - # retrieving the submodule commit from a path - self.status(msg='Updating cached git repository ' - '%(reponame)s for ref %(ref)s', - reponame=reponame, ref=ref) - repo = self.lrc.get_updated_repo(reponame, ref) + repo = self.repo_cache.get_updated_repo(reponame, ref) subref = repo.get_submodule_commit( ref, extra_source['path']) _, tree = self._resolve_ref(resolved_trees, @@ -540,17 +525,6 @@ def create_source_pool(repo_cache, repo, ref, filenames, def add_to_pool(reponame, ref, filename, absref, tree, morphology, predefined_split_rules, subtrees): - # If there are duplicate chunks which have the same 'name' and the - # same build instructions, we might cause a stack overflow in - # cachekeycomputer.py when trying to hash the build graph. The - # _find_duplicate_chunks() function doesn't handle this case, it - # is checking for duplicates with the same name but different build - # instructions. - if morphology['kind'] != 'stratum': - if pool.lookup(reponame, ref, filename): - raise morphlib.Error( - "There are multiple versions of component '%s'" % - morphology['name']) sources = morphlib.source.make_sources( reponame, ref, filename, absref, tree, morphology, |