*Very* helpful stuff.

I have re-created the tree you described, and everything seems to work. In 
particular, bitbake-layers seems happy. I tried executing it against BitBake 
1.12.0 and it succeeded.  FYI, it failed against the current BitBake master, 
which is 1.16.0.

I have some additional questions below.  You've already been so helpful that 
I'm reluctant to impose … but I'm going to try anyway :)

On Oct 4, 2012, at 1:58 PM, Rudolf Streif 
<rudolf.str...@linux.com<mailto:rudolf.str...@linux.com>> wrote:

My Bitbake "Hello World" is a little more than a basic "Hello World".

Indeed it is.  One of my first tasks will be to *remove* as much as possible 
from this until the only thing it does is print out "Hello, World!"  I'll be 
happy to share my results if anyone is interested.

Bitbake will require a base.bbclass file somewhere in a classes subdirectory of 
BBPATH. I used the base.bbclass file from the Bitbake download. As a minimum it 
should contain a do_build task. That's the target that Bitbake invokes by 
default if you do not use the -c option explicitly.


addtask build
do_build[dirs] = "${TOPDIR}"
do_build[nostamp] = "1"
python base_do_build () {
        bb.note("The included, default BB base.bbclass does not define a useful 
default task.")
        bb.note("Try running the 'listtasks' task against a .bb to see what 
tasks are defined.")

If I understand correctly, the name of the task is "build", and the name of the 
Python function that implements it is "do_build()".  So, it appears BitBake 
prefixes all task names with "do_" to derive the name of the function that 
implements the task.  Have I got that right?

The "build" task is *required*, and it's the *only* one that's required?

I've been looking around in the BitBake source code a lot, so I'm *somewhat* 
familiar with it.  I tried to find the "hard" reference to "do_build" you 
described,  but I couldn't.  Can you give me a hint?

Finally a recipe to build the Nano editor:

DESCRIPTION = "Recipe to build the 'nano' editor"

PN = "nano"
PV = "2.2.6"

SRC_URI = "http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz";

python do_fetch() {
   bb.note("Downloading source tarball from ${SRC_URI} ...")

   src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split()
   if len(src_uri) == 0:
      bb.fatal("Empty URI")

      bb.fetch.init(src_uri, d)
   except FetchError:
      bb.fatal("Could not fetch source tarball.")

   bb.note("Download successful.")

addtask fetch before do_build

I see here that you're creating the recipe-specific "do_fetch()" function, 
which seems intended to "override" the default "do_fetch()" provided by the 
base class.  This prompts some questions:

1) Must a "task function" be a Python function?  Or will a bash function do?

2) Is it absolutely necessary to follow a recipe-specific task function with an 
"addtask"?  Based on experience from "real" object-oriented languages, a naive 
observer (like me) would guess the simple presence of "do_fetch()" in the 
recipe is all that's necessary.  Or is it the "addtask" that actually "slots" 
the new function in?

yocto mailing list

Reply via email to