diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-08-28 15:31:29 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-08-29 15:16:28 +0100 |
commit | ecefb2d1936221ccf21cbad6db2fe73cd229f4f5 (patch) | |
tree | bdf91e898213f0daaa7d4c06598a920f096b5d79 /morphlib | |
parent | f2415383628cb22c5646d96b0e7bbfd6d0629072 (diff) | |
download | morph-ecefb2d1936221ccf21cbad6db2fe73cd229f4f5.tar.gz |
Strata contain "chunks", not "sources"
Rename "sources" field of stratum morphologies to "chunks".
Diffstat (limited to 'morphlib')
-rwxr-xr-x | morphlib/app.py | 2 | ||||
-rw-r--r-- | morphlib/artifactresolver.py | 2 | ||||
-rw-r--r-- | morphlib/artifactresolver_tests.py | 16 | ||||
-rw-r--r-- | morphlib/cachekeycomputer_tests.py | 4 | ||||
-rw-r--r-- | morphlib/morph2.py | 5 | ||||
-rw-r--r-- | morphlib/morph2_tests.py | 12 | ||||
-rw-r--r-- | morphlib/morphologyfactory.py | 2 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 8 |
8 files changed, 25 insertions, 26 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 2b848edc..5cb620eb 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -245,7 +245,7 @@ class Morph(cliapp.Application): queue.extend((reponame, ref, '%s.morph' % s) for s in morphology['build-depends']) queue.extend((c['repo'], c['ref'], '%s.morph' % c['morph']) - for c in morphology['sources']) + for c in morphology['chunks']) def _traverse_morphs(self, *args): warnings.warn('_traverse_morphs is deprecated, ' diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py index 929dae57..c6e7fbf3 100644 --- a/morphlib/artifactresolver.py +++ b/morphlib/artifactresolver.py @@ -197,7 +197,7 @@ class ArtifactResolver(object): processed_artifacts = [] name_to_processed_artifact = {} - for info in stratum.source.morphology['sources']: + for info in stratum.source.morphology['chunks']: chunk_source = self._source_pool.lookup( info['repo'], info['ref'], diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py index 5869cb27..952ffd85 100644 --- a/morphlib/artifactresolver_tests.py +++ b/morphlib/artifactresolver_tests.py @@ -56,9 +56,9 @@ class FakeStratumMorphology(morphlib.morph2.Morphology): assert(isinstance(build_depends, list)) if source_list: - sources = [] + chunks = [] for source_name, morph, repo, ref in source_list: - sources.append({ + chunks.append({ 'name': source_name, 'morph': morph, 'repo': repo, @@ -69,11 +69,11 @@ class FakeStratumMorphology(morphlib.morph2.Morphology): "name": "%s", "kind": "stratum", "build-depends": %s, - "sources": %s + "chunks": %s } ''' % (name, json.dumps(build_depends), - json.dumps(sources))) + json.dumps(chunks))) else: text = (''' { @@ -497,7 +497,7 @@ class ArtifactResolverTests(unittest.TestCase): { "name": "stratum", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk1", "repo": "repo", @@ -647,7 +647,7 @@ class ArtifactResolverTests(unittest.TestCase): { "name": "stratum", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk", "repo": "repo", @@ -701,7 +701,7 @@ class ArtifactResolverTests(unittest.TestCase): { "name": "stratum", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk1", "repo": "repo", @@ -744,7 +744,7 @@ class ArtifactResolverTests(unittest.TestCase): { "name": "stratum", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk", "repo": "repo", diff --git a/morphlib/cachekeycomputer_tests.py b/morphlib/cachekeycomputer_tests.py index 3aba2175..24cc636d 100644 --- a/morphlib/cachekeycomputer_tests.py +++ b/morphlib/cachekeycomputer_tests.py @@ -49,7 +49,7 @@ class CacheKeyComputerTests(unittest.TestCase): 'stratum.morph': '''{ "name": "stratum", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk", "repo": "repo", @@ -60,7 +60,7 @@ class CacheKeyComputerTests(unittest.TestCase): 'stratum2.morph': '''{ "name": "stratum2", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "chunk2", "repo": "repo", diff --git a/morphlib/morph2.py b/morphlib/morph2.py index ad9e1d89..d4d9fe07 100644 --- a/morphlib/morph2.py +++ b/morphlib/morph2.py @@ -31,8 +31,7 @@ class Morphology(object): ('build-commands', None), ('test-commands', None), ('install-commands', None), - ('chunks', {}), - ('sources', []), + ('chunks', []), ('strata', []), ('max-jobs', None), ('description', ''), @@ -80,7 +79,7 @@ class Morphology(object): self._set_stratum_defaults() def _set_stratum_defaults(self): - for source in self['sources']: + for source in self['chunks']: if 'repo' not in source: source['repo'] = source['name'] if 'morph' not in source: diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index bed6b918..b7d0a7c8 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -38,7 +38,7 @@ class MorphologyTests(unittest.TestCase): self.assertEqual(m['test-commands'], None) self.assertEqual(m['install-commands'], None) self.assertEqual(m['max-jobs'], None) - self.assertEqual(m['chunks'], {}) + self.assertEqual(m['chunks'], []) def test_makes_max_jobs_be_an_integer(self): m = Morphology(''' @@ -51,12 +51,12 @@ class MorphologyTests(unittest.TestCase): self.assertEqual(m['max-jobs'], 42) - def test_sets_stratum_sources_repo_and_morph_from_name(self): + def test_sets_stratum_chunks_repo_and_morph_from_name(self): m = Morphology(''' { "name": "foo", "kind": "stratum", - "sources": [ + "chunks": [ { "name": "le-chunk" } @@ -64,9 +64,9 @@ class MorphologyTests(unittest.TestCase): } ''') - self.assertEqual(m['sources'][0]['repo'], 'le-chunk') - self.assertEqual(m['sources'][0]['morph'], 'le-chunk') - self.assertEqual(m['sources'][0]['build-depends'], None) + self.assertEqual(m['chunks'][0]['repo'], 'le-chunk') + self.assertEqual(m['chunks'][0]['morph'], 'le-chunk') + self.assertEqual(m['chunks'][0]['build-depends'], None) def test_parses_system_disk_size(self): m = Morphology(''' diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py index ab56afde..a4e7b4e8 100644 --- a/morphlib/morphologyfactory.py +++ b/morphlib/morphologyfactory.py @@ -109,7 +109,7 @@ class MorphologyFactory(object): def _check_and_tweak_stratum(self, morphology, reponame, sha1, filename): '''Check and tweak a stratum morphology.''' - for source in morphology['sources']: # pragma: no cover + for source in morphology['chunks']: # pragma: no cover if source.get('build-depends', None) is None: name = source.get('name', source.get('repo', 'unknown')) raise morphlib.Error('No build dependencies ' diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index e5c5fb44..4eede82c 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -125,7 +125,7 @@ class BranchAndMergePlugin(cliapp.Plugin): def morphs_for_repo(cls, app, morphs_dirname, repo): for filename, morph in cls.load_morphologies(morphs_dirname): if morph['kind'] == 'stratum': - for spec in morph['sources']: + for spec in morph['chunks']: spec_repo = cls.resolve_reponame(app, spec['repo']) if spec_repo == repo: yield filename, morph @@ -134,7 +134,7 @@ class BranchAndMergePlugin(cliapp.Plugin): @classmethod def find_edit_ref(cls, app, morphs_dirname, repo): for filename, morph in cls.morphs_for_repo(app, morphs_dirname, repo): - for spec in morph['sources']: + for spec in morph['chunks']: spec_repo = cls.resolve_reponame(app, spec['repo']) if spec_repo == repo: return spec['ref'] @@ -168,7 +168,7 @@ class BranchAndMergePlugin(cliapp.Plugin): app.status(msg='Petrifying %(filename)s', filename=filename) - for source in morph['sources']: + for source in morph['chunks']: reponame = source.get('repo', source['name']) ref = source['ref'] app.status(msg='Looking up sha1 for %(repo_name)s %(ref)s', @@ -318,7 +318,7 @@ class BranchAndMergePlugin(cliapp.Plugin): for filename, morph in self.morphs_for_repo(app, morphs_dirname, repo): changed = False - for spec in morph['sources']: + for spec in morph['chunks']: spec_repo = self.resolve_reponame(app, spec['repo']) if spec_repo == repo and spec['ref'] != system_branch: app.status(msg='Replacing ref "%(ref)s" with "%(branch)s"' |