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:
Paul Eggleton
2015-09-22 17:21:24 +01:00
committed by Richard Purdie
parent 99cd79d8be
commit ae788fbd46
5 changed files with 25 additions and 19 deletions

View File

@@ -136,3 +136,17 @@ def parse_recipe(config, tinfoil, pn, appends):
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))