devtool/recipetool/meta: Adapt to bitbake API changes for multi-configuration builds

Unfortunately to implenent multiconfig support in bitbake some APIs
had to change. This updates code in OE to match the changes in bitbake.
Its mostly periperhal changes around devtool/recipetool

[Will need a bitbake version requirement bump which I'll make when merging]

(From OE-Core rev: 041212fa37bb83acac5ce4ceb9b7b77ad172c5c3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2016-08-16 18:00:13 +01:00
parent 8b35b032ed
commit 189371f839
8 changed files with 19 additions and 20 deletions

View File

@ -27,16 +27,16 @@ list_vars = ['SRC_URI', 'LIC_FILES_CHKSUM']
meta_vars = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION'] meta_vars = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION']
def pn_to_recipe(cooker, pn): def pn_to_recipe(cooker, pn, mc=''):
"""Convert a recipe name (PN) to the path to the recipe file""" """Convert a recipe name (PN) to the path to the recipe file"""
import bb.providers import bb.providers
if pn in cooker.recipecache.pkg_pn: if pn in cooker.recipecaches[mc].pkg_pn:
best = bb.providers.findBestProvider(pn, cooker.data, cooker.recipecache, cooker.recipecache.pkg_pn) best = bb.providers.findBestProvider(pn, cooker.data, cooker.recipecaches[mc], cooker.recipecaches[mc].pkg_pn)
return best[3] return best[3]
elif pn in cooker.recipecache.providers: elif pn in cooker.recipecaches[mc].providers:
filenames = cooker.recipecache.providers[pn] filenames = cooker.recipecaches[mc].providers[pn]
eligible, foundUnique = bb.providers.filterProviders(filenames, pn, cooker.expanded_data, cooker.recipecache) eligible, foundUnique = bb.providers.filterProviders(filenames, pn, cooker.expanded_data, cooker.recipecaches[mc])
filename = eligible[0] filename = eligible[0]
return filename return filename
else: else:
@ -50,13 +50,14 @@ def get_unavailable_reasons(cooker, pn):
return taskdata.get_reasons(pn) return taskdata.get_reasons(pn)
def parse_recipe(fn, appendfiles, d): def parse_recipe(cooker, fn, appendfiles):
""" """
Parse an individual recipe file, optionally with a list of Parse an individual recipe file, optionally with a list of
bbappend files. bbappend files.
""" """
import bb.cache import bb.cache
envdata = bb.cache.Cache.loadDataFull(fn, appendfiles, d) parser = bb.cache.NoCache(cooker.databuilder)
envdata = parser.loadDataFull(fn, appendfiles)
return envdata return envdata
@ -79,7 +80,7 @@ def parse_recipe_simple(cooker, pn, d, appends=True):
appendfiles = cooker.collection.get_file_appends(recipefile) appendfiles = cooker.collection.get_file_appends(recipefile)
else: else:
appendfiles = None appendfiles = None
return parse_recipe(recipefile, appendfiles, d) return parse_recipe(cooker, recipefile, appendfiles)
def get_var_files(fn, varlist, d): def get_var_files(fn, varlist, d):

View File

@ -223,7 +223,7 @@ def runqemu(pn, ssh=True):
tinfoil.config_data.setVar("TEST_QEMUBOOT_TIMEOUT", "1000") tinfoil.config_data.setVar("TEST_QEMUBOOT_TIMEOUT", "1000")
import oe.recipeutils import oe.recipeutils
recipefile = oe.recipeutils.pn_to_recipe(tinfoil.cooker, pn) recipefile = oe.recipeutils.pn_to_recipe(tinfoil.cooker, pn)
recipedata = oe.recipeutils.parse_recipe(recipefile, [], tinfoil.config_data) recipedata = oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, [])
# The QemuRunner log is saved out, but we need to ensure it is at the right # The QemuRunner log is saved out, but we need to ensure it is at the right
# log level (and then ensure that since it's a child of the BitBake logger, # log level (and then ensure that since it's a child of the BitBake logger,

View File

@ -146,8 +146,7 @@ def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True):
not path.startswith(config.workspace_path)] not path.startswith(config.workspace_path)]
else: else:
append_files = None append_files = None
return oe.recipeutils.parse_recipe(recipefile, append_files, return oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, append_files)
tinfoil.config_data)
def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False): def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False):
""" """

View File

@ -221,7 +221,7 @@ def add(args, config, basepath, workspace):
initial_rev = stdout.rstrip() initial_rev = stdout.rstrip()
tinfoil = setup_tinfoil(config_only=True, basepath=basepath) tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
rd = oe.recipeutils.parse_recipe(recipefile, None, tinfoil.config_data) rd = oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, None)
if not rd: if not rd:
return 1 return 1

View File

@ -318,7 +318,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
newvalues['SRC_URI[md5sum]'] = md5 newvalues['SRC_URI[md5sum]'] = md5
newvalues['SRC_URI[sha256sum]'] = sha256 newvalues['SRC_URI[sha256sum]'] = sha256
rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data) rd = oe.recipeutils.parse_recipe(tinfoil.cooker, fullpath, None)
oe.recipeutils.patch_recipe(rd, fullpath, newvalues) oe.recipeutils.patch_recipe(rd, fullpath, newvalues)
return fullpath, copied return fullpath, copied

View File

@ -115,8 +115,7 @@ def _parse_recipe(pn, tinfoil):
# Error already logged # Error already logged
return None return None
append_files = tinfoil.cooker.collection.get_file_appends(recipefile) append_files = tinfoil.cooker.collection.get_file_appends(recipefile)
rd = oe.recipeutils.parse_recipe(recipefile, append_files, rd = oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, append_files)
tinfoil.config_data)
return rd return rd
def determine_file_source(targetpath, rd): def determine_file_source(targetpath, rd):

View File

@ -51,7 +51,7 @@ def setvar(args):
if args.recipe_only: if args.recipe_only:
patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)] patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)]
else: else:
rd = oe.recipeutils.parse_recipe(args.recipefile, None, tinfoil.config_data) rd = oe.recipeutils.parse_recipe(tinfoil.cooker, args.recipefile, None)
if not rd: if not rd:
return 1 return 1
patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch) patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch)

View File

@ -40,13 +40,13 @@ def translate_virtualfns(tasks):
try: try:
tinfoil.prepare(False) tinfoil.prepare(False)
pkg_fn = tinfoil.cooker.recipecache.pkg_fn recipecaches = tinfoil.cooker.recipecaches
outtasks = [] outtasks = []
for task in tasks: for task in tasks:
fn, taskname = task.rsplit(':', 1) (mc, fn, taskname) = bb.runqueue.split_tid(task)
if taskname.endswith('_setscene'): if taskname.endswith('_setscene'):
taskname = taskname[:-9] taskname = taskname[:-9]
outtasks.append('%s:%s' % (pkg_fn[fn], taskname)) outtasks.append('%s:%s' % (recipecaches[mc].pkg_fn[fn], taskname))
finally: finally:
tinfoil.shutdown() tinfoil.shutdown()
return outtasks return outtasks