All of lore.kernel.org
 help / color / mirror / Atom feed
* Online tool for playing with variable expansion - first steps and where to host it
@ 2024-02-14 16:59 chris.laplante
  2024-02-15 15:20 ` [bitbake-devel] " Richard Purdie
  2024-05-13 14:55 ` BB Datastore Playground preview is now live chris.laplante
  0 siblings, 2 replies; 10+ messages in thread
From: chris.laplante @ 2024-02-14 16:59 UTC (permalink / raw)
  To: bitbake-devel@lists.openembedded.org; +Cc: behanw@converseincode.com

[-- Attachment #1: Type: text/plain, Size: 3061 bytes --]

Hi all,

This bug ("A web based playground for experimenting with bitbake variable expansion") has been preying on my mind ever since I read it on Bugzilla: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14805.

I'm happy to say that I have a simple proof-of-concept implementation built using Pyodide. The code needs some cleanup before I feel comfortable sharing it, but here are some details:


  1.  Consumes an unmodified version of BitBake source code (currently 2.0.16).
  2.  Plays some games with the Python import system (https://docs.python.org/3/reference/import.html) to shim out certain modules (currently just fcntl) that BitBake imports but Pyodide doesn't provide. (*1)
  3.  Executes the following test using JavaScript (*2):

        pyodide.runPython(`
            from bb.data_smart import DataSmart
        `)

        let DataSmart = pyodide.globals.get('DataSmart');
        const d = DataSmart();

        d.setVar("A", "B");
        d.setVar("A:test", "C");
        d.setVar("OVERRIDES", "test");

        console.log(d.getVar("A"));

        DataSmart.destroy();


As far as next steps, I was thinking I would build a simple-ish web app using https://github.com/microsoft/monaco-editor (the editor that powers VS Code). This would let us implement a Rust Playground-type of experience.

The two main questions in my mind are where to keep the code and where to host it?

For the code, I lean towards a separate repository. I was just going to put it under my company's GitHub: https://github.com/Agilent. This is what I'll do unless people feel strongly otherwise. (I'd rather not put it in BitBake itself since due to CORS restrictions I'll probably need to keep tar.gz copies of BitBake in the repo so the client can fetch it (*3). I also don't think we want all the webpack and TypeScript clutter in BitBake)

For hosting, assuming it goes on our GitHub, I was just going to use GitHub pages. The first iteration will be a client-side only application (*4)(*5), so no server will be required except a static endpoint for serving BitBake source code as mentioned above.

Does anyone have strong objections to this plan?

Notes:
    (*1) Interestingly Pyodide already provides sqlite3: https://til.simonwillison.net/python/sqlite-in-pyodide
    (*2) Exposing DataSmart to JavaScript is not necessarily relevant for the online tool; I just thought it was cool. The actual tool will probably just call `pyodide.runPython` with the user-supplied Python code.
    (*3) I foresee bundling a couple of copies of BitBake - at the very least, one with the old overrides syntax and a modern copy. That way people can play with both.
    (*4) In the future, I can envision a server-side component for shimming things like AUTOREV so that we can get git revisions; maybe also tie in https://github.com/petersalomonsen/wasm-git.
(*5) If we wanted to get really crazy, could also potentially leverage https://github.com/binji/wasm-clang - 'bitbake -c compile' in browser, anyone?

Thanks,
Chris


[-- Attachment #2: Type: text/html, Size: 14863 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-05-13 16:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14 16:59 Online tool for playing with variable expansion - first steps and where to host it chris.laplante
2024-02-15 15:20 ` [bitbake-devel] " Richard Purdie
2024-02-15 15:29   ` chris.laplante
2024-02-15 17:23     ` Richard Purdie
2024-02-15 17:25       ` chris.laplante
2024-02-15 17:28         ` Richard Purdie
2024-02-16 13:46           ` chris.laplante
2024-05-13 14:55 ` BB Datastore Playground preview is now live chris.laplante
2024-05-13 16:06   ` Michael Halstead
2024-05-13 16:19     ` chris.laplante

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.