mirror of
https://git.yoctoproject.org/poky
synced 2026-03-19 05:39:39 +01:00
oe/utils.py: Add vartrue()
It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"
(From OE-Core rev: fc5a5af7bc3619f575988a75efc0c4fe15478b2d)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
cb4134f798
commit
285b9a0d8e
@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
|
||||
# Disabled until the option works properly -feliminate-dwarf2-dups
|
||||
FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
|
||||
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
|
||||
SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"
|
||||
SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
|
||||
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
|
||||
BUILD_OPTIMIZATION = "-O2 -pipe"
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ def conditional(variable, checkvalue, truevalue, falsevalue, d):
|
||||
else:
|
||||
return falsevalue
|
||||
|
||||
def vartrue(var, iftrue, iffalse, d):
|
||||
import oe.types
|
||||
if oe.types.boolean(d.getVar(var)):
|
||||
return iftrue
|
||||
else:
|
||||
return iffalse
|
||||
|
||||
def less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
|
||||
if float(d.getVar(variable)) <= float(checkvalue):
|
||||
return truevalue
|
||||
@@ -467,3 +474,4 @@ class ImageQAFailed(bb.build.FuncFailed):
|
||||
msg = msg + ' (%s)' % self.description
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user