summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-01-24 12:05:41 +0000
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-01-24 16:29:20 +0000
commitac5354b6036437491cf53b499d0cc78190684524 (patch)
tree6fe713bf9aaafe46e5c8f154c51afc62375ca4ae
parent4902be114547b6292f1d60e5dcbf25c169f77346 (diff)
downloadybd-wip-150.tar.gz
WIP fix for #150wip-150
-rw-r--r--ybd/assembly.py26
-rw-r--r--ybd/cache.py14
2 files changed, 17 insertions, 23 deletions
diff --git a/ybd/assembly.py b/ybd/assembly.py
index 5ef9c1e..2a84ef1 100644
--- a/ybd/assembly.py
+++ b/ybd/assembly.py
@@ -80,32 +80,34 @@ def assemble(defs, target):
for subsystem in system.get('subsystems', []):
assemble(defs, subsystem)
- dependencies = component.get('build-depends', [])
- for it in dependencies:
- preinstall(defs, component, it)
-
contents = component.get('contents', [])
random.shuffle(contents)
for it in contents:
- subcomponent = defs.get(it)
- if subcomponent.get('build-mode', 'staging') != 'bootstrap':
- preinstall(defs, component, subcomponent)
+ sub = defs.get(it)
+ assemble(defs, sub)
+ if sub.get('build-mode', 'staging') != 'bootstrap':
+ sandbox.install(defs, component, sub, component['install'])
if 'systems' not in component and not get_cache(defs, component):
+ dependencies = component.get('build-depends', [])
+ for it in dependencies:
+ preinstall(defs, component, it)
+
if app.config.get('instances', 1) > 1:
with claim(defs, component):
# in here, exceptions get eaten
- do_build(defs, component)
+ build_and_cache(defs, component)
else:
# in here, exceptions do not get eaten
- do_build(defs, component)
+ build_and_cache(defs, component)
app.remove_dir(component['sandbox'])
return cache_key(defs, component)
-def do_build(defs, component):
+def build_and_cache(defs, component):
+ # build an individual component and create its artifact
app.config['counter'].increment()
with app.timer(component, 'build of %s' % component['cache']):
build(defs, component)
@@ -154,11 +156,11 @@ def preinstall(defs, component, it):
preinstall(defs, component, it)
assemble(defs, dependency)
- sandbox.install(defs, component, dependency)
+ sandbox.install(defs, component, dependency, component['sandbox'])
def build(defs, this):
- '''Actually create an artifact and add it to the cache
+ '''Build an artifact in a sandbox.
This is what actually runs ./configure, make, make install (for example)
By the time we get here, all dependencies for 'this' have been assembled.
diff --git a/ybd/cache.py b/ybd/cache.py
index fb44af7..ab471e9 100644
--- a/ybd/cache.py
+++ b/ybd/cache.py
@@ -100,17 +100,9 @@ def cache(defs, this):
tempfile.tempdir = app.config['tmp']
tmpdir = tempfile.mkdtemp()
cachefile = os.path.join(tmpdir, cache_key(defs, this))
- if this.get('kind') == "system":
- utils.hardlink_all_files(this['install'], this['sandbox'])
- shutil.rmtree(this['install'])
- shutil.rmtree(this['build'])
- utils.set_mtime_recursively(this['sandbox'])
- utils.make_deterministic_tar_archive(cachefile, this['sandbox'])
- os.rename('%s.tar' % cachefile, cachefile)
- else:
- utils.set_mtime_recursively(this['install'])
- utils.make_deterministic_gztar_archive(cachefile, this['install'])
- os.rename('%s.tar.gz' % cachefile, cachefile)
+ utils.set_mtime_recursively(this['install'])
+ utils.make_deterministic_gztar_archive(cachefile, this['install'])
+ os.rename('%s.tar.gz' % cachefile, cachefile)
unpack(defs, this, cachefile)