public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] sbuild: Fix low hit ratio for ccache on linux kernel rebuild
@ 2022-07-15 11:27 Uladzimir Bely
  2022-07-15 13:27 ` Moessbauer, Felix
  0 siblings, 1 reply; 7+ messages in thread
From: Uladzimir Bely @ 2022-07-15 11:27 UTC (permalink / raw)
  To: isar-users

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-17 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 11:27 [PATCH] sbuild: Fix low hit ratio for ccache on linux kernel rebuild Uladzimir Bely
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox