On Wed, 2020-01-22 at 13:55 +0000, Rasmus Villemoes wrote:
> I have a do_configure() python function which is essentially
> 
> python do_configure() {
>     import fileinput
>     with open("foo.txt", "w") as out:
>         for line in
> fileinput.input(files=d.getVar("FOO_INPUT").split()):
>             line = d.expand(line)
>             out.write(line)
> }
> 
> So some of those input files can contain ${VARIABLE} and it gets
> replaced appropriately. But to my surprise, when I then change
> VARIABLE,
> the recipe doesn't get rebuilt, so it seems that bitbake doesn't
> automatically realize that the recipe (or task) depends on VARIABLE.
> 
> So digging a bit into the code, it seems that d.expand() calls
> expandWithRefs(), which returns a VariableParse object, but then only
> uses the .value property, throwing away .references. So I assume that
> what I really should be doing is call expandWithRefs and then somehow
> manually pass .references to... something? Or, there must be some
> other
> bitbake interface for doing this properly?

Bitbake can only detect direct references to variables. The code above
only runs at configure time, not at parse time so its not really
surprising that bitbake can't know what its doing.

You'd need to read the data from this file at parse time for bitbake to
stand some chance of seeing it, or manually set the variables it
depends upon using the vardeps flag.

Something like:

do_configure[vardeps] = "${@my_depends_function(d)}"

where my_depends_function would return a list of variables it
references.

Reading files like that at parse time doesn't work out well for
performance.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#48083): https://lists.yoctoproject.org/g/yocto/message/48083
Mute This Topic: https://lists.yoctoproject.org/mt/69979676/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to