Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-11 Thread Patrick Turley
https://github.com/pturley0/bitbake-hello-world

On Oct 9, 2012, at 5:56 PM, McClintock Matthew-B29882 b29...@freescale.com 
wrote:

 On Tue, Oct 9, 2012 at 5:31 PM, Patrick Turley
 patricktur...@gamestop.com wrote:
 Success. The file tree depicted at the bottom of this mail is nearly the
 smallest, valid BitBake project that prints Hello, World! Here's the
 output:
 
 Perhaps you could push this to github somewhere as an example?
 
 -M

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-10 Thread Evade Flow
Again, thanks *so* much for putting this together. I tried to do this
once before and didn't have the tenacity to stick with it--it is a
surprisingly daunting task. Having a smallest-possible example will, I
think, be really helpful to developers who want to learn how to debug
bitbake and contribute fixes.

Interestingly, I tried running this and got the following result:

bitbake_hello% ../bitbake-1.15.2/bin/bitbake a
The BBPATH variable is not set
DEBUG: Removed the following variables from the environment:
http_proxy, CVS_RSH,
SHLVL, LD_LIBRARY_PATH, EDITOR, SUDO_USER, USERNAME, PROMPT,
PYTHONPATH, SUDO_UID,
RPROMPT, SUDO_COMMAND, SUDO_GID, OLDPWD, MAIL


I guess I either fat-fingered something during cut-and-paste, or it's
due to some difference between the tarball I downloaded and the bitbake
tag you were using. I'm behind a firewall, but I'll see if I can suck
down the the actual git repo through my phone and see if that makes a
difference.

