mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
devtool: make 2 functions public
Moved standard.py:_parse_recipe -> __init__.py:parse_recipe and
standard.py:_get_recipe_file -> __init__.py:get_recipe_file
to be able to call them from other modules.
(From OE-Core rev: f0e61a0d5597017c5f5d2dafb41118b79f505d9b)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
906f885efe
commit
71fdc64b8a
@@ -116,3 +116,30 @@ def add_md5(config, recipename, filename):
|
|||||||
md5 = bb.utils.md5_file(filename)
|
md5 = bb.utils.md5_file(filename)
|
||||||
with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
|
with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f:
|
||||||
f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5))
|
f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5))
|
||||||
|
|
||||||
|
def get_recipe_file(cooker, pn):
|
||||||
|
"""Find recipe file corresponding a package name"""
|
||||||
|
import oe.recipeutils
|
||||||
|
recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
|
||||||
|
if not recipefile:
|
||||||
|
skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
|
||||||
|
if skipreasons:
|
||||||
|
logger.error('\n'.join(skipreasons))
|
||||||
|
else:
|
||||||
|
logger.error("Unable to find any recipe file matching %s" % pn)
|
||||||
|
return recipefile
|
||||||
|
|
||||||
|
def parse_recipe(config, tinfoil, pn, appends):
|
||||||
|
"""Parse recipe of a package"""
|
||||||
|
import oe.recipeutils
|
||||||
|
recipefile = get_recipe_file(tinfoil.cooker, pn)
|
||||||
|
if not recipefile:
|
||||||
|
# Error already logged
|
||||||
|
return None
|
||||||
|
if appends:
|
||||||
|
append_files = tinfoil.cooker.collection.get_file_appends(recipefile)
|
||||||
|
# Filter out appends from the workspace
|
||||||
|
append_files = [path for path in append_files if
|
||||||
|
not path.startswith(config.workspace_path)]
|
||||||
|
return oe.recipeutils.parse_recipe(recipefile, append_files,
|
||||||
|
tinfoil.config_data)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ 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, DevtoolError
|
||||||
from devtool import add_md5
|
from devtool import add_md5, parse_recipe
|
||||||
|
|
||||||
logger = logging.getLogger('devtool')
|
logger = logging.getLogger('devtool')
|
||||||
|
|
||||||
@@ -157,34 +157,6 @@ def _check_compatible_recipe(pn, d):
|
|||||||
"from working. You will need to disable this "
|
"from working. You will need to disable this "
|
||||||
"first." % pn)
|
"first." % pn)
|
||||||
|
|
||||||
def _get_recipe_file(cooker, pn):
|
|
||||||
"""Find recipe file corresponding a package name"""
|
|
||||||
import oe.recipeutils
|
|
||||||
recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
|
|
||||||
if not recipefile:
|
|
||||||
skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
|
|
||||||
if skipreasons:
|
|
||||||
logger.error('\n'.join(skipreasons))
|
|
||||||
else:
|
|
||||||
logger.error("Unable to find any recipe file matching %s" % pn)
|
|
||||||
return recipefile
|
|
||||||
|
|
||||||
def _parse_recipe(config, tinfoil, pn, appends):
|
|
||||||
"""Parse recipe of a package"""
|
|
||||||
import oe.recipeutils
|
|
||||||
recipefile = _get_recipe_file(tinfoil.cooker, pn)
|
|
||||||
if not recipefile:
|
|
||||||
# Error already logged
|
|
||||||
return None
|
|
||||||
if appends:
|
|
||||||
append_files = tinfoil.cooker.collection.get_file_appends(recipefile)
|
|
||||||
# Filter out appends from the workspace
|
|
||||||
append_files = [path for path in append_files if
|
|
||||||
not path.startswith(config.workspace_path)]
|
|
||||||
return oe.recipeutils.parse_recipe(recipefile, append_files,
|
|
||||||
tinfoil.config_data)
|
|
||||||
|
|
||||||
|
|
||||||
def _ls_tree(directory):
|
def _ls_tree(directory):
|
||||||
"""Recursive listing of files in a directory"""
|
"""Recursive listing of files in a directory"""
|
||||||
ret = []
|
ret = []
|
||||||
@@ -200,7 +172,7 @@ def extract(args, config, basepath, workspace):
|
|||||||
|
|
||||||
tinfoil = setup_tinfoil()
|
tinfoil = setup_tinfoil()
|
||||||
|
|
||||||
rd = _parse_recipe(config, tinfoil, args.recipename, True)
|
rd = parse_recipe(config, tinfoil, args.recipename, True)
|
||||||
if not rd:
|
if not rd:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -420,7 +392,7 @@ def modify(args, config, basepath, workspace):
|
|||||||
|
|
||||||
tinfoil = setup_tinfoil()
|
tinfoil = setup_tinfoil()
|
||||||
|
|
||||||
rd = _parse_recipe(config, tinfoil, args.recipename, True)
|
rd = parse_recipe(config, tinfoil, args.recipename, True)
|
||||||
if not rd:
|
if not rd:
|
||||||
return 1
|
return 1
|
||||||
recipefile = rd.getVar('FILE', True)
|
recipefile = rd.getVar('FILE', True)
|
||||||
@@ -762,7 +734,7 @@ def update_recipe(args, config, basepath, workspace):
|
|||||||
|
|
||||||
tinfoil = setup_tinfoil()
|
tinfoil = setup_tinfoil()
|
||||||
|
|
||||||
rd = _parse_recipe(config, tinfoil, args.recipename, True)
|
rd = parse_recipe(config, tinfoil, args.recipename, True)
|
||||||
if not rd:
|
if not rd:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user