not path.startswith(config.workspace_path)]
return oe.recipeutils.parse_recipe(recipefile, append_files,
tinfoil.config_data)
+
+def check_workspace_recipe(workspace, pn, checksrc=True):
+ """
+ Check that a recipe is in the workspace and (optionally) that source
+ is present.
+ """
+ if not pn in workspace:
+ raise DevtoolError("No recipe named '%s' in your workspace" % pn)
+ if checksrc:
+ srctree = workspace[pn]['srctree']
+ if not os.path.exists(srctree):
+ raise DevtoolError("Source tree %s for recipe %s does not exist" % (srctree, pn))
+ if not os.listdir(srctree):
+ raise DevtoolError("Source tree %s for recipe %s is empty" % (srctree, pn))
import logging
import argparse
import tempfile
-from devtool import exec_build_env_command, DevtoolError
+from devtool import exec_build_env_command, check_workspace_recipe, DevtoolError
logger = logging.getLogger('devtool')
def build(args, config, basepath, workspace):
"""Entry point for the devtool 'build' subcommand"""
- if not args.recipename in workspace:
- raise DevtoolError("no recipe named %s in your workspace" %
- args.recipename)
+ check_workspace_recipe(workspace, args.recipename)
build_task = config.get('Build', 'build_task', 'populate_sysroot')
import os
import subprocess
import logging
-from devtool import exec_fakeroot, setup_tinfoil, DevtoolError
+from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError
logger = logging.getLogger('devtool')
import re
import oe.recipeutils
- if not args.recipename in workspace:
- raise DevtoolError("no recipe named %s in your workspace" %
- args.recipename)
+ check_workspace_recipe(workspace, args.recipename, checksrc=False)
+
try:
host, destdir = args.target.split(':')
except ValueError:
import subprocess
import logging
from bb.process import ExecutionError
-from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
+from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError
logger = logging.getLogger('devtool')
def package(args, config, basepath, workspace):
"""Entry point for the devtool 'package' subcommand"""
- if not args.recipename in workspace:
- raise DevtoolError("no recipe named %s in your workspace" %
- args.recipename)
+ check_workspace_recipe(workspace, args.recipename)
image_pkgtype = config.get('Package', 'image_pkgtype', '')
if not image_pkgtype:
import argparse
import scriptutils
import errno
-from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
+from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError
from devtool import parse_recipe
logger = logging.getLogger('devtool')
def update_recipe(args, config, basepath, workspace):
"""Entry point for the devtool 'update-recipe' subcommand"""
- if not args.recipename in workspace:
- raise DevtoolError("no recipe named %s in your workspace" %
- args.recipename)
+ check_workspace_recipe(workspace, args.recipename)
if args.append:
if not os.path.exists(args.append):
if args.recipename:
if args.all:
raise DevtoolError("Recipe cannot be specified if -a/--all is used")
- elif not args.recipename in workspace:
- raise DevtoolError("no recipe named %s in your workspace" %
- args.recipename)
+ else:
+ check_workspace_recipe(workspace, args.recipename, checksrc=False)
elif not args.all:
raise DevtoolError("Recipe must be specified, or specify -a/--all to "
"reset all recipes")