diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-15 16:24:42 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-15 17:03:53 +0000 |
commit | d976da7db86519a4c926e89a61bf129777751861 (patch) | |
tree | ad7e8a966c4de5ed0111297a3604e45fa8a736a7 | |
parent | e5af453320253be65cafc6db71da3df2a00f7eb8 (diff) | |
download | morph-d976da7db86519a4c926e89a61bf129777751861.tar.gz |
Clarify _get_stratum_triplets code
Suggested by Richard Maw
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index ac28c5f0..e5fe52e6 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -241,7 +241,21 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): logging.debug('Saving dirty morphologies: done') def _get_stratum_triplets(self, morph): - specs = morph.get('build-depends') or morph.get('strata') or [] + # Gather all references to other strata from a morphology. The + # morphology must be either a system or a stratum one. In a + # stratum one, the refs are all for build dependencies of the + # stratum. In a system one, they're the list of strata in the + # system. + + assert morph['kind'] in ('system', 'stratum') + if morph['kind'] == 'system': + specs = morph.get('strata', []) + elif morph['kind'] == 'stratum': + specs = morph.get('build-depends', []) + + # Given a list of dicts that reference strata, return a list + # of triplets (repo url, ref, filename). + return [ (spec['repo'], spec['ref'], '%s.morph' % spec['morph']) for spec in specs |