summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-03-10 10:17:33 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-04-24 10:24:08 +0000
commitfe15d7e8386cf571fbce39b7c92c43fff8b8c667 (patch)
treeb573314b93df602f0c9fbf1d915ba5e79f442094
parent3d877091c9971ee5c5bd902bcdbf73fd8b08e001 (diff)
downloadmorph-fe15d7e8386cf571fbce39b7c92c43fff8b8c667.tar.gz
Calculate the build graph in worker-build
Calculate the build graph and find the artifact which is referred to by the ArtifactReference which was deserialised. Change-Id: Icbef90932979fc1a18daf0dedac16f4429f56349
-rw-r--r--morphlib/plugins/distbuild_plugin.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/morphlib/plugins/distbuild_plugin.py b/morphlib/plugins/distbuild_plugin.py
index 8aaead10..09669988 100644
--- a/morphlib/plugins/distbuild_plugin.py
+++ b/morphlib/plugins/distbuild_plugin.py
@@ -113,7 +113,9 @@ class SerialiseArtifactPlugin(cliapp.Plugin):
srcpool = build_command.create_source_pool(
repo_name, ref, filename, original_ref=original_ref)
artifact = build_command.resolve_artifacts(srcpool)
- self.app.output.write(distbuild.serialise_artifact(artifact))
+ self.app.output.write(distbuild.serialise_artifact(artifact,
+ repo_name,
+ ref))
self.app.output.write('\n')
@@ -137,9 +139,14 @@ class WorkerBuild(cliapp.Plugin):
distbuild.add_crash_conditions(self.app.settings['crash-condition'])
serialized = sys.stdin.readline()
- artifact = distbuild.deserialise_artifact(serialized)
-
+ artifact_reference = distbuild.deserialise_artifact(serialized)
+
bc = morphlib.buildcommand.BuildCommand(self.app)
+ source_pool = bc.create_source_pool(artifact_reference.repo,
+ artifact_reference.ref,
+ artifact_reference.root_filename)
+
+ root = bc.resolve_artifacts(source_pool)
# Now, before we start the build, we garbage collect the caches
# to ensure we have room. First we remove all system artifacts
@@ -152,8 +159,21 @@ class WorkerBuild(cliapp.Plugin):
self.app.subcommands['gc']([])
- arch = artifact.arch
- bc.build_source(artifact.source, bc.new_build_env(arch))
+ source = self.find_source(source_pool, artifact_reference)
+ build_env = bc.new_build_env(artifact_reference.arch)
+ bc.build_source(source, build_env)
+
+ def find_source(self, source_pool, artifact_reference):
+ for s in source_pool.lookup(artifact_reference.source_repo,
+ artifact_reference.source_ref,
+ artifact_reference.filename):
+ if s.cache_key == artifact_reference.cache_key:
+ return s
+ for s in source_pool.lookup(artifact_reference.source_repo,
+ artifact_reference.source_sha1,
+ artifact_reference.filename):
+ if s.cache_key == artifact_reference.cache_key:
+ return s
def is_system_artifact(self, filename):
return re.match(r'^[0-9a-fA-F]{64}\.system\.', filename)