2 * Copyright (C) 2013 Canonical, Ltd.
5 * Michal Hruby <michal.hruby@canonical.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25#include "registry-tracker.h"
28RegistryTracker::RegistryTracker(QStringList const& scopes, bool systemScopes, bool serverScopes):
30 m_systemScopes(systemScopes),
31 m_serverScopes(serverScopes),
33 m_endpoints_dir(QDir::temp().filePath("scope-dev-endpoints.XXXXXX"))
38RegistryTracker::~RegistryTracker()
40 if (m_registry.state() != QProcess::NotRunning) {
41 m_registry.terminate();
42 m_registry.waitForFinished(5000);
47#define RUNTIME_CONFIG \
49"Registry.Identity = Registry\n" \
50"Registry.ConfigFile = %1\n" \
51"Default.Middleware = Zmq\n" \
52"Zmq.ConfigFile = %2\n"
54#define REGISTRY_CONFIG \
57"Zmq.Endpoint = ipc://%1/Registry\n" \
58"Zmq.EndpointDir = %2\n" \
59"Zmq.ConfigFile = %3\n" \
60"Scope.InstallDir = %4\n" \
61"Scoperunner.Path = %5\n" \
66"EndpointDir.Public = %1\n" \
67"EndpointDir.Private = %2\n"
69void RegistryTracker::runRegistry()
71 QDir tmp(QDir::temp());
72 m_runtime_config.setFileTemplate(tmp.filePath("Runtime.ini.XXXXXX"));
73 m_registry_config.setFileTemplate(tmp.filePath("Registry.ini.XXXXXX"));
74 m_mw_config.setFileTemplate(tmp.filePath("Zmq.ini.XXXXXX"));
76 if (!m_runtime_config.open() || !m_registry_config.open() || !m_mw_config.open() || !m_endpoints_dir.isValid()) {
77 qWarning("Unable to open temporary files!");
84 QStringList arguments;
85 arguments << "--variable=libdir";
86 arguments << "libunity-scopes";
87 pkg_config.start("pkg-config", arguments);
88 pkg_config.waitForFinished();
89 QByteArray libdir = pkg_config.readAllStandardOutput();
90 scopesLibdir = QDir(QString::fromLocal8Bit(libdir)).path().trimmed();
93 if (scopesLibdir.size() == 0) {
94 qWarning("Unable to find libunity-scopes package config file");
98 QString scopeRunnerPath = QDir(scopesLibdir).filePath("scoperunner/scoperunner");
100 QString runtime_ini = QString(RUNTIME_CONFIG).arg(m_registry_config.fileName()).arg(m_mw_config.fileName());
101 // FIXME: keep in sync with the SSRegistry config
102 QString serverRegistryConfig(m_serverScopes ? "SS.Registry.Identity = SSRegistry\nSS.Registry.Endpoint = ipc:///tmp/SSRegistry" : "");
103 QString scopeInstallDir(scopesLibdir + "/unity-scopes");
104 if (!m_systemScopes) {
105 m_scopeInstallDir.reset(new QTemporaryDir(tmp.filePath("scopes.XXXXXX")));
106 if (!m_scopeInstallDir->isValid()) {
107 qWarning("Unable to create temporary scopes directory!");
109 scopeInstallDir = m_scopeInstallDir->path();
111 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);
112 QString mw_ini = QString(MW_CONFIG).arg(m_endpoints_dir.path()).arg(m_endpoints_dir.path());
114 m_runtime_config.write(runtime_ini.toUtf8());
115 m_registry_config.write(registry_ini.toUtf8());
116 m_mw_config.write(mw_ini.toUtf8());
118 m_runtime_config.flush();
119 m_registry_config.flush();
122 qputenv("UNITY_SCOPES_RUNTIME_PATH", m_runtime_config.fileName().toLocal8Bit());
124 QString registryBin(QDir(scopesLibdir).filePath("scoperegistry/scoperegistry"));
125 QStringList arguments;
126 arguments << m_runtime_config.fileName();
127 arguments << m_scopes;
129 m_registry.setProcessChannelMode(QProcess::ForwardedChannels);
130 m_registry.start(registryBin, arguments);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list