public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH] add flag to enable ccache debug mode
Date: Tue, 12 Jul 2022 15:34:03 +0200	[thread overview]
Message-ID: <20220712133403.2386762-1-felix.moessbauer@siemens.com> (raw)

This patch adds the bitbake variable CCACHE_DEBUG which
can be set to 1 to enable the ccache debug mode.

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

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 3faa8f17..546ae75c 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1012,6 +1012,10 @@ adjusted by `CCACHE_TOP_DIR` variable in `local.conf`. Ccache directory
 `CCACHE_DIR` default value is `"${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}"`,
 that means caches for different distros and architectures are not overlapped.
 
+The ccache debug mode can be enabled by setting `CCACHE_DEBUG = "1"`
+in the `local.conf`.
+The debug artifacts will be placed in `${CCACHE_DIR}/debug`.
+
 
 ## Using sstate-cache
 
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 58f3e1a2..ce7b58ee 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -250,3 +250,5 @@ USER_isar[flags] += "clear-text-password"
 #USE_CCACHE = "1"
 # Uncomment and set own top level ccache directory to share between builds
 #CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
+# Enable ccache debug mode
+#CCACHE_DEBUG = "1"
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 4ec2c813..e989f69f 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -174,6 +174,9 @@ def isar_export_ccache(d):
     if d.getVar('USE_CCACHE') == '1':
         os.environ['CCACHE_DIR'] = '/ccache'
         os.environ['PATH_PREPEND'] = '/usr/lib/ccache'
+        if d.getVar('CCACHE_DEBUG') == '1':
+            os.environ['CCACHE_DEBUG'] = '1'
+            os.environ['CCACHE_DEBUGDIR'] = '/ccache/debug'
 
 do_fetch[dirs] = "${DL_DIR}"
 do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 11489661..48b9f207 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -25,7 +25,7 @@ MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}.lock"
 
 buildchroot_do_mounts() {
     if [ "${USE_CCACHE}" = "1" ]; then
-        mkdir -p ${CCACHE_DIR}
+        mkdir -p ${CCACHE_DIR}/debug
     fi
 
     sudo -s <<'EOSUDO'
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 6451cb59..48e3c8e9 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -100,7 +100,7 @@ BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH BBSERVER DL_DI
     SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM \
     USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \
     PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
-    CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_NOHASHDIR LICENSE_PATH SDKPKGSUFFIX \
+    CCACHE_DIR CCACHE_DEBUG EXTERNAL_TOOLCHAIN CCACHE CCACHE_NOHASHDIR LICENSE_PATH SDKPKGSUFFIX \
     WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \
     BB_WORKERCONTEXT BB_LIMITEDDEPS DEPLOY_DIR BUILDCHROOT_DIR \
     REPO_ISAR_DIR REPO_ISAR_DB_DIR REPO_BASE_DIR REPO_BASE_DB_DIR LAYERDIR_core \
@@ -133,6 +133,7 @@ INHERIT += "${@'buildstats' if d.getVar('USE_BUILDSTATS') == '1' else ''}"
 USE_CCACHE ??= "0"
 CCACHE_TOP_DIR ?= "${TMPDIR}/ccache"
 CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}"
+CCACHE_DEBUG ?= "0"
 
 include conf/local.conf
 include conf/multiconfig/${BB_CURRENT_MC}.conf
-- 
2.30.2


             reply	other threads:[~2022-07-12 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 13:34 Felix Moessbauer [this message]
2022-07-20  5:50 ` Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220712133403.2386762-1-felix.moessbauer@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox