Commit Graph

17 Commits

Author SHA1 Message Date
Paul Eggleton 32ef523898 devtool: categorise and order subcommands in help output
The listing of subcommands in the --help output for devtool was starting
to get difficult to follow, with commands appearing in no particular
order (due to some being in separate modules and the order of those
modules being parsed). Logically grouping the subcommands as well as
being able to exercise some control over the order of the subcommands
and groups would help, if we do so without losing the dynamic nature of
the list (i.e. that it comes from the plugins). Argparse provides no
built-in way to handle this and really, really makes it a pain to add,
but with some subclassing and hacking it's now possible, and can be
extended by any plugin as desired.

To put a subcommand into a group, all you need to do is specify a group=
parameter in the call to subparsers.add_parser(). you can also specify
an order= parameter to make the subcommand sort higher or lower in the
list (higher order numbers appear first, so use negative numbers to
force items to the end if that's what you want). To add a new group, use
subparsers.add_subparser_group(), supplying the name, description and
optionally an order number for the group itself (again, higher numbers
appear first).

(From OE-Core rev: e1b9d31e6ea3c254ecfe940fe795af44761e0e69)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21 09:32:42 +00:00
Paul Eggleton e559b66289 devtool: build-image: allow specifying packages to add to image
Provide an option to devtool build-image to specify the list of packages
instead of taking the list of packages produced by recipes in the
workspace. Sometimes you don't want all of these packages; other times
you want to add more.

This is the most immediate fix for [YOCTO #8855], though it is a little
crude so I would like to provide better means of customising the image
contents later.

(From OE-Core rev: b3a44951a74fe58714b72e71a7a558b67a71e1e3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-26 18:05:13 +00:00
Markus Lehtonen 85d8b4a92f devtool: second fix for running from a different directory
Do not change change current working directory permanently, but, only
for the duration of tinfoil initialization instead. The previous fix
caused very unintuitive behavior where using relative paths were solved
with respect to the builddir instead of the current working directory.
E.g. calling "devtool extract zlib ./zlib" would always create create
srctree in ${TOPDIR}/zlib, independent of the users cwd.

(From OE-Core rev: 4c7f159b0e17a0475a4a4e9dc4dd012e3d2e6a1f)

(From OE-Core rev: 05060699e63cd25d089e83e9aa56c11d5baa8fd8)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-24 17:54:24 +01:00
Paul Eggleton 76084cdfa6 devtool: build-image: delete bbappend at end of build
Upon further reflection, it seems to me that this bbappend ought to just
be deleted at the end of the build. This keeps things simple; you never
have to remember to delete any files to get back to where you were
before with the image. This means we can also drop the slightly awkward
message reminding the user how to do that. I've also updated the test to
look at the image manifest to determine if the command has worked
instead of looking for the (now deleted) bbappend.

(From OE-Core rev: f6b90bceaedf9bad3d111e6ca1fa79e59f472c73)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:53:19 +01:00
Paul Eggleton ef197f9b99 devtool: build-image: improve image recipe handling
* Make image optional for the extensible SDK (auto-determine it based on
  the targets the SDK was built for)
* Check that specified recipe is in fact an image

(From OE-Core rev: 8884875aacfedc69cc72898684e391e69fea00ba)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:53:19 +01:00
Paul Eggleton 8f67bb7990 devtool: build-image: tell user where to find output files
If the user is running "devtool build-image" within the extensible SDK
then they probably won't know where to find the resulting output files,
so we should tell them explicitly.

(From OE-Core rev: 9baf9fd7a53142a98c7f1cd49c7b001760af51f9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:53:19 +01:00
Paul Eggleton afb9340fc6 devtool: build-image: fix recipe/package terminology
We build recipes and include packages into the image, adjust the
terminology used in code and messages accordingly. Also fix a few typos.

(From OE-Core rev: 866f6e2de20b7022803e53c4de3ff341521b4db5)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23 09:53:18 +01:00
Ed Bartosh 9485888656 devtool: make plugin_init optional
So far all devtool and recipetool plugins were expected
to have plugin_init function. This function is empty in
most of plugins as they don't require initialisation.

Making plugin_init optional would allow not having empty
plugin_init in every plugin.

(From OE-Core rev: b99640c89f067866b264f4ee4030fae4c2f338c0)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12 22:48:30 +01:00
Ed Bartosh 15526a8591 devtool: build-image: add comments
Added couple of hopefully useful comments to the code.

(From OE-Core rev: 72dfe5b58c637d74971e025aef3ce0a64dc8172c)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:14 +01:00
Ed Bartosh 2dac49db87 devtool: build-image: remove <image>.bbappend
Removed <image>.bbappend before generating it again as
it may cause tinfoil to fail due to its wrong content.

It's safe to do as <image>.bbappend is regenerated anyway.

(From OE-Core rev: 82c6452ca953eb32e2919d9f9e64497a15212be5)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:14 +01:00
Ed Bartosh 96726242f0 devtool: build-image: add extra logging
Added logger calls to show if image is modified by the
plugin or not.

(From OE-Core rev: f719e956a6263784963b6ae9514030a1a1dc2aeb)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:13 +01:00
Ed Bartosh 45ebff42af devtool: build-image: generate notification callback
Added notification callback to <image>.bbapend to notify
user that image is modified by build-image plugin.

(From OE-Core rev: 53cb00b8af58c326e2a045cd6f8a04a24dc4c1b5)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:13 +01:00
Ed Bartosh 61ecb6ce47 devtool: build-image: filter out recipes
Filtered out non-target recipes and recipes with
recipe name != package name in build-image plugin.

Isolated all logic of getting recipes in _get_recipes
function.

(From OE-Core rev: efe685711ae6f4beec06ba591c74140ce56b96af)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:12 +01:00
Ed Bartosh 214dd950c9 devtool: build-image: improve help and description
Made parser help message and description more clear in
build-image plugin.

(From OE-Core rev: 39714557dde70c4b1ce8d08c7e1d21fd39a1d1a6)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:12 +01:00
Ed Bartosh e9fbc7a2d2 devtool: build-image: rename LOG -> logger
Used logger variable name instead of LOG as it is used the rest
of the devtool code.
Pylint complains about 'logger' being invalid constant name,
but it's better to be consistent in naming.

(From OE-Core rev: a1c811df93e831a198464008564ce33ec98a3049)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:11 +01:00
Ed Bartosh 906f885efe devtool: build-image: stop using add_md5
It doesn't make sense to use it as image recipe is not
in workspace. It means that we can't do 'devtool reset'
for the recipe, which is a main point of using add_md5.

(From OE-Core rev: f69613ed9d56c6e6ba322d8c9db07b7ed802042a)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-31 11:37:10 +01:00
Ed Bartosh b2c1e64ecd devtool: implement build-image plugin
Implemented new plugin to build image from workspace packages.

Plugin creates <image>.bbappend file, adds
all workspace packages to the image using IMAGE_INSTALL_append
variable in bbappend file. After that it runs 'bitbake <image>'.

(From OE-Core rev: 00bc43868da3ea2a4532215d3abef8e150c7b2e5)

(From OE-Core rev: fc35c10fed382e385f00b76abcee94a0148b4aee)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-30 12:35:50 +01:00