mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
devtool: check that source tree still exists
Sometimes, particularly if you extracted the source to /tmp which is on tmpfs, the external source tree that is being pointed to may no longer exist when you come to run "devtool build" or "devtool update-recipe" etc. Make all of the commands that need to check for a recipe being in the workspace call a single function and have that function additionally check the source tree still exists where appropriate. (From OE-Core rev: 0c3f289576a2ab35b1d1d8854d6763553cc3bf09) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
99cd79d8be
commit
ae788fbd46
|
@ -136,3 +136,17 @@ def parse_recipe(config, tinfoil, pn, appends):
|
||||||
not path.startswith(config.workspace_path)]
|
not path.startswith(config.workspace_path)]
|
||||||
return oe.recipeutils.parse_recipe(recipefile, append_files,
|
return oe.recipeutils.parse_recipe(recipefile, append_files,
|
||||||
tinfoil.config_data)
|
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))
|
||||||
|
|
|
@ -21,7 +21,7 @@ import bb
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
import tempfile
|
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')
|
logger = logging.getLogger('devtool')
|
||||||
|
|
||||||
|
@ -42,9 +42,7 @@ def _create_conf_file(values, conf_file=None):
|
||||||
|
|
||||||
def build(args, config, basepath, workspace):
|
def build(args, config, basepath, workspace):
|
||||||
"""Entry point for the devtool 'build' subcommand"""
|
"""Entry point for the devtool 'build' subcommand"""
|
||||||
if not args.recipename in workspace:
|
check_workspace_recipe(workspace, args.recipename)
|
||||||
raise DevtoolError("no recipe named %s in your workspace" %
|
|
||||||
args.recipename)
|
|
||||||
|
|
||||||
build_task = config.get('Build', 'build_task', 'populate_sysroot')
|
build_task = config.get('Build', 'build_task', 'populate_sysroot')
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
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')
|
logger = logging.getLogger('devtool')
|
||||||
|
|
||||||
|
@ -28,9 +28,8 @@ def deploy(args, config, basepath, workspace):
|
||||||
import re
|
import re
|
||||||
import oe.recipeutils
|
import oe.recipeutils
|
||||||
|
|
||||||
if not args.recipename in workspace:
|
check_workspace_recipe(workspace, args.recipename, checksrc=False)
|
||||||
raise DevtoolError("no recipe named %s in your workspace" %
|
|
||||||
args.recipename)
|
|
||||||
try:
|
try:
|
||||||
host, destdir = args.target.split(':')
|
host, destdir = args.target.split(':')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -20,7 +20,7 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
from bb.process import ExecutionError
|
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')
|
logger = logging.getLogger('devtool')
|
||||||
|
|
||||||
|
@ -30,9 +30,7 @@ def plugin_init(pluginlist):
|
||||||
|
|
||||||
def package(args, config, basepath, workspace):
|
def package(args, config, basepath, workspace):
|
||||||
"""Entry point for the devtool 'package' subcommand"""
|
"""Entry point for the devtool 'package' subcommand"""
|
||||||
if not args.recipename in workspace:
|
check_workspace_recipe(workspace, args.recipename)
|
||||||
raise DevtoolError("no recipe named %s in your workspace" %
|
|
||||||
args.recipename)
|
|
||||||
|
|
||||||
image_pkgtype = config.get('Package', 'image_pkgtype', '')
|
image_pkgtype = config.get('Package', 'image_pkgtype', '')
|
||||||
if not image_pkgtype:
|
if not image_pkgtype:
|
||||||
|
|
|
@ -25,7 +25,7 @@ import logging
|
||||||
import argparse
|
import argparse
|
||||||
import scriptutils
|
import scriptutils
|
||||||
import errno
|
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
|
from devtool import parse_recipe
|
||||||
|
|
||||||
logger = logging.getLogger('devtool')
|
logger = logging.getLogger('devtool')
|
||||||
|
@ -776,9 +776,7 @@ def _guess_recipe_update_mode(srctree, rdata):
|
||||||
|
|
||||||
def update_recipe(args, config, basepath, workspace):
|
def update_recipe(args, config, basepath, workspace):
|
||||||
"""Entry point for the devtool 'update-recipe' subcommand"""
|
"""Entry point for the devtool 'update-recipe' subcommand"""
|
||||||
if not args.recipename in workspace:
|
check_workspace_recipe(workspace, args.recipename)
|
||||||
raise DevtoolError("no recipe named %s in your workspace" %
|
|
||||||
args.recipename)
|
|
||||||
|
|
||||||
if args.append:
|
if args.append:
|
||||||
if not os.path.exists(args.append):
|
if not os.path.exists(args.append):
|
||||||
|
@ -830,9 +828,8 @@ def reset(args, config, basepath, workspace):
|
||||||
if args.recipename:
|
if args.recipename:
|
||||||
if args.all:
|
if args.all:
|
||||||
raise DevtoolError("Recipe cannot be specified if -a/--all is used")
|
raise DevtoolError("Recipe cannot be specified if -a/--all is used")
|
||||||
elif not args.recipename in workspace:
|
else:
|
||||||
raise DevtoolError("no recipe named %s in your workspace" %
|
check_workspace_recipe(workspace, args.recipename, checksrc=False)
|
||||||
args.recipename)
|
|
||||||
elif not args.all:
|
elif not args.all:
|
||||||
raise DevtoolError("Recipe must be specified, or specify -a/--all to "
|
raise DevtoolError("Recipe must be specified, or specify -a/--all to "
|
||||||
"reset all recipes")
|
"reset all recipes")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user