diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/icecc.bbclass | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass index 3255839942..1f53f855fe 100644 --- a/meta/classes/icecc.bbclass +++ b/meta/classes/icecc.bbclass | |||
@@ -202,6 +202,21 @@ def icc_get_and_check_tool(bb, d, tool): | |||
202 | else: | 202 | else: |
203 | return t | 203 | return t |
204 | 204 | ||
205 | wait_for_file() { | ||
206 | local TIME_ELAPSED=0 | ||
207 | local FILE_TO_TEST=$1 | ||
208 | local TIMEOUT=$2 | ||
209 | until [ -f "$FILE_TO_TEST" ] | ||
210 | do | ||
211 | TIME_ELAPSED=`expr $TIME_ELAPSED + 1` | ||
212 | if [ $TIME_ELAPSED -gt $TIMEOUT ] | ||
213 | then | ||
214 | return 1 | ||
215 | fi | ||
216 | sleep 1 | ||
217 | done | ||
218 | } | ||
219 | |||
205 | def set_icecc_env(): | 220 | def set_icecc_env(): |
206 | # dummy python version of set_icecc_env | 221 | # dummy python version of set_icecc_env |
207 | return | 222 | return |
@@ -247,10 +262,22 @@ set_icecc_env() { | |||
247 | ICECC_AS="`which as`" | 262 | ICECC_AS="`which as`" |
248 | fi | 263 | fi |
249 | 264 | ||
250 | if [ ! -r "${ICECC_VERSION}" ] | 265 | if [ ! -f "${ICECC_VERSION}.done" ] |
251 | then | 266 | then |
252 | mkdir -p "`dirname "${ICECC_VERSION}"`" | 267 | mkdir -p "`dirname "${ICECC_VERSION}"`" |
253 | ${ICECC_ENV_EXEC} "${ICECC_CC}" "${ICECC_CXX}" "${ICECC_AS}" "${ICECC_VERSION}" | 268 | |
269 | # the ICECC_VERSION generation step must be locked by a mutex | ||
270 | # in order to prevent race conditions | ||
271 | if flock -n "${ICECC_VERSION}.lock" \ | ||
272 | ${ICECC_ENV_EXEC} "${ICECC_CC}" "${ICECC_CXX}" "${ICECC_AS}" "${ICECC_VERSION}" | ||
273 | then | ||
274 | touch "${ICECC_VERSION}.done" | ||
275 | elif [ ! wait_for_file "${ICECC_VERSION}.done" 30 ] | ||
276 | then | ||
277 | # locking failed so wait for ${ICECC_VERSION}.done to appear | ||
278 | bbwarn "Timeout waiting for ${ICECC_VERSION}.done" | ||
279 | return | ||
280 | fi | ||
254 | fi | 281 | fi |
255 | 282 | ||
256 | export ICECC_VERSION ICECC_CC ICECC_CXX | 283 | export ICECC_VERSION ICECC_CC ICECC_CXX |