mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
Calling oe-debuginfod in a build failed: ... $ oe-debuginfod |Getting sysroot... |Error: NOTE: Reconnecting to bitbake server... |NOTE: Retrying server connection (#1)... (18:55:53.009687) |path-to-build/tmp/work/x86_64-linux/elfutils-native/0.192/recipe-sysroot-native doesn't exist. |Have you run 'bitbake elfutils-native -caddto_recipe_sysroot'? ... The script oe-debuginfod calls bitbake-getvar to get sysroot, the output of bitbake-getvar was mixed with info output of bitbake ... NOTE: Reconnecting to bitbake server... NOTE: Retrying server connection (#1)... (18:55:53.009687) ... Set logger level to logging.WARNING to skip info output for quiet (Bitbake rev: 873c524e1a33846df8f34b7c87b298349277b3d5) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
72 lines
2.7 KiB
Python
Executable File
72 lines
2.7 KiB
Python
Executable File
#! /usr/bin/env python3
|
|
#
|
|
# Copyright (C) 2021 Richard Purdie
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
|
|
import argparse
|
|
import io
|
|
import os
|
|
import sys
|
|
import warnings
|
|
import logging
|
|
warnings.simplefilter("default")
|
|
|
|
bindir = os.path.dirname(__file__)
|
|
topdir = os.path.dirname(bindir)
|
|
sys.path[0:0] = [os.path.join(topdir, 'lib')]
|
|
|
|
import bb.providers
|
|
import bb.tinfoil
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description="Bitbake Query Variable")
|
|
parser.add_argument("variable", help="variable name to query")
|
|
parser.add_argument("-r", "--recipe", help="Recipe name to query", default=None, required=False)
|
|
parser.add_argument('-u', '--unexpand', help='Do not expand the value (with --value)', action="store_true")
|
|
parser.add_argument('-f', '--flag', help='Specify a variable flag to query (with --value)', default=None)
|
|
parser.add_argument('--value', help='Only report the value, no history and no variable name', action="store_true")
|
|
parser.add_argument('-q', '--quiet', help='Silence bitbake server logging', action="store_true")
|
|
parser.add_argument('--ignore-undefined', help='Suppress any errors related to undefined variables', action="store_true")
|
|
args = parser.parse_args()
|
|
|
|
if not args.value:
|
|
if args.unexpand:
|
|
sys.exit("--unexpand only makes sense with --value")
|
|
|
|
if args.flag:
|
|
sys.exit("--flag only makes sense with --value")
|
|
|
|
quiet = args.quiet or args.value
|
|
if quiet:
|
|
logger = logging.getLogger("BitBake")
|
|
logger.setLevel(logging.WARNING)
|
|
|
|
with bb.tinfoil.Tinfoil(tracking=True, setup_logging=not quiet) as tinfoil:
|
|
if args.recipe:
|
|
tinfoil.prepare(quiet=3 if quiet else 2)
|
|
try:
|
|
d = tinfoil.parse_recipe(args.recipe)
|
|
except bb.providers.NoProvider as e:
|
|
sys.exit(str(e))
|
|
else:
|
|
tinfoil.prepare(quiet=2, config_only=True)
|
|
# Expand keys and run anonymous functions to get identical result to
|
|
# "bitbake -e"
|
|
d = tinfoil.finalizeData()
|
|
|
|
value = None
|
|
if args.flag:
|
|
value = d.getVarFlag(args.variable, args.flag, expand=not args.unexpand)
|
|
if value is None and not args.ignore_undefined:
|
|
sys.exit(f"The flag '{args.flag}' is not defined for variable '{args.variable}'")
|
|
else:
|
|
value = d.getVar(args.variable, expand=not args.unexpand)
|
|
if value is None and not args.ignore_undefined:
|
|
sys.exit(f"The variable '{args.variable}' is not defined")
|
|
if args.value:
|
|
print(str(value if value is not None else ""))
|
|
else:
|
|
bb.data.emit_var(args.variable, d=d, all=True)
|