diff options
author | Javier Jardón <jjardon@gnome.org> | 2017-06-14 14:27:49 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2017-06-14 14:27:49 +0000 |
commit | d0965e1da7b870632213147bc978575aaa1fbf62 (patch) | |
tree | 03648a14f8ea0ed553f0372d76e90e6c99b46057 | |
parent | d5de74dc94e7862abc294ea498adfcf82b11751c (diff) | |
parent | 9a4fbecf3abcf6510cbf43c6e3372e543c60be41 (diff) | |
download | ybd-d0965e1da7b870632213147bc978575aaa1fbf62.tar.gz |
Merge branch 'benbrown/rpm-strata-chunks' into 'master'
Allow generation of rpms from chunks/strata
Closes #259
See merge request !367
-rwxr-xr-x | ybd/__main__.py | 2 | ||||
-rw-r--r-- | ybd/assembly.py | 29 | ||||
-rw-r--r-- | ybd/rpm.py | 35 |
3 files changed, 24 insertions, 42 deletions
diff --git a/ybd/__main__.py b/ybd/__main__.py index 926a589..4e47f38 100755 --- a/ybd/__main__.py +++ b/ybd/__main__.py @@ -133,7 +133,7 @@ with timer('TOTAL'): if not isinstance(whitelist, list): whitelist = None - if target['kind'] == 'system': + if target['kind'] in ('system', 'stratum', 'chunk'): package_rpms(target, whitelist) elif target['kind'] == 'cluster': # call package_rpms for each system in the cluster diff --git a/ybd/assembly.py b/ybd/assembly.py index c818c8c..9699d6e 100644 --- a/ybd/assembly.py +++ b/ybd/assembly.py @@ -70,13 +70,13 @@ def compose(dn): compose(system['path']) with sandbox.setup(dn): - install_contents(dn) + install_contents(dn, compose) build(dn) # bring in 'build-depends', and run make return cache_key(dn) -def install_contents(dn, contents=None): +def install_contents(dn, cache_handler=None, contents=None): ''' Install contents (recursively) into dn['sandbox'] ''' if contents is None: @@ -94,11 +94,14 @@ def install_contents(dn, contents=None): continue for i in item.get('contents', []): - install_contents(dn, [i]) + install_contents(dn, cache_handler, [i]) if item.get('build-mode', 'staging') != 'bootstrap': - if not get_cache(item): - compose(item) + if not get_cache(item) and cache_handler: + cache_handler(item) + elif not get_cache(item): + log(dn, "%s is not cached, unable to create staging area" % + item['name'], exit=True) sandbox.install(dn, item) if config.get('log-verbose'): @@ -106,7 +109,7 @@ def install_contents(dn, contents=None): sandbox.list_files(dn) -def install_dependencies(dn, dependencies=None): +def install_dependencies(dn, cache_handler=None, dependencies=None): '''Install recursed dependencies of dn into dn's sandbox.''' if dependencies is None: @@ -122,13 +125,19 @@ def install_dependencies(dn, dependencies=None): log(dn, 'Already did', dependency['name'], verbose=True) continue - install_dependencies(dn, dependency.get('build-depends', [])) + install_dependencies( + dn, cache_handler, dependency.get('build-depends', [])) if (it in dn['build-depends']) or \ (dependency.get('build-mode', 'staging') == dn.get('build-mode', 'staging')): - compose(dependency) + if not get_cache(dependency) and cache_handler: + cache_handler(dependency) + elif not get_cache(dependency): + log(dn, "%s is not cached, unable to create staging area" % + dependency['name'], exit=True) if dependency.get('contents'): - install_dependencies(dn, dependency['contents']) + install_dependencies( + dn, cache_handler, dependency['contents']) sandbox.install(dn, dependency) if config.get('log-verbose'): sandbox.list_files(dn) @@ -142,7 +151,7 @@ def build(dn): with claim(dn): if dn.get('kind', 'chunk') == 'chunk': - install_dependencies(dn) + install_dependencies(dn, compose) with timer(dn, 'build of %s' % dn['cache']): run_build(dn) @@ -4,6 +4,7 @@ import sys from collections import Mapping from cache import cache_key, get_cache, md5 from app import log, timer +import assembly import time import app import sandbox @@ -512,7 +513,9 @@ def package_rpms(system, whitelist=None): system = app.defs.get(system) with sandbox.setup(system): - install_contents(system) + assembly.install_contents(system) + if system.get('kind') != "system": + assembly.install_dependencies(system, assembly.compose) # Fail now if missing `rpm` or `rpmbuild` env_vars = sandbox.env_vars_for_build(system) @@ -549,33 +552,3 @@ def package_rpms(system, whitelist=None): deploy_rpms(system, whitelist) app.log(system, "Finished deploying RPMs!") - - -# -# XXX Stuff taken from assembly.py in ybd -# -def install_contents(dn, contents=None): - ''' Install contents (recursively) into dn['sandbox'] ''' - - if contents is None: - contents = dn.get('contents', []) - - log(dn, 'Installing contents\n', contents, verbose=True) - - for it in contents: - item = app.defs.get(it) - if os.path.exists(os.path.join(dn['sandbox'], - 'baserock', item['name'] + '.meta')): - # content has already been installed - log(dn, 'Already installed', item['name'], verbose=True) - continue - - for i in item.get('contents', []): - install_contents(dn, [i]) - - if item.get('build-mode', 'staging') != 'bootstrap': - if not get_cache(item): - log('RPM', - "%s isn't cached, can't stage the system!" % item['name'], - exit=True) - sandbox.install(dn, item) |