diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-02-16 18:03:40 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-02-16 18:12:45 +0000 |
commit | 78dcb991d34727e9b6b3a965d5fc91bc214a469d (patch) | |
tree | d807f228f29077911899f557583d1a24308dbdca | |
parent | 4efaa7431b29d5992bc8173e1671b657d27485a8 (diff) | |
download | morph-78dcb991d34727e9b6b3a965d5fc91bc214a469d.tar.gz |
squash! WIP: remove artifact serialisation from distbuild
Conflicts:
morphlib/buildcommand.py
morphlib/plugins/distbuild_plugin.py
-rw-r--r-- | distbuild/worker_build_scheduler.py | 25 | ||||
-rw-r--r-- | morphlib/buildcommand.py | 12 | ||||
-rw-r--r-- | morphlib/plugins/distbuild_plugin.py | 11 |
3 files changed, 25 insertions, 23 deletions
diff --git a/distbuild/worker_build_scheduler.py b/distbuild/worker_build_scheduler.py index 833d5587..64a547cc 100644 --- a/distbuild/worker_build_scheduler.py +++ b/distbuild/worker_build_scheduler.py @@ -276,7 +276,8 @@ class WorkerBuildQueuer(distbuild.StateMachine): self.mainloop.queue_event(WorkerConnection, progress) else: logging.debug('WBQ: Creating job for: %s' % event.artifact.name) - job = self._jobs.create(event.root_artifact, event.artifact, event.initiator_id) + job = self._jobs.create(event.root_artifact, event.artifact, + event.initiator_id) if self._available_workers: self._give_job(job) @@ -476,26 +477,27 @@ class WorkerConnection(distbuild.StateMachine): '--build-log-on-stdout', ] - repo = job.root_artifact.repo_name - original_ref = job.root_artifact.original_ref - sha1 = job.root_artifact.sha1 - system_morph = job.root_artifact.filename + repo = job.root_artifact.source.repo_name + original_ref = job.root_artifact.source.original_ref + sha1 = job.root_artifact.source.sha1 + system_morph = job.root_artifact.source.filename - argv.extend([definitions_repo, repo, original_ref, sha1, system_morph]) + argv.extend([repo, original_ref, sha1, system_morph]) def find_stratum_for_chunk_artifact(root_artifact, chunk): # FIXME: This is horribly inefficient. strata = {a.source for a in root_artifact.walk() - if a.source.kind == 'source'} + if a.source.morphology['kind'] == 'stratum'} for stratum in strata: for dep in stratum.dependencies: - if dep.source.kind == 'chunk' and dep.source == chunk: - return stratum + if dep.source.morphology['kind'] == 'chunk': + if dep.source == chunk.source: + return stratum raise KeyError('Didn\'t find stratum for chunk %s' % chunk) - if job.artifact.source.kind == 'stratum': + if job.artifact.source.morphology['kind'] == 'stratum': argv.append(job.artifact.source.name) - elif job.artifact.source.kind == 'chunk': + elif job.artifact.source.morphology['kind'] == 'chunk': stratum = find_stratum_for_chunk_artifact(job.root_artifact, job.artifact) argv.append(stratum.name) @@ -504,6 +506,7 @@ class WorkerConnection(distbuild.StateMachine): msg = distbuild.message('exec-request', id=self._job.id, argv=argv, + stdin_contents='', ) self._jm.send(msg) diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 45101d2c..613a5c4a 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -312,6 +312,12 @@ class BuildCommand(object): artifacts = source.artifacts.values() return all(self.lac.has(artifact) for artifact in artifacts) + # TEMPORARY!!!!: stub out the build and return + for basename in source.files(): + with self.lac.put_file(basename) as f: + f.write('Nonsense data.\n') + return + if not artifacts_available_locally(source) and self.rac: self.maybe_cache_artifacts_locally(source) @@ -340,12 +346,6 @@ class BuildCommand(object): deps = morphlib.artifact.find_all_deps(source.artifacts.values()) - # TEMPORARY!!!!: stub out the build and return - for basename in source.files(): - with self.lac.put_file(basename) as f: - f.write('Nonsense data.\n') - return - use_chroot = False setup_mounts = False if source.morphology['kind'] == 'chunk': diff --git a/morphlib/plugins/distbuild_plugin.py b/morphlib/plugins/distbuild_plugin.py index c5dd3718..62e7cb77 100644 --- a/morphlib/plugins/distbuild_plugin.py +++ b/morphlib/plugins/distbuild_plugin.py @@ -17,9 +17,7 @@ import cliapp -import logging import re -import sys import morphlib import distbuild @@ -112,12 +110,13 @@ class WorkerBuild(cliapp.Plugin): srcpool = bc.create_source_pool(repo_name, sha1, system_morph, original_ref=original_ref) bc.validate_sources(srcpool) - root_artifact = self.resolve_artifacts(srcpool) + root_artifact = bc.resolve_artifacts(srcpool) def find_source(tree, kind, name): for a in tree.walk(): - if a.source.kind == kind and a.source.name == name: - return a + if a.source.morphology['kind'] == kind: + if a.source.name == name: + return a.source raise KeyError( 'Didn\'t find %s name %s in build graph.' % (kind, name)) @@ -140,7 +139,7 @@ class WorkerBuild(cliapp.Plugin): #self.app.subcommands['gc']([]) self.app.status(msg='NAME: %s' % to_build.source.name) - arch = artifact.arch + arch = root_artifact.source.morphology['arch'] bc.cache_or_build_source(to_build, bc.new_build_env(arch)) def is_system_artifact(self, filename): |