<?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>9984</bug_id>
          
          <creation_ts>2016-07-20 09:21:07 +0000</creation_ts>
          <short_desc>Suggested clarification of the &apos;3.1.2. Variable Expansion&apos; section</short_desc>
          <delta_ts>2016-08-01 22:32:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>BitBake User Manual</product>
          <component>bitbake-manual</component>
          <version>2.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>01 August 2016: RESOLVED</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.2 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>ulfalizer</reporter>
          <assigned_to name="Scott Rifenbark">srifenbark</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>sgw</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Done (doc changes complete)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64212</commentid>
    <comment_count>0</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-07-20 09:21:07 +0000</bug_when>
    <thetext>Hello Scott,

I&apos;ve seen people being confused about the behavior of &apos;=&apos; when variables in the right-hand side are changed after the assignment. Rewriting/expanding &apos;3.1.2. Variable Expansion&apos; as follows might help:

  3.1.2. Variable expansion
  
  Variables can reference the contents of other variables using a syntax that is
  similar to variable expansion in Bourne shells. The following assignments
  result in A containing &quot;aval&quot; and B evaluating to &quot;preavalpost&quot;.
  
       A = &quot;aval&quot;
       B = &quot;pre${A}post&quot;
  
  Note {
  Unlike in Bourne shells, the curly braces are mandatory: Only ${FOO} and
  not $FOO is recognized as an expansion of FOO.
  }
  
  The &apos;=&apos; operator does not immediately expand variable references in the
  right-hand side. Instead, expansion is deferred until the variable assigned to
  is actually used. The result depends on the current values of the referenced
  variables. The example below should clarify this behavior:
  
       A = &quot;${B} baz&quot;
       B = &quot;${C} bar&quot;
       C = &quot;foo&quot;
       *At this point, ${A} equals &quot;foo bar baz&quot;
       C = &quot;qux&quot;
       *At this point, ${A} equals &quot;qux bar baz&quot;
       B = &quot;norf&quot;
       *At this point, ${A} equals &quot;norf baz&quot;
  
  Contrast this behavior with the &apos;:=&apos; (immediate variable expansion) operator,
  which is described below.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64213</commentid>
    <comment_count>1</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-07-20 09:24:38 +0000</bug_when>
    <thetext>Hmm... was supposed to be *&apos;s at the end too:

       A = &quot;${B} baz&quot;
       B = &quot;${C} bar&quot;
       C = &quot;foo&quot;
       *At this point, ${A} equals &quot;foo bar baz&quot;*
       C = &quot;qux&quot;
       *At this point, ${A} equals &quot;qux bar baz&quot;*
       B = &quot;norf&quot;
       *At this point, ${A} equals &quot;norf baz&quot;*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64279</commentid>
    <comment_count>2</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-07-21 16:53:26 +0000</bug_when>
    <thetext>Ulf, 

Here is the new section - http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#variable-expansion.

Thanks, 
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64280</commentid>
    <comment_count>3</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-07-21 16:57:48 +0000</bug_when>
    <thetext>Looks good.

Thanks,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64281</commentid>
    <comment_count>4</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-07-21 17:30:54 +0000</bug_when>
    <thetext>Thought of one more thing that might be nice to add to the end of 3.1.11. Inline Python Variable Expansion:

Note {
Inline Python expressions work just like variable expansions insofar as the &apos;=&apos; and &apos;:=&apos; operators are concerned. Given the following assignment, &lt;code&gt;foo()&lt;/code&gt; will be called each time FOO is expanded:

    FOO = &quot;${@foo()}&quot;

Contrast this with the following immediate assignment, where &lt;code&gt;foo()&lt;/code&gt; is only called once, while the assignment is parsed:

    FOO := &quot;${@foo()}&quot;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64283</commentid>
    <comment_count>5</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-07-21 18:05:16 +0000</bug_when>
    <thetext>Here is the new note: http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#inline-python-variable-expansion

Thanks,
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64288</commentid>
    <comment_count>6</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-07-21 18:12:15 +0000</bug_when>
    <thetext>Looks good to me.

Thanks,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64290</commentid>
    <comment_count>7</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-07-21 18:17:44 +0000</bug_when>
    <thetext>Ulf, 

Closing the bug out. 

thanks,
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64755</commentid>
    <comment_count>8</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-08-01 21:54:43 +0000</bug_when>
    <thetext>Hello,

I noticed that this change (and maybe others too) disappeared from the BitBake User Manual. Was that an error?

Cheers,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64756</commentid>
    <comment_count>9</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-08-01 21:56:08 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Hello,
&gt; 
&gt; I noticed that this change (and maybe others too) disappeared from the
&gt; BitBake User Manual. Was that an error?
&gt; 
&gt; Cheers,
&gt; Ulf

At least 9985 disappeared as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64758</commentid>
    <comment_count>10</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-08-01 22:23:40 +0000</bug_when>
    <thetext>Ulf, 

Ok - I was trying to sync up my working repo with the actual upstream bitbake repo, which holds the docs.  In doing so, I did a &quot;git pull&quot; and apparently the changes I had made have not been merged into the actual upstream yet (they will be as Richard Purdie gets to these but not always right away).  

I rebuilt the manual from my poky-contrib/srifenbark/bb-manual area and the changes are there... they are not lost.  Just not merged yet.  

You can check those links out again to verify.

Sorry.

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64760</commentid>
    <comment_count>11</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-08-01 22:27:48 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; Ulf, 
&gt; 
&gt; Ok - I was trying to sync up my working repo with the actual upstream
&gt; bitbake repo, which holds the docs.  In doing so, I did a &quot;git pull&quot; and
&gt; apparently the changes I had made have not been merged into the actual
&gt; upstream yet (they will be as Richard Purdie gets to these but not always
&gt; right away).  
&gt; 
&gt; I rebuilt the manual from my poky-contrib/srifenbark/bb-manual area and the
&gt; changes are there... they are not lost.  Just not merged yet.  
&gt; 
&gt; You can check those links out again to verify.
&gt; 
&gt; Sorry.
&gt; 
&gt; Scott

OK, no worries. Just wanted to make sure they hadn&apos;t been accidentally deleted. Might&apos;ve lead to a PITA later. :)

Cheers,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64763</commentid>
    <comment_count>12</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-08-01 22:32:52 +0000</bug_when>
    <thetext>Ha - yes, it could have.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>