<div dir="ltr">&gt; You could do something like:<br>...<br>&gt; <br>
SOURCE_MIRROR_URL ?= &quot;{@base_contains(&#39;LOCALBUILD&#39;, &#39;local&#39;, &#39;file://xxx&#39;, &#39;<a href="http://xxx" rel="noreferrer" target="_blank">http://xxx</a>&#39;, d)}&quot;<br><br><br>That&#39;s exactly what I was looking for, thanks. I gather I can&#39;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 &#39;feels weird&#39; 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">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</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>
&gt; This might be an &#39;X-Y&#39; problem, so I should explain what I&#39;m trying<br>
&gt; to achieve. We have a somewhat beefy build server with 32 cores that<br>
&gt; most of my team likes to `ssh` into to do builds of our Yocto/OE<br>
&gt; -based BSP. But a few of us build on different machines often enough<br>
&gt; that I recently spun up a web server—on the 32-core build machine—to<br>
&gt; act as a &#39;pre-mirror&#39; to statically serve  our dependencies for<br>
&gt; remote builds. The web server is serving the exact same folder that<br>
&gt; I&#39;ve been pointing `SOURCE_MIRROR_URL` at, as described at: <a href="https://w" rel="noreferrer" target="_blank">https://w</a><br>
&gt; <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>
&gt; ownload_mirror_.3F<br>
&gt;<br>
&gt; When I went to integrate support for the HTTP pre-mirror, I ran into<br>
&gt; the following problem: if I assign `SOURCE_MIRROR_URL` and the<br>
&gt; specified folder doesn&#39;t exist (as will be the case for remote<br>
&gt; builds), the build *fails*. I had hoped that bitbake would &#39;fall<br>
&gt; through&#39; to searching other pre-mirrors, but that doesn&#39;t appear to<br>
&gt; be the case(?)<br>
&gt;<br>
&gt; IIs there some way I can use a specific (and *invariant*) local<br>
&gt; source mirror folder *only if it exists*, and use our internal HTTP<br>
&gt; pre-mirror otherwise?<br>
<br>
</span>You could do something like:<br>
<br>
def testislocal(d):<br>
    if os.path.exists(&quot;xxxx&quot;)<br>
        return &quot;local&quot;<br>
<br>
  return &quot;&quot;<br>
<br>
LOCALBUILD = &quot;${@testislocal(d)}&quot;<br>
<br>
SOURCE_MIRROR_URL ?= &quot;{@base_contains(&#39;LOCALBUILD&#39;, &#39;local&#39;, &#39;file://xxx&#39;, &#39;<a href="http://xxx" rel="noreferrer" target="_blank">http://xxx</a>&#39;, d)}&quot;<br>
<br>
I&#39;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>