diff options
author | Brendan Le Foll <brendan.le.foll@intel.com> | 2015-09-08 11:39:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-09 14:27:53 +0100 |
commit | 7b1f670ca385c33db3687f07d305e3a1510cf181 (patch) | |
tree | fd7747baf64b23692eaa2cc19053acf9213772d5 /scripts/lib/devtool | |
parent | 6d50a5e0ed443f17a152c3603a8cf5d6a1729477 (diff) | |
download | poky-7b1f670ca385c33db3687f07d305e3a1510cf181.tar.gz |
devtool: add package plugin that lets you create package via devtool
Enables creating packages using devtool within the extensible SDK. (This
is only enabled within the extensible SDK because it provides no
advantage over just running bitbake directly there).
(From OE-Core rev: 6dc0269bca3e874582d61b40dbf0d495331fb96a)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r-- | scripts/lib/devtool/package.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/scripts/lib/devtool/package.py b/scripts/lib/devtool/package.py new file mode 100644 index 0000000000..3a7a36b600 --- /dev/null +++ b/scripts/lib/devtool/package.py | |||
@@ -0,0 +1,61 @@ | |||
1 | # Development tool - package command plugin | ||
2 | # | ||
3 | # Copyright (C) 2014-2015 Intel Corporation | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License version 2 as | ||
7 | # published by the Free Software Foundation. | ||
8 | # | ||
9 | # This program is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along | ||
15 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | """Devtool plugin containing the package subcommands""" | ||
18 | |||
19 | import os | ||
20 | import subprocess | ||
21 | import logging | ||
22 | from bb.process import ExecutionError | ||
23 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError | ||
24 | |||
25 | logger = logging.getLogger('devtool') | ||
26 | |||
27 | def plugin_init(pluginlist): | ||
28 | """Plugin initialization""" | ||
29 | pass | ||
30 | |||
31 | def package(args, config, basepath, workspace): | ||
32 | """Entry point for the devtool 'package' subcommand""" | ||
33 | if not args.recipename in workspace: | ||
34 | raise DevtoolError("no recipe named %s in your workspace" % | ||
35 | args.recipename) | ||
36 | |||
37 | image_pkgtype = config.get('Package', 'image_pkgtype', '') | ||
38 | if not image_pkgtype: | ||
39 | tinfoil = setup_tinfoil() | ||
40 | try: | ||
41 | tinfoil.prepare(config_only=True) | ||
42 | image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE', True) | ||
43 | finally: | ||
44 | tinfoil.shutdown() | ||
45 | |||
46 | package_task = config.get('Package', 'package_task', 'package_write_%s' % image_pkgtype) | ||
47 | try: | ||
48 | exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (package_task, args.recipename), watch=True) | ||
49 | except bb.process.ExecutionError as e: | ||
50 | # We've already seen the output since watch=True, so just ensure we return something to the user | ||
51 | return e.exitcode | ||
52 | logger.info('Your packages are in %s/tmp/deploy/%s' % (basepath, image_pkgtype)) | ||
53 | |||
54 | return 0 | ||
55 | |||
56 | def register_commands(subparsers, context): | ||
57 | """Register devtool subcommands from the package plugin""" | ||
58 | if context.fixed_setup: | ||
59 | parser_package = subparsers.add_parser('package', help='Build packages for a recipe', description='Builds packages for a recipe\'s output files') | ||
60 | parser_package.add_argument('recipename', help='Recipe to package') | ||
61 | parser_package.set_defaults(func=package) | ||