All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] icecc.bbclass: Fix combining with ccache
@ 2018-02-19 22:30 Joshua Watt
  2018-02-19 22:30 ` [PATCH 2/3] icecc.bbclass: Add environment version Joshua Watt
  2018-02-19 22:30 ` [PATCH 3/3] icecc.bbclass: Remove icecream from uninative Joshua Watt
  0 siblings, 2 replies; 3+ messages in thread
From: Joshua Watt @ 2018-02-19 22:30 UTC (permalink / raw)
  To: openembedded-core

Fixes the case where ccache is enabled along with Icecream. In these
cases, there is the danger that Icecream will accidentally add the
ccache executable to the toolchain, which prevents it from working. In
particular, Fedora enables ccache by default via symbolic links in PATH.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index e8f7eab1bc1..2bf6cdb003d 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -224,13 +224,31 @@ def icecc_get_external_tool(bb, d, tool):
     target_prefix = d.expand('${TARGET_PREFIX}')
     return os.path.join(external_toolchain_bindir, '%s%s' % (target_prefix, tool))
 
+def icecc_get_tool_link(tool, d):
+    import subprocess
+    return subprocess.check_output("readlink -f %s" % tool, shell=True).decode("utf-8")[:-1]
+
+def icecc_get_path_tool(tool, d):
+    # This is a little ugly, but we want to make sure we add an actual
+    # compiler to the toolchain, not ccache. Some distros (e.g. Fedora)
+    # have ccache enabled by default using symlinks PATH, meaning ccache
+    # would be found first when looking for the compiler.
+    paths = os.getenv("PATH").split(':')
+    while True:
+        p, hist = bb.utils.which(':'.join(paths), tool, history=True)
+        if not p or os.path.basename(icecc_get_tool_link(p, d)) != 'ccache':
+            return p
+        paths = paths[len(hist):]
+
+    return ""
+
 # Don't pollute native signatures with target TUNE_PKGARCH through STAGING_BINDIR_TOOLCHAIN
 icecc_get_tool[vardepsexclude] += "STAGING_BINDIR_TOOLCHAIN"
 def icecc_get_tool(bb, d, tool):
     if icecc_is_native(bb, d):
-        return bb.utils.which(os.getenv("PATH"), tool)
+        return icecc_get_path_tool(tool, d)
     elif icecc_is_kernel(bb, d):
-        return bb.utils.which(os.getenv("PATH"), get_cross_kernel_cc(bb, d))
+        return icecc_get_path_tool(get_cross_kernel_cc(bb, d), d)
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
         target_sys = d.expand('${TARGET_SYS}')
@@ -249,8 +267,7 @@ def icecc_get_and_check_tool(bb, d, tool):
     # compiler environment package.
     t = icecc_get_tool(bb, d, tool)
     if t:
-        import subprocess
-        link_path = subprocess.check_output("readlink -f %s" % t, shell=True).decode("utf-8")[:-1]
+        link_path = icecc_get_tool_link(tool, d)
         if link_path == get_icecc(d):
             bb.error("%s is a symlink to %s in PATH and this prevents icecc from working" % (t, get_icecc(d)))
             return ""
@@ -342,9 +359,13 @@ set_icecc_env() {
         fi
     fi
 
+    # Don't let ccache find the icecream compiler links that have been created, otherwise
+    # it can end up invoking icecream recursively.
+    export CCACHE_PATH="$PATH"
+    export CCACHE_DISBALE="1"
+
     export ICECC_VERSION ICECC_CC ICECC_CXX
     export PATH="$ICE_PATH:$PATH"
-    export CCACHE_PATH="$PATH"
 
     bbnote "Using icecc"
 }
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] icecc.bbclass: Add environment version
  2018-02-19 22:30 [PATCH 1/3] icecc.bbclass: Fix combining with ccache Joshua Watt
@ 2018-02-19 22:30 ` Joshua Watt
  2018-02-19 22:30 ` [PATCH 3/3] icecc.bbclass: Remove icecream from uninative Joshua Watt
  1 sibling, 0 replies; 3+ messages in thread
From: Joshua Watt @ 2018-02-19 22:30 UTC (permalink / raw)
  To: openembedded-core

Adds a version to the environment which can be used to invalidate any
previous environments on the remote compile nodes

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 2bf6cdb003d..bfab61dfa36 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -34,6 +34,15 @@ BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_
 
 ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env"
 
+# This version can be incremented when changes are made to the environment that
+# invalidate the version on the compile nodes. Changing it will cause a new
+# environment to be created.
+#
+# A useful thing to do for testing Icecream changes locally is to add a
+# subversion in local.conf:
+#  ICECC_ENV_VERSION_append = "-my-ver-1"
+ICECC_ENV_VERSION = "1"
+
 # Default to disabling the caret workaround, If set to "1" in local.conf, icecc
 # will locally recompile any files that have warnings, which can adversely
 # affect performance.
@@ -203,7 +212,11 @@ def icecc_version(bb, d):
 
     import socket
     ice_dir = icecc_dir(bb, d)
-    tar_file = os.path.join(ice_dir, archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz')
+    tar_file = os.path.join(ice_dir, "{archive}-{version}-@VERSION@-{hostname}.tar.gz".format(
+        archive=archive_name,
+        version=d.getVar('ICECC_ENV_VERSION', True),
+        hostname=socket.gethostname()
+        ))
 
     return tar_file
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] icecc.bbclass: Remove icecream from uninative
  2018-02-19 22:30 [PATCH 1/3] icecc.bbclass: Fix combining with ccache Joshua Watt
  2018-02-19 22:30 ` [PATCH 2/3] icecc.bbclass: Add environment version Joshua Watt
@ 2018-02-19 22:30 ` Joshua Watt
  1 sibling, 0 replies; 3+ messages in thread
From: Joshua Watt @ 2018-02-19 22:30 UTC (permalink / raw)
  To: openembedded-core

The icecream native tools should not be included in uninative tarballs
even though it is nativesdk

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index bfab61dfa36..48a51310c21 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -403,5 +403,8 @@ do_install_prepend() {
 ICECC_SDK_HOST_TASK = "nativesdk-icecc-toolchain"
 ICECC_SDK_HOST_TASK_task-populate-sdk-ext = ""
 
+# Don't include IceCream in uninative tarball
+ICECC_SDK_HOST_TASK_pn-uninative-tarball = ""
+
 # Add the toolchain scripts to the SDK
 TOOLCHAIN_HOST_TASK_append = " ${ICECC_SDK_HOST_TASK}"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-19 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 22:30 [PATCH 1/3] icecc.bbclass: Fix combining with ccache Joshua Watt
2018-02-19 22:30 ` [PATCH 2/3] icecc.bbclass: Add environment version Joshua Watt
2018-02-19 22:30 ` [PATCH 3/3] icecc.bbclass: Remove icecream from uninative Joshua Watt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.