diff mbox series

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

Message ID 20260317120859.317294-2-jose.quaresma@foundries.io
State New
Headers show
Series sanity: condition hash equivalence warnings to when it is in use. | expand

Commit Message

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

The warnings about the hash equivalence are only valid when it the hash equivalence
signature is being used, and for that we have to check the BB_SIGNATURE_HANDLER variable.
We also have to consider the case where the variable BB_HASHSERVE is not defined.

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>
---
 meta/classes-global/sanity.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Purdie March 17, 2026, 12:16 p.m. UTC | #1
On Tue, 2026-03-17 at 12:09 +0000, Jose Quaresma via lists.openembedded.org wrote:
> From: Jose Quaresma <jose.quaresma@oss.qualcomm.com>
> 
> The warnings about the hash equivalence are only valid when it the hash equivalence
> signature is being used, and for that we have to check the BB_SIGNATURE_HANDLER variable.
> We also have to consider the case where the variable BB_HASHSERVE is not defined.
> 
> 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>
> ---
>  meta/classes-global/sanity.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
> index a170c3f5f5..e8eab1cdfe 100644
> --- a/meta/classes-global/sanity.bbclass
> +++ b/meta/classes-global/sanity.bbclass
> @@ -1007,8 +1007,8 @@ def check_sanity_everybuild(status, d):
>                      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"):
> +    hashserv = "" if d.getVar("BB_SIGNATURE_HANDLER") != "OEEquivHash" else d.getVar("BB_HASHSERVE") or ""
> +    if d.getVar("SSTATE_MIRRORS") 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.")

Good catch, thanks.

Since we're in python, we don't need to make this all one line and I
suspect it might be more readable if you put the two conditions on
separate lines and add a level of indentation.

"" if d.getVar("BB_SIGNATURE_HANDLER") != "OEEquivHash" else d.getVar("BB_HASHSERVE") or ""

isn't easily parsable.

Cheers,

Richard
Jose Quaresma March 17, 2026, 2:38 p.m. UTC | #2
Richard Purdie <richard.purdie@linuxfoundation.org> escreveu (terça,
17/03/2026 à(s) 12:16):

> On Tue, 2026-03-17 at 12:09 +0000, Jose Quaresma via
> lists.openembedded.org wrote:
> > From: Jose Quaresma <jose.quaresma@oss.qualcomm.com>
> >
> > The warnings about the hash equivalence are only valid when it the hash
> equivalence
> > signature is being used, and for that we have to check the
> BB_SIGNATURE_HANDLER variable.
> > We also have to consider the case where the variable BB_HASHSERVE is not
> defined.
> >
> > 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>
> > ---
> >  meta/classes-global/sanity.bbclass | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/meta/classes-global/sanity.bbclass
> b/meta/classes-global/sanity.bbclass
> > index a170c3f5f5..e8eab1cdfe 100644
> > --- a/meta/classes-global/sanity.bbclass
> > +++ b/meta/classes-global/sanity.bbclass
> > @@ -1007,8 +1007,8 @@ def check_sanity_everybuild(status, d):
> >                      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"):
> > +    hashserv = "" if d.getVar("BB_SIGNATURE_HANDLER") != "OEEquivHash"
> else d.getVar("BB_HASHSERVE") or ""
> > +    if d.getVar("SSTATE_MIRRORS") 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.")
>
> Good catch, thanks.
>
> Since we're in python, we don't need to make this all one line and I
> suspect it might be more readable if you put the two conditions on
> separate lines and add a level of indentation.
>
> "" if d.getVar("BB_SIGNATURE_HANDLER") != "OEEquivHash" else
> d.getVar("BB_HASHSERVE") or ""
>
> isn't easily parsable.
>

It's true, it's the conditional operator in C, but impossible to read in
Python. I sent a v2.

Jose


> Cheers,
>
> Richard
>
diff mbox series

Patch

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index a170c3f5f5..e8eab1cdfe 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -1007,8 +1007,8 @@  def check_sanity_everybuild(status, d):
                     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"):
+    hashserv = "" if d.getVar("BB_SIGNATURE_HANDLER") != "OEEquivHash" else d.getVar("BB_HASHSERVE") or ""
+    if d.getVar("SSTATE_MIRRORS") 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