diff mbox series

[v3] sanity: condition hash equivalence warnings to when it is in use.

Message ID 20260317162211.321710-2-jose.quaresma@foundries.io
State Under Review
Headers show
Series [v3] sanity: condition hash equivalence warnings to when it is in use. | expand

Commit Message

Jose Quaresma March 17, 2026, 4:22 p.m. UTC
From: Jose Quaresma <jose.quaresma@oss.qualcomm.com>

The warnings about the hash equivalence server are only valid when the signature is
being used, and for that we have to check the BB_SIGNATURE_HANDLER variable.

This fix the warning that is displayed when using the basic signature hash, OEBasicHash.

| WARNING:
| 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.

Signed-off-by: Jose Quaresma <jose.quaresma@oss.qualcomm.com>
---

 v2: add new top conditions for the BB_SIGNATURE_HANDLER and ident the existing one
 v3: ident the hash equivalence complete block

 meta/classes-global/sanity.bbclass | 51 +++++++++++++++---------------
 1 file changed, 26 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index a170c3f5f5..b5d905399b 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -1006,33 +1006,34 @@  def check_sanity_everybuild(status, d):
                     mirror_base = urllib.parse.urlparse(mirror[:-1*len('/PATH')]).path
                     check_symlink(mirror_base, d)
 
-    # Check sstate mirrors aren't being used with a local hash server and no remote
-    hashserv = d.getVar("BB_HASHSERVE")
-    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 {}.
+    if d.getVar("BB_SIGNATURE_HANDLER") == "OEEquivHash":
+        # Check sstate mirrors aren't being used with a local hash server and no remote
+        hashserv = d.getVar("BB_HASHSERVE")
+        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:
+        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))
+        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')