Merge lp:~mhr3/unity8/extend-scope-tool into lp:unity8

Proposed by Michal Hruby
Status: Superseded
Proposed branch: lp:~mhr3/unity8/extend-scope-tool
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/new-scopes
Diff against target: 143 lines (+52/-14)
3 files modified
tools/registry-tracker.cpp (+18/-4)
tools/registry-tracker.h (+7/-2)
tools/scopetool.cpp (+27/-8)
To merge this branch: bzr merge lp:~mhr3/unity8/extend-scope-tool
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+209955@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-14.

Commit message

Change and extend the way non-installed scopes are started with the scope-tool.

Description of the change

Change and extend the way non-installed scopes are started with the scope-tool.

Note that this requires Qt5.2.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mhr3/unity8/extend-scope-tool updated
759. By PS Jenkins bot

Resync trunk

760. By Michal Hruby

Change and extend the way non-installed scopes are started with the scope-tool

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/registry-tracker.cpp'
2--- tools/registry-tracker.cpp 2013-12-20 15:27:59 +0000
3+++ tools/registry-tracker.cpp 2014-03-14 17:18:47 +0000
4@@ -25,8 +25,10 @@
5 #include "registry-tracker.h"
6
7
8-RegistryTracker::RegistryTracker(QString const& scope_dir):
9- m_scopeDir(scope_dir),
10+RegistryTracker::RegistryTracker(QStringList const& scopes, bool systemScopes, bool serverScopes):
11+ m_scopes(scopes),
12+ m_systemScopes(systemScopes),
13+ m_serverScopes(serverScopes),
14 m_registry(nullptr),
15 m_endpoints_dir(QDir::temp().filePath("scope-dev-endpoints.XXXXXX"))
16 {
17@@ -56,7 +58,8 @@
18 "Zmq.EndpointDir = %2\n" \
19 "Zmq.ConfigFile = %3\n" \
20 "Scope.InstallDir = %4\n" \
21-"Scoperunner.Path = %5\n"
22+"Scoperunner.Path = %5\n" \
23+"%6"
24
25 #define MW_CONFIG \
26 "[Zmq]\n" \
27@@ -95,7 +98,17 @@
28 QString scopeRunnerPath = QDir(scopesLibdir).filePath("scoperunner/scoperunner");
29
30 QString runtime_ini = QString(RUNTIME_CONFIG).arg(m_registry_config.fileName()).arg(m_mw_config.fileName());
31- QString registry_ini = QString(REGISTRY_CONFIG).arg(m_endpoints_dir.path()).arg(m_endpoints_dir.path()).arg(m_mw_config.fileName()).arg(m_scopeDir).arg(scopeRunnerPath);
32+ // FIXME: keep in sync with the SSRegistry config
33+ QString serverRegistryConfig(m_serverScopes ? "SS.Registry.Identity = SSRegistry\nSS.Registry.Endpoint = ipc:///tmp/SSRegistry" : "");
34+ QString scopeInstallDir(scopesLibdir + "/unity-scopes");
35+ if (!m_systemScopes) {
36+ m_scopeInstallDir.reset(new QTemporaryDir(tmp.filePath("scopes.XXXXXX")));
37+ if (!m_scopeInstallDir->isValid()) {
38+ qWarning("Unable to create temporary scopes directory!");
39+ }
40+ scopeInstallDir = m_scopeInstallDir->path();
41+ }
42+ QString registry_ini = QString(REGISTRY_CONFIG).arg(m_endpoints_dir.path()).arg(m_endpoints_dir.path()).arg(m_mw_config.fileName()).arg(scopeInstallDir).arg(scopeRunnerPath).arg(serverRegistryConfig);
43 QString mw_ini = QString(MW_CONFIG).arg(m_endpoints_dir.path()).arg(m_endpoints_dir.path());
44
45 m_runtime_config.write(runtime_ini.toUtf8());
46@@ -111,6 +124,7 @@
47 QString registryBin(QDir(scopesLibdir).filePath("scoperegistry/scoperegistry"));
48 QStringList arguments;
49 arguments << m_runtime_config.fileName();
50+ arguments << m_scopes;
51
52 m_registry.start(registryBin, arguments);
53 }
54
55=== modified file 'tools/registry-tracker.h'
56--- tools/registry-tracker.h 2013-12-20 15:27:59 +0000
57+++ tools/registry-tracker.h 2014-03-14 17:18:47 +0000
58@@ -22,12 +22,14 @@
59 #include <QTemporaryFile>
60 #include <QTemporaryDir>
61 #include <QDebug>
62+#include <QStringList>
63+#include <QScopedPointer>
64
65
66 class RegistryTracker
67 {
68 public:
69- RegistryTracker(QString const&);
70+ RegistryTracker(QStringList const&, bool, bool);
71 ~RegistryTracker();
72
73 QProcess* registry() const;
74@@ -35,10 +37,13 @@
75 private:
76 void runRegistry();
77
78- QString m_scopeDir;
79+ QStringList m_scopes;
80+ bool m_systemScopes;
81+ bool m_serverScopes;
82 QProcess m_registry;
83 QTemporaryDir m_endpoints_dir;
84 QTemporaryFile m_runtime_config;
85 QTemporaryFile m_registry_config;
86 QTemporaryFile m_mw_config;
87+ QScopedPointer<QTemporaryDir> m_scopeInstallDir;
88 };
89
90=== modified file 'tools/scopetool.cpp'
91--- tools/scopetool.cpp 2014-01-03 10:26:36 +0000
92+++ tools/scopetool.cpp 2014-03-14 17:18:47 +0000
93@@ -24,6 +24,8 @@
94 #include <QtQml/QQmlContext>
95 #include <QScopedPointer>
96 #include <QDebug>
97+#include <QCommandLineParser>
98+#include <QCommandLineOption>
99 #include <libintl.h>
100
101
102@@ -46,16 +48,33 @@
103 QGuiApplication *application;
104 application = new QGuiApplication(argc, argv);
105
106- QStringList arguments = application->arguments();
107- QString scopesDir;
108- if (arguments.contains("--scope-dir")) {
109- int idx = arguments.indexOf("--scope-dir");
110- scopesDir = arguments[idx+1];
111- }
112+ QCommandLineParser parser;
113+ parser.setApplicationDescription("Unity Scope Tool\n\n"
114+ "This tool allows development and testing of scopes. Running it without\n"
115+ "any arguments will open a session to all scopes available on the system.\n"
116+ "Otherwise passing a path to a scope config file will open a session with\n"
117+ "only that scope (assuming that the binary implementing the scope can be\n"
118+ "found in the same directory as the config file).");
119+ parser.addHelpOption();
120+ parser.addPositionalArgument("scopes", "Paths to scope config files to spawn, optionally.", "[scopes...]");
121+
122+ QCommandLineOption includeSystemScopes("include-system-scopes",
123+ "Initialize the registry with scopes installed on this system");
124+ QCommandLineOption includeServerScopes("include-server-scopes",
125+ "Initialize the registry with scopes on the default server");
126+
127+ parser.addOption(includeServerScopes);
128+ parser.addOption(includeSystemScopes);
129+
130+ parser.process(*application);
131+
132+ QStringList extraScopes = parser.positionalArguments();
133
134 QScopedPointer<RegistryTracker> tracker;
135- if (!scopesDir.isEmpty()) {
136- tracker.reset(new RegistryTracker(scopesDir));
137+ if (!extraScopes.isEmpty()) {
138+ bool systemScopes = parser.isSet(includeSystemScopes);
139+ bool serverScopes = parser.isSet(includeServerScopes);
140+ tracker.reset(new RegistryTracker(extraScopes, systemScopes, serverScopes));
141 }
142
143 resolveIconTheme();

Subscribers

People subscribed via source and target branches