All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof.johansson@axis.com>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] build/data: Write out more complete python run files
Date: Tue, 2 Sep 2014 10:20:52 +0200	[thread overview]
Message-ID: <20140902082052.GB21392@axis.com> (raw)
In-Reply-To: <1409145892.5772.49.camel@ted>

On 14-08-27 15:24 +0200, Richard Purdie wrote:
> Currently the output in the python task/function run files is rather
> incomplete and effectively useless. This enhances the code to take
> advantage of the bitbake's dependency tracking and extend the output to
> include dependencies. This makes the files more usable for debugging
> purposes. Since this only happens at python function execution time, the
> overhead is minimal in the grand scheme of things.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
....
> diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
> index 3d776b3..91b1eb1 100644
> --- a/bitbake/lib/bb/data.py
> +++ b/bitbake/lib/bb/data.py
....
> +def emit_func_python(func, o=sys.__stdout__, d = init()):
> +    """Emits all items in the data store in a format such that it can be sourced by a shell."""
> +
> +    def write_func(func, o, call = False):
> +        body = d.getVar(func, True)
> +        if not body.startswith("def"):
> +            body = _functionfmt.format(function=func, body=body)
....

With this change, we are seeing problems in certain cases when a python
function (def foo():) is being resolved. d.getVar("foo") would return None
and then fail from not having a startswith() method:

ERROR: Build of do_unpack failed
ERROR: Traceback (most recent call last):
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/build.py", line 497, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/build.py", line 438, in _exec_task
    exec_func(task, localdata)
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/build.py", line 212, in exec_func
    exec_func_python(func, d, runfile, cwd=adir)
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/build.py", line 230, in exec_func_python
    bb.data.emit_func_python(func, script, d)
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/data.py", line 313, in emit_func_python
    write_func(dep, o)
  File "/var/opt/builds/olofjn/oe/master/bitbake/lib/bb/data.py", line 294, in write_func
    if not body.startswith("def"):
AttributeError: 'NoneType' object has no attribute 'startswith'


Our qemu_%.bbappend contains the following:

    def _remove_git_submodule_file(filename):
        import os
    
        if not os.path.isfile(filename):
            return
    
        os.unlink(filename)
    
    do_unpack_append() {
        _remove_git_submodule_file(d.getVar("S", True) + "/dtc/.git")
        _remove_git_submodule_file(d.getVar("S", True) + "/pixman/.git")
    }

Moving the function to within do_unpack_append would solve the problem.

-- 
olofjn


  reply	other threads:[~2014-09-02  8:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 13:24 [PATCH] build/data: Write out more complete python run files Richard Purdie
2014-09-02  8:20 ` Olof Johansson [this message]
2014-09-03 22:08   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140902082052.GB21392@axis.com \
    --to=olof.johansson@axis.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.