On Tue, Oct 9, 2012 at 6:31 PM, Patrick Turley
patricktur...@gamestop.com wrote:
 Success. The file tree depicted at the bottom of this mail is nearly the
 smallest, valid BitBake project that prints Hello, World! Here's the
 output:


 $ ../BitBake/bin/bitbake  a
 Parsing recipes: 100%
 |#| Time:
 00:00:00
 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0
 skipped, 0 masked, 0 errors.
 NOTE: Resolving any missing task queue dependencies
 NOTE: Preparing runqueue
 NOTE: Executing RunQueue Tasks
 NOTE: Running task 1 of 1 (ID: 0,
 /home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
 NOTE: package None: task do_build: Started
 Hello, World!
 NOTE: package None: task do_build: Succeeded
 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and all succeeded.


 A few things to note:

 1) This is not the *smallest* such BitBake project. For example, the
 DESCRIPTION and PV variables need not be assigned in a.bb. I set those
 variables because I wanted show-layers and show-recipes to display
 reasonable information.

 2) Some of the variables set in bitbake.conf have simplified values. For
 example, you would *not* want to use these values if there were multiple
 recipes and you had to disambiguate the output from each of them.

 3) On the other hand, *all* the variable assignments in bitbake.conf are
 *essential* to BitBake itself. If you remove any one of those assignments,
 BitBake will either declare an error or die (usually because some internal
 variable is set to None and the BitBake code can't handle it).


 


 ├── build
 │   │
 │   ├── classes
 │   │   │
 │   │   └── base.bbclass
 │   │
 │   │   +---
 │   │   |  addtask build
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   ├── bblayers.conf
 │   │
 │   │   +---
 │   │   |  BBLAYERS ?=  \
 │   │   |/home/pturley/Workspace/Hello/LayerA \
 │   │   |
 │   │   +---
 │   │
 │   └── bitbake.conf
 │
 │   +---
 │   |  TMPDIR  = ${TOPDIR}/tmp
 │   |  CACHE   = ${TMPDIR}/cache
 │   |  STAMP   = ${TMPDIR}/stamps
 │   |  T   = ${TMPDIR}/work
 │   |  B   = ${TMPDIR}
 │   +---
 │
 ├── LayerA
 │   │
 │   ├── a.bb
 │   │
 │   │   +---
 │   │   |  DESCRIPTION = Layer A Recipe
 │   │   |  PN = 'a'
 │   │   |  PV = '1'
 │   │   |
 │   │   |  python do_build() {
 │   │   |  bb.plain(Hello, World!);
 │   │   |  }
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   └── layer.conf
 │
 │   +---
 │   |  BBPATH .= :${LAYERDIR}
 │   |
 │   |  BBFILES += ${LAYERDIR}/*.bb
 │   |
 │   |  BBFILE_COLLECTIONS += A
 │   |  BBFILE_PATTERN_A := ^${LAYERDIR}/
 │   +---
 │
 └── BitBake

The BitBake directory origin is:

http://git.openembedded.org/bitbake/

I have the 1.15.2 tag checked out, which is what
Yocto denzil uses.


 ___
 yocto mailing list
 yocto@yoctoproject.org
 https://lists.yoctoproject.org/listinfo/yocto

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-10 Thread Evade Flow
It helps a lot if you run it from the build dir. :-%

build% ../../bitbake/bin/bitbake a
Parsing recipes: 100%
|#|
Time: 00:00:00
Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0
skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing RunQueue Tasks
NOTE: Running task 1 of 1 (ID: 0,
/home/evadeflow/projects/bitbake_hello/LayerA/a.bb, do_build)
NOTE: package None: task do_build: Started
Hello, World!
NOTE: package None: task do_build: Succeeded
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
rerun and all succeeded.

Thanks again!


On Wed, Oct 10, 2012 at 11:45 AM, Evade Flow evadef...@gmail.com wrote:
 Again, thanks *so* much for putting this together. I tried to do this
 once before and didn't have the tenacity to stick with it--it is a
 surprisingly daunting task. Having a smallest-possible example will, I
 think, be really helpful to developers who want to learn how to debug
 bitbake and contribute fixes.

 Interestingly, I tried running this and got the following result:

 bitbake_hello% ../bitbake-1.15.2/bin/bitbake a
 The BBPATH variable is not set
 DEBUG: Removed the following variables from the environment:
 http_proxy, CVS_RSH,
 SHLVL, LD_LIBRARY_PATH, EDITOR, SUDO_USER, USERNAME, PROMPT,
 PYTHONPATH, SUDO_UID,
 RPROMPT, SUDO_COMMAND, SUDO_GID, OLDPWD, MAIL


 I guess I either fat-fingered something during cut-and-paste, or it's
 due to some difference between the tarball I downloaded and the bitbake
 tag you were using. I'm behind a firewall, but I'll see if I can suck
 down the the actual git repo through my phone and see if that makes a
 difference.

 On Tue, Oct 9, 2012 at 6:31 PM, Patrick Turley
 patricktur...@gamestop.com wrote:
 Success. The file tree depicted at the bottom of this mail is nearly the
 smallest, valid BitBake project that prints Hello, World! Here's the
 output:


 $ ../BitBake/bin/bitbake  a
 Parsing recipes: 100%
 |#| Time:
 00:00:00
 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0
 skipped, 0 masked, 0 errors.
 NOTE: Resolving any missing task queue dependencies
 NOTE: Preparing runqueue
 NOTE: Executing RunQueue Tasks
 NOTE: Running task 1 of 1 (ID: 0,
 /home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
 NOTE: package None: task do_build: Started
 Hello, World!
 NOTE: package None: task do_build: Succeeded
 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and all succeeded.


 A few things to note:

 1) This is not the *smallest* such BitBake project. For example, the
 DESCRIPTION and PV variables need not be assigned in a.bb. I set those
 variables because I wanted show-layers and show-recipes to display
 reasonable information.

 2) Some of the variables set in bitbake.conf have simplified values. For
 example, you would *not* want to use these values if there were multiple
 recipes and you had to disambiguate the output from each of them.

 3) On the other hand, *all* the variable assignments in bitbake.conf are
 *essential* to BitBake itself. If you remove any one of those assignments,
 BitBake will either declare an error or die (usually because some internal
 variable is set to None and the BitBake code can't handle it).


 


 ├── build
 │   │
 │   ├── classes
 │   │   │
 │   │   └── base.bbclass
 │   │
 │   │   +---
 │   │   |  addtask build
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   ├── bblayers.conf
 │   │
 │   │   +---
 │   │   |  BBLAYERS ?=  \
 │   │   |/home/pturley/Workspace/Hello/LayerA \
 │   │   |
 │   │   +---
 │   │
 │   └── bitbake.conf
 │
 │   +---
 │   |  TMPDIR  = ${TOPDIR}/tmp
 │   |  CACHE   = ${TMPDIR}/cache
 │   |  STAMP   = ${TMPDIR}/stamps
 │   |  T   = ${TMPDIR}/work
 │   |  B   = ${TMPDIR}
 │   +---
 │
 ├── LayerA
 │   │
 │   ├── a.bb
 │   │
 │   │   +---
 │   │   |  DESCRIPTION = Layer A Recipe
 │   │   |  PN = 'a'
 │   │   |  PV = '1'
 │   │   |
 │   │   |  python do_build() {
 │   │   |  bb.plain(Hello, World!);
 │   │   |  }
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   └── layer.conf
 │
 │   +---
 │   |  BBPATH .= :${LAYERDIR}
 │   |
 │   |  BBFILES += 

Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-09 Thread Patrick Turley
Success. The file tree depicted at the bottom of this mail is nearly the 
smallest, valid BitBake project that prints Hello, World! Here's the output:


$ ../BitBake/bin/bitbake  a
Parsing recipes: 100% 
|#| Time: 00:00:00
Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 
0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing RunQueue Tasks
NOTE: Running task 1 of 1 (ID: 0, 
/home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
NOTE: package None: task do_build: Started
Hello, World!
NOTE: package None: task do_build: Succeeded
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun 
and all succeeded.


A few things to note:

1) This is not the *smallest* such BitBake project. For example, the 
DESCRIPTION and PV variables need not be assigned in a.bb. I set those 
variables because I wanted show-layers and show-recipes to display 
reasonable information.

2) Some of the variables set in bitbake.conf have simplified values. For 
example, you would *not* want to use these values if there were multiple 
recipes and you had to disambiguate the output from each of them.

3) On the other hand, *all* the variable assignments in bitbake.conf are 
*essential* to BitBake itself. If you remove any one of those assignments, 
BitBake will either declare an error or die (usually because some internal 
variable is set to None and the BitBake code can't handle it).





├── build
│   │
│   ├── classes
│   │   │
│   │   └── base.bbclass
│   │
│   │   +---
│   │   |  addtask build
│   │   +---
│   │
│   └── conf
│   │
│   ├── bblayers.conf
│   │
│   │   +---
│   │   |  BBLAYERS ?=  \
│   │   |/home/pturley/Workspace/Hello/LayerA \
│   │   |
│   │   +---
│   │
│   └── bitbake.conf
│
│   +---
│   |  TMPDIR  = ${TOPDIR}/tmp
│   |  CACHE   = ${TMPDIR}/cache
│   |  STAMP   = ${TMPDIR}/stamps
│   |  T   = ${TMPDIR}/work
│   |  B   = ${TMPDIR}
│   +---
│
├── LayerA
│   │
│   ├── a.bb
│   │
│   │   +---
│   │   |  DESCRIPTION = Layer A Recipe
│   │   |  PN = 'a'
│   │   |  PV = '1'
│   │   |
│   │   |  python do_build() {
│   │   |  bb.plain(Hello, World!);
│   │   |  }
│   │   +---
│   │
│   └── conf
│   │
│   └── layer.conf
│
│   +---
│   |  BBPATH .= :${LAYERDIR}
│   |
│   |  BBFILES += ${LAYERDIR}/*.bb
│   |
│   |  BBFILE_COLLECTIONS += A
│   |  BBFILE_PATTERN_A := ^${LAYERDIR}/
│   +---
│
└── BitBake

   The BitBake directory origin is:

   http://git.openembedded.org/bitbake/

   I have the 1.15.2 tag checked out, which is what
   Yocto denzil uses.

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-09 Thread McClintock Matthew-B29882
On Tue, Oct 9, 2012 at 5:31 PM, Patrick Turley
patricktur...@gamestop.com wrote:
 Success. The file tree depicted at the bottom of this mail is nearly the
 smallest, valid BitBake project that prints Hello, World! Here's the
 output:

Perhaps you could push this to github somewhere as an example?

-M



 $ ../BitBake/bin/bitbake  a
 Parsing recipes: 100%
 |#| Time:
 00:00:00
 Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0
 skipped, 0 masked, 0 errors.
 NOTE: Resolving any missing task queue dependencies
 NOTE: Preparing runqueue
 NOTE: Executing RunQueue Tasks
 NOTE: Running task 1 of 1 (ID: 0,
 /home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
 NOTE: package None: task do_build: Started
 Hello, World!
 NOTE: package None: task do_build: Succeeded
 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and all succeeded.


 A few things to note:

 1) This is not the *smallest* such BitBake project. For example, the
 DESCRIPTION and PV variables need not be assigned in a.bb. I set those
 variables because I wanted show-layers and show-recipes to display
 reasonable information.

 2) Some of the variables set in bitbake.conf have simplified values. For
 example, you would *not* want to use these values if there were multiple
 recipes and you had to disambiguate the output from each of them.

 3) On the other hand, *all* the variable assignments in bitbake.conf are
 *essential* to BitBake itself. If you remove any one of those assignments,
 BitBake will either declare an error or die (usually because some internal
 variable is set to None and the BitBake code can't handle it).


 


 ├── build
 │   │
 │   ├── classes
 │   │   │
 │   │   └── base.bbclass
 │   │
 │   │   +---
 │   │   |  addtask build
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   ├── bblayers.conf
 │   │
 │   │   +---
 │   │   |  BBLAYERS ?=  \
 │   │   |/home/pturley/Workspace/Hello/LayerA \
 │   │   |
 │   │   +---
 │   │
 │   └── bitbake.conf
 │
 │   +---
 │   |  TMPDIR  = ${TOPDIR}/tmp
 │   |  CACHE   = ${TMPDIR}/cache
 │   |  STAMP   = ${TMPDIR}/stamps
 │   |  T   = ${TMPDIR}/work
 │   |  B   = ${TMPDIR}
 │   +---
 │
 ├── LayerA
 │   │
 │   ├── a.bb
 │   │
 │   │   +---
 │   │   |  DESCRIPTION = Layer A Recipe
 │   │   |  PN = 'a'
 │   │   |  PV = '1'
 │   │   |
 │   │   |  python do_build() {
 │   │   |  bb.plain(Hello, World!);
 │   │   |  }
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   └── layer.conf
 │
 │   +---
 │   |  BBPATH .= :${LAYERDIR}
 │   |
 │   |  BBFILES += ${LAYERDIR}/*.bb
 │   |
 │   |  BBFILE_COLLECTIONS += A
 │   |  BBFILE_PATTERN_A := ^${LAYERDIR}/
 │   +---
 │
 └── BitBake

The BitBake directory origin is:

http://git.openembedded.org/bitbake/

I have the 1.15.2 tag checked out, which is what
Yocto denzil uses.


 ___
 yocto mailing list
 yocto@yoctoproject.org
 https://lists.yoctoproject.org/listinfo/yocto

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-09 Thread Patrick Turley
That's a perfectly reasonable suggestion, and a good excuse for me to open a 
github account and learn how to use it :)

On Oct 9, 2012, at 5:56 PM, McClintock Matthew-B29882 b29...@freescale.com 
wrote:

 On Tue, Oct 9, 2012 at 5:31 PM, Patrick Turley
 patricktur...@gamestop.com wrote:
 Success. The file tree depicted at the bottom of this mail is nearly the
 smallest, valid BitBake project that prints Hello, World! Here's the
 output:
 
 Perhaps you could push this to github somewhere as an example?
 
 -M
 
 
 
$ ../BitBake/bin/bitbake  a
Parsing recipes: 100%
 |#| Time:
 00:00:00
Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0
 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing RunQueue Tasks
NOTE: Running task 1 of 1 (ID: 0,
 /home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
NOTE: package None: task do_build: Started
Hello, World!
NOTE: package None: task do_build: Succeeded
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and all succeeded.
 
 
 A few things to note:
 
 1) This is not the *smallest* such BitBake project. For example, the
 DESCRIPTION and PV variables need not be assigned in a.bb. I set those
 variables because I wanted show-layers and show-recipes to display
 reasonable information.
 
 2) Some of the variables set in bitbake.conf have simplified values. For
 example, you would *not* want to use these values if there were multiple
 recipes and you had to disambiguate the output from each of them.
 
 3) On the other hand, *all* the variable assignments in bitbake.conf are
 *essential* to BitBake itself. If you remove any one of those assignments,
 BitBake will either declare an error or die (usually because some internal
 variable is set to None and the BitBake code can't handle it).
 
 
 
 
 
 ├── build
 │   │
 │   ├── classes
 │   │   │
 │   │   └── base.bbclass
 │   │
 │   │   +---
 │   │   |  addtask build
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   ├── bblayers.conf
 │   │
 │   │   +---
 │   │   |  BBLAYERS ?=  \
 │   │   |/home/pturley/Workspace/Hello/LayerA \
 │   │   |
 │   │   +---
 │   │
 │   └── bitbake.conf
 │
 │   +---
 │   |  TMPDIR  = ${TOPDIR}/tmp
 │   |  CACHE   = ${TMPDIR}/cache
 │   |  STAMP   = ${TMPDIR}/stamps
 │   |  T   = ${TMPDIR}/work
 │   |  B   = ${TMPDIR}
 │   +---
 │
 ├── LayerA
 │   │
 │   ├── a.bb
 │   │
 │   │   +---
 │   │   |  DESCRIPTION = Layer A Recipe
 │   │   |  PN = 'a'
 │   │   |  PV = '1'
 │   │   |
 │   │   |  python do_build() {
 │   │   |  bb.plain(Hello, World!);
 │   │   |  }
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   └── layer.conf
 │
 │   +---
 │   |  BBPATH .= :${LAYERDIR}
 │   |
 │   |  BBFILES += ${LAYERDIR}/*.bb
 │   |
 │   |  BBFILE_COLLECTIONS += A
 │   |  BBFILE_PATTERN_A := ^${LAYERDIR}/
 │   +---
 │
 └── BitBake
 
   The BitBake directory origin is:
 
   http://git.openembedded.org/bitbake/
 
   I have the 1.15.2 tag checked out, which is what
   Yocto denzil uses.
 
 
 ___
 yocto mailing list
 yocto@yoctoproject.org
 https://lists.yoctoproject.org/listinfo/yocto

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-08 Thread Patrick Turley
I am continuing my work on creating a Hello, World! BitBake project. Because 
of the excellent help I got before, things have gone reasonably well, but I'm 
again running into something I don't know how to fix.

As before, the entire contents of my very small project appear at the end of 
this message. Here's what works fine:


$ ../BitBake/bin/bitbake-layers show-layers
Parsing recipes..done.

layer pathpriority
==
LayerA/home/pturley/Workspace/Hello/LayerA1

$ ../BitBake/bin/bitbake-layers show-recipes
Parsing recipes..done.
=== Available recipes: ===
a:
  LayerA   1


When I tried this:


../BitBake/bin/bitbake -c listtasks a


I got a Python stack trace that ended here:


  File ../BitBake/lib/bb/runqueue.py, line 902, in 
RunQueue.check_stamp_task(task=0, taskname='do_listtasks', recurse=False):
 # If the stamp is missing its not current
if not os.access(stampfile, os.F_OK):
 logger.debug(2, Stampfile %s not available, stampfile)
TypeError: coercing to Unicode: need string or buffer, NoneType found


This code isn't expecting the stampfile variable to be None (which it is), 
so it freaks out. I made a very simple fix to get past the problem:


if not stampfile or not os.access(stampfile, os.F_OK):


That made a dramatic difference, and enabled me to get this far:


$ ../BitBake/bin/bitbake -c listtasks a
Loading cache: 100% 
|###| ETA:  00:00:00
Loaded 2 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing RunQueue Tasks
NOTE: Running task 1 of 1 (ID: 0, 
/home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks)
ERROR: T variable not set, unable to build
ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks) 
failed with exit code '1'
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun 
and 1 failed.

Summary: 1 task failed:
  /home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

$ ../BitBake/bin/bitbake a
Loading cache: 100% 
|###| ETA:  00:00:00
Loaded 2 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing RunQueue Tasks
NOTE: Running task 1 of 1 (ID: 0, 
/home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
ERROR: T variable not set, unable to build
ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_build) failed 
with exit code '1'
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun 
and 1 failed.

Summary: 1 task failed:
  /home/pturley/Workspace/Hello/LayerA/a.bb, do_build
Summary: There was 1 ERROR message shown, returning a non-zero exit code.


As you can see, BitBake is expecting the T variable to be set.  I don't think 
I've ever seen this variable -- so I don't know what it's for or what I should 
change.

Can anyone offer a hint?





├── build
│   │
│   ├── classes
│   │   │
│   │   └── base.bbclass
│   │
│   │   +---
│   │   |  addtask listtasks
│   │   |
│   │   |  do_listtasks[nostamp] = 1
│   │   |
│   │   |  python do_listtasks() {
│   │   |  import sys
│   │   |  # emit variables and shell functions
│   │   |  #bb.data.emit_env(sys.__stdout__, d)
│   │   |  # emit the metadata which isnt valid shell
│   │   |  for e in d.keys():
│   │   |  if d.getVarFlag(e, 'task'):
│   │   |  bb.plain(%s % e)
│   │   |  }
│   │   |
│   │   |  addtask build
│   │   |
│   │   |  do_build() {
│   │   |  echo Hello
│   │   |  }
│   │   +---
│   │
│   └── conf
│   │
│   ├── bblayers.conf
│   │
│   │   +---
│   │   |  BBLAYERS ?=  \
│   │   |/home/pturley/Workspace/Hello/LayerA \
│   │   |
│   │   +---
│   │
│   └── bitbake.conf
│
│   +---
│   |  CACHE = ${TOPDIR}/cache
│   +---
│
├── LayerA
│   │
│   ├── a.bb
│   │
│   │   +---
│   │   |  DESCRIPTION = Layer A Main Recipe
│   │   |  PN = 'a'
│   │   |  PV = '1'
│   │   

Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-08 Thread Rudolf Streif
The T variable points to a directory were Bitbake places temporary files
when building a particular package. It is typically set to

T = ${WORKDIR}/temp

WORKDIR is the directory into which Bitbake unpacks and builds a package.
The default bitbake.conf file sets this variable.

T is not to be confused with TMPDIR which points to the root of the
directory tree where Bitbake puts the output of an entire build.

:rjs

On Mon, Oct 8, 2012 at 5:30 PM, Patrick Turley
patricktur...@gamestop.comwrote:

  I am continuing my work on creating a Hello, World! BitBake project.
 Because of the excellent help I got before, things have gone reasonably
 well, but I'm again running into something I don't know how to fix.

  As before, the entire contents of my very small project appear at the
 end of this message. Here's what works fine:


  $ ../BitBake/bin/bitbake-layers show-layers
 Parsing recipes..done.

  layer pathpriority
 ==
 LayerA/home/pturley/Workspace/Hello/LayerA1

  $ ../BitBake/bin/bitbake-layers show-recipes
 Parsing recipes..done.
 === Available recipes: ===
 a:
   LayerA   1


  When I tried this:


  ../BitBake/bin/bitbake -c listtasks a


  I got a Python stack trace that ended here:


File ../BitBake/lib/bb/runqueue.py, line 902, in
 RunQueue.check_stamp_task(task=0, taskname='do_listtasks', recurse=False):
  # If the stamp is missing its not current
 if not os.access(stampfile, os.F_OK):
  logger.debug(2, Stampfile %s not available,
 stampfile)
 TypeError: coercing to Unicode: need string or buffer, NoneType found


  This code isn't expecting the stampfile variable to be None (which
 it is), so it freaks out. I made a very simple fix to get past the problem:


  if not stampfile or not os.access(stampfile, os.F_OK):


  That made a dramatic difference, and enabled me to get this far:


  $ ../BitBake/bin/bitbake -c listtasks a
 Loading cache: 100%
 |###| ETA:
  00:00:00
 Loaded 2 entries from dependency cache.
 NOTE: Resolving any missing task queue dependencies
 NOTE: Preparing runqueue
 NOTE: Executing RunQueue Tasks
 NOTE: Running task 1 of 1 (ID: 0, /home/pturley/Workspace/Hello/LayerA/
 a.bb, do_listtasks)
 ERROR: T variable not set, unable to build
 ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb,
 do_listtasks) failed with exit code '1'
 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and 1 failed.

  Summary: 1 task failed:
   /home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks
 Summary: There was 1 ERROR message shown, returning a non-zero exit
 code.

  $ ../BitBake/bin/bitbake a
 Loading cache: 100%
 |###| ETA:
  00:00:00
 Loaded 2 entries from dependency cache.
 NOTE: Resolving any missing task queue dependencies
 NOTE: Preparing runqueue
 NOTE: Executing RunQueue Tasks
 NOTE: Running task 1 of 1 (ID: 0, /home/pturley/Workspace/Hello/LayerA/
 a.bb, do_build)
 ERROR: T variable not set, unable to build
 ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
 failed with exit code '1'
 NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
 rerun and 1 failed.

  Summary: 1 task failed:
   /home/pturley/Workspace/Hello/LayerA/a.bb, do_build
 Summary: There was 1 ERROR message shown, returning a non-zero exit
 code.


  As you can see, BitBake is expecting the T variable to be set.  I
 don't think I've ever seen this variable -- so I don't know what it's for
 or what I should change.

  Can anyone offer a hint?


  


  ├── build
 │   │
 │   ├── classes
 │   │   │
 │   │   └── base.bbclass
 │   │
 │   │   +---
 │   │   |  addtask listtasks
 │   │   |
 │   │   |  do_listtasks[nostamp] = 1
 │   │   |
 │   │   |  python do_listtasks() {
 │   │   |  import sys
 │   │   |  # emit variables and shell functions
 │   │   |  #bb.data.emit_env(sys.__stdout__, d)
 │   │   |  # emit the metadata which isnt valid shell
 │   │   |  for e in d.keys():
 │   │   |  if d.getVarFlag(e, 'task'):
 │   │   |  bb.plain(%s % e)
 │   │   |  }
 │   │   |
 │   │   |  addtask build
 │   │   |
 │   │   |  do_build() {
 │   │   |  echo Hello
 │   │   |  }
 │   │   +---
 │   │
 │   └── conf
 │   │
 │   ├── bblayers.conf
 │   │
 │   │   +---
 │  

Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-05 Thread Richard Purdie
On Thu, 2012-10-04 at 20:00 -0700, Rudolf Streif wrote:
 Disclaimer: I am no Bitbake expert. I just put this together by
 rummaging through the Bitbake code for a couple of minutes. I am
 reasonably confident that what I am saying below is rather accurate
 but the Bitbake experts know better.
 
 
 
 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.


 You can just do a recipe and overwrite do_build() in it e.g.
 
 
 python do_build() {
 bb.note(Hello World)
 }
 
That would print:

NOTE: Hello World

and would probably only sent it to the task logfile.

bb.plain(Hello World)

would make it to the console though :)

[...]



 1) Must a task function be a Python function?  Or will a
 bash function do?
 
 
 Tasks must be Python functions. 
 
 
No, they can be shell functions too.

Cheers,

Richard


___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-05 Thread Tomas Frydrych
 Tasks must be Python functions. 
 

 No, they can be shell functions too.

Probably worth adding that if you are doing an _append() on a task
function, you have to match the original function type. E.g., if you
want to append a shell snippet to a python task function, you need to do
something like this (from the eglibc recipe):

do_unpack_append() {
bb.build.exec_func('do_move_ports', d)
}

do_move_ports() {
if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then
rm -rf ${S}/ports
mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${S}/
fi
}

Tomas
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Patrick Turley
That is excellent news. I very much look forward to seeing that.


On Oct 3, 2012, at 6:03 PM, Rudolf Streif 
rudolf.str...@linux.commailto:rudolf.str...@linux.com
 wrote:

Hi Patrick,

I think I understand what you are looking for. I created this Bitbake Hello 
World for a training class. It just uses 'raw' Bitbake and a very basic recipe 
to build the Nano editor (including download from the project site).

You need to have a couple of things in place to make this work. I got to run 
but I will get back to it and post it.

:rjs

On Wed, Oct 3, 2012 at 3:56 PM, Patrick Turley 
patricktur...@gamestop.commailto:patricktur...@gamestop.com wrote:
In my previous message, some of the indentation in the representation of
my file tree was wrong (because we're using Outlook, which destroy all
indentation when you paste it into an e-mail message). The errors are
small, but I want to avoid annoying anyone who might think I don't even
have the file tree constructed correctly.

The following is accurate:

/home/pturley/Workspace/woohoo
|
+-- build
|   |
|   +-- classes
|   |   |
|   |   +-- base.bbclass
|   |
|   | +---
|   | | do_hello() {
|   | | echo Hello
|   | | }
|   | |
|   | | addtask hello
|   | +---
|   |
|   +-- conf
|   |
|   +-- bblayers.conf
|   |
|   | +---
|   | | BBLAYERS ?=  \
|   | |   /home/pturley/Workspace/woohoo/LayerA \
|   | |   
|   | +---
|   |
|   +-- bitbake.conf
|
| +---
| | CACHE = ${TOPDIR}/cache
| +---
|
+-- LayerA
|   |
|   +-- a.bbhttp://a.bb/
|   |
|   | +---
|   | | PN = 'a'
|   | | PV = '1'
|   | +---
|   |
|   +-- conf
|   |
|   +-- layer.conf
|
| +---
| | BBPATH .= :${LAYERDIR}
| | BBFILES += ${LAYERDIR}/*.bb
| +---
|
+-- BitBake ...

The BitBake directory origin is:

http://git.openembedded.org/bitbake/

I have the 1.15.2 tag checked out, which is what
Yocto denzil uses.

___
yocto mailing list
yocto@yoctoproject.orgmailto:yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Rudolf Streif
[Warning: lengthy post, and probably boring to most.]

My Bitbake Hello World is a little more than a basic Hello World. It's
idea is to incorporate a layer and use a structure similar to what OE and
Yocto are using. You can do it simpler if you want to. I did this a while
ago with Bitbake 1.12.0. I would think it works with newer versions too
although I have not tested it. This is the layout I am using:

bbtest/
├── conf
│   ├── bblayers.conf
│   └── bitbake.conf
├── downloads
│   └── /* need to create but will be populated with downloads */
├── meta-test
│   ├── classes
│   │   └── base.bbclass
│   ├── conf

│   │   └── layer.conf

│   └── recipes-test

│   └── nano

│ └── nano.bb

└── tmp

└── /* will be created and populated when building */

The first thing Bitbake looks for is a conf/bblayers.conf file in the
directory you started it from. This file must provide an initial setting
for BBPATH:

bblayers.conf:

BBPATH := ${TOPDIR}
BBFILES ?= 
BBLAYERS =  \
  ${TOPDIR}/meta-test \
  

Without BBPATH Bitbake will not find any conf/filename.conf files and
recipe files at all. It will also not find bitbake.conf. I simply copied
bitbake.conf from the Bitbake download and edited DL_DIR:

bitbake.conf:

# comments omitted
B = ${S}

CVSDIR = ${DL_DIR}/cvs

DEPENDS = 

DEPLOY_DIR = ${TMPDIR}/deploy
DEPLOY_DIR_IMAGE = ${DEPLOY_DIR}/images
DL_DIR = ${TOPDIR}/downloads
FETCHCOMMAND = 
FETCHCOMMAND_cvs = /usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS}
${CVSMODULE}
FETCHCOMMAND_svn = /usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT}
${SVNMODULE}
FETCHCOMMAND_wget = /usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR}
${URI}
FILESDIR = ${@bb.utils.which(bb.data.getVar('FILESPATH', d, 1), '.')}
FILESPATH =
${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}
FILE_DIRNAME = ${@os.path.dirname(bb.data.getVar('FILE', d))}
GITDIR = ${DL_DIR}/git
IMAGE_CMD = _NO_DEFINED_IMAGE_TYPES_
IMAGE_ROOTFS = ${TMPDIR}/rootfs
MKTEMPCMD = mktemp -q ${TMPBASE}
MKTEMPDIRCMD = mktemp -d -q ${TMPBASE}
OVERRIDES = local:${MACHINE}:${TARGET_OS}:${TARGET_ARCH}
P = ${PN}-${PV}
PERSISTENT_DIR = ${TMPDIR}/cache
PF = ${PN}-${PV}-${PR}
PN = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0]
or 'defaultpkgname'}
PR = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2]
or 'r0'}
PROVIDES = 
PV = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1]
or '1.0'}
RESUMECOMMAND = 
RESUMECOMMAND_wget = /usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR}
${URI}
S = ${WORKDIR}/${P}
SRC_URI = file://${FILE}
STAMP = ${TMPDIR}/stamps/${PF}
SVNDIR = ${DL_DIR}/svn
T = ${WORKDIR}/temp
TARGET_ARCH = ${BUILD_ARCH}
TMPDIR = ${TOPDIR}/tmp
UPDATECOMMAND = 
UPDATECOMMAND_cvs = /usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}
UPDATECOMMAND_svn = /usr/bin/env svn update ${SVNCOOPTS}
WORKDIR = ${TMPDIR}/work/${PF}
PERSISTENT_DIR = ${TMPDIR}/cache

