diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/devtool/__init__.py | 14 | ||||
| -rw-r--r-- | scripts/lib/devtool/build.py | 6 | ||||
| -rw-r--r-- | scripts/lib/devtool/deploy.py | 7 | ||||
| -rw-r--r-- | scripts/lib/devtool/package.py | 6 | ||||
| -rw-r--r-- | scripts/lib/devtool/standard.py | 11 |
5 files changed, 25 insertions, 19 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index 404d3e6645..fb699b5c61 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py | |||
| @@ -136,3 +136,17 @@ def parse_recipe(config, tinfoil, pn, appends): | |||
| 136 | not path.startswith(config.workspace_path)] | 136 | not path.startswith(config.workspace_path)] |
| 137 | return oe.recipeutils.parse_recipe(recipefile, append_files, | 137 | return oe.recipeutils.parse_recipe(recipefile, append_files, |
| 138 | tinfoil.config_data) | 138 | tinfoil.config_data) |
| 139 | |||
| 140 | def check_workspace_recipe(workspace, pn, checksrc=True): | ||
| 141 | """ | ||
| 142 | Check that a recipe is in the workspace and (optionally) that source | ||
| 143 | is present. | ||
| 144 | """ | ||
| 145 | if not pn in workspace: | ||
| 146 | raise DevtoolError("No recipe named '%s' in your workspace" % pn) | ||
| 147 | if checksrc: | ||
| 148 | srctree = workspace[pn]['srctree'] | ||
| 149 | if not os.path.exists(srctree): | ||
| 150 | raise DevtoolError("Source tree %s for recipe %s does not exist" % (srctree, pn)) | ||
| 151 | if not os.listdir(srctree): | ||
| 152 | raise DevtoolError("Source tree %s for recipe %s is empty" % (srctree, pn)) | ||
diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py index 335aff5491..9b58858a62 100644 --- a/scripts/lib/devtool/build.py +++ b/scripts/lib/devtool/build.py | |||
| @@ -21,7 +21,7 @@ import bb | |||
| 21 | import logging | 21 | import logging |
| 22 | import argparse | 22 | import argparse |
| 23 | import tempfile | 23 | import tempfile |
| 24 | from devtool import exec_build_env_command, DevtoolError | 24 | from devtool import exec_build_env_command, check_workspace_recipe, DevtoolError |
| 25 | 25 | ||
| 26 | logger = logging.getLogger('devtool') | 26 | logger = logging.getLogger('devtool') |
| 27 | 27 | ||
| @@ -42,9 +42,7 @@ def _create_conf_file(values, conf_file=None): | |||
| 42 | 42 | ||
| 43 | def build(args, config, basepath, workspace): | 43 | def build(args, config, basepath, workspace): |
| 44 | """Entry point for the devtool 'build' subcommand""" | 44 | """Entry point for the devtool 'build' subcommand""" |
| 45 | if not args.recipename in workspace: | 45 | check_workspace_recipe(workspace, args.recipename) |
| 46 | raise DevtoolError("no recipe named %s in your workspace" % | ||
| 47 | args.recipename) | ||
| 48 | 46 | ||
| 49 | build_task = config.get('Build', 'build_task', 'populate_sysroot') | 47 | build_task = config.get('Build', 'build_task', 'populate_sysroot') |
| 50 | 48 | ||
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py index fa93adf181..41b666ff96 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | import os | 19 | import os |
| 20 | import subprocess | 20 | import subprocess |
| 21 | import logging | 21 | import logging |
| 22 | from devtool import exec_fakeroot, setup_tinfoil, DevtoolError | 22 | from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError |
| 23 | 23 | ||
| 24 | logger = logging.getLogger('devtool') | 24 | logger = logging.getLogger('devtool') |
| 25 | 25 | ||
| @@ -28,9 +28,8 @@ def deploy(args, config, basepath, workspace): | |||
| 28 | import re | 28 | import re |
| 29 | import oe.recipeutils | 29 | import oe.recipeutils |
| 30 | 30 | ||
| 31 | if not args.recipename in workspace: | 31 | check_workspace_recipe(workspace, args.recipename, checksrc=False) |
| 32 | raise DevtoolError("no recipe named %s in your workspace" % | 32 | |
| 33 | args.recipename) | ||
| 34 | try: | 33 | try: |
| 35 | host, destdir = args.target.split(':') | 34 | host, destdir = args.target.split(':') |
| 36 | except ValueError: | 35 | except ValueError: |
diff --git a/scripts/lib/devtool/package.py b/scripts/lib/devtool/package.py index 3a7a36b600..28ecfed7a7 100644 --- a/scripts/lib/devtool/package.py +++ b/scripts/lib/devtool/package.py | |||
| @@ -20,7 +20,7 @@ import os | |||
| 20 | import subprocess | 20 | import subprocess |
| 21 | import logging | 21 | import logging |
| 22 | from bb.process import ExecutionError | 22 | from bb.process import ExecutionError |
| 23 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError | 23 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError |
| 24 | 24 | ||
| 25 | logger = logging.getLogger('devtool') | 25 | logger = logging.getLogger('devtool') |
| 26 | 26 | ||
| @@ -30,9 +30,7 @@ def plugin_init(pluginlist): | |||
| 30 | 30 | ||
| 31 | def package(args, config, basepath, workspace): | 31 | def package(args, config, basepath, workspace): |
| 32 | """Entry point for the devtool 'package' subcommand""" | 32 | """Entry point for the devtool 'package' subcommand""" |
| 33 | if not args.recipename in workspace: | 33 | check_workspace_recipe(workspace, args.recipename) |
| 34 | raise DevtoolError("no recipe named %s in your workspace" % | ||
| 35 | args.recipename) | ||
| 36 | 34 | ||
| 37 | image_pkgtype = config.get('Package', 'image_pkgtype', '') | 35 | image_pkgtype = config.get('Package', 'image_pkgtype', '') |
| 38 | if not image_pkgtype: | 36 | if not image_pkgtype: |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index d5900b4f82..018ef2a987 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -25,7 +25,7 @@ import logging | |||
| 25 | import argparse | 25 | import argparse |
| 26 | import scriptutils | 26 | import scriptutils |
| 27 | import errno | 27 | import errno |
| 28 | from devtool import exec_build_env_command, setup_tinfoil, DevtoolError | 28 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError |
| 29 | from devtool import parse_recipe | 29 | from devtool import parse_recipe |
| 30 | 30 | ||
| 31 | logger = logging.getLogger('devtool') | 31 | logger = logging.getLogger('devtool') |
| @@ -776,9 +776,7 @@ def _guess_recipe_update_mode(srctree, rdata): | |||
| 776 | 776 | ||
| 777 | def update_recipe(args, config, basepath, workspace): | 777 | def update_recipe(args, config, basepath, workspace): |
| 778 | """Entry point for the devtool 'update-recipe' subcommand""" | 778 | """Entry point for the devtool 'update-recipe' subcommand""" |
| 779 | if not args.recipename in workspace: | 779 | check_workspace_recipe(workspace, args.recipename) |
| 780 | raise DevtoolError("no recipe named %s in your workspace" % | ||
| 781 | args.recipename) | ||
| 782 | 780 | ||
| 783 | if args.append: | 781 | if args.append: |
| 784 | if not os.path.exists(args.append): | 782 | if not os.path.exists(args.append): |
| @@ -830,9 +828,8 @@ def reset(args, config, basepath, workspace): | |||
| 830 | if args.recipename: | 828 | if args.recipename: |
| 831 | if args.all: | 829 | if args.all: |
| 832 | raise DevtoolError("Recipe cannot be specified if -a/--all is used") | 830 | raise DevtoolError("Recipe cannot be specified if -a/--all is used") |
| 833 | elif not args.recipename in workspace: | 831 | else: |
| 834 | raise DevtoolError("no recipe named %s in your workspace" % | 832 | check_workspace_recipe(workspace, args.recipename, checksrc=False) |
| 835 | args.recipename) | ||
| 836 | elif not args.all: | 833 | elif not args.all: |
| 837 | raise DevtoolError("Recipe must be specified, or specify -a/--all to " | 834 | raise DevtoolError("Recipe must be specified, or specify -a/--all to " |
| 838 | "reset all recipes") | 835 | "reset all recipes") |
