<?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>4366</bug_id>
          
          <creation_ts>2013-04-22 05:59:28 +0000</creation_ts>
          <short_desc>Several variables&apos; assignments are hard to understand</short_desc>
          <delta_ts>2013-10-02 09:59:39 +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>OE-Core</product>
          <component>configuration</component>
          <version>1.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.5 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>corneliux.stoicescu</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</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>32423</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-04-22 05:59:28 +0000</bug_when>
    <thetext>Several variables&apos; assignments are hard to understand, e.g., in bitbake.conf:

TARGET_SYS = &quot;${TARGET_ARCH}${TARGET_VENDOR}${@[&apos;-&apos; + d.getVar(&apos;TARGET_OS&apos;, True), &apos;&apos;][d.getVar(&apos;TARGET_OS&apos;, True) == (&apos;&apos; or &apos;custom&apos;)]}&quot;

MACHINE_ARCH = &quot;${@[d.getVar(&apos;TUNE_PKGARCH&apos;, True), d.getVar(&apos;MACHINE&apos;, True)][bool(d.getVar(&apos;MACHINE&apos;, True))].replace(&apos;-&apos;, &apos;_&apos;)}&quot;

Can we find a new way for the assignments ? For example, put the expression in the function or create a new syntax.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34421</commentid>
    <comment_count>1</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-07-09 08:48:59 +0000</bug_when>
    <thetext>Hi All,

I&apos;ve extracted those seemingly hard-to-understand lines from bitbake.conf.

TARGET_SYS = &quot;${TARGET_ARCH}${TARGET_VENDOR}${@[&apos;-&apos; + d.getVar(&apos;TARGET_OS&apos;, True), &apos;&apos;][d.getVar(&apos;TARGET_OS&apos;, True) == (&apos;&apos; or &apos;custom&apos;)]}&quot;

SDK_SYS = &quot;${SDK_ARCH}${SDK_VENDOR}${@[&apos;-&apos; + d.getVar(&apos;SDK_OS&apos;, True), &apos;&apos;][d.getVar(&apos;SDK_OS&apos;, True) == (&apos;&apos; or &apos;custom&apos;)]}&quot;

MACHINE_ARCH = &quot;${@[d.getVar(&apos;TUNE_PKGARCH&apos;, True), d.getVar(&apos;MACHINE&apos;, True)][bool(d.getVar(&apos;MACHINE&apos;, True))].replace(&apos;-&apos;, &apos;_&apos;)}&quot;

EXTENDPE = &quot;${@[&apos;&apos;,&apos;${PE\x7d_&apos;][int(d.getVar(&apos;PE&apos;,1) or 0) &gt; 0]}&quot;

EXTENDPRAUTO = &quot;${@[&apos;.${PRAUTO\x7d&apos;,&apos;&apos;][d.getVar(&apos;PRAUTO&apos;,1) is None]}&quot;

EXTENDPKGEVER = &quot;${@[&apos;&apos;,&apos;${PKGE\x7d:&apos;][d.getVar(&apos;PKGE&apos;,1).strip() != &apos;&apos;]}&quot;

FILES_${PN}-dbg = &quot;${@d.getVar([&apos;DOTDEBUG-dbg&apos;, &apos;DEBUGFILEDIRECTORY-dbg&apos;][d.getVar(&apos;PACKAGE_DEBUG_SPLIT_STYLE&apos;, True) == &apos;debug-file-directory&apos;], True)}&quot;

export CCACHE_DISABLE ??= &quot;${@[0,1][d.getVar(&apos;CCACHE&apos;, True) == &apos;&apos;]}&quot;

SELECTED_OPTIMIZATION = &quot;${@d.getVar([&apos;FULL_OPTIMIZATION&apos;, &apos;DEBUG_OPTIMIZATION&apos;][d.getVar(&apos;DEBUG_BUILD&apos;, True) == &apos;1&apos;], True)}&quot;

These lines have one thing in common, that is, they choose between value1 and value2 according to condition. I don&apos;t see an easier way to do this than [value1,value2][condition].

The true problem here, from my point of view, is lack of documentation of these variables. For example, I can&apos;t find MACHINE_ARCH, TARGET_SYS and SDK_SYS in the glossary section of the reference manual.

P.S.
The assignment is kind of weird for TARGET_SYS and SDK_SYS, as (&apos;&apos; or &apos;custom&apos;) equals to &apos;custom&apos;.

I think what is expected is:
TARGET_SYS = &quot;${TARGET_ARCH}${TARGET_VENDOR}${@[&apos;-&apos; + d.getVar(&apos;TARGET_OS&apos;, True), &apos;&apos;][d.getVar(&apos;TARGET_OS&apos;, True) == &apos;&apos; or d.getVar(&apos;TARGET_OS&apos;, True) == &apos;custom&apos;]}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34424</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-07-09 09:09:27 +0000</bug_when>
    <thetext>Close this bug.
Reason detailed in the last comment.

//Chen Qi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37457</commentid>
    <comment_count>3</comment_count>
    <who name="Stoicescu Cornel">corneliux.stoicescu</who>
    <bug_when>2013-10-02 09:59:39 +0000</bug_when>
    <thetext>There have been no modification done to bitbake.conf on behalf of this bug.

Verified in:
poky master:4d8ab87d25ea6e59dc88375813ef88ee0ac813d0</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>