That's more than you need but it's convenient.

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.
It's empty and does not do anything but it functions as an anchor for tasks
you define in your recipes:

base.bbclass:

# comments omitted
die() {
bbfatal $*
}

bbnote() {
echo NOTE: $*
}

bbwarn() {
echo WARNING: $*
}

bbfatal() {
echo FATAL: $*
exit 1
}

addtask showdata
do_showdata[nostamp] = 1
python do_showdata() {
import sys
# emit variables and shell functions
bb.data.emit_env(sys.__stdout__, d, True)
# emit the metadata which isnt valid shell
for e in bb.data.keys(d):
if bb.data.getVarFlag(e, 'python', d):
sys.__stdout__.write(\npython %s () {\n%s}\n %
(e, bb.data.getVar(e, d, 1)))
}

addtask listtasks
do_listtasks[nostamp] = 1
python do_listtasks() {
import sys
for e in bb.data.keys(d):
if bb.data.getVarFlag(e, 'task', d):
sys.__stdout__.write(%s\n % e)
}

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.)
}

EXPORT_FUNCTIONS do_clean do_mrproper do_build

Again, it's more than you need. It's just convenient to use it. I put this
file inside the layer but you can also create a classes directory in
${TOPDIR} (bbtest in this example). Next, create a layer (meta-bbtest in my
example, name does not matter, meta-* is convention). It needs a
conf/layer.con file:

