diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-07 21:15:20 +0900 |
---|---|---|
committer | GitLab <gitlab@gitlab.com> | 2016-12-12 12:38:40 +0000 |
commit | f8bc9d661ad1284a1712b14aa67db3a64f16f230 (patch) | |
tree | dbde4e89378e524aad722682e3635694f2300813 | |
parent | 003f82148ff57dbde5e6d7ad02ea2c03629045e0 (diff) | |
download | ybd-f8bc9d661ad1284a1712b14aa67db3a64f16f230.tar.gz |
Fix collection of prefixes to recursefix-prefix-collection
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
-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') |