diff options
Diffstat (limited to 'scripts/lib/devtool/build-image.py')
| -rw-r--r-- | scripts/lib/devtool/build-image.py | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/scripts/lib/devtool/build-image.py b/scripts/lib/devtool/build-image.py index 2c014289fe..fa6f0d738a 100644 --- a/scripts/lib/devtool/build-image.py +++ b/scripts/lib/devtool/build-image.py | |||
| @@ -25,8 +25,8 @@ from devtool import exec_build_env_command, setup_tinfoil, parse_recipe | |||
| 25 | 25 | ||
| 26 | logger = logging.getLogger('devtool') | 26 | logger = logging.getLogger('devtool') |
| 27 | 27 | ||
| 28 | def _get_recipes(workspace, config): | 28 | def _get_packages(workspace, config): |
| 29 | """Get list of target recipes from the workspace.""" | 29 | """Get list of packages from recipes in the workspace.""" |
| 30 | result = [] | 30 | result = [] |
| 31 | tinfoil = setup_tinfoil() | 31 | tinfoil = setup_tinfoil() |
| 32 | for recipe in workspace: | 32 | for recipe in workspace: |
| @@ -35,7 +35,7 @@ def _get_recipes(workspace, config): | |||
| 35 | if recipe in data.getVar('PACKAGES', True): | 35 | if recipe in data.getVar('PACKAGES', True): |
| 36 | result.append(recipe) | 36 | result.append(recipe) |
| 37 | else: | 37 | else: |
| 38 | logger.warning("Skipping recipe %s as it doesn't produce " | 38 | logger.warning("Skipping recipe %s as it doesn't produce a " |
| 39 | "package with the same name", recipe) | 39 | "package with the same name", recipe) |
| 40 | tinfoil.shutdown() | 40 | tinfoil.shutdown() |
| 41 | return result | 41 | return result |
| @@ -46,29 +46,32 @@ def build_image(args, config, basepath, workspace): | |||
| 46 | appendfile = os.path.join(config.workspace_path, 'appends', | 46 | appendfile = os.path.join(config.workspace_path, 'appends', |
| 47 | '%s.bbappend' % image) | 47 | '%s.bbappend' % image) |
| 48 | 48 | ||
| 49 | # remove <image>.bbapend to make sure setup_tinfoil doesn't | 49 | # remove <image>.bbappend to make sure setup_tinfoil doesn't |
| 50 | # breake because of it | 50 | # break because of it |
| 51 | if os.path.isfile(appendfile): | 51 | if os.path.isfile(appendfile): |
| 52 | os.unlink(appendfile) | 52 | os.unlink(appendfile) |
| 53 | 53 | ||
| 54 | recipes = _get_recipes(workspace, config) | 54 | if workspace: |
| 55 | if recipes: | 55 | packages = _get_packages(workspace, config) |
| 56 | with open(appendfile, 'w') as afile: | 56 | if packages: |
| 57 | # include selected recipes into the image | 57 | with open(appendfile, 'w') as afile: |
| 58 | afile.write('IMAGE_INSTALL_append = " %s"\n' % ' '.join(recipes)) | 58 | # include packages from workspace recipes into the image |
| 59 | afile.write('IMAGE_INSTALL_append = " %s"\n' % ' '.join(packages)) | ||
| 59 | 60 | ||
| 60 | # Generate notification callback devtool_warn_image_extended | 61 | # Generate notification callback devtool_warn_image_extended |
| 61 | afile.write('do_rootfs[prefuncs] += "devtool_warn_image_extended"\n\n') | 62 | afile.write('do_rootfs[prefuncs] += "devtool_warn_image_extended"\n\n') |
| 62 | afile.write("python devtool_warn_image_extended() {\n") | 63 | afile.write("python devtool_warn_image_extended() {\n") |
| 63 | afile.write(" bb.plain('NOTE: %%s: building with additional '\n" | 64 | afile.write(" bb.plain('NOTE: %%s: building with additional '\n" |
| 64 | " 'packages due to \"devtool build-image\"'" | 65 | " 'packages due to \"devtool build-image\"'" |
| 65 | " %% d.getVar('PN', True))\n" | 66 | " %% d.getVar('PN', True))\n" |
| 66 | " bb.plain('NOTE: delete %%s to clear this' %% \\\n" | 67 | " bb.plain('NOTE: delete %%s to clear this' %% \\\n" |
| 67 | " '%s')\n" % os.path.relpath(appendfile, basepath)) | 68 | " '%s')\n" % os.path.relpath(appendfile, basepath)) |
| 68 | afile.write("}\n") | 69 | afile.write("}\n") |
| 69 | 70 | ||
| 70 | logger.info('Building image %s with the following ' | 71 | logger.info('Building image %s with the following ' |
| 71 | 'additional packages: %s', image, ' '.join(recipes)) | 72 | 'additional packages: %s', image, ' '.join(packages)) |
| 73 | else: | ||
| 74 | logger.warning('No packages to add, building image %s unmodified', image) | ||
| 72 | else: | 75 | else: |
| 73 | logger.warning('No recipes in workspace, building image %s unmodified', image) | 76 | logger.warning('No recipes in workspace, building image %s unmodified', image) |
| 74 | 77 | ||
