From 589661c0d5dc2430fb98f71f58d3a2ec83c73be5 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 21 Aug 2024 14:54:37 +0200 Subject: [PATCH] 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 (cherry picked from commit fd2c408af2f300e100d94a386743c7cbe74fadef) Reviewed-by: Qt Cherry-pick Bot --- src/tools/androiddeployqt/main.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 9ff9ab277f0..e762d43d76c 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -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