<?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>9033</bug_id>
          
          <creation_ts>2016-02-02 10:04:01 +0000</creation_ts>
          <short_desc>Data.getVar doesn&apos;t support the expansion of nested variables</short_desc>
          <delta_ts>2016-02-02 14:18:05 +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>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Igor Stoppa">igor.stoppa</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>58420</commentid>
    <comment_count>0</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-02-02 10:04:01 +0000</bug_when>
    <thetext>In a recipe, it is common to have a variable defined in terms of another, with various levels of nesting.

Simple Ex:


Precondition:
-------------

VAR1 ?= &quot;a&quot;

VAR2 ?= &quot;${VAR1}b&quot;


Triggering Action:
------------------
running Data.getVar over VAR2 in a python script, within a recipe
ex: print d.getVar(&quot;VAR2&quot;)

Expected Outcome:
-----------------
one would expect that it will yield &quot;ab&quot;, just like it would happen if the expansion was performed within a shell script


Actual Outcome:
---------------
It will instead yield &quot;${VAR1}b&quot;, which is somewhat less intuitive and definitely less usable, in typical scenario where one wants to have the final evaluation of the expression.


Additional remarks:
-------------------
One might argue that this is a feature request, rather than a bug, but I see the current implementation as a deviation from the behaviour of the existing variable expansion performed in shell context. I think it&apos;s fair to expect getVar to be the python counterpart of variable retrieval that in a shell is done with &quot;{VAR2}&quot; and therefore I think it should be expected that it behaves in a compatible way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58421</commentid>
    <comment_count>1</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-02-02 10:05:44 +0000</bug_when>
    <thetext>In the remarks, s/{VAR2}/${VAR2}/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58435</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-02-02 11:57:33 +0000</bug_when>
    <thetext>Try d.getVar(&quot;VAR2&quot;, True)

There is an open bug about changing to expand by default but that is a long process. In the current cycle we will make the expand parameter mandatory (we&apos;ve already done a few rounds of cleanup adding the missing parameters).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58437</commentid>
    <comment_count>3</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-02-02 12:10:45 +0000</bug_when>
    <thetext>Yes, thanks, it worked.

I was looking at the wrong code, where the value was already set to True, so I couldn&apos;t figure out what else I could do.

But this issue can be closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58448</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-02-02 14:18:05 +0000</bug_when>
    <thetext>Resolved as variable expansion does work.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>