Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/chroot-agent into lp:qtcreator-plugin-ubuntu

Proposed by Benjamin Zeller
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 339
Merged at revision: 321
Proposed branch: lp:~zeller-benjamin/qtcreator-plugin-ubuntu/chroot-agent
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 1393 lines (+729/-94)
45 files modified
chroot-agent/chroot-agent.pro (+36/-0)
chroot-agent/chrootagent.cpp (+324/-0)
chroot-agent/chrootagent.h (+62/-0)
chroot-agent/main.cpp (+159/-0)
debian/control (+2/-0)
debian/qtcreator-plugin-ubuntu.install (+1/-0)
qtcreator-plugin-ubuntu.pro (+2/-1)
share/qtcreator/templates/wizards/ubuntu/backendplustabs/CMakeLists.txt (+1/-1)
share/qtcreator/templates/wizards/ubuntu/backendplustabs/app/displayName.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/backendplustabs/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/appName/main.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/manifest/manifest.json.in (+1/-1)
share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/main.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt (+1/-1)
share/qtcreator/templates/wizards/ubuntu/scope/manifest.json.in (+1/-1)
share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in (+1/-1)
share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml (+6/-6)
share/qtcreator/templates/wizards/ubuntu/share/manifest.json (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple/main.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/simplei18n/CMakeLists.txt (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simplei18n/app/displayName.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simplei18n/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/tabs/main.qml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml (+3/-3)
share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml (+5/-4)
share/qtcreator/ubuntu/scripts/qtc_chroot_wrapper.py (+29/-8)
src/plugin.pri (+3/-0)
src/ubuntu/manifest.json.template (+1/-1)
src/ubuntu/ubuntu.pro (+11/-2)
src/ubuntu/ubuntuapimode.cpp (+0/-1)
src/ubuntu/ubuntuclickdialog.cpp (+14/-0)
src/ubuntu/ubuntuclicktool.cpp (+9/-1)
src/ubuntu/ubuntuconstants.h (+2/-2)
src/ubuntu/ubuntukitmanager.cpp (+2/-24)
src/ubuntu/ubuntumanifesteditorwidget.cpp (+2/-2)
src/ubuntu/ubuntuplugin.cpp (+21/-3)
src/ubuntu/ubuntuplugin.h (+0/-1)
src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp (+1/-1)
src/ubuntu/wizards/ubuntuprojectmigrationwizard.cpp (+1/-1)
tests/manifest/manifest.json.template (+1/-1)
tests/manifest/tst_manifest.cpp (+1/-1)
To merge this branch: bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/chroot-agent
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zoltan Balogh Approve
Review via email: mp+244611@code.launchpad.net

Commit message

- Bug #1400741: API tab links to the wrong version of the API
- Add click-chroot-agent, a user session daemon that preloads chroot sessions
- Adding support for new package naming scheme

Description of the change

- Bug #1400741: API tab links to the wrong version of the API
- Add click-chroot-agent, a user session daemon that preloads chroot sessions
- Adding support for new package naming scheme

To post a comment you must log in.
337. By Benjamin Zeller

Adding support for new package naming scheme

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

OK

review: Approve
338. By Benjamin Zeller

Only try to connect chroot-agent if it makes sense

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
339. By Benjamin Zeller

Make sure invalid QtVersions are recreated

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'chroot-agent'
2=== added file 'chroot-agent/chroot-agent.pro'
3--- chroot-agent/chroot-agent.pro 1970-01-01 00:00:00 +0000
4+++ chroot-agent/chroot-agent.pro 2015-01-08 08:00:01 +0000
5@@ -0,0 +1,36 @@
6+#-------------------------------------------------
7+#
8+# Project created by QtCreator 2014-12-09T14:24:45
9+#
10+#-------------------------------------------------
11+
12+QT += core dbus
13+
14+QT -= gui
15+
16+TARGET = click-chroot-agent
17+CONFIG += console
18+CONFIG -= app_bundle
19+
20+QMAKE_CXXFLAGS += -Werror
21+CONFIG += c++11 dbusadaptors
22+
23+TEMPLATE = app
24+
25+
26+SOURCES += main.cpp \
27+ chrootagent.cpp
28+
29+HEADERS += \
30+ chrootagent.h
31+
32+xml_desc.target=com.ubuntu.sdk.ClickChrootAgent.xml
33+xml_desc.commands=qdbuscpp2xml -o $$xml_desc.target $$PWD/chrootagent.h
34+xml_desc.depends=$$PWD/chrootagent.h
35+
36+QMAKE_EXTRA_TARGETS+=xml_desc
37+
38+DBUS_ADAPTORS += $$xml_desc.target
39+
40+target.path=/bin
41+INSTALLS+=target
42
43=== added file 'chroot-agent/chrootagent.cpp'
44--- chroot-agent/chrootagent.cpp 1970-01-01 00:00:00 +0000
45+++ chroot-agent/chrootagent.cpp 2015-01-08 08:00:01 +0000
46@@ -0,0 +1,324 @@
47+#include "chrootagent.h"
48+#include "clickchrootagent_adaptor.h"
49+
50+#include <QCoreApplication>
51+#include <QFileSystemWatcher>
52+#include <QDebug>
53+#include <QProcess>
54+#include <QRegularExpression>
55+#include <QDir>
56+#include <QUuid>
57+
58+#include <unistd.h>
59+#include <sys/types.h>
60+
61+ChrootAgent *ChrootAgent::m_instance = nullptr;
62+
63+const char UBUNTU_CLICK_CHROOT_BASEPATH[] = "/var/lib/schroot/chroots";
64+const char UBUNTU_CLICK_TARGETS_REGEX[] = "^click-(.*)-([A-Za-z0-9]+)$";
65+
66+ChrootAgent::ChrootAgent(QObject *parent) :
67+ QObject(parent),
68+ m_chrootDirWatcher(nullptr)
69+{
70+ m_instance = this;
71+ new ClickChrootAgentAdaptor(this);
72+
73+ m_sessionPrefix = QString(QStringLiteral("ucca-%1")).arg(getuid());
74+
75+ //invoke the initialize once we enter the event loop
76+ QMetaObject::invokeMethod(this,"initialize",Qt::QueuedConnection);
77+}
78+
79+void ChrootAgent::initialize()
80+{
81+ foreach(const Chroot &ch, listAvailableClickChroots()) {
82+ m_knownChroots.insert(
83+ toInternalName(ch.framework,ch.architecture),
84+ ch);
85+ }
86+
87+ findExistingChrootSessions();
88+
89+ foreach(const QString &key, m_knownChroots.keys()) {
90+ if(!m_knownChroots[key].session.isEmpty())
91+ continue;
92+
93+ m_knownChroots[key].session = createClickSession(m_knownChroots[key]);
94+ }
95+
96+ emit chrootListChanged();
97+ emit sessionListChanged();
98+
99+ if(!m_chrootDirWatcher) {
100+ m_chrootDirWatcher = new QFileSystemWatcher(QStringList{QStringLiteral("/etc/schroot/chroot.d")},this);
101+ connect(m_chrootDirWatcher,SIGNAL(directoryChanged(QString)),this,SLOT(directoryChanged()));
102+ }
103+}
104+
105+void ChrootAgent::directoryChanged()
106+{
107+ QList<Chroot> chRootOnSys = listAvailableClickChroots();
108+ QSet<QString> chRootOnSysKeys;
109+
110+ foreach(const Chroot &ch, chRootOnSys)
111+ chRootOnSysKeys.insert(toInternalName(ch.framework,ch.architecture));
112+
113+ bool changed = false;
114+ foreach(const QString &key, m_knownChroots.keys()) {
115+ if(!chRootOnSysKeys.contains(key)) {
116+ qDebug()<<"Removing chroot"<<key<<"from internal List";
117+ changed = true;
118+ m_knownChroots.remove(key);
119+ }
120+ }
121+
122+ if(changed)
123+ emit chrootListChanged();
124+}
125+
126+ChrootAgent *ChrootAgent::instance()
127+{
128+ return m_instance;
129+}
130+
131+QString ChrootAgent::spawnSession(const QString &framework, const QString &architecture)
132+{
133+ QString intName = toInternalName(framework,architecture);
134+
135+ qDebug()<<"Request to spawn session "<<framework<<architecture;
136+
137+ Chroot *ch = nullptr;
138+ bool createSession = false;
139+ if(m_knownChroots.contains(intName)) {
140+ if(!m_knownChroots[intName].session.isEmpty()) {
141+ return m_knownChroots[intName].session;
142+ } else {
143+ createSession = true;
144+ ch = &m_knownChroots[intName];
145+ }
146+ } else {
147+ createSession = true;
148+ Chroot newChroot;
149+ if(!chrootFromPath(QString::fromLatin1("click-%1-%2"),&newChroot))
150+ return QString();
151+ m_knownChroots.insert(intName,newChroot);
152+ ch = &m_knownChroots[intName];
153+
154+ emit chrootListChanged();
155+ }
156+
157+ if(createSession) {
158+ ch->session = createClickSession(*ch);
159+ emit sessionListChanged();
160+ return ch->session;
161+ }
162+ return QString();
163+}
164+
165+bool ChrootAgent::releaseSession(const QString &framework, const QString &architecture)
166+{
167+ qDebug()<<"Request to release session "<<framework<<architecture;
168+
169+ QString intName = toInternalName(framework,architecture);
170+ if(!m_knownChroots.contains(intName))
171+ return true;
172+
173+ bool s = endClickSession(m_knownChroots[intName]);
174+ emit sessionListChanged();
175+
176+ return s;
177+}
178+
179+void ChrootAgent::shutdown()
180+{
181+ foreach(const QString &key, m_knownChroots.keys())
182+ endClickSession(m_knownChroots[key]);
183+
184+ qApp->exit(0);
185+}
186+
187+void ChrootAgent::hangup()
188+{
189+ foreach(const QString &key, m_knownChroots.keys())
190+ endClickSession(m_knownChroots[key]);
191+
192+ m_knownChroots.clear();
193+ initialize();
194+}
195+
196+/**
197+ * @brief UbuntuClickTool::listAvailableTargets
198+ * @return all currently existing chroot targets in the system
199+ */
200+QList<ChrootAgent::Chroot> ChrootAgent::listAvailableClickChroots( )
201+{
202+ QList<Chroot> items;
203+
204+ //use the etc dir, config files show only up if we can actually create session
205+ QDir chrootDir( QStringLiteral("/etc/schroot/chroot.d") );
206+
207+ //if the dir does not exist there are no available chroots
208+ if(!chrootDir.exists())
209+ return items;
210+
211+ QStringList availableChroots = chrootDir.entryList(QDir::Files | QDir::NoDotAndDotDot,
212+ QDir::Name | QDir::Reversed);
213+
214+ QRegularExpression clickFilter(QString::fromLatin1(UBUNTU_CLICK_TARGETS_REGEX));
215+ //iterate over all chroots and check if they are click chroots
216+ foreach (const QString &chroot, availableChroots) {
217+ QRegularExpressionMatch match = clickFilter.match(chroot);
218+ if(!match.hasMatch())
219+ continue;
220+
221+ Chroot t;
222+ if(!chrootFromPath(chroot,&t))
223+ continue;
224+
225+ items.append(t);
226+ }
227+ return items;
228+}
229+
230+void ChrootAgent::findExistingChrootSessions()
231+{
232+ QStringList args{
233+ QStringLiteral("--list"),
234+ QStringLiteral("--all-sessions")
235+ };
236+
237+ QProcess proc;
238+ proc.setProgram(QStringLiteral("schroot"));
239+ proc.setArguments(args);
240+ proc.start();
241+ proc.waitForFinished();
242+
243+ //session string format
244+ //session:click-ubuntu-sdk-15.04-armhf-13e7f626-a933-47f1-a501-329749612445
245+ QRegularExpression exp(QString::fromLatin1("session:click-(ubuntu-sdk-[0-9.]*)-([\\w]*)-(%1-.*)").arg(m_sessionPrefix));
246+ while(proc.canReadLine()) {
247+ QString line = QString::fromLocal8Bit(proc.readLine());
248+ QRegularExpressionMatch match = exp.match(line);
249+ if(!match.hasMatch())
250+ continue;
251+
252+ QString fw = match.captured(1);
253+ QString arch = match.captured(2);
254+ QString internal_name = toInternalName(fw,arch);
255+
256+ qDebug()<<"Pickung up existing session: "<<fw<<arch<<match.captured(3);
257+
258+ if(m_knownChroots.contains(internal_name))
259+ m_knownChroots[internal_name].session = match.captured(3);
260+ else {
261+ Chroot ch;
262+ ch.architecture = arch;
263+ ch.framework = fw;
264+ ch.internalName = internal_name;
265+ ch.session = match.captured(3);
266+ m_knownChroots.insert(internal_name,ch);
267+ }
268+ }
269+}
270+
271+/*!
272+ * \brief UbuntuClickTool::targetFromPath
273+ * returns true if the given path is a click target
274+ * if it is, \a tg will be initialized with that targets values
275+ */
276+bool ChrootAgent::chrootFromPath(const QString &targetPath, ChrootAgent::Chroot *tg) const
277+{
278+ QRegularExpression clickFilter(QString::fromLatin1(UBUNTU_CLICK_TARGETS_REGEX));
279+ QRegularExpressionMatch match = clickFilter.match(targetPath);
280+ if(!match.hasMatch()) {
281+ return false;
282+ }
283+
284+ Chroot t;
285+ t.framework = match.captured(1);
286+ t.architecture = match.captured(2);
287+ t.internalName = toInternalName(t.framework,t.architecture);
288+
289+ //now read informations about the target
290+ QFile f(QString::fromLatin1("%1/%2")
291+ .arg(chrootBasePath(t))
292+ .arg(QLatin1String("/etc/lsb-release")));
293+
294+ if (!f.exists()) {
295+ //there is no lsb-release file... the chroot is broken
296+ return false;
297+
298+ }
299+
300+ *tg = t;
301+ return true;
302+}
303+
304+QString ChrootAgent::chrootBasePath(const ChrootAgent::Chroot &target) const
305+{
306+ return QString::fromLatin1("%1/click-%2-%3")
307+ .arg(QLatin1String(UBUNTU_CLICK_CHROOT_BASEPATH))
308+ .arg(target.framework)
309+ .arg(target.architecture);
310+}
311+
312+QString ChrootAgent::toInternalName(const QString &framework, const QString &arch) const
313+{
314+ return QString::fromLatin1("%1-%2").arg(framework).arg(arch);;
315+}
316+
317+QString ChrootAgent::createClickSession(const ChrootAgent::Chroot &ch)
318+{
319+ QString name = QString::fromLatin1("%1-%2").arg(m_sessionPrefix).arg(QUuid::createUuid().toString());
320+ QStringList args = {
321+ QStringLiteral("chroot"),
322+ QStringLiteral("-a"),
323+ ch.architecture,
324+ QStringLiteral("-f"),
325+ ch.framework,
326+ QStringLiteral("begin-session"),
327+ name
328+ };
329+
330+ if(QProcess::execute(QStringLiteral("click"),args) == 0) {
331+ qDebug()<<"Created session "<<name;
332+ return name;
333+ }
334+
335+ qDebug()<<"Failed to create Session for "<<ch.architecture<<ch.framework;
336+ return QString();
337+}
338+
339+bool ChrootAgent::endClickSession(ChrootAgent::Chroot &ch)
340+{
341+ if(endClickSession(ch.framework,ch.architecture,ch.session)) {
342+ ch.session = QString();
343+ return true;
344+ }
345+ return false;
346+}
347+
348+bool ChrootAgent::endClickSession(const QString &framework, const QString &architecture, const QString &sessionName)
349+{
350+ if(sessionName.isEmpty())
351+ return true;
352+
353+ QStringList args = {
354+ QStringLiteral("chroot"),
355+ QStringLiteral("-a"),
356+ architecture,
357+ QStringLiteral("-f"),
358+ framework,
359+ QStringLiteral("end-session"),
360+ sessionName
361+ };
362+
363+ if(QProcess::execute(QStringLiteral("click"),args) == 0) {
364+ qDebug()<<"Removed session"<<sessionName<<"for"<<architecture<<framework;
365+ return true;
366+ }
367+
368+ qDebug()<<"Could not remove session for "<<architecture<<framework<<sessionName;
369+ return false;
370+}
371
372=== added file 'chroot-agent/chrootagent.h'
373--- chroot-agent/chrootagent.h 1970-01-01 00:00:00 +0000
374+++ chroot-agent/chrootagent.h 2015-01-08 08:00:01 +0000
375@@ -0,0 +1,62 @@
376+#ifndef CHROOTAGENT_H
377+#define CHROOTAGENT_H
378+
379+#include <qdbusmacros.h>
380+
381+#include <QObject>
382+#include <QStringList>
383+
384+class QFileSystemWatcher;
385+
386+class ChrootAgent : public QObject
387+{
388+ Q_OBJECT
389+ Q_CLASSINFO("D-Bus Interface", "com.ubuntu.sdk.ClickChrootAgent")
390+
391+ struct Chroot{
392+ QString internalName;
393+ QString framework;
394+ QString architecture;
395+ QString session;
396+ };
397+
398+public:
399+ explicit ChrootAgent(QObject *parent = 0);
400+
401+ static ChrootAgent *instance ();
402+
403+signals:
404+ void chrootListChanged ();
405+ void sessionListChanged ();
406+
407+public slots:
408+ QString spawnSession (const QString &framework, const QString &architecture);
409+ bool releaseSession (const QString &framework, const QString &architecture);
410+
411+ Q_NOREPLY void shutdown ();
412+ void hangup ();
413+
414+private slots:
415+ void initialize ();
416+ void directoryChanged ();
417+
418+private:
419+ void findExistingChrootSessions();
420+ bool chrootFromPath(const QString &targetPath, ChrootAgent::Chroot *tg) const;
421+ QString chrootBasePath(const ChrootAgent::Chroot &target) const;
422+ QString toInternalName (const QString &framework, const QString &arch) const;
423+ QString createClickSession(const Chroot &ch);
424+ bool endClickSession(Chroot &ch);
425+ bool endClickSession(const QString &framework, const QString &architecture, const QString &sessionName);
426+
427+private:
428+ QMap<QString,Chroot> m_knownChroots;
429+ QFileSystemWatcher *m_chrootDirWatcher;
430+ QString m_sessionPrefix;
431+ static ChrootAgent *m_instance;
432+
433+
434+ QList<ChrootAgent::Chroot> listAvailableClickChroots();
435+};
436+
437+#endif // CHROOTAGENT_H
438
439=== added file 'chroot-agent/main.cpp'
440--- chroot-agent/main.cpp 1970-01-01 00:00:00 +0000
441+++ chroot-agent/main.cpp 2015-01-08 08:00:01 +0000
442@@ -0,0 +1,159 @@
443+/**
444+ *
445+ * based on code taken from http://www.enderunix.org/docs/eng/daemon.php
446+ */
447+
448+#include <stdio.h>
449+#include <fcntl.h>
450+#include <signal.h>
451+#include <unistd.h>
452+#include <pwd.h>
453+
454+#include <sys/types.h>
455+#include <sys/stat.h>
456+#include <syslog.h>
457+
458+#include <QCoreApplication>
459+#include <QDir>
460+#include <QDBusConnection>
461+#include <QDebug>
462+#include <QDBusError>
463+#include <QStandardPaths>
464+
465+#include "chrootagent.h"
466+
467+void syslogMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
468+{
469+ bool do_abort = false;
470+ openlog ("click-chroot-agent", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
471+
472+ QByteArray localMsg = msg.toLocal8Bit();
473+ switch (type) {
474+ case QtDebugMsg:
475+ syslog (LOG_DEBUG, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
476+ break;
477+ case QtWarningMsg:
478+ syslog (LOG_WARNING,"Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
479+ break;
480+ case QtCriticalMsg:
481+ syslog (LOG_CRIT, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
482+ break;
483+ case QtFatalMsg:
484+ syslog (LOG_EMERG, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
485+ do_abort=true;
486+ }
487+
488+ closelog();
489+
490+ if(do_abort) abort();
491+}
492+
493+void log_message (const char *message, int logType = LOG_INFO)
494+{
495+ openlog ("click-chroot-agent", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
496+ syslog (logType, message,0);
497+ closelog();
498+}
499+
500+void signal_handler(int sig)
501+{
502+ switch(sig) {
503+ case SIGHUP:
504+ log_message("hangup signal catched");
505+ ChrootAgent::instance()->hangup();
506+ break;
507+ case SIGTERM:
508+ log_message("terminate signal catched");
509+ ChrootAgent::instance()->shutdown();
510+ break;
511+ }
512+}
513+
514+void daemonize()
515+{
516+ if(getppid()==1) return; /* already a daemon */
517+
518+ int i=fork();
519+ if (i<0) {
520+ log_message("Could not fork.",LOG_EMERG);
521+ exit(1); /* fork error */
522+ }
523+ if (i>0) {
524+ _exit(0); /* parent exits */
525+ }
526+
527+ /* child (daemon) continues */
528+ setsid(); /* obtain a new process group */
529+ for (i=getdtablesize();i>=0;--i)
530+ close(i); /* close all descriptors */
531+
532+ /* handle standart I/O */
533+ i=open("/dev/null",O_RDWR);
534+ if(dup(i) < 0)
535+ log_message("Could not redirect std filedescriptor",LOG_ERR);
536+ if(dup(i) < 0)
537+ log_message("Could not redirect std filedescriptor",LOG_ERR);
538+
539+ umask(027); /* set newly created file permissions */
540+
541+ QString lockFile = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)+
542+ QDir::separator()+
543+ QStringLiteral("click-chroot-agent.pid");
544+
545+ int lfp=open(qPrintable(lockFile),O_RDWR|O_CREAT,0640);
546+ if (lfp<0) {
547+ log_message("Can not open lockfile",LOG_ERR);
548+ exit(1); /* can not open */
549+ }
550+
551+ if (lockf(lfp,F_TLOCK,0)<0) {
552+ log_message("Can not lock lockfile");
553+ exit(2); /* can not lock, server already running */
554+ }
555+
556+ /* first instance continues */
557+ QByteArray arr = QByteArray::number(getpid());
558+ if(write(lfp,arr.constData(),strlen(arr.constData())) < 0) /* record pid to lockfile */
559+ log_message("Could not write pid to the lockfile");
560+
561+ signal(SIGCHLD,SIG_IGN); /* ignore child */
562+ signal(SIGTSTP,SIG_IGN); /* ignore tty signals */
563+ signal(SIGTTOU,SIG_IGN);
564+ signal(SIGTTIN,SIG_IGN);
565+}
566+
567+int main(int argc, char *argv[])
568+{
569+ daemonize();
570+
571+ qInstallMessageHandler(syslogMessageHandler);
572+ QCoreApplication a(argc, argv);
573+
574+ //the control signals
575+ signal(SIGHUP,signal_handler); /* catch hangup signal */
576+ signal(SIGTERM,signal_handler); /* catch term signal */
577+
578+ ChrootAgent agent;
579+
580+ QDBusConnection sessionBus = QDBusConnection::sessionBus();
581+
582+ //when the session bus goes down we want to exit
583+ if(!sessionBus.connect(QString(),QString(),QStringLiteral("org.freedesktop.DBus.Local"),QStringLiteral("Disconnected"), &agent, SLOT(shutdown()))) {
584+ log_message("Could not connect to DBUS session bus",LOG_EMERG);
585+ return 1;
586+ }
587+
588+ if(!sessionBus.registerObject(QStringLiteral("/com/ubuntu/sdk/ClickChrootAgent"),&agent)) {
589+ log_message("Could not register DBUS interface",LOG_EMERG);
590+ qDebug()<<sessionBus.lastError();
591+ return 1;
592+ }
593+
594+ if(!sessionBus.registerService(QStringLiteral("com.ubuntu.sdk.ClickChrootAgent"))) {
595+ log_message("Could not register DBUS service",LOG_EMERG);
596+ qDebug()<<sessionBus.lastError();
597+ return 1;
598+ }
599+
600+ return a.exec();
601+}
602
603=== modified file 'debian/control'
604--- debian/control 2014-12-17 17:27:29 +0000
605+++ debian/control 2015-01-08 08:00:01 +0000
606@@ -7,6 +7,7 @@
607 libqt5scripttools5 (>= 5.3),
608 libqt5webkit5-dev,
609 libqt5widgets5 (>= 5.3),
610+ libqt5dbus5 (>= 5.3),
611 libsqlite3-dev,
612 qt5-qmake (>= 5.3),
613 qtcreator-dev (>= 3.1.1-0ubuntu7),
614@@ -51,6 +52,7 @@
615 gdb-multiarch,
616 click-reviewers-tools,
617 phablet-tools,
618+ python-dbus,
619 ${shlibs:Depends},
620 ${misc:Depends},
621 Recommends: ubuntu-sdk,
622
623=== modified file 'debian/qtcreator-plugin-ubuntu.install'
624--- debian/qtcreator-plugin-ubuntu.install 2013-09-06 04:16:42 +0000
625+++ debian/qtcreator-plugin-ubuntu.install 2015-01-08 08:00:01 +0000
626@@ -2,3 +2,4 @@
627 ubuntu-qtcreator.png usr/share/icons
628 usr/lib/*/qtcreator/plugins/Canonical/Ubuntu.pluginspec
629 usr/lib/*/qtcreator/plugins/Canonical/libUbuntu.so
630+usr/bin/click-chroot-agent
631
632=== modified file 'qtcreator-plugin-ubuntu.pro'
633--- qtcreator-plugin-ubuntu.pro 2014-05-15 19:25:53 +0000
634+++ qtcreator-plugin-ubuntu.pro 2015-01-08 08:00:01 +0000
635@@ -1,3 +1,4 @@
636 TEMPLATE = subdirs
637 SUBDIRS = src/ubuntu \
638- tests
639+ tests \
640+ chroot-agent
641
642=== modified file 'share/qtcreator/templates/wizards/ubuntu/backendplustabs/CMakeLists.txt'
643--- share/qtcreator/templates/wizards/ubuntu/backendplustabs/CMakeLists.txt 2014-11-17 15:09:02 +0000
644+++ share/qtcreator/templates/wizards/ubuntu/backendplustabs/CMakeLists.txt 2015-01-08 08:00:01 +0000
645@@ -25,7 +25,7 @@
646 option(INSTALL_TESTS "Install the tests on make install" on)
647
648 set(APP_NAME %ProjectName%)
649-set(APP_ID "%ClickDomain:l%.%ProjectName:l%")
650+set(APP_ID "%ProjectName:l%.%ClickDomain:l%")
651 set(%ProjectName:u%_DIR "share/qml/%ProjectName%")
652 set(MAIN_QML "%ProjectName%.qml")
653 set(ICON "graphics/%ProjectName%.png")
654
655=== modified file 'share/qtcreator/templates/wizards/ubuntu/backendplustabs/app/displayName.qml'
656--- share/qtcreator/templates/wizards/ubuntu/backendplustabs/app/displayName.qml 2014-09-03 11:49:49 +0000
657+++ share/qtcreator/templates/wizards/ubuntu/backendplustabs/app/displayName.qml 2015-01-08 08:00:01 +0000
658@@ -13,7 +13,7 @@
659 objectName: "mainView"
660
661 // Note! applicationName needs to match the "name" field of the click manifest
662- applicationName: "%ClickDomain:l%.%ProjectName:l%"
663+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
664
665 /*
666 This property enables the application to change orientation
667
668=== modified file 'share/qtcreator/templates/wizards/ubuntu/backendplustabs/wizard.xml'
669--- share/qtcreator/templates/wizards/ubuntu/backendplustabs/wizard.xml 2014-11-17 16:13:26 +0000
670+++ share/qtcreator/templates/wizards/ubuntu/backendplustabs/wizard.xml 2015-01-08 08:00:01 +0000
671@@ -49,9 +49,9 @@
672 <fieldpagetitle>Click package parameters</fieldpagetitle>
673 <fields>
674 <field mandatory="true" name="ClickDomain">
675- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
676- defaulttext="" placeholdertext="Domain"/>
677- <fielddescription>Domain:</fielddescription>
678+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
679+ defaulttext="" placeholdertext="Nickname"/>
680+ <fielddescription>Nickname:</fielddescription>
681 </field>
682 <field mandatory="true" name="ClickMaintainer">
683 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
684
685=== modified file 'share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/appName/main.qml'
686--- share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/appName/main.qml 2014-11-13 15:45:24 +0000
687+++ share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/appName/main.qml 2015-01-08 08:00:01 +0000
688@@ -10,7 +10,7 @@
689 objectName: "mainView"
690
691 // Note! applicationName needs to match the "name" field of the click manifest
692- applicationName: "%ClickDomain:l%.%ProjectName:l%"
693+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
694
695 /*
696 This property enables the application to change orientation
697
698=== modified file 'share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/manifest/manifest.json.in'
699--- share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/manifest/manifest.json.in 2014-11-21 08:06:14 +0000
700+++ share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/manifest/manifest.json.in 2015-01-08 08:00:01 +0000
701@@ -1,5 +1,5 @@
702 {
703- "name": "%ClickDomain:l%.%ProjectName:l%",
704+ "name": "%ProjectName:l%.%ClickDomain:l%",
705 "description": "description of %ProjectName%",
706 "architecture": "@CLICK_ARCH@",
707 "title": "%ProjectName%",
708
709=== modified file 'share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/wizard.xml'
710--- share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/wizard.xml 2014-11-21 08:06:14 +0000
711+++ share/qtcreator/templates/wizards/ubuntu/bin_app-qmake/wizard.xml 2015-01-08 08:00:01 +0000
712@@ -31,9 +31,9 @@
713 <fieldpagetitle>Click package parameters</fieldpagetitle>
714 <fields>
715 <field mandatory="true" name="ClickDomain">
716- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
717- defaulttext="" placeholdertext="Domain"/>
718- <fielddescription>Domain:</fielddescription>
719+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
720+ defaulttext="" placeholdertext="Nickname"/>
721+ <fielddescription>Nickname:</fielddescription>
722 </field>
723 <field mandatory="true" name="ClickMaintainer">
724 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
725
726=== modified file 'share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/main.qml'
727--- share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/main.qml 2014-09-03 11:49:49 +0000
728+++ share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/main.qml 2015-01-08 08:00:01 +0000
729@@ -10,7 +10,7 @@
730 objectName: "mainView"
731
732 // Note! applicationName needs to match the "name" field of the click manifest
733- applicationName: "%ClickDomain:l%.%ProjectName:l%"
734+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
735
736 /*
737 This property enables the application to change orientation
738
739=== modified file 'share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml'
740--- share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml 2014-11-17 16:13:26 +0000
741+++ share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml 2015-01-08 08:00:01 +0000
742@@ -22,9 +22,9 @@
743 <fieldpagetitle>Details</fieldpagetitle>
744 <fields>
745 <field mandatory="true" name="ClickDomain">
746- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
747- defaulttext="" placeholdertext="Domain"/>
748- <fielddescription>Domain:</fielddescription>
749+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
750+ defaulttext="" placeholdertext="Nickname"/>
751+ <fielddescription>Nickname:</fielddescription>
752 </field>
753 <field mandatory="true" name="ClickMaintainer">
754 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
755
756=== modified file 'share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml'
757--- share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml 2014-11-17 16:13:26 +0000
758+++ share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml 2015-01-08 08:00:01 +0000
759@@ -29,9 +29,9 @@
760 <fieldpagetitle>Click package parameters</fieldpagetitle>
761 <fields>
762 <field mandatory="true" name="ClickDomain">
763- <fieldcontrol class="QLineEdit" validator='^[^"]+$'
764- defaulttext="" placeholdertext="Domain"/>
765- <fielddescription>Domain:</fielddescription>
766+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
767+ defaulttext="" placeholdertext="Nickname"/>
768+ <fielddescription>Nickname:</fielddescription>
769 </field>
770 <field mandatory="true" name="ClickMaintainer">
771 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
772
773=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt'
774--- share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt 2014-11-21 15:37:11 +0000
775+++ share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt 2015-01-08 08:00:01 +0000
776@@ -64,7 +64,7 @@
777 set(CMAKE_INSTALL_PREFIX /)
778 set(SCOPE_INSTALL_DIR "/%ClickHookName:l%")
779 set(GETTEXT_PACKAGE "%ProjectName:l%")
780-set(PACKAGE_NAME "%ClickDomain:l%.%ProjectName:l%")
781+set(PACKAGE_NAME "%ProjectName:l%.%ClickDomain:l%")
782 set(SCOPE_NAME "${PACKAGE_NAME}_%ClickHookName:l%")
783
784 # If we need to refer to the scope's name or package in code, these definitions will help
785
786=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/manifest.json.in'
787--- share/qtcreator/templates/wizards/ubuntu/scope/manifest.json.in 2014-11-17 14:24:59 +0000
788+++ share/qtcreator/templates/wizards/ubuntu/scope/manifest.json.in 2015-01-08 08:00:01 +0000
789@@ -6,7 +6,7 @@
790 @endif
791 "maintainer": "%ClickMaintainer%",
792 "architecture": "@CLICK_ARCH@",
793- "name": "%ClickDomain:l%.%ProjectName:l%",
794+ "name": "%ProjectName:l%.%ClickDomain:l%",
795 "title": "%ProjectName:l%",
796 "framework" : "%ClickFrameworkVersion%",
797 "hooks": {
798
799=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in'
800--- share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in 2014-11-21 14:45:30 +0000
801+++ share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in 2015-01-08 08:00:01 +0000
802@@ -1,4 +1,4 @@
803-[type: gettext/ini] data/%ClickDomain:l%.%ProjectName:l%_%ClickHookName:l%.ini.in
804+[type: gettext/ini] data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in
805 include/api/config.h
806 include/api/client.h
807 include/scope/preview.h
808
809=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml'
810--- share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2014-11-21 14:45:30 +0000
811+++ share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2015-01-08 08:00:01 +0000
812@@ -13,7 +13,7 @@
813 <file source="cmake/FindIntltool.cmake"/>
814
815 <file source="data/CMakeLists.txt"/>
816- <file source="data/displayName.ini.in" target="data/%ClickDomain:l%.%ProjectName:l%_%ClickHookName:l%.ini.in"/>
817+ <file source="data/displayName.ini.in" target="data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in"/>
818 <file source="data/icon.png" binary="true"/>
819 <file source="data/logo.png" binary="true"/>
820 <file source="data/screenshot.png" binary="true"/>
821@@ -58,11 +58,11 @@
822 <!-- Create a 2nd wizard page with click package parameters -->
823 <fieldpagetitle>Click package parameters</fieldpagetitle>
824 <fields>
825- <field mandatory="true" name="ClickDomain">
826- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
827- defaulttext="" placeholdertext="Domain"/>
828- <fielddescription>Domain:</fielddescription>
829- </field>
830+ <field mandatory="true" name="ClickDomain">
831+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
832+ defaulttext="" placeholdertext="Nickname"/>
833+ <fielddescription>Nickname:</fielddescription>
834+ </field>
835 <field mandatory="true" name="ClickMaintainer">
836 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
837 defaulttext="" placeholdertext="Maintainer"/>
838
839=== modified file 'share/qtcreator/templates/wizards/ubuntu/share/manifest.json'
840--- share/qtcreator/templates/wizards/ubuntu/share/manifest.json 2014-11-17 14:24:59 +0000
841+++ share/qtcreator/templates/wizards/ubuntu/share/manifest.json 2015-01-08 08:00:01 +0000
842@@ -1,5 +1,5 @@
843 {
844- "name": "%ClickDomain:l%.%ProjectName:l%",
845+ "name": "%ProjectName:l%.%ClickDomain:l%",
846 "description": "description of %ProjectName%",
847 "architecture": "all",
848 "title": "%ProjectName%",
849
850=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple/main.qml'
851--- share/qtcreator/templates/wizards/ubuntu/simple/main.qml 2014-09-15 15:31:26 +0000
852+++ share/qtcreator/templates/wizards/ubuntu/simple/main.qml 2015-01-08 08:00:01 +0000
853@@ -10,7 +10,7 @@
854 objectName: "mainView"
855
856 // Note! applicationName needs to match the "name" field of the click manifest
857- applicationName: "%ClickDomain:l%.%ProjectName:l%"
858+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
859
860 /*
861 This property enables the application to change orientation
862
863=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml'
864--- share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml 2014-11-17 16:13:26 +0000
865+++ share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml 2015-01-08 08:00:01 +0000
866@@ -30,9 +30,9 @@
867 <fieldpagetitle>Click package parameters</fieldpagetitle>
868 <fields>
869 <field mandatory="true" name="ClickDomain">
870- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
871- defaulttext="" placeholdertext="Domain"/>
872- <fielddescription>Domain:</fielddescription>
873+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
874+ defaulttext="" placeholdertext="Nickname"/>
875+ <fielddescription>Nickname:</fielddescription>
876 </field>
877 <field mandatory="true" name="ClickMaintainer">
878 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
879
880=== modified file 'share/qtcreator/templates/wizards/ubuntu/simplei18n/CMakeLists.txt'
881--- share/qtcreator/templates/wizards/ubuntu/simplei18n/CMakeLists.txt 2014-11-17 15:09:02 +0000
882+++ share/qtcreator/templates/wizards/ubuntu/simplei18n/CMakeLists.txt 2015-01-08 08:00:01 +0000
883@@ -34,7 +34,7 @@
884 option(INSTALL_TESTS "Install the tests on make install" on)
885
886 set(APP_NAME %ProjectName%)
887-set(APP_ID "%ClickDomain:l%.%ProjectName:l%")
888+set(APP_ID "%ProjectName:l%.%ClickDomain:l%")
889 set(%ProjectName:u%_DIR "share/qml/%ProjectName%")
890 set(MAIN_QML "%ProjectName%.qml")
891 set(ICON "graphics/%ProjectName%.png")
892
893=== modified file 'share/qtcreator/templates/wizards/ubuntu/simplei18n/app/displayName.qml'
894--- share/qtcreator/templates/wizards/ubuntu/simplei18n/app/displayName.qml 2014-10-14 08:33:49 +0000
895+++ share/qtcreator/templates/wizards/ubuntu/simplei18n/app/displayName.qml 2015-01-08 08:00:01 +0000
896@@ -13,7 +13,7 @@
897 objectName: "mainView"
898
899 // Note! applicationName needs to match the "name" field of the click manifest
900- applicationName: "%ClickDomain:l%.%ProjectName:l%"
901+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
902
903 /*
904 This property enables the application to change orientation
905
906=== modified file 'share/qtcreator/templates/wizards/ubuntu/simplei18n/wizard.xml'
907--- share/qtcreator/templates/wizards/ubuntu/simplei18n/wizard.xml 2014-11-17 16:13:26 +0000
908+++ share/qtcreator/templates/wizards/ubuntu/simplei18n/wizard.xml 2015-01-08 08:00:01 +0000
909@@ -38,9 +38,9 @@
910 <fieldpagetitle>Click package parameters</fieldpagetitle>
911 <fields>
912 <field mandatory="true" name="ClickDomain">
913- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
914- defaulttext="" placeholdertext="Domain"/>
915- <fielddescription>Domain:</fielddescription>
916+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
917+ defaulttext="" placeholdertext="Nickname"/>
918+ <fielddescription>Nickname:</fielddescription>
919 </field>
920 <field mandatory="true" name="ClickMaintainer">
921 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
922
923=== modified file 'share/qtcreator/templates/wizards/ubuntu/tabs/main.qml'
924--- share/qtcreator/templates/wizards/ubuntu/tabs/main.qml 2014-09-03 11:49:49 +0000
925+++ share/qtcreator/templates/wizards/ubuntu/tabs/main.qml 2015-01-08 08:00:01 +0000
926@@ -13,7 +13,7 @@
927 objectName: "mainView"
928
929 // Note! applicationName needs to match the "name" field of the click manifest
930- applicationName: "%ClickDomain:l%.%ProjectName:l%"
931+ applicationName: "%ProjectName:l%.%ClickDomain:l%"
932
933 /*
934 This property enables the application to change orientation
935
936=== modified file 'share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml'
937--- share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml 2014-11-17 16:13:26 +0000
938+++ share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml 2015-01-08 08:00:01 +0000
939@@ -35,9 +35,9 @@
940 <fieldpagetitle>Click package parameters</fieldpagetitle>
941 <fields>
942 <field mandatory="true" name="ClickDomain">
943- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
944- defaulttext="" placeholdertext="Domain"/>
945- <fielddescription>Domain:</fielddescription>
946+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
947+ defaulttext="" placeholdertext="Nickname"/>
948+ <fielddescription>Nickname:</fielddescription>
949 </field>
950 <field mandatory="true" name="ClickMaintainer">
951 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
952
953=== modified file 'share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml'
954--- share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml 2014-11-17 16:13:26 +0000
955+++ share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml 2015-01-08 08:00:01 +0000
956@@ -16,10 +16,11 @@
957 <!-- Create a 2nd wizard page with click package parameters -->
958 <fieldpagetitle>Click package parameters</fieldpagetitle>
959 <fields>
960- <field mandatory="true" name="ClickDomain">
961- <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' defaulttext="" placeholdertext="Domain"/>
962- <fielddescription>Domain:</fielddescription>
963- </field>
964+ <field mandatory="true" name="ClickDomain">
965+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
966+ defaulttext="" placeholdertext="Nickname"/>
967+ <fielddescription>Nickname:</fielddescription>
968+ </field>
969 <field mandatory="true" name="ClickMaintainer">
970 <fieldcontrol class="QLineEdit" validator='^[^"]+$' defaulttext="" placeholdertext="Maintainer"/>
971 <fielddescription>Maintainer:</fielddescription>
972
973=== modified file 'share/qtcreator/ubuntu/scripts/qtc_chroot_wrapper.py'
974--- share/qtcreator/ubuntu/scripts/qtc_chroot_wrapper.py 2014-11-24 11:17:19 +0000
975+++ share/qtcreator/ubuntu/scripts/qtc_chroot_wrapper.py 2015-01-08 08:00:01 +0000
976@@ -34,6 +34,7 @@
977 import fcntl
978 import uuid
979 import signal
980+import dbus
981
982 #find out the directory holding the link
983 dirname = os.path.basename(os.path.dirname(os.path.abspath(sys.argv[0])))
984@@ -45,12 +46,12 @@
985 #find out the path this script is in, required for local plugin installation
986 scriptpath = os.path.dirname(os.path.realpath(__file__))
987
988-#@BUG get this dynamically
989-chroot_name_prefix = "click"
990+#get the click prefix from env, or use click if the var is not set
991+#if the variable is set we do not try to reach the click-chroot-agent
992+chroot_name_prefix = os.getenv('CLICK_CHROOT_SUFFIX', "click")
993
994 architecture = dirname[idx+1:]
995 framework = dirname[0:idx]
996-session_id = str(uuid.uuid4())
997
998 args = sys.argv[1:]
999 command = os.path.basename(sys.argv[0])
1000@@ -62,9 +63,9 @@
1001 success = subprocess.call(["/bin/bash",legacy_script,framework,architecture,chroot_name_prefix]+args,stdout=sys.stdout,stderr=sys.stderr)
1002 sys.exit(success)
1003
1004-subproc = None
1005-
1006-click = shutil.which("click")
1007+subproc = None
1008+session_id = ""
1009+click = shutil.which("click")
1010
1011 if( click is None ):
1012 print("Could not find click in the path, please make sure it is installed")
1013@@ -89,7 +90,25 @@
1014 signal.signal(signal.SIGINT , exit_gracefully)
1015 signal.signal(signal.SIGHUP , exit_gracefully)
1016
1017-success = subprocess.call([click, "chroot","-a",architecture,"-f",framework,"-n",chroot_name_prefix,"begin-session",session_id],stdout=subprocess.DEVNULL)
1018+#only ask the chroot-agent if we use the default click prefix
1019+if chroot_name_prefix == "click":
1020+ try:
1021+ sessionBus = dbus.SessionBus()
1022+ clickChrootAgent = sessionBus.get_object('com.ubuntu.sdk.ClickChrootAgent','/com/ubuntu/sdk/ClickChrootAgent')
1023+ clickChrootAgentIFace = dbus.Interface(clickChrootAgent,dbus_interface='com.ubuntu.sdk.ClickChrootAgent')
1024+ session_id = clickChrootAgentIFace.spawnSession(framework,architecture)
1025+ except dbus.exceptions.DBusException:
1026+ session_id = ""
1027+
1028+if (len(session_id) == 0):
1029+ session_id = str(uuid.uuid4())
1030+ pre_spawned_session = False
1031+else:
1032+ pre_spawned_session = True
1033+
1034+if ( not pre_spawned_session ):
1035+ success = subprocess.call([click, "chroot","-a",architecture,"-f",framework,"-n",chroot_name_prefix,"begin-session",session_id],stdout=subprocess.DEVNULL)
1036+
1037 subproc = subprocess.Popen([click, "chroot","-a",architecture,"-f",framework,"-n",chroot_name_prefix,"run","-n",session_id]+[command]+args,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1038
1039 stdout = ""
1040@@ -142,5 +161,7 @@
1041 if(len(stderr) != 0):
1042 sys.stderr.write(mapPaths(stderr))
1043
1044-subprocess.call([click, "chroot","-a",architecture,"-f",framework,"-n",chroot_name_prefix,"end-session",session_id],stdout=subprocess.DEVNULL)
1045+if (not pre_spawned_session):
1046+ subprocess.call([click, "chroot","-a",architecture,"-f",framework,"-n",chroot_name_prefix,"end-session",session_id],stdout=subprocess.DEVNULL)
1047+
1048 sys.exit(subproc.returncode)
1049
1050=== modified file 'src/plugin.pri'
1051--- src/plugin.pri 2014-07-29 07:58:30 +0000
1052+++ src/plugin.pri 2015-01-08 08:00:01 +0000
1053@@ -16,6 +16,9 @@
1054
1055 DEFINES += UBUNTU_RESOURCE_PATH_LOCAL=\"$${PATHSTR}\" UBUNTU_BUILD_LOCAL
1056
1057+ BUILD_ROOT_STR = '\\"$$clean_path($${OUT_PWD}/../../)\\"'
1058+ DEFINES += UBUNTU_BUILD_ROOT=\"$${BUILD_ROOT_STR}\"
1059+
1060 #create a link so we get our wizards in the new project wizard
1061 system("rm '$$(HOME)/.config/QtProject/qtcreator/templates'")
1062 system("ln -s '$${PWD}/../share/qtcreator/templates' '$$(HOME)/.config/QtProject/qtcreator/templates'")
1063
1064=== modified file 'src/ubuntu/manifest.json.template'
1065--- src/ubuntu/manifest.json.template 2014-08-19 09:50:02 +0000
1066+++ src/ubuntu/manifest.json.template 2015-01-08 08:00:01 +0000
1067@@ -1,5 +1,5 @@
1068 {
1069- "name": "com.ubuntu.developer.username.myapp",
1070+ "name": "myapp.username",
1071 "description": "description of myapp",
1072 "framework": "myFramework",
1073 "architecture": "all",
1074
1075=== modified file 'src/ubuntu/ubuntu.pro'
1076--- src/ubuntu/ubuntu.pro 2014-11-27 16:23:51 +0000
1077+++ src/ubuntu/ubuntu.pro 2015-01-08 08:00:01 +0000
1078@@ -1,9 +1,9 @@
1079-QT += network qml quick webkitwidgets script scripttools
1080+QT += network qml quick webkitwidgets script scripttools dbus
1081
1082 include(../plugin.pri)
1083
1084 QMAKE_CXXFLAGS += -Werror
1085-CONFIG += c++11
1086+CONFIG += c++11 dbusinterfaces
1087
1088 #####################################
1089 # required for Ubuntu Device Notifier
1090@@ -222,3 +222,12 @@
1091 ubuntuscopefinalizer.h \
1092 wizards/ubuntuprojectmigrationwizard.h
1093
1094+INCLUDEPATH+=$$OUT_PWD
1095+
1096+xml_desc.target=com.ubuntu.sdk.ClickChrootAgent.xml
1097+xml_desc.commands=qdbuscpp2xml -o $$xml_desc.target $$PWD/../../chroot-agent/chrootagent.h
1098+xml_desc.depends=$$PWD/../../chroot-agent/chrootagent.h
1099+QMAKE_EXTRA_TARGETS+=xml_desc
1100+
1101+DBUS_INTERFACES += $$xml_desc.target
1102+
1103
1104=== modified file 'src/ubuntu/ubuntuapimode.cpp'
1105--- src/ubuntu/ubuntuapimode.cpp 2014-08-04 13:46:45 +0000
1106+++ src/ubuntu/ubuntuapimode.cpp 2015-01-08 08:00:01 +0000
1107@@ -149,5 +149,4 @@
1108 }
1109
1110 return QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_API_ONLINE));
1111-
1112 }
1113
1114=== modified file 'src/ubuntu/ubuntuclickdialog.cpp'
1115--- src/ubuntu/ubuntuclickdialog.cpp 2014-08-01 13:11:09 +0000
1116+++ src/ubuntu/ubuntuclickdialog.cpp 2015-01-08 08:00:01 +0000
1117@@ -30,6 +30,7 @@
1118 #include <texteditor/fontsettings.h>
1119
1120 #include "ubuntucreatenewchrootdialog.h"
1121+#include "clickchrootagent_interface.h"
1122
1123 namespace Ubuntu {
1124 namespace Internal {
1125@@ -120,6 +121,19 @@
1126 QString text = tr(Constants::UBUNTU_CLICK_DELETE_MESSAGE);
1127 if( QMessageBox::question(Core::ICore::mainWindow(),title,text) != QMessageBox::Yes )
1128 return 0;
1129+
1130+ if(UbuntuClickTool::clickChrootSuffix() == QLatin1String(Constants::UBUNTU_CLICK_CHROOT_DEFAULT_NAME)) {
1131+ ComUbuntuSdkClickChrootAgentInterface clickAgent(QStringLiteral("com.ubuntu.sdk.ClickChrootAgent"),
1132+ QStringLiteral("/com/ubuntu/sdk/ClickChrootAgent"),
1133+ QDBusConnection::sessionBus());
1134+ if(clickAgent.isValid()) {
1135+ QDBusPendingReply<bool> ret = clickAgent.releaseSession(target.framework,target.architecture);
1136+ if(ret.isError())
1137+ qDebug()<<ret.error();
1138+
1139+ ret.waitForFinished();
1140+ }
1141+ }
1142 }
1143
1144 ProjectExplorer::ProcessParameters params;
1145
1146=== modified file 'src/ubuntu/ubuntuclicktool.cpp'
1147--- src/ubuntu/ubuntuclicktool.cpp 2014-12-02 14:20:35 +0000
1148+++ src/ubuntu/ubuntuclicktool.cpp 2015-01-08 08:00:01 +0000
1149@@ -60,11 +60,19 @@
1150 debug = 0
1151 };
1152
1153+static QString getChrootSuffixFromEnv ()
1154+{
1155+ QByteArray value = qgetenv(Constants::UBUNTU_CLICK_CHROOT_SUFFIX_ENV_VAR);
1156+ if(value.isNull())
1157+ return QLatin1String(Constants::UBUNTU_CLICK_CHROOT_DEFAULT_NAME);
1158+
1159+ return QString::fromLatin1(value);
1160+}
1161
1162 /**
1163 * Initialize the m_strClickChrootSuffix from the environment variable
1164 */
1165-QString UbuntuClickTool::m_strClickChrootSuffix = QProcessEnvironment::systemEnvironment().value(QLatin1String(Constants::UBUNTU_CLICK_CHROOT_SUFFIX_ENV_VAR),QLatin1String(Constants::UBUNTU_CLICK_CHROOT_DEFAULT_NAME));
1166+QString UbuntuClickTool::m_strClickChrootSuffix = getChrootSuffixFromEnv();
1167
1168 /**
1169 * @brief UbuntuClickTool::UbuntuClickTool
1170
1171=== modified file 'src/ubuntu/ubuntuconstants.h'
1172--- src/ubuntu/ubuntuconstants.h 2014-12-19 03:41:39 +0000
1173+++ src/ubuntu/ubuntuconstants.h 2015-01-08 08:00:01 +0000
1174@@ -183,7 +183,7 @@
1175 const char UBUNTUPACKAGINGWIDGET_BUILDCMAKEPACKAGE_ID[] ="Ubuntu.Build.PackageCMake";
1176 const char UBUNTUPACKAGINGWIDGET_DEFAULT_MANIFEST[] =":/ubuntu/manifest.json.template";
1177 const char UBUNTUPACKAGINGWIDGET_DEFAULT_MYAPP[] =":/ubuntu/myapp.json.template";
1178-const char UBUNTUPACKAGINGWIDGET_DEFAULT_NAME[] ="com.ubuntu.developer.%0.%1";
1179+const char UBUNTUPACKAGINGWIDGET_DEFAULT_NAME[] ="%0.%1";
1180 const char UBUNTUPACKAGINGWIDGET_LOCAL_REVIEWER_INSTALLED[] = "Checking installed click reviewer tools package.";
1181 const char UBUNTUPACKAGINGWIDGET_ONFINISHED_LOCAL_NO_EMULATOR_INSTALLED[] = "The package is not installed.";
1182 const char UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE[] = "Click Reviewers tools against %0";
1183@@ -380,7 +380,7 @@
1184 const char UBUNTU_MODE_WIKI_DISPLAYNAME[] = "Wiki";
1185
1186 const char UBUNTU_IRC[] = "http://webchat.freenode.net/?channels=ubuntu-app-devel";
1187-const char UBUNTU_API_ONLINE[] = "http://developer.ubuntu.com/api/devel/ubuntu-13.10/qml/ui-toolkit/overview-ubuntu-sdk.html";
1188+const char UBUNTU_API_ONLINE[] = "http://developer.ubuntu.com/api/qml/current";
1189 const char UBUNTU_API_OFFLINE[] = "%1/share/ubuntu-ui-toolkit/doc/html/overview-ubuntu-sdk.html";
1190 const char UBUNTU_COREAPPS[] = "https://launchpad.net/ubuntu-phone-coreapps/";
1191 const char UBUNTU_WIKI[] = "https://wiki.ubuntu.com/Touch";
1192
1193=== modified file 'src/ubuntu/ubuntukitmanager.cpp'
1194--- src/ubuntu/ubuntukitmanager.cpp 2014-11-14 11:29:05 +0000
1195+++ src/ubuntu/ubuntukitmanager.cpp 2015-01-08 08:00:01 +0000
1196@@ -82,7 +82,6 @@
1197 if (qtVersion->type() != QLatin1String(Constants::UBUNTU_QTVERSION_TYPE))
1198 continue;
1199
1200- qDebug()<<qtVersion->qmakeCommand().toFileInfo().absoluteFilePath();
1201 if (qtVersion->qmakeCommand().toFileInfo().absoluteFilePath() == QFileInfo(qmakePath).absoluteFilePath())
1202 return static_cast<UbuntuQtVersion*> (qtVersion);
1203 }
1204@@ -168,14 +167,14 @@
1205 continue;
1206
1207 UbuntuQtVersion* ver = static_cast<UbuntuQtVersion*> (qtVersion);
1208- if(ver->scriptVersion() < UbuntuQtVersion::minimalScriptVersion()) {
1209+ if(ver->scriptVersion() < UbuntuQtVersion::minimalScriptVersion() || !qtVersion->isValid()) {
1210 //we need to remove that QtVersion
1211 QFile::remove(ver->qmakeCommand().toString());
1212 QtSupport::QtVersionManager::removeVersion(ver);
1213 }
1214 }
1215
1216- // having a empty toolchains list will remove all autodetected kits for android
1217+ // having a empty toolchains list will remove all autodetected kits for ubuntu
1218 // exactly what we want in that case
1219 QList<ClickToolChain *> toolchains = clickToolChains();
1220
1221@@ -202,27 +201,6 @@
1222 existingKits << k;
1223 }
1224
1225-#if 0
1226- QMap<Abi::Architecture, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch;
1227- foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::versions()) {
1228- if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
1229- continue;
1230- QList<Abi> qtAbis = qtVersion->qtAbis();
1231- if (qtAbis.empty())
1232- continue;
1233- qtVersionsForArch[qtAbis.first().architecture()].append(qtVersion);
1234- }
1235-
1236- DeviceManager *dm = DeviceManager::instance();
1237- IDevice::ConstPtr device = dm->find(Core::Id(Constants::ANDROID_DEVICE_ID));
1238- if (device.isNull()) {
1239- // no device, means no sdk path
1240- foreach (Kit *k, existingKits)
1241- KitManager::deregisterKit(k);
1242- return;
1243- }
1244-#endif
1245-
1246 // create new kits
1247 QList<ProjectExplorer::Kit *> newKits;
1248 foreach (ClickToolChain *tc, toolchains) {
1249
1250=== modified file 'src/ubuntu/ubuntumanifesteditorwidget.cpp'
1251--- src/ubuntu/ubuntumanifesteditorwidget.cpp 2014-11-19 10:28:30 +0000
1252+++ src/ubuntu/ubuntumanifesteditorwidget.cpp 2015-01-08 08:00:01 +0000
1253@@ -308,7 +308,7 @@
1254 /* Commented out for bug #1219948 - https://bugs.launchpad.net/qtcreator-plugin-ubuntu/+bug/1219948
1255 QString userName = bzr->launchpadId();
1256 if (userName.isEmpty()) userName = QLatin1String(Constants::USERNAME);
1257- m_ui->lineEdit_maintainer->setText(QString(QLatin1String("com.ubuntu.developer.%0.%1")).arg(userName).arg(m_projectName));
1258+ m_ui->lineEdit_maintainer->setText(QString(QLatin1String("%0.%1")).arg(m_projectName).arg(userName));
1259 */
1260
1261 if(activePage() != General)
1262@@ -432,7 +432,7 @@
1263
1264 QString UbuntuManifestEditorWidget::createPackageName(const QString &userName, const QString &projectName)
1265 {
1266- return QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_DEFAULT_NAME)).arg(userName).arg(projectName);
1267+ return QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_DEFAULT_NAME)).arg(projectName).arg(userName);
1268 }
1269
1270 void UbuntuManifestEditorWidget::addMissingFieldsToManifest (QString fileName)
1271
1272=== modified file 'src/ubuntu/ubuntuplugin.cpp'
1273--- src/ubuntu/ubuntuplugin.cpp 2014-12-05 10:08:58 +0000
1274+++ src/ubuntu/ubuntuplugin.cpp 2015-01-08 08:00:01 +0000
1275@@ -42,6 +42,7 @@
1276 #include "ubuntutestcontrol.h"
1277 #include "ubuntupackageoutputparser.h"
1278 #include "ubuntuprojecthelper.h"
1279+#include "ubuntuscopefinalizer.h"
1280
1281 #include "wizards/ubuntuprojectapplicationwizard.h"
1282 #include "wizards/ubuntufirstrunwizard.h"
1283@@ -65,6 +66,7 @@
1284 #include <QtQml>
1285 #include <QFile>
1286 #include <QAction>
1287+#include <QProcess>
1288
1289 #include <coreplugin/icore.h>
1290 #include <stdint.h>
1291@@ -74,12 +76,28 @@
1292
1293 UbuntuPlugin::UbuntuPlugin()
1294 {
1295+ if(UbuntuClickTool::clickChrootSuffix() == QLatin1String(Constants::UBUNTU_CLICK_CHROOT_DEFAULT_NAME)) {
1296+#ifdef UBUNTU_BUILD_ROOT
1297+ Utils::FileName chrootAgent = Utils::FileName::fromString(QStringLiteral(UBUNTU_BUILD_ROOT));
1298+ chrootAgent.appendPath(QStringLiteral("chroot-agent")) //append dir
1299+ .appendPath(QStringLiteral("click-chroot-agent")); //append binary
1300
1301+ bool started = false;
1302+ if(chrootAgent.toFileInfo().isExecutable()) {
1303+ started = QProcess::startDetached(chrootAgent.toFileInfo().absoluteFilePath());
1304+ }
1305+ if(!started) {
1306+ QProcess::startDetached(QStringLiteral("click-chroot-agent"));
1307+ }
1308+#else
1309+ //start the chroot-agent
1310+ QProcess::startDetached(QStringLiteral("click-chroot-agent"));
1311+#endif
1312+ }
1313 }
1314
1315 UbuntuPlugin::~UbuntuPlugin()
1316 {
1317-
1318 }
1319
1320 bool UbuntuPlugin::initialize(const QStringList &arguments, QString *errorString)
1321@@ -272,8 +290,8 @@
1322 mproject->addAction(comm, ProjectExplorer::Constants::G_PROJECT_BUILD);
1323
1324 comm = Core::ActionManager::command("Ubuntu.Build.CreateManifest");
1325- if(comm)
1326- mproject->addAction(comm, ProjectExplorer::Constants::G_PROJECT_BUILD);
1327+ if(comm)
1328+ mproject->addAction(comm, ProjectExplorer::Constants::G_PROJECT_BUILD);
1329 }
1330
1331 //add ubuntu testcontrol to the object tree
1332
1333=== modified file 'src/ubuntu/ubuntuplugin.h'
1334--- src/ubuntu/ubuntuplugin.h 2014-11-27 16:23:51 +0000
1335+++ src/ubuntu/ubuntuplugin.h 2015-01-08 08:00:01 +0000
1336@@ -37,7 +37,6 @@
1337 #include "ubuntusettingsclickpage.h"
1338
1339 #include <extensionsystem/iplugin.h>
1340-#include <QProcess>
1341 #include <coreplugin/mimedatabase.h>
1342
1343 namespace Ubuntu {
1344
1345=== modified file 'src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp'
1346--- src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2014-12-02 14:20:35 +0000
1347+++ src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2015-01-08 08:00:01 +0000
1348@@ -83,7 +83,7 @@
1349 }
1350
1351 projectDialog->setField(QStringLiteral("ClickMaintainer"),whoami);
1352- projectDialog->setField(QStringLiteral("ClickDomain"),QString(QStringLiteral("com.ubuntu.developer.")+maintainer));
1353+ projectDialog->setField(QStringLiteral("ClickDomain"),maintainer);
1354
1355 QList<QComboBox*> boxes = projectDialog->findChildren<QComboBox*>();
1356 foreach(QComboBox* box, boxes){
1357
1358=== modified file 'src/ubuntu/wizards/ubuntuprojectmigrationwizard.cpp'
1359--- src/ubuntu/wizards/ubuntuprojectmigrationwizard.cpp 2014-12-02 14:43:15 +0000
1360+++ src/ubuntu/wizards/ubuntuprojectmigrationwizard.cpp 2015-01-08 08:00:01 +0000
1361@@ -569,7 +569,7 @@
1362 whoami = bzr->whoami();
1363 }
1364
1365- wizard()->setField(QStringLiteral("domain"),QString(QStringLiteral("com.ubuntu.developer.")+maintainer));
1366+ wizard()->setField(QStringLiteral("domain"),maintainer);
1367 wizard()->setField(QStringLiteral("maintainer"),whoami);
1368 }
1369
1370
1371=== modified file 'tests/manifest/manifest.json.template'
1372--- tests/manifest/manifest.json.template 2014-06-25 11:33:20 +0000
1373+++ tests/manifest/manifest.json.template 2015-01-08 08:00:01 +0000
1374@@ -1,5 +1,5 @@
1375 {
1376- "name": "com.ubuntu.developer.username.myapp",
1377+ "name": "myapp.username",
1378 "description": "description of myapp",
1379 "framework": "myFramework",
1380 "architecture": "all",
1381
1382=== modified file 'tests/manifest/tst_manifest.cpp'
1383--- tests/manifest/tst_manifest.cpp 2014-08-18 12:29:43 +0000
1384+++ tests/manifest/tst_manifest.cpp 2015-01-08 08:00:01 +0000
1385@@ -68,7 +68,7 @@
1386 void UbuntuManifestTest::testWriteName()
1387 {
1388 testWriteStringValue(
1389- QString("com.ubuntu.developer.name"),
1390+ QString("name"),
1391 &UbuntuClickManifest::setName,
1392 &UbuntuClickManifest::name);
1393 }

Subscribers

People subscribed via source and target branches