summaryrefslogtreecommitdiff
path: root/morphlib/buildcommand.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-02-19 16:48:13 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-02-19 17:17:20 +0000
commit55031ffdb1e29cf5e97407dc220d9de0ee6e3707 (patch)
treec464e7fd2525ff39ddad8da5ded1c1da64151d4a /morphlib/buildcommand.py
parent46d42eb7f183ac37c2f1209c3c733fc3bc348e1a (diff)
downloadmorph-55031ffdb1e29cf5e97407dc220d9de0ee6e3707.tar.gz
Stop computing the old build ordering
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r--morphlib/buildcommand.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index c12735bb..34a3e291 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -75,12 +75,6 @@ class BuildCommand(object):
def get_artifact_object(self, repo_name, ref, filename):
'''Create an Artifact object representing the given triplet.'''
- order = self._compute_build_order(repo_name, ref, filename)
- artifact = order.groups[-1][-1]
- return artifact
-
- def _compute_build_order(self, repo_name, ref, filename):
- '''Compute build order for a triplet.'''
self.app.status(msg='Figuring out the right build order')
self.app.status(msg='Creating source pool', chatty=True)
@@ -103,9 +97,9 @@ class BuildCommand(object):
artifact.cache_id = self.ckc.get_cache_id(artifact)
self.app.status(msg='Computing build order', chatty=True)
- order = morphlib.buildorder.BuildOrder(artifacts)
+ root_artifact = self._find_root_artifact(artifacts)
- return order
+ return root_artifact
def _validate_cross_morphology_references(self, srcpool):
'''Perform validation across all morphologies involved in the build'''
@@ -165,6 +159,21 @@ class BuildCommand(object):
other.morphology['kind'],
wanted))
+ def _find_root_artifact(self, artifacts):
+ '''Find the root artifact among a set of artifacts in a DAG.
+
+ There can be only one.
+
+ '''
+
+ maybe = set(artifacts)
+ for a in artifacts:
+ for dep in a.dependencies:
+ if dep in maybe:
+ maybe.remove(dep)
+ assert len(maybe) == 1
+ return maybe.pop()
+
def build_in_order(self, artifact):
'''Build everything specified in a build order.'''
self.app.status(msg='Building according to build ordering',