diff options
Diffstat (limited to 'meta/classes/icecc.bbclass')
-rw-r--r-- | meta/classes/icecc.bbclass | 140 |
1 files changed, 71 insertions, 69 deletions
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass index d095305ed8..159cae20f8 100644 --- a/meta/classes/icecc.bbclass +++ b/meta/classes/icecc.bbclass | |||
@@ -1,40 +1,45 @@ | |||
1 | # IceCream distributed compiling support | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | # Icecream distributed compiling support | ||
2 | # | 8 | # |
3 | # Stages directories with symlinks from gcc/g++ to icecc, for both | 9 | # Stages directories with symlinks from gcc/g++ to icecc, for both |
4 | # native and cross compilers. Depending on each configure or compile, | 10 | # native and cross compilers. Depending on each configure or compile, |
5 | # the directories are added at the head of the PATH list and ICECC_CXX | 11 | # the directories are added at the head of the PATH list and ICECC_CXX |
6 | # and ICEC_CC are set. | 12 | # and ICECC_CC are set. |
7 | # | 13 | # |
8 | # For the cross compiler, creates a tar.gz of our toolchain and sets | 14 | # For the cross compiler, creates a tar.gz of our toolchain and sets |
9 | # ICECC_VERSION accordingly. | 15 | # ICECC_VERSION accordingly. |
10 | # | 16 | # |
11 | # The class now handles all 3 different compile 'stages' (i.e native ,cross-kernel and target) creating the | 17 | # The class now handles all 3 different compile 'stages' (i.e native ,cross-kernel and target) creating the |
12 | # necessary environment tar.gz file to be used by the remote machines. | 18 | # necessary environment tar.gz file to be used by the remote machines. |
13 | # It also supports meta-toolchain generation | 19 | # It also supports meta-toolchain generation. |
14 | # | 20 | # |
15 | # If ICECC_PATH is not set in local.conf then the class will try to locate it using 'bb.utils.which' | 21 | # If ICECC_PATH is not set in local.conf then the class will try to locate it using 'bb.utils.which' |
16 | # but nothing is sure ;) | 22 | # but nothing is sure. ;) |
17 | # | 23 | # |
18 | # If ICECC_ENV_EXEC is set in local.conf, then it should point to the icecc-create-env script provided by the user | 24 | # If ICECC_ENV_EXEC is set in local.conf, then it should point to the icecc-create-env script provided by the user |
19 | # or the default one provided by icecc-create-env.bb will be used | 25 | # or the default one provided by icecc-create-env_0.1.bb will be used. |
20 | # (NOTE that this is a modified version of the script need it and *not the one that comes with icecc* | 26 | # (NOTE that this is a modified version of the needed script and *not the one that comes with icecream*). |
21 | # | 27 | # |
22 | # User can specify if specific packages or packages belonging to class should not use icecc to distribute | 28 | # User can specify if specific recipes or recipes inheriting specific classes should not use icecc to distribute |
23 | # compile jobs to remote machines, but handled locally, by defining ICECC_USER_CLASS_BL and ICECC_USER_PACKAGE_BL | 29 | # compile jobs to remote machines, but handle them locally by defining ICECC_CLASS_DISABLE and ICECC_RECIPE_DISABLE |
24 | # with the appropriate values in local.conf. In addition the user can force to enable icecc for packages | 30 | # with the appropriate values in local.conf. In addition the user can force to enable icecc for recipes |
25 | # which set an empty PARALLEL_MAKE variable by defining ICECC_USER_PACKAGE_WL. | 31 | # which set an empty PARALLEL_MAKE variable by defining ICECC_RECIPE_ENABLE. |
26 | # | 32 | # |
27 | ######################################################################################### | 33 | ######################################################################################### |
28 | #Error checking is kept to minimum so double check any parameters you pass to the class | 34 | # Error checking is kept to minimum so double check any parameters you pass to the class |
29 | ########################################################################################### | 35 | ######################################################################################### |
30 | 36 | ||
31 | BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_BL \ | 37 | BB_BASEHASH_IGNORE_VARS += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_RECIPE_DISABLE \ |
32 | ICECC_USER_CLASS_BL ICECC_USER_PACKAGE_WL ICECC_PATH ICECC_ENV_EXEC \ | 38 | ICECC_CLASS_DISABLE ICECC_RECIPE_ENABLE ICECC_PATH ICECC_ENV_EXEC \ |
33 | ICECC_CARET_WORKAROUND ICECC_CFLAGS ICECC_ENV_VERSION \ | 39 | ICECC_CARET_WORKAROUND ICECC_CFLAGS ICECC_ENV_VERSION \ |
34 | ICECC_DEBUG ICECC_LOGFILE ICECC_REPEAT_RATE ICECC_PREFERRED_HOST \ | 40 | ICECC_DEBUG ICECC_LOGFILE ICECC_REPEAT_RATE ICECC_PREFERRED_HOST \ |
35 | ICECC_CLANG_REMOTE_CPP ICECC_IGNORE_UNVERIFIED ICECC_TEST_SOCKET \ | 41 | ICECC_CLANG_REMOTE_CPP ICECC_IGNORE_UNVERIFIED ICECC_TEST_SOCKET \ |
36 | ICECC_ENV_DEBUG ICECC_SYSTEM_PACKAGE_BL ICECC_SYSTEM_CLASS_BL \ | 42 | ICECC_ENV_DEBUG ICECC_REMOTE_CPP \ |
37 | ICECC_REMOTE_CPP \ | ||
38 | " | 43 | " |
39 | 44 | ||
40 | ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env" | 45 | ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env" |
@@ -45,9 +50,9 @@ HOSTTOOLS_NONFATAL += "icecc patchelf" | |||
45 | # invalidate the version on the compile nodes. Changing it will cause a new | 50 | # invalidate the version on the compile nodes. Changing it will cause a new |
46 | # environment to be created. | 51 | # environment to be created. |
47 | # | 52 | # |
48 | # A useful thing to do for testing Icecream changes locally is to add a | 53 | # A useful thing to do for testing icecream changes locally is to add a |
49 | # subversion in local.conf: | 54 | # subversion in local.conf: |
50 | # ICECC_ENV_VERSION_append = "-my-ver-1" | 55 | # ICECC_ENV_VERSION:append = "-my-ver-1" |
51 | ICECC_ENV_VERSION = "2" | 56 | ICECC_ENV_VERSION = "2" |
52 | 57 | ||
53 | # Default to disabling the caret workaround, If set to "1" in local.conf, icecc | 58 | # Default to disabling the caret workaround, If set to "1" in local.conf, icecc |
@@ -66,46 +71,46 @@ CXXFLAGS += "${ICECC_CFLAGS}" | |||
66 | # Debug flags when generating environments | 71 | # Debug flags when generating environments |
67 | ICECC_ENV_DEBUG ??= "" | 72 | ICECC_ENV_DEBUG ??= "" |
68 | 73 | ||
69 | # "system" recipe blacklist contains a list of packages that can not distribute | 74 | # Disable recipe list contains a list of recipes that can not distribute |
70 | # compile tasks for one reason or the other. When adding new entry, please | 75 | # compile tasks for one reason or the other. When adding a new entry, please |
71 | # document why (how it failed) so that we can re-evaluate it later e.g. when | 76 | # document why (how it failed) so that we can re-evaluate it later e.g. when |
72 | # there is new version | 77 | # there is a new version. |
73 | # | 78 | # |
74 | # libgcc-initial - fails with CPP sanity check error if host sysroot contains | 79 | # libgcc-initial - fails with CPP sanity check error if host sysroot contains |
75 | # cross gcc built for another target tune/variant | 80 | # cross gcc built for another target tune/variant. |
76 | # pixman - prng_state: TLS reference mismatches non-TLS reference, possibly due to | 81 | # pixman - prng_state: TLS reference mismatches non-TLS reference, possibly due to |
77 | # pragma omp threadprivate(prng_state) | 82 | # pragma omp threadprivate(prng_state). |
78 | # systemtap - _HelperSDT.c undefs macros and uses the identifiers in macros emitting | 83 | # systemtap - _HelperSDT.c undefs macros and uses the identifiers in macros emitting |
79 | # inline assembly | 84 | # inline assembly. |
80 | # target-sdk-provides-dummy - ${HOST_PREFIX} is empty which triggers the "NULL | 85 | # target-sdk-provides-dummy - ${HOST_PREFIX} is empty which triggers the "NULL |
81 | # prefix" error. | 86 | # prefix" error. |
82 | ICECC_SYSTEM_PACKAGE_BL += "\ | 87 | ICECC_RECIPE_DISABLE += "\ |
83 | libgcc-initial \ | 88 | libgcc-initial \ |
84 | pixman \ | 89 | pixman \ |
85 | systemtap \ | 90 | systemtap \ |
86 | target-sdk-provides-dummy \ | 91 | target-sdk-provides-dummy \ |
87 | " | 92 | " |
88 | 93 | ||
89 | # "system" classes that should be blacklisted. When adding new entry, please | 94 | # Classes that should not use icecc. When adding a new entry, please |
90 | # document why (how it failed) so that we can re-evaluate it later | 95 | # document why (how it failed) so that we can re-evaluate it later. |
91 | # | 96 | # |
92 | # image - Image aren't compiling, but the testing framework for images captures | 97 | # image - images aren't compiling, but the testing framework for images captures |
93 | # PARALLEL_MAKE as part of the test environment. Many tests won't use | 98 | # PARALLEL_MAKE as part of the test environment. Many tests won't use |
94 | # icecream, but leaving the high level of parallelism can cause them to | 99 | # icecream, but leaving the high level of parallelism can cause them to |
95 | # consume an unnecessary amount of resources. | 100 | # consume an unnecessary amount of resources. |
96 | ICECC_SYSTEM_CLASS_BL += "\ | 101 | ICECC_CLASS_DISABLE += "\ |
97 | image \ | 102 | image \ |
98 | " | 103 | " |
99 | 104 | ||
100 | def icecc_dep_prepend(d): | 105 | def get_icecc_dep(d): |
101 | # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not | 106 | # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not |
102 | # we need that built is the responsibility of the patch function / class, not | 107 | # we need that built is the responsibility of the patch function / class, not |
103 | # the application. | 108 | # the application. |
104 | if not d.getVar('INHIBIT_DEFAULT_DEPS'): | 109 | if not d.getVar('INHIBIT_DEFAULT_DEPS'): |
105 | return "icecc-create-env-native" | 110 | return "icecc-create-env-native" |
106 | return "" | 111 | return "" |
107 | 112 | ||
108 | DEPENDS_prepend = "${@icecc_dep_prepend(d)} " | 113 | DEPENDS:prepend = "${@get_icecc_dep(d)} " |
109 | 114 | ||
110 | get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC" | 115 | get_cross_kernel_cc[vardepsexclude] += "KERNEL_CC" |
111 | def get_cross_kernel_cc(bb,d): | 116 | def get_cross_kernel_cc(bb,d): |
@@ -138,39 +143,31 @@ def use_icecc(bb,d): | |||
138 | if icecc_is_cross_canadian(bb, d): | 143 | if icecc_is_cross_canadian(bb, d): |
139 | return "no" | 144 | return "no" |
140 | 145 | ||
141 | if d.getVar('INHIBIT_DEFAULT_DEPS', False): | ||
142 | # We don't have a compiler, so no icecc | ||
143 | return "no" | ||
144 | |||
145 | pn = d.getVar('PN') | 146 | pn = d.getVar('PN') |
146 | bpn = d.getVar('BPN') | 147 | bpn = d.getVar('BPN') |
147 | 148 | ||
148 | # Blacklist/whitelist checks are made against BPN, because there is a good | 149 | # Enable/disable checks are made against BPN, because there is a good |
149 | # chance that if icecc should be skipped for a recipe, it should be skipped | 150 | # chance that if icecc should be skipped for a recipe, it should be skipped |
150 | # for all the variants of that recipe. PN is still checked in case a user | 151 | # for all the variants of that recipe. PN is still checked in case a user |
151 | # specified a more specific recipe. | 152 | # specified a more specific recipe. |
152 | check_pn = set([pn, bpn]) | 153 | check_pn = set([pn, bpn]) |
153 | 154 | ||
154 | system_class_blacklist = (d.getVar('ICECC_SYSTEM_CLASS_BL') or "").split() | 155 | class_disable = (d.getVar('ICECC_CLASS_DISABLE') or "").split() |
155 | user_class_blacklist = (d.getVar('ICECC_USER_CLASS_BL') or "none").split() | ||
156 | package_class_blacklist = system_class_blacklist + user_class_blacklist | ||
157 | 156 | ||
158 | for black in package_class_blacklist: | 157 | for bbclass in class_disable: |
159 | if bb.data.inherits_class(black, d): | 158 | if bb.data.inherits_class(bbclass, d): |
160 | bb.debug(1, "%s: class %s found in blacklist, disable icecc" % (pn, black)) | 159 | bb.debug(1, "%s: bbclass %s found in disable, disable icecc" % (pn, bbclass)) |
161 | return "no" | 160 | return "no" |
162 | 161 | ||
163 | system_package_blacklist = (d.getVar('ICECC_SYSTEM_PACKAGE_BL') or "").split() | 162 | disabled_recipes = (d.getVar('ICECC_RECIPE_DISABLE') or "").split() |
164 | user_package_blacklist = (d.getVar('ICECC_USER_PACKAGE_BL') or "").split() | 163 | enabled_recipes = (d.getVar('ICECC_RECIPE_ENABLE') or "").split() |
165 | user_package_whitelist = (d.getVar('ICECC_USER_PACKAGE_WL') or "").split() | ||
166 | package_blacklist = system_package_blacklist + user_package_blacklist | ||
167 | 164 | ||
168 | if check_pn & set(package_blacklist): | 165 | if check_pn & set(disabled_recipes): |
169 | bb.debug(1, "%s: found in blacklist, disable icecc" % pn) | 166 | bb.debug(1, "%s: found in disable list, disable icecc" % pn) |
170 | return "no" | 167 | return "no" |
171 | 168 | ||
172 | if check_pn & set(user_package_whitelist): | 169 | if check_pn & set(enabled_recipes): |
173 | bb.debug(1, "%s: found in whitelist, enable icecc" % pn) | 170 | bb.debug(1, "%s: found in enabled recipes list, enable icecc" % pn) |
174 | return "yes" | 171 | return "yes" |
175 | 172 | ||
176 | if d.getVar('PARALLEL_MAKE') == "": | 173 | if d.getVar('PARALLEL_MAKE') == "": |
@@ -262,7 +259,7 @@ def icecc_get_tool_link(tool, d): | |||
262 | def icecc_get_path_tool(tool, d): | 259 | def icecc_get_path_tool(tool, d): |
263 | # This is a little ugly, but we want to make sure we add an actual | 260 | # This is a little ugly, but we want to make sure we add an actual |
264 | # compiler to the toolchain, not ccache. Some distros (e.g. Fedora) | 261 | # compiler to the toolchain, not ccache. Some distros (e.g. Fedora) |
265 | # have ccache enabled by default using symlinks PATH, meaning ccache | 262 | # have ccache enabled by default using symlinks in PATH, meaning ccache |
266 | # would be found first when looking for the compiler. | 263 | # would be found first when looking for the compiler. |
267 | paths = os.getenv("PATH").split(':') | 264 | paths = os.getenv("PATH").split(':') |
268 | while True: | 265 | while True: |
@@ -313,7 +310,7 @@ wait_for_file() { | |||
313 | local TIMEOUT=$2 | 310 | local TIMEOUT=$2 |
314 | until [ -f "$FILE_TO_TEST" ] | 311 | until [ -f "$FILE_TO_TEST" ] |
315 | do | 312 | do |
316 | TIME_ELAPSED=`expr $TIME_ELAPSED + 1` | 313 | TIME_ELAPSED=$(expr $TIME_ELAPSED + 1) |
317 | if [ $TIME_ELAPSED -gt $TIMEOUT ] | 314 | if [ $TIME_ELAPSED -gt $TIMEOUT ] |
318 | then | 315 | then |
319 | return 1 | 316 | return 1 |
@@ -362,12 +359,12 @@ set_icecc_env() { | |||
362 | ICECC_WHICH_AS="${@bb.utils.which(os.getenv('PATH'), 'as')}" | 359 | ICECC_WHICH_AS="${@bb.utils.which(os.getenv('PATH'), 'as')}" |
363 | if [ ! -x "${ICECC_CC}" -o ! -x "${ICECC_CXX}" ] | 360 | if [ ! -x "${ICECC_CC}" -o ! -x "${ICECC_CXX}" ] |
364 | then | 361 | then |
365 | bbwarn "Cannot use icecc: could not get ICECC_CC or ICECC_CXX" | 362 | bbnote "Cannot use icecc: could not get ICECC_CC or ICECC_CXX" |
366 | return | 363 | return |
367 | fi | 364 | fi |
368 | 365 | ||
369 | ICE_VERSION=`$ICECC_CC -dumpversion` | 366 | ICE_VERSION="$($ICECC_CC -dumpversion)" |
370 | ICECC_VERSION=`echo ${ICECC_VERSION} | sed -e "s/@VERSION@/$ICE_VERSION/g"` | 367 | ICECC_VERSION=$(echo ${ICECC_VERSION} | sed -e "s/@VERSION@/$ICE_VERSION/g") |
371 | if [ ! -x "${ICECC_ENV_EXEC}" ] | 368 | if [ ! -x "${ICECC_ENV_EXEC}" ] |
372 | then | 369 | then |
373 | bbwarn "Cannot use icecc: invalid ICECC_ENV_EXEC" | 370 | bbwarn "Cannot use icecc: invalid ICECC_ENV_EXEC" |
@@ -383,7 +380,6 @@ set_icecc_env() { | |||
383 | fi | 380 | fi |
384 | for compiler in $compilers; do | 381 | for compiler in $compilers; do |
385 | ln -sf $ICECC_BIN $ICE_PATH/symlinks/$compiler | 382 | ln -sf $ICECC_BIN $ICE_PATH/symlinks/$compiler |
386 | rm -f $ICE_PATH/$compiler | ||
387 | cat <<-__EOF__ > $ICE_PATH/$compiler | 383 | cat <<-__EOF__ > $ICE_PATH/$compiler |
388 | #!/bin/sh -e | 384 | #!/bin/sh -e |
389 | export ICECC_VERSION=$ICECC_VERSION | 385 | export ICECC_VERSION=$ICECC_VERSION |
@@ -394,18 +390,18 @@ set_icecc_env() { | |||
394 | chmod 775 $ICE_PATH/$compiler | 390 | chmod 775 $ICE_PATH/$compiler |
395 | done | 391 | done |
396 | 392 | ||
397 | ICECC_AS="`${ICECC_CC} -print-prog-name=as`" | 393 | ICECC_AS="$(${ICECC_CC} -print-prog-name=as)" |
398 | # for target recipes should return something like: | 394 | # for target recipes should return something like: |
399 | # /OE/tmp-eglibc/sysroots/x86_64-linux/usr/libexec/arm920tt-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.2/as | 395 | # /OE/tmp-eglibc/sysroots/x86_64-linux/usr/libexec/arm920tt-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.2/as |
400 | # and just "as" for native, if it returns "as" in current directory (for whatever reason) use "as" from PATH | 396 | # and just "as" for native, if it returns "as" in current directory (for whatever reason) use "as" from PATH |
401 | if [ "`dirname "${ICECC_AS}"`" = "." ] | 397 | if [ "$(dirname "${ICECC_AS}")" = "." ] |
402 | then | 398 | then |
403 | ICECC_AS="${ICECC_WHICH_AS}" | 399 | ICECC_AS="${ICECC_WHICH_AS}" |
404 | fi | 400 | fi |
405 | 401 | ||
406 | if [ ! -f "${ICECC_VERSION}.done" ] | 402 | if [ ! -f "${ICECC_VERSION}.done" ] |
407 | then | 403 | then |
408 | mkdir -p "`dirname "${ICECC_VERSION}"`" | 404 | mkdir -p "$(dirname "${ICECC_VERSION}")" |
409 | 405 | ||
410 | # the ICECC_VERSION generation step must be locked by a mutex | 406 | # the ICECC_VERSION generation step must be locked by a mutex |
411 | # in order to prevent race conditions | 407 | # in order to prevent race conditions |
@@ -432,28 +428,34 @@ set_icecc_env() { | |||
432 | bbnote "Using icecc tarball: $ICECC_VERSION" | 428 | bbnote "Using icecc tarball: $ICECC_VERSION" |
433 | } | 429 | } |
434 | 430 | ||
435 | do_configure_prepend() { | 431 | do_configure:prepend() { |
436 | set_icecc_env | 432 | set_icecc_env |
437 | } | 433 | } |
438 | 434 | ||
439 | do_compile_prepend() { | 435 | do_compile:prepend() { |
440 | set_icecc_env | 436 | set_icecc_env |
441 | } | 437 | } |
442 | 438 | ||
443 | do_compile_kernelmodules_prepend() { | 439 | do_compile_kernelmodules:prepend() { |
444 | set_icecc_env | 440 | set_icecc_env |
445 | } | 441 | } |
446 | 442 | ||
447 | do_install_prepend() { | 443 | do_install:prepend() { |
448 | set_icecc_env | 444 | set_icecc_env |
449 | } | 445 | } |
450 | 446 | ||
451 | # IceCream is not (currently) supported in the extensible SDK | 447 | # Icecream is not (currently) supported in the extensible SDK |
452 | ICECC_SDK_HOST_TASK = "nativesdk-icecc-toolchain" | 448 | ICECC_SDK_HOST_TASK = "nativesdk-icecc-toolchain" |
453 | ICECC_SDK_HOST_TASK_task-populate-sdk-ext = "" | 449 | ICECC_SDK_HOST_TASK:task-populate-sdk-ext = "" |
454 | 450 | ||
455 | # Don't include IceCream in uninative tarball | 451 | # Don't include icecream in uninative tarball |
456 | ICECC_SDK_HOST_TASK_pn-uninative-tarball = "" | 452 | ICECC_SDK_HOST_TASK:pn-uninative-tarball = "" |
457 | 453 | ||
458 | # Add the toolchain scripts to the SDK | 454 | # Add the toolchain scripts to the SDK |
459 | TOOLCHAIN_HOST_TASK_append = " ${ICECC_SDK_HOST_TASK}" | 455 | TOOLCHAIN_HOST_TASK:append = " ${ICECC_SDK_HOST_TASK}" |
456 | |||
457 | python () { | ||
458 | if d.getVar('ICECC_DISABLED') != "1": | ||
459 | for task in ['do_configure', 'do_compile', 'do_compile_kernelmodules', 'do_install']: | ||
460 | d.setVarFlag(task, 'network', '1') | ||
461 | } | ||