[bitbake-devel] Conditionally inherit own-mirrors and set SOURCE_MIRROR_URL?

Evade Flow evadeflow at gmail.com
Fri Sep 2 22:56:05 UTC 2016


> It is an annoying and somewhat artificial limitation. I have been known
> to work around it by adding a xxx.bbclass file in a classes directory
> and then INHERIT += "xxx".

That's a really handy trick to know about, thanks! I will probably switch
to that approach soon since—now that I see the possibilities—I anticipate
I'll be adding more conditional config items so my teammates don't have to
worry about it.

The solution I managed to finger-mumble my way to in the meantime is a
little scary-looking:

SOURCE_MIRROR_URL = "${@'file:///demo/source-mirror' if
os.path.exists('/demo/source-mirror') else
'http://mycompany.com:1234/source-mirror'}"
INHERIT += "own-mirrors"


About the best thing I can say about it is: it *does* work. And it's
actually pretty readable, aside from the line length being so long it won't
fit in a tweet(!)

On Fri, Sep 2, 2016 at 5:46 PM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:

> On Fri, 2016-09-02 at 15:26 -0400, Evade Flow wrote:
> > > You could do something like:
> > ...
> > >
> > SOURCE_MIRROR_URL ?= "{@base_contains('LOCALBUILD', 'local', '
> > file://xxx', 'http://xxx', d)}"
> >
> >
> > That's exactly what I was looking for, thanks. I gather I can't put
> > functions in local.conf, which is where our current build is setting
> > SOURCE_MIRROR_URL. Can I trouble you to recommend a home for such a
> > function? It 'feels weird' to put it in a recipe, is there some
> > other, semi-standard place to stuff helper functions?
>
> It is an annoying and somewhat artificial limitation. I have been known
> to work around it by adding a xxx.bbclass file in a classes directory
> and then INHERIT += "xxx".
>
> Cheers,
>
> Richard
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20160902/ea90dd20/attachment-0002.html>


More information about the bitbake-devel mailing list