Re: [OE-core] [PATCH] oe-setup-build: add a tool for discovering config templates and setting up builds

2023-01-26 Thread Alexander Kanavin
On Mon, 16 Jan 2023 at 14:30, Richard Purdie
 wrote:
> There is also an implied challenge here of the different stages of
> "checkout the repos", "document those checkouts in bblayers.conf" and
> "here is a separate build directory". The layer config file is where
> information from the two are mixed but I suspect there is something
> different we could do.
>
> For example, if the config fragment says "I need layers X, Y" but the
> layer setup json might define Z as well. We'd need a markup for "layers
> X, Y, Z are available" from oe-setup-layers. oe-setup-build could then
> iterate the layers, show the configs, then generate a setup for configX
> which only needed layers Y and Z configured.

What I would like to try is have oe-setup-layers first clone/checkout
the layer repositories (according to what is in the supplied json),
then walk the resulting directories looking for conf/layer.conf, e.g.
determine what actual layers are in the checkout and where they are.

Then this list would be written out to a file in the top level
directory containing the layer repos for further usage by other tools.
E.g.:

/path/to/setup-layers --destdir path/to/checkout/

would write a path/to/checkout/oe-layers.txt (final filename TBD)
containing layer paths relative to the file itself, e.g. (final format also TBD)

meta-intel
meta-arm
meta-openembedded/meta-oe
meta-openembedded/meta-networking

and the location of oe-setup-build into a runnable shell script
path/to/checkout/setup-build.sh:
#!/bin/sh
poky/scripts/oe-setup-build --layers-list ./oe-layers.txt $*

This leaves bblayers.conf(.sample) unchanged and exactly as it was - a
template/build item consumed by bitbake only and used to list layers
active in a specific build.

Alex

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176391): 
https://lists.openembedded.org/g/openembedded-core/message/176391
Mute This Topic: https://lists.openembedded.org/mt/94932581/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] oe-setup-build: add a tool for discovering config templates and setting up builds

2023-01-16 Thread Richard Purdie
On Thu, 2022-11-10 at 10:24 +0100, Alexander Kanavin wrote:
> This is the last (I believe) piece of the puzzle in setting up builds from 
> nothing
> without having to write custom scripts or use external tools.
> 
> After layers have been fetched and placed into their respective locations, 
> one would
> surely want to proceed to the actual build, and here's how:
> 
> 1. Without arguments or with 'list-config-templates', the tool simply walks 
> the ../..
> of its location (which is the parent dir of poky/oe-core), and prints what 
> templates it
> has found, as seen below. If the following is not enough information,
> adding '-v' will also print conf-notes.txt for each of the templates:
> 
> $ oe-setup-build
> Available build configuration templates (re-run with -v to see their 
> descriptions):
> 
> /srv/work/alex/poky/scripts/oe-setup-build setup-build-env -c 
> /srv/work/alex/poky/meta-poky/conf/templates/default
> will create a build configuration in /srv/work/alex/build-meta-poky-default
> 
> /srv/work/alex/poky/scripts/oe-setup-build setup-build-env -c 
> /srv/work/alex/meta-alex/conf/templates/configuration-gizmo
> will create a build configuration in 
> /srv/work/alex/build-meta-alex-configuration-gizmo
> 
> /srv/work/alex/poky/scripts/oe-setup-build setup-build-env -c 
> /srv/work/alex/meta-alex/conf/templates/configuration-gadget
> will create a build configuration in 
> /srv/work/alex/build-meta-alex-configuration-gadget
> 
> 2. Then the user picks one command of the above and runs it. This will land 
> them in a shell ready to run bitbake:
> 
> $ oe-setup-build setup-build-env -c 
> /srv/work/alex/meta-alex/conf/templates/configuration-gizmo
> Running: 
> TEMPLATECONF=/srv/work/alex/meta-alex/conf/templates/configuration-gizmo . 
> /srv/work/alex/poky/oe-init-build-env 
> /srv/work/alex/build-meta-alex-configuration-gizmo && /bin/bash
> You had no conf/local.conf file. This configuration file has therefore been
> created for you from 
> /srv/work/alex/meta-alex/conf/templates/configuration-gizmo/local.conf.sample
> You may wish to edit it to, for example, select a different MACHINE (target
> hardware). See conf/local.conf for more information as common configuration
> options are commented.
> 
> You had no conf/bblayers.conf file. This configuration file has therefore been
> created for you from 
> /srv/work/alex/meta-alex/conf/templates/configuration-gizmo/bblayers.conf.sample
> To add additional metadata layers into your configuration please add entries
> to conf/bblayers.conf.
> 
> The Yocto Project has extensive documentation about OE including a reference
> manual which can be found at:
> https://docs.yoctoproject.org
> 
> For more information about OpenEmbedded see the website:
> https://www.openembedded.org/
> 
> This configuration template will set up a build for the purposes of 
> supporting gizmo.
> Please refer to meta-alex/README for additional details and available bitbake 
> targets.
> 
> 3. The full set of command line options is:
> 
> $ oe-setup-build -h
> usage: oe-setup-build [-h] {list-config-templates,setup-build-env} ...
> 
> A script that discovers available build configuration templates and sets up a 
> build environment based on one of them
> 
> positional arguments:
>   {list-config-templates,setup-build-env}
> list-config-templates
> List available configuration templates
> setup-build-env Set up a build environment and open a shell session 
> with it, ready to run builds.
> 
> optional arguments:
>   -h, --helpshow this help message and exit
> 
> $ oe-setup-build list-config-templates -h
> usage: oe-setup-build list-config-templates [-h] [--topdir TOPDIR] [-v]
> 
> optional arguments:
>   -h, --help   show this help message and exit
>   --topdir TOPDIR  Where to look for available build configuration templates 
> (default is /srv/work/alex).
>   -v   Print a description for each available build configuration 
> template.
> 
> $ oe-setup-build setup-build-env -h
> usage: oe-setup-build setup-build-env [-h] -c template_path [-b build_path] 
> [--no-shell]
> 
> optional arguments:
>   -h, --helpshow this help message and exit
>   -c template_path  Use a build configuration template in template_path to 
> set up a build environment (run this script with 'list-config-templates' to 
> see what is available)
>   -b build_path Set up a build directory in build_path (run this script 
> with 'list-config-templates' to see where it would be by default)
>   --no-shellCreate a build directory but do not start a shell session 
> with the build environment from it.
> 
> 4. There's also a selftest that runs a basic check for template discovery and 
> build setup,
> and an added hint in oe-setup-layers about how to proceed (as it is really 
> not user-friendly
> to fetch the layer repos successfully and then exit without a word).
> 
> Signed-off-by: Alexander Kanavin 

I appreciate I've taken