[1/1] move ccache dir from tmpdir to topdir

Message ID 20250220141054.29225-1-felix.moessbauer@siemens.com
State New
Headers show
Series [1/1] move ccache dir from tmpdir to topdir | expand

Commit Message

Felix Moessbauer Feb. 20, 2025, 2:10 p.m. UTC
By having the ccache below tmp it is cleaned on "kas clean" or any other
operation that removes the tmpdir. As this dir is frequently cleaned in
common use-cases, the cache is not reused.

We now move the ccache dir to the topdir to persist it across clean
operations. We further considered to move it into topdir/cache, but this
directory is managed by bitbake.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 doc/user_manual.md               | 2 +-
 meta-isar/conf/local.conf.sample | 2 +-
 meta/conf/bitbake.conf           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jan Kiszka Feb. 20, 2025, 2:59 p.m. UTC | #1
On 20.02.25 15:10, 'Felix Moessbauer' via isar-users wrote:
> By having the ccache below tmp it is cleaned on "kas clean" or any other
> operation that removes the tmpdir. As this dir is frequently cleaned in
> common use-cases, the cache is not reused.
> 
> We now move the ccache dir to the topdir to persist it across clean
> operations. We further considered to move it into topdir/cache, but this
> directory is managed by bitbake.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  doc/user_manual.md               | 2 +-
>  meta-isar/conf/local.conf.sample | 2 +-
>  meta/conf/bitbake.conf           | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index d8e5c33e..ff63aaa5 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -1198,7 +1198,7 @@ To enable global ccache functionality, `USE_CCACHE = "1"` can be added
>  to `local.conf`. If some package requires ccache to be always disabled,
>  `USE_CCACHE = "0"` can be used in the recipe despite global setup.
>  
> -By default, ccache directory is created inside `TMPDIR`, but it can be
> +By default, ccache directory is created inside `TOPDIR`, but it can be
>  adjusted by `CCACHE_TOP_DIR` variable in `local.conf`. Ccache directory
>  `CCACHE_DIR` default value is
>  `"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"`, that means
> diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
> index b59f310b..93d2ef96 100644
> --- a/meta-isar/conf/local.conf.sample
> +++ b/meta-isar/conf/local.conf.sample
> @@ -211,7 +211,7 @@ USER_isar[flags] += "clear-text-password"
>  # Uncomment this to use ccache for custom packages
>  #USE_CCACHE = "1"
>  # Uncomment and set own top level ccache directory to share between builds
> -#CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
> +#CCACHE_TOP_DIR ?= "${TOPDIR}/ccache"
>  # Enable ccache debug mode
>  #CCACHE_DEBUG = "1"
>  
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 5ab8ced7..4a964cfc 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -200,7 +200,7 @@ INHERIT += "${@'buildstats' if bb.utils.to_boolean(d.getVar('USE_BUILDSTATS')) e
>  
>  # Default values for ccache
>  USE_CCACHE ??= "0"
> -CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
> +CCACHE_TOP_DIR ?= "${TOPDIR}/ccache"
>  CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"
>  CCACHE_DEBUG ?= "0"
>  

IIRC, the default location was once modeled after OE - which does not
mean we shouldn't consider to deviate now.

Jan

Patch

diff --git a/doc/user_manual.md b/doc/user_manual.md
index d8e5c33e..ff63aaa5 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1198,7 +1198,7 @@  To enable global ccache functionality, `USE_CCACHE = "1"` can be added
 to `local.conf`. If some package requires ccache to be always disabled,
 `USE_CCACHE = "0"` can be used in the recipe despite global setup.
 
-By default, ccache directory is created inside `TMPDIR`, but it can be
+By default, ccache directory is created inside `TOPDIR`, but it can be
 adjusted by `CCACHE_TOP_DIR` variable in `local.conf`. Ccache directory
 `CCACHE_DIR` default value is
 `"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"`, that means
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index b59f310b..93d2ef96 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -211,7 +211,7 @@  USER_isar[flags] += "clear-text-password"
 # Uncomment this to use ccache for custom packages
 #USE_CCACHE = "1"
 # Uncomment and set own top level ccache directory to share between builds
-#CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
+#CCACHE_TOP_DIR ?= "${TOPDIR}/ccache"
 # Enable ccache debug mode
 #CCACHE_DEBUG = "1"
 
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 5ab8ced7..4a964cfc 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -200,7 +200,7 @@  INHERIT += "${@'buildstats' if bb.utils.to_boolean(d.getVar('USE_BUILDSTATS')) e
 
 # Default values for ccache
 USE_CCACHE ??= "0"
-CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
+CCACHE_TOP_DIR ?= "${TOPDIR}/ccache"
 CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}-${BUILD_ARCH}"
 CCACHE_DEBUG ?= "0"