diff options
author | Michael Ho <Michael.Ho@bmw.de> | 2019-05-27 17:42:36 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-30 12:37:03 +0100 |
commit | 74331a426ff263cd7b74a7578d6f49eb72d7f3c2 (patch) | |
tree | 20bb474a36aef203f144cbb49bd8f23e0f9142fb /meta/classes/base.bbclass | |
parent | 49e4108756ca3324fa12f8c6a39f3c7f8ac4f55e (diff) | |
download | poky-74331a426ff263cd7b74a7578d6f49eb72d7f3c2.tar.gz |
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.
(From OE-Core rev: fdc000b8ae1577f1b29efb2cc4927664ad41e21c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 1636c6ef93..25d5fff72e 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -639,6 +639,18 @@ python () { | |||
639 | if needsrcrev: | 639 | if needsrcrev: |
640 | d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}") | 640 | d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}") |
641 | 641 | ||
642 | # Gather all named SRCREVs to add to the sstate hash calculation | ||
643 | # This anonymous python snippet is called multiple times so we | ||
644 | # need to be careful to not double up the appends here and cause | ||
645 | # the base hash to mismatch the task hash | ||
646 | for uri in srcuri.split(): | ||
647 | parm = bb.fetch.decodeurl(uri)[5] | ||
648 | uri_names = parm.get("name", "").split(",") | ||
649 | for uri_name in filter(None, uri_names): | ||
650 | srcrev_name = "SRCREV_{}".format(uri_name) | ||
651 | if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split(): | ||
652 | d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name)) | ||
653 | |||
642 | set_packagetriplet(d) | 654 | set_packagetriplet(d) |
643 | 655 | ||
644 | # 'multimachine' handling | 656 | # 'multimachine' handling |