Sync with qtcreator-plugin-ubuntu

This commit is contained in:
Benjamin Zeller
2016-07-07 15:03:01 +02:00
parent c2177bc75e
commit 172cbde853
10 changed files with 99 additions and 16 deletions

View File

@@ -88,7 +88,14 @@ extra_packages = {
runtime_packages = [
"unity-scope-tool",
"ssh",
"gdbserver"
"gdbserver",
"pulseaudio",
"gstreamer1.0-pulseaudio",
"gstreamer1.0-plugins-good",
"gstreamer0.10-pulseaudio",
"gstreamer0.10-plugins-good",
"qml-module-ubuntu-connectivity",
"webapp-container"
]
metadata_template = """\
@@ -548,6 +555,14 @@ class ClickChroot:
for i in $(dpkg-architecture -a {target_arch} 2>/dev/null); \
do echo "export $i" >> /etc/profile.d/clickvars.sh ; \
done
echo "if [ ! -z \\"\\${{SSH_CONNECTION}}\\" ]; then" >> /etc/profile.d/clickvars.sh ;
echo " IP=(\\$SSH_CONNECTION)" >> /etc/profile.d/clickvars.sh ;
echo " export PULSE_SERVER=\\${{IP[0]}}" >> /etc/profile.d/clickvars.sh ;
echo "fi" >> /etc/profile.d/clickvars.sh ;
# enable pulsed streaming
if [ -e "/etc/pulse/default.pa" ]; then
sed "s/^#load-module module-native-protocol-tcp$/load-module module-native-protocol-tcp/g" -i /etc/pulse/default.pa
fi
# Clean up
rm /finish.sh
apt-get clean

View File

@@ -48,6 +48,9 @@ void TargetUpgradeManager::checkForUpgrades()
m_state = CollectPendingUpdates;
m_outdatedChroots.clear();
foreach(const UbuntuClickTool::Target &buildTarget, UbuntuClickTool::listAvailableTargets()) {
if (!buildTarget.upgradesEnabled)
continue;
QPointer<QProcess> proc(new QProcess(this));
connect(proc.data(),SIGNAL(finished(int)),this,SLOT(processFinished()));

View File

@@ -157,8 +157,6 @@ void UbuntuClickTool::parametersForCreateChroot(const Target &target, ProjectExp
QString command = QString::fromLatin1(Constants::UBUNTU_CREATE_CLICK_TARGET_ARGS)
.arg(env.value(QStringLiteral("USDK_TEST_REMOTE")))
.arg(Constants::UBUNTU_TARGET_TOOL)
.arg(target.architecture)
.arg(target.framework)
.arg(target.containerName)
.arg(target.imageName);
@@ -357,6 +355,7 @@ QList<UbuntuClickTool::Target> UbuntuClickTool::listAvailableTargets(const QStri
t.architecture = map.value(QStringLiteral("architecture")).toString();
t.framework = targetFw;
t.containerName = map.value(QStringLiteral("name")).toString();
t.upgradesEnabled = map.value(QStringLiteral("updatesEnabled"),false).toBool();
targets.append(t);
}
return targets;
@@ -405,6 +404,23 @@ const UbuntuClickTool::Target *UbuntuClickTool::clickTargetFromTarget(ProjectExp
#endif
}
bool UbuntuClickTool::setTargetUpgradesEnabled(const Target &target, const bool set)
{
QProcess sdkTool;
sdkTool.setProgram(Constants::UBUNTU_TARGET_TOOL);
sdkTool.setArguments(QStringList{
QStringLiteral("set"),
target.containerName,
set ? QStringLiteral("upgrades-enabled") : QStringLiteral("upgrades-disabled")
});
sdkTool.start(QIODevice::ReadOnly);
if (!sdkTool.waitForFinished(3000)
|| sdkTool.exitCode() != 0
|| sdkTool.exitStatus() != QProcess::NormalExit)
return false;
return true;
}
QString UbuntuClickTool::findOrCreateGccWrapper (const UbuntuClickTool::Target &target)
{
QString compiler;

View File

@@ -63,7 +63,10 @@ public:
QString framework;
QString architecture;
QString containerName;
QString imageName; //only set for container creation
bool upgradesEnabled = false;
//only set for container creation
QString imageName;
};
UbuntuClickTool();
@@ -90,6 +93,7 @@ public:
static QList<Target> listAvailableTargets (const QString &framework=QString());
static QList<Target> listPossibleDeviceContainers ();
static const Target *clickTargetFromTarget(ProjectExplorer::Target *t);
static bool setTargetUpgradesEnabled (const Target& target, const bool set = true);
static QString clickChrootSuffix ();
static QString m_strClickChrootSuffix;

View File

@@ -298,7 +298,7 @@ const char UBUNTU_CLICK_BINARY[] = "/usr/bin/click";
const char UBUNTU_SUDO_BINARY[] = "/usr/bin/pkexec";
const QString UBUNTU_TARGET_TOOL = QStandardPaths::findExecutable(QStringLiteral("usdk-target"));
const char UBUNTU_CREATE_CLICK_TARGET_ARGS[] = "env USDK_TEST_REMOTE=\"%0\" %1 create -a %2 -f %3 -n %4 -p %5";
const char UBUNTU_CREATE_CLICK_TARGET_ARGS[] = "env USDK_TEST_REMOTE=\"%0\" %1 create -n %2 -p %3";
const char UBUNTU_DESTROY_CLICK_TARGET_ARGS[] = "%0 destroy %1";
const char UBUNTU_UPGRADE_CLICK_TARGET_ARGS[] = "upgrade %0";
const char UBUNTU_CLICK_OPEN_TERMINAL[] = "%0 maint %1";

View File

@@ -21,7 +21,6 @@
#include "ubuntumenu.h"
#include "ubuntuclicktool.h"
#include "ubuntuvalidationresultmodel.h"
#include <ubuntu/device/remote/ubuntudevice.h>
#include "ubuntupackagestep.h"
#include "ubuntushared.h"
#include "ubuntucmakecache.h"
@@ -29,6 +28,9 @@
#include "ubuntufixmanifeststep.h"
#include "wizards/ubuntufatpackagingwizard.h"
#include "clicktoolchain.h"
#include "ubuntuproject.h"
#include <ubuntu/device/remote/ubuntudevice.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
@@ -522,7 +524,8 @@ void UbuntuPackagingModel::buildClickPackage()
if(!k)
return;
if(!ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k).toString().startsWith(QLatin1String(Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID))) {
UbuntuKitMatcher m;
if (!m.matches(k)) {
QMessageBox::warning(Core::ICore::mainWindow(),tr("Wrong kit type"),tr("It is not supported to create click packages for a non UbuntuSDK target"));
return;
}

View File

@@ -470,5 +470,21 @@ bool UbuntuPlugin::checkContainerSetup()
break;
}
}
QProcess proc;
proc.setProgram(QString::fromLatin1("%0/qtc_initialize_sound").arg(Constants::UBUNTU_SCRIPTPATH));
proc.start();
if (!proc.waitForFinished()) {
QMessageBox::warning(Core::ICore::mainWindow(),
qApp->applicationName(),
tr("Initializing the sound backend did time out.\nPlaying sound from containers may not work."));
}
if (proc.exitStatus() != QProcess::NormalExit || proc.exitCode() != 0) {
QMessageBox::warning(Core::ICore::mainWindow(),
qApp->applicationName(),
tr("Initializing the sound backend failed.\nPlaying sound from containers may not work."));
}
return true;
}

View File

@@ -27,6 +27,7 @@
#include <QDir>
#include <QRegExp>
#include <QTreeWidgetItem>
#include <QCheckBox>
#include <QDebug>
enum {
@@ -55,9 +56,11 @@ UbuntuSettingsClickWidget::UbuntuSettingsClickWidget(QWidget *parent) :
connect(m_maintainMapper, SIGNAL(mapped(int)),this, SLOT(on_maintainClickChroot(int)));
m_updateMapper = new QSignalMapper(this);
connect(m_updateMapper, SIGNAL(mapped(int)),this, SLOT(on_upgradeClickChroot(int)));
m_toggleUpgradeMapper = new QSignalMapper(this);
connect(m_toggleUpgradeMapper, SIGNAL(mapped(int)),this, SLOT(on_toggleTargetUpgradeEnabled(int)));
QStringList headers;
headers << tr("Series")<< tr("Framework") << tr("Architecture")<<QLatin1String("")<<QLatin1String("")<<QLatin1String("");
headers << tr("Series")<< tr("Framework") << tr("Architecture")<< tr("Autoupgrade") << QLatin1String("")<<QLatin1String("")<<QLatin1String("");
ui->treeWidgetClickTargets->setHeaderLabels(headers);
ui->treeWidgetClickTargets->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
ui->treeWidgetClickTargets->header()->setSectionResizeMode(1, QHeaderView::Stretch);
@@ -65,6 +68,7 @@ UbuntuSettingsClickWidget::UbuntuSettingsClickWidget(QWidget *parent) :
ui->treeWidgetClickTargets->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
ui->treeWidgetClickTargets->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
ui->treeWidgetClickTargets->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents);
ui->treeWidgetClickTargets->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents);
listExistingClickTargets();
}
@@ -116,6 +120,19 @@ void UbuntuSettingsClickWidget::on_upgradeClickChroot(const int index)
Internal::UbuntuClickDialog::maintainClickModal(m_availableTargets.at(index),UbuntuClickTool::Upgrade);
}
void UbuntuSettingsClickWidget::on_toggleTargetUpgradeEnabled(const int index)
{
if(index < 0 || index > m_availableTargets.size())
return;
QCheckBox *c = qobject_cast<QCheckBox *>(m_toggleUpgradeMapper->mapping(index));
if(!c)
return;
UbuntuClickTool::setTargetUpgradesEnabled(m_availableTargets.at(index), c->checkState()==Qt::Checked);
listExistingClickTargets();
}
/**
* @brief UbuntuSettingsClickWidget::listExistingClickTargets
* Lists all existing click targets in /var/lib/schroot/chroots
@@ -139,23 +156,28 @@ void UbuntuSettingsClickWidget::listExistingClickTargets()
chrootItem->setText(0,target.containerName);
chrootItem->setText(1,target.framework);
chrootItem->setText(2,target.architecture);
ui->treeWidgetClickTargets->addTopLevelItem(chrootItem);
QCheckBox* box = new QCheckBox();
m_toggleUpgradeMapper->setMapping(box,i);
box->setChecked(target.upgradesEnabled);
connect(box, SIGNAL(stateChanged(int)), m_toggleUpgradeMapper, SLOT(map()));
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,3), box);
QPushButton* push = new QPushButton(tr("Update"));
m_updateMapper->setMapping(push,i);
connect(push,SIGNAL(clicked()),m_updateMapper,SLOT(map()));
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,3), push);
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,4), push);
push = new QPushButton(tr("Maintain"));
m_maintainMapper->setMapping(push,i);
connect(push,SIGNAL(clicked()),m_maintainMapper,SLOT(map()));
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,4), push);
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,5), push);
push = new QPushButton(tr("Delete"));
m_deleteMapper->setMapping(push,i);
connect(push,SIGNAL(clicked()),m_deleteMapper,SLOT(map()));
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,5), push);
ui->treeWidgetClickTargets->setIndexWidget(model->index(i,6), push);
}
}

View File

@@ -45,6 +45,7 @@ protected slots:
void on_deleteClickChroot (const int index);
void on_maintainClickChroot (const int index);
void on_upgradeClickChroot (const int index);
void on_toggleTargetUpgradeEnabled (const int index);
private:
void listExistingClickTargets ();
@@ -54,6 +55,7 @@ private:
QSignalMapper* m_deleteMapper;
QSignalMapper* m_updateMapper;
QSignalMapper* m_maintainMapper;
QSignalMapper* m_toggleUpgradeMapper;
QList<Ubuntu::UbuntuClickTool::Target> m_availableTargets;
};

View File

@@ -1,7 +1,8 @@
#include "ubuntufatpackagingwizard.h"
#include "../ubuntuclicktool.h"
#include "../ubuntuconstants.h"
#include "../clicktoolchain.h"
#include <ubuntu/ubuntuclicktool.h>
#include <ubuntu/ubuntuconstants.h>
#include <ubuntu/clicktoolchain.h>
#include <ubuntu/ubuntuproject.h>
#include <utils/pathchooser.h>
#include <projectexplorer/buildconfiguration.h>
@@ -166,13 +167,14 @@ void UbuntuChooseTargetPage::initializePage()
m_suspects.clear();
m_targetView->clear();
UbuntuKitMatcher m;
foreach(ProjectExplorer::Target *t , m_project->targets()) {
ProjectExplorer::Kit* k = t->kit();
if(!k)
continue;
if(!ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k).toString().startsWith(QLatin1String(Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID)))
if (!m.matches(k))
continue;
foreach(ProjectExplorer::BuildConfiguration *b, t->buildConfigurations()) {