Skip to contentSkip to conversation

ccache.bbclass: Add allowed list for native recipes

PATCH Superseded Angelo Ribeiro 2 participants 2 messages Aug 16, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ccache.bbclass: Add allowed list for native recipes

From: Angelo Ribeiro <[email protected]>

Native recipes are not able to use ccache currently, due to a circular dependency between ccache-native and cmake-native.
This affects also other native recipes, but not all, imposing a limitation in build time optimizations.

The introduction of CCACHE_NATIVE_ALLOWED allows the user to specify which native recipes should use ccache, keeping it disable by default for all native recipes.

---
 meta/classes/ccache.bbclass | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
meta/classes/ccache.bbclass +8 -3
index 34becb69d1..262db6672c 100644
@@ -28,6 +28,11 @@
 # be shared between different builds.
 CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
 
+# ccache-native and cmake-native have a circular dependency
+# that affects other native recipes, but not all.
+# Allows to use ccache in specified native recipes.
+CCACHE_NATIVE_RECIPES_ALLOWED ?= ""
+
 # ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same
 # in different builds.
 export CCACHE_BASEDIR ?= "${TMPDIR}"
@@ -54,9 +59,9 @@ python() {
     Enable ccache for the recipe
     """
     pn = d.getVar('PN')
-    # quilt-native doesn't need ccache since no c files
-    if not (bb.data.inherits_class("native", d) or
-            bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))):
+    if (pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or
+        not (bb.data.inherits_class("native", d) or
+        bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))):
         d.appendVar('DEPENDS', ' ccache-native')
         d.setVar('CCACHE', 'ccache ')
 }

--
2.34.1

The information in this communication may contain confidential or legally privileged information. It is intended solely for the use of the individual or entity it addresses and others authorized to receive it. If you are not an intended recipient, you are hereby notified that any disclosure, copying, distribution or action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication by error, please notify us immediately by responding to this e-mail and then delete it from your system. Critical TechWorks is not liable for the proper and complete transmission of the information in this communication nor for any delay in its receipt

This e-mail is environmentally friendly, just like Critical TechWorks, which lives in a paper-free atmosphere. Therefore, please consider the environment before printing it!

#1 lore raw

Hello,

Quoted 11 lines · Angelo Ribeiro via lists.openembedded.org

From: Angelo Ribeiro <[email protected]>

Native recipes are not able to use ccache currently, due to a circular dependency between ccache-native and cmake-native.
This affects also other native recipes, but not all, imposing a limitation in build time optimizations.

The introduction of CCACHE_NATIVE_ALLOWED allows the user to specify which native recipes should use ccache, keeping it disable by default for all native recipes.

You must also submit documentation for this new variable.

Quoted 50 lines
---
 meta/classes/ccache.bbclass | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
meta/classes/ccache.bbclass +8 -4
index 34becb69d1..262db6672c 100644
@@ -28,6 +28,11 @@
 # be shared between different builds.
 CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
 
+# ccache-native and cmake-native have a circular dependency
+# that affects other native recipes, but not all.
+# Allows to use ccache in specified native recipes.
+CCACHE_NATIVE_RECIPES_ALLOWED ?= ""
+
 # ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same
 # in different builds.
 export CCACHE_BASEDIR ?= "${TMPDIR}"
@@ -54,9 +59,9 @@ python() {
     Enable ccache for the recipe
     """
     pn = d.getVar('PN')
-    # quilt-native doesn't need ccache since no c files
-    if not (bb.data.inherits_class("native", d) or
-            bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))):
+    if (pn in d.getVar('CCACHE_NATIVE_RECIPES_ALLOWED') or
+        not (bb.data.inherits_class("native", d) or
+        bb.utils.to_boolean(d.getVar('CCACHE_DISABLE')))):
         d.appendVar('DEPENDS', ' ccache-native')
         d.setVar('CCACHE', 'ccache ')
 }
--

2.34.1

The information in this communication may contain confidential or legally privileged information. It is intended solely for the use of the individual or entity it addresses and others authorized to receive it. If you are not an intended recipient, you are hereby notified that any disclosure, copying, distribution or action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication by error, please notify us immediately by responding to this e-mail and then delete it from your system. Critical TechWorks is not liable for the proper and complete transmission of the information in this communication nor for any delay in its receipt

This e-mail is environmentally friendly, just like Critical TechWorks, which lives in a paper-free atmosphere. Therefore, please consider the environment before printing it!

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#186132): https://lists.openembedded.org/g/openembedded-core/message/186132
Mute This Topic: https://lists.openembedded.org/mt/100780019/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com