Fix wildcard ('%') handling in the filter pattern.
Fixes: 200094780 Test: internal Change-Id: I5f6a46679cdfa965ad98b9c0c22ef396a13a0bf6
This commit is contained in:
@@ -1162,17 +1162,21 @@ func (ctx *parseContext) parseCompareFilterFuncResult(cond *mkparser.Directive,
|
|||||||
}
|
}
|
||||||
// Either pattern or text should be const, and the
|
// Either pattern or text should be const, and the
|
||||||
// non-const one should be varRefExpr
|
// non-const one should be varRefExpr
|
||||||
if xInList, ok = xPattern.(*stringLiteralExpr); ok {
|
if xInList, ok = xPattern.(*stringLiteralExpr); ok && !strings.ContainsRune(xInList.literal, '%') && xText.typ() == starlarkTypeList {
|
||||||
expr = xText
|
expr = xText
|
||||||
} else if xInList, ok = xText.(*stringLiteralExpr); ok {
|
} else if xInList, ok = xText.(*stringLiteralExpr); ok {
|
||||||
expr = xPattern
|
expr = xPattern
|
||||||
} else {
|
} else {
|
||||||
return &callExpr{
|
expr = &callExpr{
|
||||||
object: nil,
|
object: nil,
|
||||||
name: filterFuncCall.name,
|
name: filterFuncCall.name,
|
||||||
args: filterFuncCall.args,
|
args: filterFuncCall.args,
|
||||||
returnType: starlarkTypeBool,
|
returnType: starlarkTypeBool,
|
||||||
}
|
}
|
||||||
|
if negate {
|
||||||
|
expr = ¬Expr{expr: expr}
|
||||||
|
}
|
||||||
|
return expr
|
||||||
}
|
}
|
||||||
case *variableRefExpr:
|
case *variableRefExpr:
|
||||||
if v, ok := xPattern.(*variableRefExpr); ok {
|
if v, ok := xPattern.(*variableRefExpr); ok {
|
||||||
|
@@ -360,20 +360,27 @@ ifeq ($(TARGET_BUILD_VARIANT), $(filter $(TARGET_BUILD_VARIANT), userdebug eng))
|
|||||||
endif
|
endif
|
||||||
ifneq (,$(filter true, $(v1)$(v2)))
|
ifneq (,$(filter true, $(v1)$(v2)))
|
||||||
endif
|
endif
|
||||||
|
ifeq (,$(filter barbet coral%,$(TARGET_PRODUCT)))
|
||||||
|
else ifneq (,$(filter barbet%,$(TARGET_PRODUCT)))
|
||||||
|
endif
|
||||||
`,
|
`,
|
||||||
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
|
||||||
def init(g, handle):
|
def init(g, handle):
|
||||||
cfg = rblf.cfg(handle)
|
cfg = rblf.cfg(handle)
|
||||||
if g["TARGET_BUILD_VARIANT"] not in ["userdebug", "eng"]:
|
if not rblf.filter("userdebug eng", g["TARGET_BUILD_VARIANT"]):
|
||||||
pass
|
pass
|
||||||
if g["TARGET_BUILD_VARIANT"] == "userdebug":
|
if rblf.filter("userdebug", g["TARGET_BUILD_VARIANT"]):
|
||||||
pass
|
pass
|
||||||
if "plaf" in g.get("PLATFORM_LIST", []):
|
if "plaf" in g.get("PLATFORM_LIST", []):
|
||||||
pass
|
pass
|
||||||
if g["TARGET_BUILD_VARIANT"] in ["userdebug", "eng"]:
|
if g["TARGET_BUILD_VARIANT"] in ["userdebug", "eng"]:
|
||||||
pass
|
pass
|
||||||
if "%s%s" % (_v1, _v2) == "true":
|
if rblf.filter("true", "%s%s" % (_v1, _v2)):
|
||||||
|
pass
|
||||||
|
if not rblf.filter("barbet coral%", g["TARGET_PRODUCT"]):
|
||||||
|
pass
|
||||||
|
elif rblf.filter("barbet%", g["TARGET_PRODUCT"]):
|
||||||
pass
|
pass
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user