don't assume that configure --foo options' value is 'yes'
otherwise, the invalid "--qpa xcb" would complain about "xcb" being unknown, rather than "--qpa" missing an argument. actual booleans are handled by the type-specific callback, just like -foo would be. Task-number: QTBUG-59062 Change-Id: I96632dacfb721cfcbf223b76f6c5c38c810e8d0e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
0af9999c8b
commit
b9c5c7139e
@ -125,7 +125,8 @@ defineTest(qtConfValidateValue) {
|
|||||||
defineTest(qtConfCommandline_string) {
|
defineTest(qtConfCommandline_string) {
|
||||||
opt = $${1}
|
opt = $${1}
|
||||||
val = $${2}
|
val = $${2}
|
||||||
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
|
nextok = $${3}
|
||||||
|
isEmpty(val):$$nextok: val = $$qtConfGetNextCommandlineArg()
|
||||||
|
|
||||||
# Note: Arguments which are variable assignments are legit here.
|
# Note: Arguments which are variable assignments are legit here.
|
||||||
contains(val, "^-.*")|isEmpty(val) {
|
contains(val, "^-.*")|isEmpty(val) {
|
||||||
@ -142,9 +143,10 @@ defineTest(qtConfCommandline_string) {
|
|||||||
defineTest(qtConfCommandline_optionalString) {
|
defineTest(qtConfCommandline_optionalString) {
|
||||||
opt = $${1}
|
opt = $${1}
|
||||||
val = $${2}
|
val = $${2}
|
||||||
|
nextok = $${3}
|
||||||
isEmpty(val) {
|
isEmpty(val) {
|
||||||
v = $$qtConfPeekNextCommandlineArg()
|
$$nextok: val = $$qtConfPeekNextCommandlineArg()
|
||||||
contains(v, "^-.*|[A-Z_]+=.*")|isEmpty(v): \
|
contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val): \
|
||||||
val = "yes"
|
val = "yes"
|
||||||
else: \
|
else: \
|
||||||
val = $$qtConfGetNextCommandlineArg()
|
val = $$qtConfGetNextCommandlineArg()
|
||||||
@ -160,7 +162,8 @@ defineTest(qtConfCommandline_optionalString) {
|
|||||||
defineTest(qtConfCommandline_addString) {
|
defineTest(qtConfCommandline_addString) {
|
||||||
opt = $${1}
|
opt = $${1}
|
||||||
val = $${2}
|
val = $${2}
|
||||||
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
|
nextok = $${3}
|
||||||
|
isEmpty(val):$$nextok: val = $$qtConfGetNextCommandlineArg()
|
||||||
|
|
||||||
# Note: Arguments which are variable assignments are legit here.
|
# Note: Arguments which are variable assignments are legit here.
|
||||||
contains(val, "^-.*")|isEmpty(val) {
|
contains(val, "^-.*")|isEmpty(val) {
|
||||||
@ -236,6 +239,7 @@ defineTest(qtConfParseCommandLine) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# parse out opt and val
|
# parse out opt and val
|
||||||
|
nextok = false
|
||||||
contains(c, "^--?enable-(.*)") {
|
contains(c, "^--?enable-(.*)") {
|
||||||
opt = $$replace(c, "^--?enable-(.*)", "\\1")
|
opt = $$replace(c, "^--?enable-(.*)", "\\1")
|
||||||
val = yes
|
val = yes
|
||||||
@ -247,10 +251,11 @@ defineTest(qtConfParseCommandLine) {
|
|||||||
val = $$replace(c, "^--([^=]+)=(.*)", "\\2")
|
val = $$replace(c, "^--([^=]+)=(.*)", "\\2")
|
||||||
} else: contains(c, "^--(.*)") {
|
} else: contains(c, "^--(.*)") {
|
||||||
opt = $$replace(c, "^--(.*)", "\\1")
|
opt = $$replace(c, "^--(.*)", "\\1")
|
||||||
val = yes
|
val =
|
||||||
} else: contains(c, "^-(.*)") {
|
} else: contains(c, "^-(.*)") {
|
||||||
opt = $$replace(c, "^-(.*)", "\\1")
|
opt = $$replace(c, "^-(.*)", "\\1")
|
||||||
val =
|
val =
|
||||||
|
nextok = true
|
||||||
for (cc, allConfigs) {
|
for (cc, allConfigs) {
|
||||||
type = $$eval($${cc}.commandline.options.$${opt})
|
type = $$eval($${cc}.commandline.options.$${opt})
|
||||||
!isEmpty(type): break()
|
!isEmpty(type): break()
|
||||||
@ -277,6 +282,7 @@ defineTest(qtConfParseCommandLine) {
|
|||||||
contains(c, $$e) {
|
contains(c, $$e) {
|
||||||
opt = $$eval($${cc}.commandline.prefix.$${p})
|
opt = $$eval($${cc}.commandline.prefix.$${p})
|
||||||
val = $$replace(c, $$e, "\\1")
|
val = $$replace(c, $$e, "\\1")
|
||||||
|
nextok = true
|
||||||
type = "addString"
|
type = "addString"
|
||||||
break()
|
break()
|
||||||
}
|
}
|
||||||
@ -315,7 +321,7 @@ defineTest(qtConfParseCommandLine) {
|
|||||||
error("Command line option '$$c' has unknown type '$$type'.")
|
error("Command line option '$$c' has unknown type '$$type'.")
|
||||||
|
|
||||||
# now that we have opt and value, process it
|
# now that we have opt and value, process it
|
||||||
$${call}($$opt, $$val)
|
$${call}($$opt, $$val, $$nextok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user