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 2/2] refactor: inject ccache environment similar to proxy env
Date: Fri,  3 Dec 2021 16:21:36 +0100	[thread overview]
Message-ID: <20211203152136.3260090-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20211203152136.3260090-1-felix.moessbauer@siemens.com>

Instead of configuring ccache in the build shell scripts,
we configure it by preparing the environment of the calling task.

The tasks invoke the build scripts using sudo.
By that, we have to modify the PATH variable inside sudo as
sudo itself clears it and sets it to the value of secure_path.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/dpkg.bbclass                         | 3 ++-
 meta/recipes-devtools/buildchroot/files/build.sh  | 5 -----
 meta/recipes-devtools/buildchroot/files/common.sh | 4 +++-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 7da7334..27fe84f 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -32,7 +32,8 @@ addtask devshell after do_install_builddeps
 # Build package from sources using build script
 dpkg_runbuild() {
     E="${@ isar_export_proxies(d)}"
+    E="${@ isar_export_ccache(d)}"
     export PARALLEL_MAKE="${PARALLEL_MAKE}"
     sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
-         /isar/build.sh ${PP}/${PPS} ${PACKAGE_ARCH} ${USE_CCACHE}
+         /isar/build.sh ${PP}/${PPS} ${PACKAGE_ARCH}
 }
diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
index 8e6507c..101581d 100644
--- a/meta/recipes-devtools/buildchroot/files/build.sh
+++ b/meta/recipes-devtools/buildchroot/files/build.sh
@@ -14,9 +14,4 @@ for i in configure aclocal.m4 Makefile.am Makefile.in; do
     fi
 done
 
-if [ "$use_ccache" == "1" ]; then
-    export CCACHE_DIR=/ccache
-    export PATH=/usr/lib/ccache:$PATH
-fi
-
 ${GBP_PREFIX}dpkg-buildpackage -a$target_arch -d --source-option=-I
diff --git a/meta/recipes-devtools/buildchroot/files/common.sh b/meta/recipes-devtools/buildchroot/files/common.sh
index 7085f44..73226d8 100644
--- a/meta/recipes-devtools/buildchroot/files/common.sh
+++ b/meta/recipes-devtools/buildchroot/files/common.sh
@@ -17,7 +17,6 @@ fi
 
 # Create human-readable names
 target_arch=$2
-use_ccache=$3
 
 set_arch="--host-arch $target_arch"
 
@@ -28,3 +27,6 @@ cd "$1"
 export LC_ALL=C
 export LANG=C
 export LANGUAGE=C
+
+# allow for changes to the PATH variable
+export PATH=$PATH_PREPEND:$PATH
-- 
2.30.2


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 15:21 [PATCH 1/2] Setup ccache in devshell as well Felix Moessbauer
2021-12-03 15:21 ` Felix Moessbauer [this message]
2021-12-17 11:03 ` 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-2-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