From 821dce1e9d3d76d6ccb4920230be7e603482c97d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Mar 2023 17:19:01 +0100 Subject: [PATCH] Qnx: Drop support for QNX 6.5 Or, rather, assume that slog2info is available and handle a missting slog2info more or less gracefully. Change-Id: I739482ff0a3d88ee7ff735adf42809cc2ee3e510 Reviewed-by: Marcus Tillmanns Reviewed-by: --- src/plugins/qnx/qnxdevice.cpp | 42 ----------------------------- src/plugins/qnx/qnxdevice.h | 9 ------- src/plugins/qnx/qnxdevicetester.cpp | 12 +++------ src/plugins/qnx/slog2inforunner.cpp | 9 +++---- 4 files changed, 6 insertions(+), 66 deletions(-) diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index 7f1d73ae0d1..dac5c9698b3 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -23,8 +23,6 @@ using namespace Utils; namespace Qnx::Internal { -const char QnxVersionKey[] = "QnxVersion"; - static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig) { QString executable = filePath; @@ -65,46 +63,6 @@ QnxDevice::QnxDevice() }}); } -int QnxDevice::qnxVersion() const -{ - if (m_versionNumber == 0) - updateVersionNumber(); - - return m_versionNumber; -} - -void QnxDevice::updateVersionNumber() const -{ - QtcProcess versionNumberProcess; - - versionNumberProcess.setCommand({filePath("uname"), {"-r"}}); - versionNumberProcess.runBlocking(EventLoopMode::On); - - QByteArray output = versionNumberProcess.readAllRawStandardOutput(); - QString versionMessage = QString::fromLatin1(output); - const QRegularExpression versionNumberRegExp("(\\d+)\\.(\\d+)\\.(\\d+)"); - const QRegularExpressionMatch match = versionNumberRegExp.match(versionMessage); - if (match.hasMatch()) { - int major = match.captured(1).toInt(); - int minor = match.captured(2).toInt(); - int patch = match.captured(3).toInt(); - m_versionNumber = (major << 16)|(minor<<8)|(patch); - } -} - -void QnxDevice::fromMap(const QVariantMap &map) -{ - m_versionNumber = map.value(QLatin1String(QnxVersionKey), 0).toInt(); - LinuxDevice::fromMap(map); -} - -QVariantMap QnxDevice::toMap() const -{ - QVariantMap map(LinuxDevice::toMap()); - map.insert(QLatin1String(QnxVersionKey), m_versionNumber); - return map; -} - PortsGatheringMethod QnxDevice::portsGatheringMethod() const { return { diff --git a/src/plugins/qnx/qnxdevice.h b/src/plugins/qnx/qnxdevice.h index 34940580e1a..e2e6403432e 100644 --- a/src/plugins/qnx/qnxdevice.h +++ b/src/plugins/qnx/qnxdevice.h @@ -20,20 +20,11 @@ public: ProjectExplorer::DeviceTester *createDeviceTester() const override; - int qnxVersion() const; - private: QnxDevice(); - void fromMap(const QVariantMap &map) final; - QVariantMap toMap() const final; - QString interruptProcessByNameCommandLine(const QString &filePath) const; QString killProcessByNameCommandLine(const QString &filePath) const; - - void updateVersionNumber() const; - - mutable int m_versionNumber = 0; }; class QnxDeviceFactory final : public ProjectExplorer::IDeviceFactory diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp index daecd468f99..1fd755138de 100644 --- a/src/plugins/qnx/qnxdevicetester.cpp +++ b/src/plugins/qnx/qnxdevicetester.cpp @@ -4,7 +4,6 @@ #include "qnxdevicetester.h" #include "qnxconstants.h" -#include "qnxdevice.h" #include "qnxtr.h" #include @@ -20,7 +19,7 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent) void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device) { - QStringList commandsToTest = { + static const QStringList commandsToTest { "awk", "cat", "cut", @@ -37,15 +36,10 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device) "sed", "sleep", "tail", - "uname" + "uname", + "slog2info" }; - QnxDevice::ConstPtr qnxDevice = device.dynamicCast(); - QTC_ASSERT(qnxDevice, return); - - if (qnxDevice->qnxVersion() > 0x060500) - commandsToTest.append("slog2info"); - setExtraCommandsToTest(commandsToTest); using namespace Tasking; diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp index 58509782c5b..e350c75f6ec 100644 --- a/src/plugins/qnx/slog2inforunner.cpp +++ b/src/plugins/qnx/slog2inforunner.cpp @@ -3,9 +3,9 @@ #include "slog2inforunner.h" -#include "qnxdevice.h" #include "qnxtr.h" +#include #include #include @@ -41,11 +41,8 @@ void Slog2InfoRunner::start() m_found = true; }; const auto testErrorHandler = [this](const QtcProcess &) { - QnxDevice::ConstPtr qnxDevice = device().dynamicCast(); - if (qnxDevice && qnxDevice->qnxVersion() > 0x060500) { - appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, " - "debug output not available."), ErrorMessageFormat); - } + appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, " + "debug output not available."), ErrorMessageFormat); }; const auto launchTimeStartHandler = [this](QtcProcess &process) {