diff options
-rwxr-xr-x | morphlib/app.py | 12 | ||||
-rw-r--r-- | morphlib/morphologyfactory.py | 13 |
2 files changed, 12 insertions, 13 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 5d5a2039..64c1b6b7 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -476,19 +476,7 @@ class Morph(cliapp.Application): def _create_source_pool(self, lrc, rrc, triplet): pool = morphlib.sourcepool.SourcePool() - def check_stratum(filename, morphology): - for source in morphology['sources']: - if source.get('build-depends', None) is None: - name = source.get('name', source.get('repo', 'unknown')) - raise morphlib.Error('No build dependencies ' - 'stratum %s for chunk %s ' - '(build-depends is a mandatory ' - 'field)' % - (filename, name)) - def add_to_pool(reponame, ref, filename, absref, morphology): - if morphology['kind'] == 'stratum': - check_stratum(filename, morphology) source = morphlib.source.Source(reponame, ref, absref, morphology, filename) pool.add(source) diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py index 6f9915fb..c84acd52 100644 --- a/morphlib/morphologyfactory.py +++ b/morphlib/morphologyfactory.py @@ -45,7 +45,18 @@ class MorphologyFactory(object): text = self._cat_text(reponame, sha1, filename) except: text = self._autodetect_text(reponame, sha1, filename) - return morphlib.morph2.Morphology(text) + + morphology = morphlib.morph2.Morphology(text) + if morphology['kind'] == 'stratum': #pragma: no cover + for source in morphology['sources']: + if source.get('build-depends', None) is None: + name = source.get('name', source.get('repo', 'unknown')) + raise morphlib.Error('No build dependencies ' + 'stratum %s for chunk %s ' + '(build-depends is a mandatory ' + 'field)' % + (filename, name)) + return morphology def _cat_text(self, reponame, sha1, filename): if self._lrc.has_repo(reponame): |