summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-12-07 21:15:20 +0900
committerGitLab <gitlab@gitlab.com>2016-12-12 12:38:40 +0000
commitf8bc9d661ad1284a1712b14aa67db3a64f16f230 (patch)
treedbde4e89378e524aad722682e3635694f2300813
parent003f82148ff57dbde5e6d7ad02ea2c03629045e0 (diff)
downloadybd-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.py28
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')