summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorDouglas Royds <douglas.royds@taitradio.com>2018-12-20 11:59:47 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-20 14:53:55 +0000
commitf6c639f578cbe8abb7c9255688dd10345aabbd6a (patch)
tree68675cdb812f80d176af101a891c565e1dc24b33 /meta/classes
parent45a59ffbd6f111c752057cff018678fd454636e6 (diff)
downloadpoky-f6c639f578cbe8abb7c9255688dd10345aabbd6a.tar.gz
icecc: Don't generate recipe-sysroot symlinks at recipe-parsing time
The python function icecc_path() was being invoked inline by set_icecc_env(), meaning that it was being invoked at recipe-parsing time. As a side-effect, icecc_path() was creating the recipe-sysroot directory and symlinking icecc into it. Because this was done at parsing time (rather than configure time), we were generating otherwise-empty WORKDIRs for *all* parsed recipes, and for all virtual classes (-native, -nativesdk). In my build, this generated more than 800 of these otherwise-empty WORKDIRs. I have simplified icecc_path() to return only the intended path to the icecc symlinks in the recipe-sysroot, with no side-effect. We then create the directory and the icecc symlinks at configure time. Because get_cross_kernel_cc() is still invoked at parse-time, it needs a guard-clause for the non-kernel case. We are now finding the host icecc at do_configure time, so icecc needs to be in the HOSTTOOLS. I have made this non-fatal, so that we can still inherit icecc without icecc installed. (From OE-Core rev: d2fcaeb153fdc3f8d7143ea823139f1537055ff1) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/icecc.bbclass62
1 files changed, 25 insertions, 37 deletions
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 2171e11db0..49597175ca 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -38,6 +38,8 @@ BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_
38 38
39ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env" 39ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env"
40 40
41HOSTTOOLS_NONFATAL += "icecc"
42
41# This version can be incremented when changes are made to the environment that 43# This version can be incremented when changes are made to the environment that
42# invalidate the version on the compile nodes. Changing it will cause a new 44# invalidate the version on the compile nodes. Changing it will cause a new
43# environment to be created. 45# environment to be created.
@@ -98,9 +100,11 @@ DEPENDS_prepend += "${@icecc_dep_prepend(d)} "
98 100
99get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC" 101get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC"
100def get_cross_kernel_cc(bb,d): 102def get_cross_kernel_cc(bb,d):
101 kernel_cc = d.getVar('KERNEL_CC') 103 if not icecc_is_kernel(bb, d):
104 return None
102 105
103 # evaluate the expression by the shell if necessary 106 # evaluate the expression by the shell if necessary
107 kernel_cc = d.getVar('KERNEL_CC')
104 if '`' in kernel_cc or '$(' in kernel_cc: 108 if '`' in kernel_cc or '$(' in kernel_cc:
105 import subprocess 109 import subprocess
106 kernel_cc = subprocess.check_output("echo %s" % kernel_cc, shell=True).decode("utf-8")[:-1] 110 kernel_cc = subprocess.check_output("echo %s" % kernel_cc, shell=True).decode("utf-8")[:-1]
@@ -113,38 +117,6 @@ def get_cross_kernel_cc(bb,d):
113def get_icecc(d): 117def get_icecc(d):
114 return d.getVar('ICECC_PATH') or bb.utils.which(os.getenv("PATH"), "icecc") 118 return d.getVar('ICECC_PATH') or bb.utils.which(os.getenv("PATH"), "icecc")
115 119
116def create_path(compilers, bb, d):
117 """
118 Create Symlinks for the icecc in the staging directory
119 """
120 staging = os.path.join(d.expand('${STAGING_BINDIR}'), "ice")
121 if icecc_is_kernel(bb, d):
122 staging += "-kernel"
123
124 #check if the icecc path is set by the user
125 icecc = get_icecc(d)
126
127 # Create the dir if necessary
128 try:
129 os.stat(staging)
130 except:
131 try:
132 os.makedirs(staging)
133 except:
134 pass
135
136 for compiler in compilers:
137 gcc_path = os.path.join(staging, compiler)
138 try:
139 os.stat(gcc_path)
140 except:
141 try:
142 os.symlink(icecc, gcc_path)
143 except:
144 pass
145
146 return staging
147
148def use_icecc(bb,d): 120def use_icecc(bb,d):
149 if d.getVar('ICECC_DISABLED') == "1": 121 if d.getVar('ICECC_DISABLED') == "1":
150 # don't even try it, when explicitly disabled 122 # don't even try it, when explicitly disabled
@@ -248,12 +220,11 @@ def icecc_path(bb,d):
248 # don't create unnecessary directories when icecc is disabled 220 # don't create unnecessary directories when icecc is disabled
249 return 221 return
250 222
223 staging = os.path.join(d.expand('${STAGING_BINDIR}'), "ice")
251 if icecc_is_kernel(bb, d): 224 if icecc_is_kernel(bb, d):
252 return create_path( [get_cross_kernel_cc(bb,d), ], bb, d) 225 staging += "-kernel"
253 226
254 else: 227 return staging
255 prefix = d.expand('${HOST_PREFIX}')
256 return create_path( [prefix+"gcc", prefix+"g++"], bb, d)
257 228
258def icecc_get_external_tool(bb, d, tool): 229def icecc_get_external_tool(bb, d, tool):
259 external_toolchain_bindir = d.expand('${EXTERNAL_TOOLCHAIN}${bindir_cross}') 230 external_toolchain_bindir = d.expand('${EXTERNAL_TOOLCHAIN}${bindir_cross}')
@@ -350,6 +321,23 @@ set_icecc_env() {
350 return 321 return
351 fi 322 fi
352 323
324 ICECC_BIN="${@get_icecc(d)}"
325 if [ -z "${ICECC_BIN}" ]; then
326 bbwarn "Cannot use icecc: icecc binary not found"
327 return
328 fi
329
330 # Create symlinks to icecc in the recipe-sysroot directory
331 mkdir -p ${ICE_PATH}
332 if [ -n "${KERNEL_CC}" ]; then
333 compilers="${@get_cross_kernel_cc(bb,d)}"
334 else
335 compilers="${HOST_PREFIX}gcc ${HOST_PREFIX}g++"
336 fi
337 for compiler in $compilers; do
338 ln -sf ${ICECC_BIN} ${ICE_PATH}/$compiler
339 done
340
353 ICECC_CC="${@icecc_get_and_check_tool(bb, d, "gcc")}" 341 ICECC_CC="${@icecc_get_and_check_tool(bb, d, "gcc")}"
354 ICECC_CXX="${@icecc_get_and_check_tool(bb, d, "g++")}" 342 ICECC_CXX="${@icecc_get_and_check_tool(bb, d, "g++")}"
355 # cannot use icecc_get_and_check_tool here because it assumes as without target_sys prefix 343 # cannot use icecc_get_and_check_tool here because it assumes as without target_sys prefix