<div dir="ltr">> You could do something like:<br>...<br>> <br>
SOURCE_MIRROR_URL ?= "{@base_contains('LOCALBUILD', 'local', 'file://xxx', '<a href="http://xxx" rel="noreferrer" target="_blank">http://xxx</a>', d)}"<br><br><br>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?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 2, 2016 at 7:57 AM, Richard Purdie <span dir="ltr"><<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, 2016-09-01 at 11:29 -0400, Evade Flow wrote:<br>
> This might be an 'X-Y' problem, so I should explain what I'm trying<br>
> to achieve. We have a somewhat beefy build server with 32 cores that<br>
> most of my team likes to `ssh` into to do builds of our Yocto/OE<br>
> -based BSP. But a few of us build on different machines often enough<br>
> that I recently spun up a web server—on the 32-core build machine—to<br>
> act as a 'pre-mirror' to statically serve our dependencies for<br>
> remote builds. The web server is serving the exact same folder that<br>
> I've been pointing `SOURCE_MIRROR_URL` at, as described at: <a href="https://w" rel="noreferrer" target="_blank">https://w</a><br>
> <a href="http://iki.yoctoproject.org/wiki/How_do_I#Q:_How_do_I_create_my_own_source_d" rel="noreferrer" target="_blank">iki.yoctoproject.org/wiki/How_<wbr>do_I#Q:_How_do_I_create_my_<wbr>own_source_d</a><br>
> ownload_mirror_.3F<br>
><br>
> When I went to integrate support for the HTTP pre-mirror, I ran into<br>
> the following problem: if I assign `SOURCE_MIRROR_URL` and the<br>
> specified folder doesn't exist (as will be the case for remote<br>
> builds), the build *fails*. I had hoped that bitbake would 'fall<br>
> through' to searching other pre-mirrors, but that doesn't appear to<br>
> be the case(?)<br>
><br>
> IIs there some way I can use a specific (and *invariant*) local<br>
> source mirror folder *only if it exists*, and use our internal HTTP<br>
> pre-mirror otherwise?<br>
<br>
</span>You could do something like:<br>
<br>
def testislocal(d):<br>
if os.path.exists("xxxx")<br>
return "local"<br>
<br>
return ""<br>
<br>
LOCALBUILD = "${@testislocal(d)}"<br>
<br>
SOURCE_MIRROR_URL ?= "{@base_contains('LOCALBUILD', 'local', 'file://xxx', '<a href="http://xxx" rel="noreferrer" target="_blank">http://xxx</a>', d)}"<br>
<br>
I'm sure there are ways to neaten this up but you get the idea...<br>
<br>
Cheers,<br>
<br>
Richard<br>
<br>
<br>
<br>
</blockquote></div><br></div>