diff options
author | Katja Marttila <katja.marttila@qt.io> | 2022-09-08 13:57:42 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2022-09-08 16:37:22 +0300 |
commit | d0e03a6ea7c545e15b24de0915e0b153be24ed51 (patch) | |
tree | b86bfdc209702c339402454ea60ed947a9a61cb4 | |
parent | b15f069996610481a6ae8aaca9b174504ac68135 (diff) |
Attach to squish only when the port is separately given
Attaching to squish will trigger firewall questions in the installer.
Changing the attach behavior so that by default no attach is done, and user
can run the installer with --squish-port <number> if the attach is needed.
Task-number: QTIFW-2746
Change-Id: I89f06a52b1ef95493e99084cb6080266b4eaf1dc
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
-rw-r--r-- | src/libs/installer/commandlineparser.cpp | 4 | ||||
-rw-r--r-- | src/sdk/installerbase.cpp | 20 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp index a04891303..b40556f6c 100644 --- a/src/libs/installer/commandlineparser.cpp +++ b/src/libs/installer/commandlineparser.cpp @@ -220,8 +220,8 @@ CommandLineParser::CommandLineParser() QLatin1String("socketname, key"))); addOption(QCommandLineOption(QStringList() << CommandLineOptions::scSquishPortShort << CommandLineOptions::scSquishPortLong, - QLatin1String("Give a port where Squish can connect to. If no port is given, default port 11233 is " - "used. Note: To enable Squish support you first need to build IFW with SQUISH_PATH " + QLatin1String("Give a port where Squish can connect to. If no port is given, attach to squish " + "not done. Note: To enable Squish support you first need to build IFW with SQUISH_PATH " "parameter where SQUISH_PATH is pointing to your Squish installation folder: " "<path_to_qt>/bin/qmake -r SQUISH_PATH=<pat_to_squish>"), QLatin1String("port number"))); diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 32df0b550..dcbf15228 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -98,17 +98,15 @@ int InstallerBase::run() return status; #ifdef ENABLE_SQUISH - int squishPort = 11233; if (m_parser.isSet(CommandLineOptions::scSquishPortLong)) { - squishPort = m_parser.value(CommandLineOptions::scSquishPortLong).toInt(); - } - if (squishPort != 0) { - if (Squish::allowAttaching(squishPort)) - qCDebug(QInstaller::lcDeveloperBuild) << "Attaching to squish port " << squishPort << " succeeded"; - else - qCDebug(QInstaller::lcDeveloperBuild) << "Attaching to squish failed."; - } else { - qCWarning(QInstaller::lcDeveloperBuild) << "Invalid squish port number: " << squishPort; + const int maxSquishPortNumber = 65535; + int squishPort = m_parser.value(CommandLineOptions::scSquishPortLong).toInt(); + if (squishPort <= 0 || squishPort > maxSquishPortNumber) { + qWarning().noquote() << "Invalid Squish port:" << squishPort; + } else { + Squish::allowAttaching(squishPort); + qCDebug(QInstaller::lcDeveloperBuild) << "Attaching to squish port" << squishPort << "succeeded"; + } } #endif const int result = QCoreApplication::instance()->exec(); |