[oe-commits] [openembedded-core] 07/14: base.bbclass: add named SRCREVs to the sstate hash

git at git.openembedded.org git at git.openembedded.org
Thu May 30 09:34:33 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 310cc321c6bf1ccb88bdd1993f3aa921c3e58354
Author: Michael Ho <Michael.Ho at bmw.de>
AuthorDate: Mon May 27 17:42:36 2019 +0200

    base.bbclass: add named SRCREVs to the sstate hash
    
    Several fetchers support named sources that require setting a SRCREV with
    the source name as a suffix. These named SRCREV variables are not captured
    in the sstate hash calculation because they're only referenced within the
    bitbake fetcher function. Several recipes avoid this bug by adding the
    different SRCREVs to their packaging versioning but this is not enforced so
    it is very trivial to trip this bug case.
    
    Add a snippet to the base.bbclass anonymous python to add all named SRCREV
    variables to the vardeps of do_fetch to capture them in the sstate hash
    calculation.
    
    Testing of the bug can be shown by running the following bitbake commands
    with this patch set not applied:
    
    bitbake vulkan-demos | tee
    sed -i 's/SRCREV_gli = ".*"/SRCREV_gli = "xxx"/' \
      ../meta/recipes-graphics/vulkan/vulkan-demos_git.bb
    bitbake vulkan-demos | tee;
    
    The above results in no errors despite a broken SRCREV because the recipe  is
    considered unchanged by the bitbake sstate hash.
    
    After applying this patch the above commands instead result in a fetcher
    error which is correct.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/base.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 1636c6e..25d5fff 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -639,6 +639,18 @@ python () {
     if needsrcrev:
         d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
 
+        # Gather all named SRCREVs to add to the sstate hash calculation
+        # This anonymous python snippet is called multiple times so we
+        # need to be careful to not double up the appends here and cause
+        # the base hash to mismatch the task hash
+        for uri in srcuri.split():
+            parm = bb.fetch.decodeurl(uri)[5]
+            uri_names = parm.get("name", "").split(",")
+            for uri_name in filter(None, uri_names):
+                srcrev_name = "SRCREV_{}".format(uri_name)
+                if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split():
+                    d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name))
+
     set_packagetriplet(d)
 
     # 'multimachine' handling

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list