ccache: make sure ccache is really not used even when installed

Message ID 20220722140421.22357-1-henning.schild@siemens.com
State Accepted, archived
Headers show
Series ccache: make sure ccache is really not used even when installed | expand

Commit Message

Henning Schild July 22, 2022, 6:04 a.m. UTC
As soon as ccache is installed the build system meson will jump on it
and tries to use it. But it is not really usable when USE_CCACHE is not
enabled, the build will run into permission problems creating cache
files which anyhow will be ditched with the sbuild chroot.

Could be considered a bug in meson that it will use ccache if it is
installed, or it could be a bug in isar where ccache can not be used
inside the sbuild chroot ... while it is installed there.

Simply disabling it inside the chroot when disabled for that package
works well.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/dpkg.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Comments

Henning Schild July 22, 2022, 11:33 a.m. UTC | #1
Am Fri, 22 Jul 2022 16:04:21 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> As soon as ccache is installed the build system meson will jump on it
> and tries to use it. But it is not really usable when USE_CCACHE is
> not enabled, the build will run into permission problems creating
> cache files which anyhow will be ditched with the sbuild chroot.
> 
> Could be considered a bug in meson that it will use ccache if it is
> installed, or it could be a bug in isar where ccache can not be used
> inside the sbuild chroot ... while it is installed there.
> 
> Simply disabling it inside the chroot when disabled for that package
> works well.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta/classes/dpkg.bbclass | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index b726ea9d8473..c772c0f5c6d2 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -60,6 +60,8 @@ dpkg_runbuild() {
>  
>      if [ ${USE_CCACHE} -eq 1 ]; then
>          schroot_configure_ccache
> +    else
> +        sbuild_export CCACHE_DISABLE "1"

I guess the better solution would be to simply only install the
"ccache" package in the sbuild chroot when "USE_CCACHE == 1". So that
meson will not pick up on it. Or not set any CCACHE related env
variables while setting a HOME so that any build system can just use
ccache (even if useless) when isar itself is not using it.

I failed to find a good solution for both of those, so i propose this.
And it will hopefully "just work".

In this very case i can again share the recipe and invite anyone to
come up with a better solution.

flashrom_1.2_5.bb
--
inherit dpkg

SRC_URI +=
"http://deb.debian.org/debian/pool/main/f/${PN}/${PN}_${PV}.orig.tar.bz2;name=origtarball"
SRC_URI[origtarball.sha256sum] =
"e1f8d95881f5a4365dfe58776ce821dfcee0f138f75d0f44f8a3cd032d9ea42b"
SRC_URI +=
"http://deb.debian.org/debian/pool/main/f/${PN}/${PN}_${PV}-${PR}.debian.tar.xz;name=debian"
SRC_URI[debian.sha256sum] =
"11f061e832386004ea7aa85e8afe025d73f3db839c14b629f4019137afe6c37d"
SRC_URI +=
"file://0001-chipset_enable-register-APL-I-Broxton-PCI-ID.patch;apply=no"

MAINTAINER = "isar-users <isar-users@googlegroups.com>"
CHANGELOG_V = "<orig-version>+isar"

S="${WORKDIR}/${PN}-v${PV}"

do_prepare_build() {
	cp -f ${DL_DIR}/${PN}_${PV}.orig.tar.bz2 ${WORKDIR}/
	cd ${S}
	rm -rf debian
	cp -r ../debian .
	quilt pop -a || true
	rm -rf debian/patches
	export QUILT_PATCHES="debian/patches"
	quilt import
${WORKDIR}/0001-chipset_enable-register-APL-I-Broxton-PCI-ID.patch
quilt push deb_add_changelog
	cat > ${S}/debian/source/options <<-EOF
		extend-diff-ignore = "(^|/)(.*)(\.buildinfo|\.changes)$"
	EOF
}
--

files/0001-chipset_enable-register-APL-I-Broxton-PCI-ID.patch
--
diff --git a/chipset_enable.c b/chipset_enable.c
index e826d90..2b8c0ce 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -2036,6 +2036,7 @@ const struct penable chipset_enables[] = {
 	{0x8086, 0xa2c9, B_S,    NT,  "Intel", "Z370",
		enable_flash_pch100}, {0x8086, 0xa2d2, B_S,    NT,
"Intel", "X299",				enable_flash_pch100},
{0x8086, 0x5ae8, B_S,    DEP, "Intel", "Apollo Lake",
	enable_flash_apl},
+	{0x8086, 0x5af0, B_S,    DEP, "Intel", "Apollo Lake",
		enable_flash_apl}, {0x8086, 0xa303, B_S,    NT,
"Intel", "H310",				enable_flash_pch300},
{0x8086, 0xa304, B_S,    NT,  "Intel", "H370",
	enable_flash_pch300}, {0x8086, 0xa305, B_S,    NT,  "Intel",
"Z390", enable_flash_pch300},

--

Henning


>      fi
>  
>      profiles="${@ isar_deb_build_profiles(d)}"
Anton Mikanovich July 31, 2022, 10:20 p.m. UTC | #2
22.07.2022 17:04, Henning Schild wrote:
> As soon as ccache is installed the build system meson will jump on it
> and tries to use it. But it is not really usable when USE_CCACHE is not
> enabled, the build will run into permission problems creating cache
> files which anyhow will be ditched with the sbuild chroot.
>
> Could be considered a bug in meson that it will use ccache if it is
> installed, or it could be a bug in isar where ccache can not be used
> inside the sbuild chroot ... while it is installed there.
>
> Simply disabling it inside the chroot when disabled for that package
> works well.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>

Applied to next, thanks.

Patch

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index b726ea9d8473..c772c0f5c6d2 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -60,6 +60,8 @@  dpkg_runbuild() {
 
     if [ ${USE_CCACHE} -eq 1 ]; then
         schroot_configure_ccache
+    else
+        sbuild_export CCACHE_DISABLE "1"
     fi
 
     profiles="${@ isar_deb_build_profiles(d)}"