layer.conf:

# We have a metadata layer directory, add to BBPATH
BBPATH .= :${LAYERDIR}

# We have a recipe directory, add to BBFILES
BBFILES 

Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Evade Flow
Thanks, this is great! I was looking for something exactly like this.
I'm going to have a play wit it right now.  If you (or anyone) can think
of any ways this example doesn't adhere to current bitbake best
practices (other than not inheriting from OECore's more full-featured
base classes), please let me know...


On Thu, Oct 4, 2012 at 2:58 PM, Rudolf Streif rudolf.str...@linux.com wrote:
 [Warning: lengthy post, and probably boring to most.]

 My Bitbake Hello World is a little more than a basic Hello World. It's
 idea is to incorporate a layer and use a structure similar to what OE and
 Yocto are using. You can do it simpler if you want to. I did this a while
 ago with Bitbake 1.12.0. I would think it works with newer versions too
 although I have not tested it. This is the layout I am using:

 bbtest/
 ├── conf
 │   ├── bblayers.conf
 │   └── bitbake.conf
 ├── downloads
 │   └── /* need to create but will be populated with downloads */
 ├── meta-test
 │   ├── classes
 │   │   └── base.bbclass
 │   ├── conf
 │   │   └── layer.conf
 │   └── recipes-test
 │   └── nano
 │ └── nano.bb
 └── tmp
 └── /* will be created and populated when building */

 The first thing Bitbake looks for is a conf/bblayers.conf file in the
 directory you started it from. This file must provide an initial setting for
 BBPATH:

 bblayers.conf:

 BBPATH := ${TOPDIR}
 BBFILES ?= 
 BBLAYERS =  \
   ${TOPDIR}/meta-test \
   

 Without BBPATH Bitbake will not find any conf/filename.conf files and
 recipe files at all. It will also not find bitbake.conf. I simply copied
 bitbake.conf from the Bitbake download and edited DL_DIR:

 bitbake.conf:

 # comments omitted
 B = ${S}
 CVSDIR = ${DL_DIR}/cvs
 DEPENDS = 
 DEPLOY_DIR = ${TMPDIR}/deploy
 DEPLOY_DIR_IMAGE = ${DEPLOY_DIR}/images
 DL_DIR = ${TOPDIR}/downloads
 FETCHCOMMAND = 
 FETCHCOMMAND_cvs = /usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS}
 ${CVSMODULE}
 FETCHCOMMAND_svn = /usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT}
 ${SVNMODULE}
 FETCHCOMMAND_wget = /usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR}
 ${URI}
 FILESDIR = ${@bb.utils.which(bb.data.getVar('FILESPATH', d, 1), '.')}
 FILESPATH =
 ${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}
 FILE_DIRNAME = ${@os.path.dirname(bb.data.getVar('FILE', d))}
 GITDIR = ${DL_DIR}/git
 IMAGE_CMD = _NO_DEFINED_IMAGE_TYPES_
 IMAGE_ROOTFS = ${TMPDIR}/rootfs
 MKTEMPCMD = mktemp -q ${TMPBASE}
 MKTEMPDIRCMD = mktemp -d -q ${TMPBASE}
 OVERRIDES = local:${MACHINE}:${TARGET_OS}:${TARGET_ARCH}
 P = ${PN}-${PV}
 PERSISTENT_DIR = ${TMPDIR}/cache
 PF = ${PN}-${PV}-${PR}
 PN = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0] or
 'defaultpkgname'}
 PR = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2] or
 'r0'}
 PROVIDES = 
 PV = ${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1] or
 '1.0'}
 RESUMECOMMAND = 
 RESUMECOMMAND_wget = /usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR}
 ${URI}
 S = ${WORKDIR}/${P}
 SRC_URI = file://${FILE}
 STAMP = ${TMPDIR}/stamps/${PF}
 SVNDIR = ${DL_DIR}/svn
 T = ${WORKDIR}/temp
 TARGET_ARCH = ${BUILD_ARCH}
 TMPDIR = ${TOPDIR}/tmp
 UPDATECOMMAND = 
 UPDATECOMMAND_cvs = /usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}
 UPDATECOMMAND_svn = /usr/bin/env svn update ${SVNCOOPTS}
 WORKDIR = ${TMPDIR}/work/${PF}
 PERSISTENT_DIR = ${TMPDIR}/cache

 That's more than you need but it's convenient.

 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. It's empty
 and does not do anything but it functions as an anchor for tasks you define
 in your recipes:

 base.bbclass:

 # comments omitted
 die() {
 bbfatal $*
 }

 bbnote() {
 echo NOTE: $*
 }

 bbwarn() {
 echo WARNING: $*
 }

 bbfatal() {
 echo FATAL: $*
 exit 1
 }

 addtask showdata
 do_showdata[nostamp] = 1
 python do_showdata() {
 import sys
 # emit variables and shell functions
 bb.data.emit_env(sys.__stdout__, d, True)
 # emit the metadata which isnt valid shell
 for e in bb.data.keys(d):
 if bb.data.getVarFlag(e, 'python', d):
 sys.__stdout__.write(\npython %s () {\n%s}\n % (e,
 bb.data.getVar(e, d, 1)))
 }

 addtask listtasks
 do_listtasks[nostamp] = 1
 python do_listtasks() {
 import sys
 for e in bb.data.keys(d):
 if bb.data.getVarFlag(e, 'task', d):
 sys.__stdout__.write(%s\n % e)
 }

 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
 

Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Patrick Turley
*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.commailto: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)

   try:
  bb.fetch.init(src_uri, d)
  bb.fetch.go(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
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Patrick Turley
And one final question: Have I been putting this on the wrong mailing list?

I just discovered the mailing lists at OpenEmbedded, specifically:

bitbake-de...@lists.openembedded.org

Apologies if I've been bothering the wrong people.

On Oct 4, 2012, at 7:47 PM, Patrick Turley patricktur...@gamestop.com
 wrote:

 *Very* helpful stuff.

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Rudolf Streif
Disclaimer: I am no Bitbake expert. I just put this together by rummaging
through the Bitbake code for a couple of minutes. I am reasonably confident
that what I am saying below is rather accurate but the Bitbake experts know
better.


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.

 You can just do a recipe and overwrite do_build() in it e.g.

python do_build() {
bb.note(Hello World)
}


 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?


Yes. All tasks defined in recipes or classes have to follow the naming
convention do_taskname when defining them. However, when adding them to
the queue you have to omit the do_ e.g. addtask taskname.



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


No task is really required. The build task is only the default task if you
do not specify a specific task with -c. However, if you use -c Bitbake will
only execute that task and not check and run any task that this task is
depending on. But that's a whole different story.



  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?

 In bitbakedir/lib/bb/cooker.py:

class BBCooker:

Manages one bitbake build run


def __init__(self, configuration, server_registration_cb):

# stuff omitted

if not self.configuration.cmd:
self.configuration.cmd = bb.data.getVar(BB_DEFAULT_TASK,
self.configuration.data, True) or build

  # more stuff

Bitbake checks if the variable BB_DEFAULT_TASK is set and if not uses
build as default task. You could set BB_DEFAULT_TASK in a configuration
file e.g. bitbake.conf to any task you like (as long as it is defined).


  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:


My  base.bbclass file does not have a do_fetch function. What am I missing?



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


Tasks must be Python functions.


  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?

   You have to use addtask to make your Python function, given it follows
the naming convention, known to Bitbake as a task. You can put addtask with
the tasks name anywhere in your recipe. It does not need to follow the task
but it makes it easier to read. If you just add a task using addtask it is
kind of standalone. If you use addtask with the before/after directives you
establish an execution order.

:rjs
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Rudolf Streif
 And one final question: Have I been putting this on the wrong mailing
list?

Kind of, but you would not have gotten my response because I do not
subscribe to bitbake-devel :)

