public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH] sbuild: Fix low hit ratio for ccache on linux kernel rebuild
Date: Fri, 15 Jul 2022 13:27:16 +0200	[thread overview]
Message-ID: <20220715112716.2460-1-ubely@ilbers.de> (raw)

For some targets defconfig for linux recipe includes option
CONFIG_DEBUG_INFO that embeds absolute path to the source files
into compiled binaries.

While sbuild uses unique directory to place sources for each build
by default, it happens that ccache hits ration is to small on rebuild.

This patch makes sbuild use the same build directory for sequential
builds. While several packages can be built in parallel (e.g. same
package for different architectures), WORKDIR is used to generate
hash part for the build directory of sbuild.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/dpkg.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index b726ea9d..016e46c4 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -82,6 +82,8 @@ dpkg_runbuild() {
     sh -c "cd ${WORKDIR}; dpkg-source -q -b ${PPS}"
     DSC_FILE=$(find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -print)
 
+    build_path_hash=$(echo "${WORKDIR}" | md5sum | cut -b1-6)
+
     sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}" \
         --host=${PACKAGE_ARCH} --build=${SBUILD_HOST_ARCH} ${profiles} \
         --no-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alternatives \
@@ -91,6 +93,7 @@ dpkg_runbuild() {
         --finished-build-commands="cp -n --no-preserve=owner ${deb_dir}/*.deb -t ${ext_deb_dir}/ || :" \
         --finished-build-commands="cp /var/log/dpkg.log ${ext_root}/dpkg_partial.log" \
         --debbuildopts="--source-option=-I" \
+        --build-path="/build/${PN}-${build_path_hash}" \
         --build-dir=${WORKDIR} --dist="isar" ${DSC_FILE}
 
     sbuild_dpkg_log_export "${WORKDIR}/rootfs/dpkg_partial.log"
-- 
2.20.1


             reply	other threads:[~2022-07-15 11:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 11:27 Uladzimir Bely [this message]
2022-07-15 13:27 ` Moessbauer, Felix
2022-07-15 13:44   ` Uladzimir Bely
2022-07-15 13:50     ` Baurzhan Ismagulov
2022-07-15 14:48       ` Moessbauer, Felix
2022-07-15 13:47   ` Baurzhan Ismagulov
2022-07-17 18:53     ` Jan Kiszka

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=20220715112716.2460-1-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.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