summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-09-10 13:17:54 +0000
committerRichard Maw <richard.maw@gmail.com>2014-09-17 15:51:10 +0000
commitb3dcb7963988e204d8d8651f006a6791b04b3cb6 (patch)
tree7f875b5d2ddcdcd86b9ad2fae3762bcaf8a3bf78
parent776961cdf1890aaed5a64cf5afb067ee86e88a80 (diff)
downloadmorph-b3dcb7963988e204d8d8651f006a6791b04b3cb6.tar.gz
Don't validate morphologies during ArtifactResolver
-rw-r--r--morphlib/artifactresolver.py30
-rw-r--r--morphlib/artifactresolver_tests.py28
2 files changed, 9 insertions, 49 deletions
diff --git a/morphlib/artifactresolver.py b/morphlib/artifactresolver.py
index 9e3cea48..49e03664 100644
--- a/morphlib/artifactresolver.py
+++ b/morphlib/artifactresolver.py
@@ -37,15 +37,6 @@ class DependencyOrderError(cliapp.AppException):
(stratum_source, chunk, dependency_name))
-class DependencyFormatError(cliapp.AppException):
-
- def __init__(self, stratum_source, chunk):
- cliapp.AppException.__init__(
- self, 'In stratum %s, chunk %s uses an invalid '
- 'build-depends format' % (stratum_source, chunk))
-
-
-
class ArtifactResolver(object):
'''Resolves sources into artifacts that would be build from the sources.
@@ -214,18 +205,15 @@ class ArtifactResolver(object):
chunk_artifact.add_dependency(other_stratum)
# Add dependencies between chunks mentioned in this stratum
- if isinstance(build_depends, list):
- for name in build_depends:
- if name not in name_to_processed_artifacts:
- raise DependencyOrderError(
- source, info['name'], name)
- other_artifacts = name_to_processed_artifacts[name]
- for other_artifact in other_artifacts:
- for ca_name in chunk_source.split_rules.artifacts:
- chunk_artifact = chunk_source.artifacts[ca_name]
- chunk_artifact.add_dependency(other_artifact)
- else:
- raise DependencyFormatError(source, info['name'])
+ for name in build_depends:
+ if name not in name_to_processed_artifacts:
+ raise DependencyOrderError(
+ source, info['name'], name)
+ other_artifacts = name_to_processed_artifacts[name]
+ for other_artifact in other_artifacts:
+ for ca_name in chunk_source.split_rules.artifacts:
+ chunk_artifact = chunk_source.artifacts[ca_name]
+ chunk_artifact.add_dependency(other_artifact)
# Add build dependencies between our stratum's artifacts
# and the chunk artifacts produced by this stratum.
diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py
index 96f7ced8..2051cbfd 100644
--- a/morphlib/artifactresolver_tests.py
+++ b/morphlib/artifactresolver_tests.py
@@ -457,34 +457,6 @@ class ArtifactResolverTests(unittest.TestCase):
self.assertRaises(morphlib.artifactresolver.DependencyOrderError,
self.resolver.resolve_artifacts, pool)
- def test_detection_of_invalid_build_depends_format(self):
- pool = morphlib.sourcepool.SourcePool()
-
- loader = morphlib.morphloader.MorphologyLoader()
- morph = loader.load_from_string(
- '''
- name: stratum
- kind: stratum
- build-depends: []
- chunks:
- - name: chunk
- repo: repo
- ref: original/ref
- build-depends: whatever
- ''')
- morph.builds_artifacts = ['stratum']
- stratum = morphlib.source.Source(
- 'repo', 'original/ref', 'sha1', 'tree', morph, 'stratum.morph')
- pool.add(stratum)
-
- morph = get_chunk_morphology('chunk')
- chunk = morphlib.source.Source(
- 'repo', 'original/ref', 'sha1', 'tree', morph, 'chunk.morph')
- pool.add(chunk)
-
- self.assertRaises(morphlib.artifactresolver.DependencyFormatError,
- self.resolver.resolve_artifacts, pool)
-
# TODO: Expand test suite to include better dependency checking, many
# tests were removed due to the fundamental change in how artifacts