From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH v3] sanity.bbclass: warn when sstate is outside of build dir, but hash equiv database is inside it
Date: Wed, 4 Mar 2026 11:25:31 +0100 [thread overview]
Message-ID: <20260304102531.3825150-1-alex.kanavin@gmail.com> (raw)
From: Alexander Kanavin <alex@linutronix.de>
This should help with the long-standing usability problem: when
someone tweaks the configuration to put sstate somewhere else than
the default (so that it can be shared between local builds, or over NFS),
they should also share the hash equivalency database, but no indication
would be given to the user to do so.
This will issue a warning and recommend to start a dedicated hash equivalency
server (if sstate is on NFS), or set BB_HASHSERVE_DB_DIR (if it isn't).
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
v3: moved the check to oe-core's sanity class (v1/2 had it in bitbake cooker),
due to use of SSTATE_DIR variable which is specific to oe-core.
---
meta/classes-global/sanity.bbclass | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 7e81d65939..a170c3f5f5 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -1011,6 +1011,29 @@ def check_sanity_everybuild(status, d):
if d.getVar("SSTATE_MIRRORS") and hashserv and hashserv.startswith("unix://") and not d.getVar("BB_HASHSERVE_UPSTREAM"):
bb.warn("You are using a local hash equivalence server but have configured an sstate mirror. This will likely mean no sstate will match from the mirror. You may wish to disable the hash equivalence use (BB_HASHSERVE), or use a hash equivalence server alongside the sstate mirror.")
+ # Check that when SSTATE_DIR is shared between builds, hashserve database is not private to a build
+ hashserv_proto,_,hashserv_path,_,_,_ = bb.fetch2.decodeurl(hashserv)
+ if hashserv_proto == "unix":
+ dbdir = d.getVar("BB_HASHSERVE_DB_DIR") or d.getVar("PERSISTENT_DIR") or d.getVar("CACHE")
+ topdir = d.getVar("TOPDIR")
+ sstatedir = d.getVar("SSTATE_DIR")
+
+ if (hashserv_path.startswith(topdir) and dbdir.startswith(topdir) and not sstatedir.startswith(topdir)):
+ if bb.utils.is_path_on_nfs(sstatedir):
+ bb.warn("""Sstate directory is on a shared NFS (it is set via SSTATE_DIR to {}),
+ but hash equivalency database is inside this particular build directory {}.
+
+ This will prevent sstate reuse, and it is recommended to set up a permanently running hash equivalency server
+ according to https://docs.yoctoproject.org/dev-manual/hashequivserver.html""".format(sstatedir, topdir))
+ else:
+ bb.warn("""Sstate directory is shared between several builds (it is set via SSTATE_DIR to {}),
+ but hash equivalency database is inside this particular build directory {}.
+
+ This will prevent sstate reuse, and it is recommended to set the location for the database to a common path
+ via BB_HASHSERVE_DB_DIR, for example:
+
+ BB_HASHSERVE_DB_DIR = \"${{SSTATE_DIR}}\"""".format(sstatedir, topdir))
+
# Check that TMPDIR hasn't changed location since the last time we were run
tmpdir = d.getVar('TMPDIR')
checkfile = os.path.join(tmpdir, "saved_tmpdir")
--
2.47.3
next reply other threads:[~2026-03-04 10:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 10:25 Alexander Kanavin [this message]
2026-03-04 10:46 ` Patchtest results for [PATCH v3] sanity.bbclass: warn when sstate is outside of build dir, but hash equiv database is inside it patchtest
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=20260304102531.3825150-1-alex.kanavin@gmail.com \
--to=alex.kanavin@gmail.com \
--cc=alex@linutronix.de \
--cc=openembedded-core@lists.openembedded.org \
/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