<?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>9603</bug_id>
          
          <creation_ts>2016-05-06 09:07:47 +0000</creation_ts>
          <short_desc>bitbake example class uses old getVarFlag() syntax</short_desc>
          <delta_ts>2016-06-02 09:50:33 +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>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexe Radu">alexeRadu2007</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>jku</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</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>62011</commentid>
    <comment_count>0</comment_count>
    <who name="Alexe Radu">alexeRadu2007</who>
    <bug_when>2016-05-06 09:07:47 +0000</bug_when>
    <thetext>I have just downloaded a fresh copy of bitbake and I&apos;ve been going through this tutorial: http://a4z.bitbucket.org/docs/BitBake/guide.html#_exploring_recipes_and_tasks.

When I try to list the tasks using:

bitbake -c listtasks second

I get the following error: 


radu@testy:~/work/bbtutorial/build$ bitbake -c listtasks second
Parsing recipes: 100% |####################################################################################################################| Time: 00:00:00
Parsing of 2 .bb files complete (0 cached, 2 parsed). 2 targets, 0 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing RunQueue
NOTE: Executing RunQueue Tasks
ERROR: second-1.0-r1 do_listtasks: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:do_listtasks(d)
     0003:
File: &apos;/home/radu/work/bbtutorial/build/../meta-tutorial/classes/base.bbclass&apos;, lineno: 55, function: do_listtasks
     0051:do_listtasks[nostamp] = &quot;1&quot;
     0052:python do_listtasks() {
     0053:	import sys
     0054:	for e in bb.data.keys(d):
 *** 0055:		if d.getVarFlag(e, &apos;task&apos;):
     0056:			bb.plain(&quot;%s&quot; % e)
     0057:}
     0058:
     0059:addtask build
Exception: TypeError: getVarFlag() takes at least 4 arguments (3 given)

ERROR: second-1.0-r1 do_listtasks: Function failed: do_listtasks
ERROR: Logfile of failure stored in: /home/radu/work/bbtutorial/build/tmp/work/second-1.0-r1/temp/log.do_listtasks.3349
ERROR: Task 0 (/home/radu/work/bbtutorial/build/../meta-tutorial/recipes-tutorial/second/second_1.0.bb, do_listtasks) failed with exit code &apos;1&apos;
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn&apos;t need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/radu/work/bbtutorial/build/../meta-tutorial/recipes-tutorial/second/second_1.0.bb, do_listtasks
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.


If I modify the the function do_listtasks() from base.class to:

...
if d.getVarFlag(e, &apos;task&apos;, False):
...

it works perfectly.

PS:
- the same problem/solution is for the &quot;showdata()&quot; function
- I am running ubuntu in a virtual machine
- I was at chapter 6.3 in the tutorial when this happened (so that you might recreate my project)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62034</commentid>
    <comment_count>1</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-05-09 07:39:18 +0000</bug_when>
    <thetext>Since earlier this year getVarFlag() requires the expand parameter to be present (this is in preparation for future when expand will default to True).

So this is not a bug in bitbake or yocto but an API change. I&apos;m not closing the bug yet since it seems the documentation is not up-to-date yet (e.g. https://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#accessing-datastore-variables-using-python).


I&apos;ll send the tutorial author an email, maybe he wants to fix that as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62036</commentid>
    <comment_count>2</comment_count>
    <who name="Alexe Radu">alexeRadu2007</who>
    <bug_when>2016-05-09 09:14:00 +0000</bug_when>
    <thetext>The comment is not only in the documentation but also in the default base.bbclass provided by bitbake.

Problems are at line 46 and line 55. Here the old API is used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62038</commentid>
    <comment_count>3</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-05-09 10:22:46 +0000</bug_when>
    <thetext>I assume you mean this base.bbclass:

&gt; home/radu/work/bbtutorial/build/../meta-tutorial/classes/base.bbclass

This file seems to be part of the tutorial you are using, not bitbake or oe-core.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62039</commentid>
    <comment_count>4</comment_count>
    <who name="Alexe Radu">alexeRadu2007</who>
    <bug_when>2016-05-09 11:02:49 +0000</bug_when>
    <thetext>The base.bbclass is located in &lt;bitbake-path&gt;/classes that comes with the standard bitbake I cloned from the github repository.

The tutorial pointed out that I should use it which I did.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62041</commentid>
    <comment_count>5</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-05-09 12:01:52 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; The base.bbclass is located in &lt;bitbake-path&gt;/classes that comes with the
&gt; standard bitbake I cloned from the github repository.
&gt; 
&gt; The tutorial pointed out that I should use it which I did.

Ah, you copied the example class to the tutorial directory and that one is not updated. Got it, sorry for my slowness (it is monday).

Updating title.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62047</commentid>
    <comment_count>6</comment_count>
    <who name="Alexe Radu">alexeRadu2007</who>
    <bug_when>2016-05-09 14:29:32 +0000</bug_when>
    <thetext>No problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62593</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-06-02 09:50:33 +0000</bug_when>
    <thetext>http://git.openembedded.org/bitbake/commit/?id=d830dccf948d188492cecfcf2ff053f31740dc21</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>