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, adriaan.schmidt@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/2] Setup ccache in devshell as well
Date: Fri,  3 Dec 2021 16:21:35 +0100	[thread overview]
Message-ID: <20211203152136.3260090-1-felix.moessbauer@siemens.com> (raw)

This patch also enables the ccache in the devshell for recipes
that use the ccache. By that, also ccache statistics can be
inspected.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/base.bbclass      | 5 +++++
 meta/classes/dpkg-base.bbclass | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index c43ec19..d8347b9 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -166,6 +166,11 @@ def isar_export_proxies(d):
 
     return bb.utils.export_proxies(d)
 
+def isar_export_ccache(d):
+    if d.getVar('USE_CCACHE') == '1':
+        os.environ['CCACHE_DIR'] = '/ccache'
+        os.environ['PATH_PREPEND'] = '/usr/lib/ccache'
+
 do_fetch[dirs] = "${DL_DIR}"
 do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
 do_fetch[vardeps] += "SRCREV"
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 6704385..cb5ce4a 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -278,10 +278,12 @@ python do_devshell() {
     bb.build.exec_func('dpkg_do_mounts', d)
 
     isar_export_proxies(d)
+    isar_export_ccache(d)
 
     buildchroot = d.getVar('BUILDCHROOT_DIR')
     pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS'))
-    termcmd = "sudo -E chroot {0} sh -c 'cd {1}; $SHELL -i'"
+    # the PATH variable is not forwarded by sudo -E.
+    termcmd = "sudo -E chroot {0} sh -c 'cd {1}; export PATH=$PATH_PREPEND:$PATH; $SHELL -i'"
     oe_terminal(termcmd.format(buildchroot, pp_pps), "Isar devshell", d)
 
     bb.build.exec_func('dpkg_undo_mounts', d)
-- 
2.30.2


             reply	other threads:[~2021-12-03 15:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 15:21 Felix Moessbauer [this message]
2021-12-03 15:21 ` [PATCH 2/2] refactor: inject ccache environment similar to proxy env Felix Moessbauer
2021-12-17 11:03 ` [PATCH 1/2] Setup ccache in devshell as well 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=20211203152136.3260090-1-felix.moessbauer@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=adriaan.schmidt@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