Commit aa2ab949 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Use rpm for listing packages on Meego devices.

parent 0d9da49d
......@@ -81,7 +81,10 @@ void MaemoConfigTestDialog::startConfigTest()
return;
m_currentTest = GeneralTest;
m_ui->testResultEdit->setPlainText(tr("Testing configuration..."));
const QString testingText = m_config->type() == MaemoDeviceConfig::Simulator
? tr("Testing configuration. This may take a while.")
: tr("Testing configuration...");
m_ui->testResultEdit->setPlainText(testingText);
m_closeButton->setText(tr("Stop Test"));
m_testProcessRunner = SshRemoteProcessRunner::create(m_config->sshParameters());
connect(m_testProcessRunner.data(), SIGNAL(connectionError(Core::SshError)),
......@@ -91,9 +94,12 @@ void MaemoConfigTestDialog::startConfigTest()
connect(m_testProcessRunner.data(),
SIGNAL(processOutputAvailable(QByteArray)), this,
SLOT(processSshOutput(QByteArray)));
QLatin1String sysInfoCmd("uname -rsm");
QLatin1String qtInfoCmd("dpkg-query -W -f '${Package} ${Version} ${Status}\n' 'libqt*' "
"|grep ' installed$'");
const QLatin1String sysInfoCmd("uname -rsm");
const bool osUsesRpm = MaemoGlobal::packagingSystem(m_config->osVersion()) == MaemoGlobal::Rpm;
const QLatin1String qtInfoCmd(osUsesRpm
? "rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'"
: "dpkg-query -W -f '${Package} ${Version} ${Status}\n' 'libqt*' "
"|grep ' installed$'");
QString command(sysInfoCmd + " && " + qtInfoCmd);
m_testProcessRunner->run(command.toUtf8());
}
......@@ -229,8 +235,11 @@ QString MaemoConfigTestDialog::parseTestOutput()
output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2));
output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1)));
const QRegExp dkpgPattern(QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+"));
index = dkpgPattern.indexIn(m_deviceTestOutput);
const bool osUsesRpm = MaemoGlobal::packagingSystem(m_config->osVersion()) == MaemoGlobal::Rpm;
const QRegExp packagePattern(QLatin1String(osUsesRpm
? "(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))"
: "(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+"));
index = packagePattern.indexIn(m_deviceTestOutput);
if (index == -1) {
output.append(tr("No Qt packages installed."));
return output;
......@@ -238,12 +247,12 @@ QString MaemoConfigTestDialog::parseTestOutput()
output.append(tr("List of installed Qt packages:") + QLatin1Char('\n'));
do {
output.append(QLatin1Char('\t') + dkpgPattern.cap(1) + QLatin1Char(' ')
+ dkpgPattern.cap(2) + QLatin1Char('\n'));
index = dkpgPattern.indexIn(m_deviceTestOutput, index
+ dkpgPattern.cap(0).length());
if (!m_qtVersionOk && QT_VERSION_CHECK(dkpgPattern.cap(3).toInt(),
dkpgPattern.cap(4).toInt(), dkpgPattern.cap(5).toInt()) >= 0x040602) {
output.append(QLatin1Char('\t') + packagePattern.cap(1) + QLatin1Char(' ')
+ packagePattern.cap(2) + QLatin1Char('\n'));
index = packagePattern.indexIn(m_deviceTestOutput, index
+ packagePattern.cap(0).length());
if (!m_qtVersionOk && QT_VERSION_CHECK(packagePattern.cap(3).toInt(),
packagePattern.cap(4).toInt(), packagePattern.cap(5).toInt()) >= 0x040602) {
m_qtVersionOk = true;
}
} while (index != -1);
......
......@@ -456,20 +456,36 @@ class MaemoDeviceConfigWizardFinalPage : public QWizardPage
{
Q_OBJECT
public:
MaemoDeviceConfigWizardFinalPage(QWidget *parent) : QWizardPage(parent)
MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData,
QWidget *parent)
: QWizardPage(parent),
m_infoLabel(new QLabel(this)),
m_wizardData(wizardData)
{
setTitle(tr("Setup Finished"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
const QString infoText = tr("Setup is complete.\n"
"The new device configuration will now be created and a test "
"procedure will be run to check whether Qt Creator can "
"connect to the device and to provide some information "
"about its features.");
QLabel * const infoLabel = new QLabel(infoText, this);
infoLabel->setWordWrap(true);
m_infoLabel->setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this);
layout->addWidget(infoLabel);
layout->addWidget(m_infoLabel);
}
virtual void initializePage()
{
QString infoText = tr("The new device configuration will now be "
"created and a test procedure will be run to check whether "
"Qt Creator can connect to the device and to provide some "
"information about its features.");
if (m_wizardData.deviceType == MaemoDeviceConfig::Simulator) {
infoText += QLatin1Char('\n')
+ tr("Please make sure that Qemu is running, otherwise "
"the test will fail.");
}
m_infoLabel->setText(infoText);
}
private:
QLabel * const m_infoLabel;
const WizardData &m_wizardData;
};
} // anonymous namespace
......@@ -484,7 +500,7 @@ struct MaemoDeviceConfigWizardPrivate
reuseKeysCheckPage(parent),
keyCreationPage(parent),
keyDeploymentPage(wizardData, parent),
finalPage(parent)
finalPage(wizardData, parent)
{
}
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>680</width>
<width>618</width>
<height>122</height>
</rect>
</property>
......@@ -68,7 +68,7 @@
<item>
<widget class="QRadioButton" name="qemuButton">
<property name="text">
<string>Emulator (Qemu, should be currently running)</string>
<string>Emulator (Qemu)</string>
</property>
</widget>
</item>
......
......@@ -300,6 +300,10 @@ QString MaemoGlobal::maemoVersionToString(MaemoVersion version)
return QString();
}
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoVersion maemoVersion)
{
return maemoVersion == Meego ? Rpm : Dpkg;
}
MaemoGlobal::FileUpdate::FileUpdate(const QString &fileName)
: m_fileName(fileName)
......
......@@ -62,6 +62,7 @@ class MaemoGlobal
Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal)
public:
enum MaemoVersion { Maemo5, Maemo6, Meego };
enum PackagingSystem { Dpkg, Rpm };
class FileUpdate {
public:
......@@ -99,6 +100,8 @@ public:
static QString maemoVersionToString(MaemoVersion version);
static PackagingSystem packagingSystem(MaemoVersion maemoVersion);
static bool removeRecursively(const QString &filePath, QString &error);
template<class T> static T *buildStep(const ProjectExplorer::DeployConfiguration *dc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment