diff options
author | locallycompact <locallycompact@gmail.com> | 2016-12-12 14:22:38 +0000 |
---|---|---|
committer | locallycompact <locallycompact@gmail.com> | 2016-12-12 14:22:38 +0000 |
commit | 736ad7a0b1d9dd5477e49dd75a784f6a021e7de6 (patch) | |
tree | dbde4e89378e524aad722682e3635694f2300813 | |
parent | 003f82148ff57dbde5e6d7ad02ea2c03629045e0 (diff) | |
parent | f8bc9d661ad1284a1712b14aa67db3a64f16f230 (diff) | |
download | ybd-736ad7a0b1d9dd5477e49dd75a784f6a021e7de6.tar.gz |
Merge branch 'fix-prefix-collection' into 'master'
Fix collection of prefixes to recurse
Where sandbox tries to compose the PATH variable, it iterates over
direct dependencies and composes PATH using the 'prefix' parameters
specified in dependencies.
This patch fixes this routine to make PATH prefix collection
recursive, so when you have installed qmake into a non-standard
prefix, Qt modules which do not depend *directly* on qtbase still
find qmake in /opt/strange/path/bin
See merge request !279
-rw-r--r-- | ybd/sandbox.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/ybd/sandbox.py b/ybd/sandbox.py index cfaed2d..4361b95 100644 --- a/ybd/sandbox.py +++ b/ybd/sandbox.py @@ -261,6 +261,27 @@ def ccache_mounts(dn, ccache_target): return mounts +def list_prefixes(dn): + """List all the prefixes in a given definition's dependencies""" + prefix = dn.get('prefix') + if prefix: + yield prefix + + dependencies = dn.get('build-depends', []) + for dep in dependencies: + + dependency = app.defs.get(dep) + for prefix in list_prefixes(dependency): + yield prefix + + contents = dependency.get('contents', []) + for ct in contents: + content = app.defs.get(ct) + prefix = content.get('prefix') + if prefix: + yield prefix + + def env_vars_for_build(dn): env = {} extra_path = [] @@ -277,12 +298,7 @@ def env_vars_for_build(dn): if not app.config.get('no-distcc'): env['CCACHE_PREFIX'] = 'distcc' - prefixes = [] - - for name in dn.get('build-depends', []): - dependency = app.defs.get(name) - prefixes.append(dependency.get('prefix', '/usr')) - prefixes = set(prefixes) + prefixes = set(list_prefixes(dn)) for prefix in prefixes: if prefix: bin_path = os.path.join(prefix, 'bin') |