:rjs
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-04 Thread Rudolf Streif
 And one final question: Have I been putting this on the wrong mailing
list?

Possibly, kind of, but you would not have gotten my response because I do
not follow to bitbake-devel :)

:rjs
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-03 Thread Patrick Turley
In my previous message, some of the indentation in the representation of
my file tree was wrong (because we're using Outlook, which destroy all
indentation when you paste it into an e-mail message). The errors are
small, but I want to avoid annoying anyone who might think I don't even
have the file tree constructed correctly.

The following is accurate:

/home/pturley/Workspace/woohoo
|
+-- build
|   |
|   +-- classes
|   |   |
|   |   +-- base.bbclass
|   |
|   | +---
|   | | do_hello() {
|   | | echo Hello
|   | | }
|   | |
|   | | addtask hello
|   | +---
|   |
|   +-- conf
|   |
|   +-- bblayers.conf
|   |
|   | +---
|   | | BBLAYERS ?=  \
|   | |   /home/pturley/Workspace/woohoo/LayerA \
|   | |   
|   | +---
|   |
|   +-- bitbake.conf
|
| +---
| | CACHE = ${TOPDIR}/cache
| +---
|
+-- LayerA
|   |
|   +-- a.bb
|   |
|   | +---
|   | | PN = 'a'
|   | | PV = '1'
|   | +---
|   |
|   +-- conf
|   |
|   +-- layer.conf
|
| +---
| | BBPATH .= :${LAYERDIR}
| | BBFILES += ${LAYERDIR}/*.bb
| +---
|
+-- BitBake ...

The BitBake directory origin is:

http://git.openembedded.org/bitbake/

I have the 1.15.2 tag checked out, which is what
Yocto denzil uses.

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] The BitBake equivalent of Hello, World!

2012-10-03 Thread Rudolf Streif
Hi Patrick,

I think I understand what you are looking for. I created this Bitbake Hello
World for a training class. It just uses 'raw' Bitbake and a very basic
recipe to build the Nano editor (including download from the project site).

You need to have a couple of things in place to make this work. I got to
run but I will get back to it and post it.

:rjs

On Wed, Oct 3, 2012 at 3:56 PM, Patrick Turley
patricktur...@gamestop.comwrote:

 In my previous message, some of the indentation in the representation of
 my file tree was wrong (because we're using Outlook, which destroy all
 indentation when you paste it into an e-mail message). The errors are
 small, but I want to avoid annoying anyone who might think I don't even
 have the file tree constructed correctly.

 The following is accurate:

 /home/pturley/Workspace/woohoo
 |
 +-- build
 |   |
 |   +-- classes
 |   |   |
 |   |   +-- base.bbclass
 |   |
 |   | +---
 |   | | do_hello() {
 |   | | echo Hello
 |   | | }
 |   | |
 |   | | addtask hello
 |   | +---
 |   |
 |   +-- conf
 |   |
 |   +-- bblayers.conf
 |   |
 |   | +---
 |   | | BBLAYERS ?=  \
 |   | |   /home/pturley/Workspace/woohoo/LayerA \
 |   | |   
 |   | +---
 |   |
 |   +-- bitbake.conf
 |
 | +---
 | | CACHE = ${TOPDIR}/cache
 | +---
 |
 +-- LayerA
 |   |
 |   +-- a.bb
 |   |
 |   | +---
 |   | | PN = 'a'
 |   | | PV = '1'
 |   | +---
 |   |
 |   +-- conf
 |   |
 |   +-- layer.conf
 |
 | +---
 | | BBPATH .= :${LAYERDIR}
 | | BBFILES += ${LAYERDIR}/*.bb
 | +---
 |
 +-- BitBake ...
 
 The BitBake directory origin is:
 
 http://git.openembedded.org/bitbake/
 
 I have the 1.15.2 tag checked out, which is what
 Yocto denzil uses.

 ___
 yocto mailing list
 yocto@yoctoproject.org
 https://lists.yoctoproject.org/listinfo/yocto

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto