Commit Graph

9 Commits

Author SHA1 Message Date
Alexander Kanavin
11762e4dc3 bblayers/makesetup: move check for existence of git remotes to oe-setup-layers plugin
This helps when making a local copy of all the layers: it's fine to
not have any remotes configured in that case.

Also correct the mistake in accessing 'contains_this_file' property:
it may not necessarily exist, and if so, it should default to False.

(From OE-Core rev: 639df31e57b7f3da2d475cbae9a79d45755dede6)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:38:22 +01:00
Alexander Kanavin
8332fd532f bblayers/makesetup: include local repository paths in discovered layer repo data
This can be useful when the caller needs to know where the repos actually
are on local disk (for example to make a local copy of them or obtain
additional information about them).

This field however should be removed from the json output in oe-setup-layers
plugin, as it is host-specific and not part of the schema.

(From OE-Core rev: ee33ebf6140ad13e401c2cccbb106a22043be356)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:38:22 +01:00
Alexander Kanavin
f82c933a4b bblayers/makesetup: raise exceptions when errors happen
Otherwise the calling code can only issue a generic, unhelpful
erorr message, and it's difficult to tell what went wrong
if logger.error output is obscured or redirected.

(From OE-Core rev: 155fe6bda2d715aa616fa8db922dbaa11ebb8080)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-28 09:38:22 +01:00
Jermain Horsman
9b839a835c bblayers/makesetup.py: Move git utility functions to oe.buildcfg module
This allows other classes to make use of these as well.

Includes a git describe and git toplevel function and functions
to get info for git remotes.

(From OE-Core rev: a04a084b6e513d15cb57ee103c6d6215ce1c75b9)

Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-30 22:25:43 +00:00
Jermain Horsman
54f9db951a lib/bblayers/makesetup.py: Remove unused imports
(From OE-Core rev: 789549ed28c043a6d9b304f99f528546f4ade957)

Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-04 23:47:51 +00:00
Alexander Kanavin
314944eaab bblayers/makesetup: skip git repos that are submodules
(From OE-Core rev: d8bc9cd4ca8ae268a61024f8ac5083a2bbdc432f)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-02-15 10:21:34 +00:00
Enguerrand de Ribaucourt
59a06db5dc bitbake-layers: fix a typo
(From OE-Core rev: fab3aa7b1b7003bb03678c5cfc62ad2b597f0932)

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-02 15:31:56 +00:00
Alexander Kanavin
2bdc042d9c meta/files/layers.schema.json: drop the layers property
This is a leftover from one of the RFC iterations, where
the property contained available machines, distros and templates.
As all of those were dropped from the final version, there is no
reason to list the layers either anymore.

Normally this would be a backwards incompatible change, but as
the layer setup itself was just merged, I think we can do a quick
fixup :-)

(From OE-Core rev: 64a774de0e154ef81f20853fec903b17d9985a72)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-09-02 15:58:26 +01:00
Alexander Kanavin
e561fc1cbe bitbake-layers: add ability to save current layer repository configuration into a file
This addresses a long standing gap in the core offering:
there is no tooling to capture the currently configured layers
with their revisions, or restore the layers from a configuration
file (without using external tools, some of which aren't particularly
suitable for the task). This plugin addresses the 'capture' part.

Note that the actual writing is performed by a sub-plugin; one such
sub-plugin is provided (for the json + python script format), but
more can be added (e.g. kas, repo, etc.).

How to save a layer configuration:

a) Running with default choices:

$ bitbake-layers create-layers-setup /srv/work/alex/meta-alex/
NOTE: Starting bitbake server...
NOTE: Created /srv/work/alex/meta-alex/setup-layers.json
NOTE: Created /srv/work/alex/meta-alex/setup-layers

b) Command line options:

NOTE: Starting bitbake server...
usage: bitbake-layers create-layers-setup [-h] [--output-prefix OUTPUT_PREFIX] [--writer {oe-setup-layers}] [--json-only] destdir

 Writes out a configuration file and/or a script that replicate the directory structure and revisions of the layers in a current build.

positional arguments:
  destdir               Directory where to write the output
                        (if it is inside one of the layers, the layer becomes a bootstrap repository and thus will be excluded from fetching).

optional arguments:
  -h, --help            show this help message and exit
  --output-prefix OUTPUT_PREFIX, -o OUTPUT_PREFIX
                        File name prefix for the output files, if the default (setup-layers) is undesirable.
  --writer {oe-setup-layers}, -w {oe-setup-layers}
                        Choose the output format (defaults to oe-setup-layers).

                        Currently supported options are:
                        oe-setup-layers - a self-contained python script and a json config for it.

  --json-only           When using the oe-setup-layers writer, write only the layer configuruation in json format. Otherwise, also a copy of scripts/oe-setup-layers (from oe-core or poky) is provided, which is a self contained python script that fetches all the needed layers and sets them to correct revisions using the data from the json.

(From OE-Core rev: 5606d1a123a3816ab45e49ee7707ed84c9c23c5c)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-09-01 10:07:02 +01:00