androiddeployqt: Fix the --sign argument handling ordering

Allow using the follow arguments after '--sign' argument in
androiddeployqt. The previous fix had no effect since we should
consider the argument count first and the type of arguments next.

Amends 9c56a77027db2fedfc2b50f96ceaee5003a7d383

Fixes: QTBUG-128254
Task-number: QTBUG-109619
Pick-to: 6.7 6.5
Change-Id: I34eac4def94c1d0c8d304f383d60c1e21b7dc6a2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fd2c408af2f300e100d94a386743c7cbe74fadef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2024-08-21 14:54:37 +02:00 committed by Qt Cherry-pick Bot
parent 7f09ec878b
commit 589661c0d5

View File

@ -452,7 +452,11 @@ Options parseOptions()
else
options.buildDirectory = arguments.at(++i);
} else if (argument.compare("--sign"_L1, Qt::CaseInsensitive) == 0) {
if (i + 2 >= arguments.size()) {
if (i + 2 < arguments.size() && !arguments.at(i + 1).startsWith("--"_L1) &&
!arguments.at(i + 2).startsWith("--"_L1)) {
options.keyStore = arguments.at(++i);
options.keyStoreAlias = arguments.at(++i);
} else {
const QString keyStore = qEnvironmentVariable("QT_ANDROID_KEYSTORE_PATH");
const QString storeAlias = qEnvironmentVariable("QT_ANDROID_KEYSTORE_ALIAS");
if (keyStore.isEmpty() || storeAlias.isEmpty()) {
@ -465,14 +469,6 @@ Options parseOptions()
options.keyStore = keyStore;
options.keyStoreAlias = storeAlias;
}
} else if (!arguments.at(i + 1).startsWith("--"_L1) &&
!arguments.at(i + 2).startsWith("--"_L1)) {
options.keyStore = arguments.at(++i);
options.keyStoreAlias = arguments.at(++i);
} else {
options.helpRequested = true;
fprintf(stderr, "Package signing path and alias values are not "
"specified.\n");
}
// Do not override if the passwords are provided through arguments