[OE-core] Automatic prebuilt management
Loic Poulain
loic.poulain at linaro.org
Fri Aug 23 09:49:46 UTC 2019
On Mon, 5 Aug 2019 at 18:39, chris.laplante at agilent.com <
chris.laplante at agilent.com> wrote:
> > But I would like something smarter, e.g. first trying to check if the
> SRC_URI is available, if not switching on using the prebuilt package if
> available (e.g.
> > in a DIR_PREBUILT)...
> >
> > Before going further is there already an existing solution for that? do
> you have any recommendation on the easier/best way to
> > achieve this?
>
> I don't have a "best practice" recommendation to offer. But coincidentally
> I suggested something similar for upstreaming a few weeks ago. It was
> (rightfully) rejected as too "hacky" for inclusion in core code.
> Regardless, here's a bbclass we currently use:
>
> addhandler skip_eventhandler
> python skip_eventhandler() {
> try:
> bb.fetch2.Fetch(d.getVar("SRC_URI").split(), d)
> except bb.fetch2.FetchError:
> raise bb.parse.SkipRecipe("skip-inaccessible: could not access
> upstream repo; check SRC_URI, access rights, and network availability")
> }
> skip_eventhandler[eventmask] = "bb.event.RecipePreFinalise"
>
>
> As was pointed out to me, this is a pretty heavy-handed approach - it can
> fail for any number of reasons, not just the URI actually being
> unavailable. So you may consider a more surgical check, e.g. actually
> trying to fetch the SRC_URI directly using raw GET requests.
>
> To implement the handover, you'd have separate recipes for the
> build-from-source and the prebuilt case which PROVIDE the same package. You
> probably also want to set PREFERRED_PROVIDER in your layer conf to prefer
> the build-from-source recipe.
>
> Alternatively, you can do it all in a single recipe by rewriting the
> SRC_URI from within the event handler. But I think separate recipes is
> nicer.
>
Well, I ended up with the attached class, which generates or install
prebuilt tarball. It's only a draft and I'll come back with a polished
version, but the idea is to look for the related prebuilt package into a
'PREBUILT_SRC_DIR' (if defined) and install it instead of fetching and
compiling from source. This allows having only one recipe. Then a company
just needs to provide closed-source software as a set of prebuilt tarballs
and customer need to point to the prebuilt dir (e.g. in local.conf).
Regards,
Loic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20190823/8497c30b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prebuilt.bbclass
Type: application/octet-stream
Size: 2772 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20190823/8497c30b/attachment-0001.obj>
More information about the Openembedded-core
mailing list