<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12473</bug_id>
          
          <creation_ts>2018-01-11 14:26:51 +0000</creation_ts>
          <short_desc>Recipe cache not working for nested DataSmart objects (BB_ORIGENV)</short_desc>
          <delta_ts>2020-04-28 03:13:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="dj">dominik.jaeger</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>stephano</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>79022</commentid>
    <comment_count>0</comment_count>
    <who name="dj">dominik.jaeger</who>
    <bug_when>2018-01-11 14:26:51 +0000</bug_when>
    <thetext>The recipe cache (activated by CACHE option) is not working if there are nested DataSmart objects. For example BB_ORIGENV is itself a DataSmart and also an entry in the main DataSmart object. The get_hash function calculates a hash based on the values of the DataSmart dict. For nested objects the value may not be persistent. In the case of the BB_ORIGENV the value contains the memory address of the object which is different each bitbake invocation. This causes the hash to change in each invocation. The hash is used in the file names of the cache files. Therefore the cache can never be used.

This problem exists in this project: https://github.com/openembedded/bitbake.git
Selectable versions in bugzilla don&apos;t match available tags in git so I didn&apos;t specify the version. The problem exists at least in the recent versions and on master.

Below patch seems to fix it. The idea is to make the get_hash function recursive in case of nested DataSmart objects and use their hash in the main hash. But I&apos;m not sure if this is the best way to solve it. Someone more experienced with the bitbake implementation should take a look.

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 7b09af5..c0e4228 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -1014,7 +1014,10 @@ class DataSmart(MutableMapping):
                 continue

             value = d.getVar(key, False) or &quot;&quot;
-            data.update({key:value})
+            if type(value) is type(self):
+                data.update({key:value.get_hash()})
+            else:
+                data.update({key:value})

             varflags = d.getVarFlags(key, internalflags = True)
             if not varflags</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86925</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-04-07 14:10:17 +0000</bug_when>
    <thetext>I did look into this and agree with your patch. We don&apos;t use BB_ORIGENV in the base configuration by default which is why we&apos;ve not run into this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86933</commentid>
    <comment_count>2</comment_count>
    <who name="dj">dominik.jaeger</who>
    <bug_when>2020-04-08 11:32:55 +0000</bug_when>
    <thetext>Thank you for looking into this. Would it be possible for you to integrate this patch and release a new version? I&apos;m not familiar with the processes in this project.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87087</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-04-26 06:03:15 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=98f9b05875c9a989490ad98b38f8f8bcaf0ca9d8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87092</commentid>
    <comment_count>4</comment_count>
    <who name="dj">dominik.jaeger</who>
    <bug_when>2020-04-28 03:13:51 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; http://git.yoctoproject.org/cgit.cgi/poky/commit/
&gt; ?id=98f9b05875c9a989490ad98b38f8f8bcaf0ca9d8

Thank you!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>