forked from qt-creator/qt-creator
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 <marcus.tillmanns@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -23,8 +23,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Qnx::Internal {
|
namespace Qnx::Internal {
|
||||||
|
|
||||||
const char QnxVersionKey[] = "QnxVersion";
|
|
||||||
|
|
||||||
static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig)
|
static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig)
|
||||||
{
|
{
|
||||||
QString executable = filePath;
|
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
|
PortsGatheringMethod QnxDevice::portsGatheringMethod() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
@@ -20,20 +20,11 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::DeviceTester *createDeviceTester() const override;
|
ProjectExplorer::DeviceTester *createDeviceTester() const override;
|
||||||
|
|
||||||
int qnxVersion() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QnxDevice();
|
QnxDevice();
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) final;
|
|
||||||
QVariantMap toMap() const final;
|
|
||||||
|
|
||||||
QString interruptProcessByNameCommandLine(const QString &filePath) const;
|
QString interruptProcessByNameCommandLine(const QString &filePath) const;
|
||||||
QString killProcessByNameCommandLine(const QString &filePath) const;
|
QString killProcessByNameCommandLine(const QString &filePath) const;
|
||||||
|
|
||||||
void updateVersionNumber() const;
|
|
||||||
|
|
||||||
mutable int m_versionNumber = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QnxDeviceFactory final : public ProjectExplorer::IDeviceFactory
|
class QnxDeviceFactory final : public ProjectExplorer::IDeviceFactory
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include "qnxdevicetester.h"
|
#include "qnxdevicetester.h"
|
||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
#include "qnxdevice.h"
|
|
||||||
#include "qnxtr.h"
|
#include "qnxtr.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -20,7 +19,7 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent)
|
|||||||
|
|
||||||
void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device)
|
void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device)
|
||||||
{
|
{
|
||||||
QStringList commandsToTest = {
|
static const QStringList commandsToTest {
|
||||||
"awk",
|
"awk",
|
||||||
"cat",
|
"cat",
|
||||||
"cut",
|
"cut",
|
||||||
@@ -37,15 +36,10 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::Ptr &device)
|
|||||||
"sed",
|
"sed",
|
||||||
"sleep",
|
"sleep",
|
||||||
"tail",
|
"tail",
|
||||||
"uname"
|
"uname",
|
||||||
|
"slog2info"
|
||||||
};
|
};
|
||||||
|
|
||||||
QnxDevice::ConstPtr qnxDevice = device.dynamicCast<const QnxDevice>();
|
|
||||||
QTC_ASSERT(qnxDevice, return);
|
|
||||||
|
|
||||||
if (qnxDevice->qnxVersion() > 0x060500)
|
|
||||||
commandsToTest.append("slog2info");
|
|
||||||
|
|
||||||
setExtraCommandsToTest(commandsToTest);
|
setExtraCommandsToTest(commandsToTest);
|
||||||
|
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "slog2inforunner.h"
|
#include "slog2inforunner.h"
|
||||||
|
|
||||||
#include "qnxdevice.h"
|
|
||||||
#include "qnxtr.h"
|
#include "qnxtr.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -41,11 +41,8 @@ void Slog2InfoRunner::start()
|
|||||||
m_found = true;
|
m_found = true;
|
||||||
};
|
};
|
||||||
const auto testErrorHandler = [this](const QtcProcess &) {
|
const auto testErrorHandler = [this](const QtcProcess &) {
|
||||||
QnxDevice::ConstPtr qnxDevice = device().dynamicCast<const QnxDevice>();
|
|
||||||
if (qnxDevice && qnxDevice->qnxVersion() > 0x060500) {
|
|
||||||
appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, "
|
appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, "
|
||||||
"debug output not available."), ErrorMessageFormat);
|
"debug output not available."), ErrorMessageFormat);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto launchTimeStartHandler = [this](QtcProcess &process) {
|
const auto launchTimeStartHandler = [this](QtcProcess &process) {
|
||||||
|
Reference in New Issue
Block a user