diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-06-01 12:53:08 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-06-03 14:57:17 +0000 |
commit | eb3eb4702c59f643dd2369514e5ade0fa7b7174a (patch) | |
tree | b93f359ad2f9238d432470521b6677c5db916518 /morphlib/sourceresolver.py | |
parent | e7027e591c4fea5235a33bbe2cda809ddbe6bbf0 (diff) | |
download | morph-eb3eb4702c59f643dd2369514e5ade0fa7b7174a.tar.gz |
sourceresolver: Pass build system directly to morphology creation
We cache based on the name, but to get the name we acutally loaded the
build system, so it's a waste of effort to cache by the name only to
reload it later.
Change-Id: Ia77e1c73d27005cd4cc6a3bb5553b44e8dfc75c1
Diffstat (limited to 'morphlib/sourceresolver.py')
-rw-r--r-- | morphlib/sourceresolver.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/morphlib/sourceresolver.py b/morphlib/sourceresolver.py index 07a0b395..150dc49b 100644 --- a/morphlib/sourceresolver.py +++ b/morphlib/sourceresolver.py @@ -348,13 +348,12 @@ class SourceResolver(object): # error. raise MorphologyNotFoundError(expected_filename) - return buildsystem.name + return buildsystem - def _create_morphology_for_build_system(self, buildsystem_name, + def _create_morphology_for_build_system(self, buildsystem, morph_name): # pragma: no cover - bs = morphlib.buildsystem.lookup_build_system(buildsystem_name) loader = morphlib.morphloader.MorphologyLoader() - morph = bs.get_morphology(morph_name) + morph = buildsystem.get_morphology(morph_name) loader.validate(morph) loader.set_commands(morph) loader.set_defaults(morph) @@ -478,7 +477,7 @@ class SourceResolver(object): morph_name): # pragma: no cover logging.debug('Caching build system for chunk with key %s', chunk_key) - self._resolved_buildsystems[chunk_key] = buildsystem + self._resolved_buildsystems[chunk_key] = buildsystem.name morphology = self._create_morphology_for_build_system(buildsystem, morph_name) @@ -511,7 +510,9 @@ class SourceResolver(object): self.status(msg='Build system for %(chunk)s is cached', chunk=str(chunk_key), chatty=True) - buildsystem = self._resolved_buildsystems[chunk_key] + buildsystem_name = self._resolved_buildsystems[chunk_key] + buildsystem = morphlib.buildsystem.lookup_build_system( + buildsystem_name) # If the build system for this chunk is cached then: # * the chunk does not have a chunk morph |