Merge lp:~marcustomlinson/unity-scopes-api/install_smartscopesproxy into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michal Hruby
Approved revision: 187
Merged at revision: 183
Proposed branch: lp:~marcustomlinson/unity-scopes-api/install_smartscopesproxy
Merge into: lp:unity-scopes-api/devel
Prerequisite: lp:~michihenning/unity-scopes-api/extra-scopes
Diff against target: 239 lines (+79/-33)
13 files modified
data/CMakeLists.txt (+7/-1)
data/Registry.ini.in (+2/-0)
data/SSRegistry.ini.in (+7/-0)
data/SSRuntime.ini.in (+5/-0)
data/scope-registry.conf.in (+1/-1)
data/smart-scopes-proxy.conf.in (+12/-0)
debian/libunity-scopes0.install (+1/-0)
include/unity/scopes/internal/DfltConfig.h.in (+1/-0)
smartscopesproxy/CMakeLists.txt (+2/-6)
smartscopesproxy/Runtime.ini.in (+0/-5)
smartscopesproxy/SSRegistry.ini.in (+0/-10)
smartscopesproxy/Zmq.ini.in (+0/-3)
smartscopesproxy/smartscopesproxy.cpp (+41/-7)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/install_smartscopesproxy
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michal Hruby (community) Approve
Michi Henning Pending
Review via email: mp+204678@code.launchpad.net

Commit message

Configured smartscopesproxy to be installed.

Description of the change

Configured smartscopesproxy to be installed.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks like it will work... in some cases anyway :) Hopefully we can get rid of some of this craziness soon enough.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
187. By Marcus Tomlinson

Merged devel

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/CMakeLists.txt'
2--- data/CMakeLists.txt 2014-01-28 04:02:36 +0000
3+++ data/CMakeLists.txt 2014-02-06 05:06:43 +0000
4@@ -6,7 +6,13 @@
5 configure_file(Runtime.ini.in Runtime.ini @ONLY)
6 configure_file(Registry.ini.in Registry.ini @ONLY)
7 configure_file(Zmq.ini.in Zmq.ini @ONLY)
8-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini ${CMAKE_CURRENT_BINARY_DIR}/Registry.ini ${CMAKE_CURRENT_BINARY_DIR}/Zmq.ini DESTINATION ${SCOPES_DEFAULT_CONFIGDIR})
9+configure_file(SSRuntime.ini.in SSRuntime.ini @ONLY)
10+configure_file(SSRegistry.ini.in SSRegistry.ini @ONLY)
11+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini ${CMAKE_CURRENT_BINARY_DIR}/Registry.ini ${CMAKE_CURRENT_BINARY_DIR}/SSRuntime.ini ${CMAKE_CURRENT_BINARY_DIR}/SSRegistry.ini ${CMAKE_CURRENT_BINARY_DIR}/Zmq.ini DESTINATION ${SCOPES_DEFAULT_CONFIGDIR})
12+
13+# upstart job for smart scopes proxy
14+configure_file(smart-scopes-proxy.conf.in smart-scopes-proxy.conf @ONLY)
15+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/smart-scopes-proxy.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions)
16
17 # upstart job for scope registry
18 configure_file(scope-registry.conf.in scope-registry.conf @ONLY)
19
20=== modified file 'data/Registry.ini.in'
21--- data/Registry.ini.in 2014-01-27 21:33:11 +0000
22+++ data/Registry.ini.in 2014-02-06 05:06:43 +0000
23@@ -5,3 +5,5 @@
24 Zmq.ConfigFile = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/Zmq.ini
25 Scope.InstallDir = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_DATADIR@/scopes
26 Scoperunner.Path = @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/scoperunner/scoperunner
27+SS.Registry.Identity = SSRegistry
28+SS.Registry.Endpoint = ipc:///tmp/SSRegistry
29
30=== added file 'data/SSRegistry.ini.in'
31--- data/SSRegistry.ini.in 1970-01-01 00:00:00 +0000
32+++ data/SSRegistry.ini.in 2014-02-06 05:06:43 +0000
33@@ -0,0 +1,7 @@
34+[Registry]
35+Middleware = Zmq
36+Zmq.Endpoint = ipc:///tmp/SSRegistry
37+Zmq.EndpointDir = /tmp
38+Zmq.ConfigFile = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/Zmq.ini
39+Scope.InstallDir = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_DATADIR@/scopes
40+Scoperunner.Path = @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/scoperunner/scoperunner
41
42=== added file 'data/SSRuntime.ini.in'
43--- data/SSRuntime.ini.in 1970-01-01 00:00:00 +0000
44+++ data/SSRuntime.ini.in 2014-02-06 05:06:43 +0000
45@@ -0,0 +1,5 @@
46+[Runtime]
47+Registry.Identity = SSRegistry
48+Registry.ConfigFile = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/SSRegistry.ini
49+Default.Middleware = Zmq
50+Zmq.ConfigFile = @CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/Zmq.ini
51
52=== modified file 'data/scope-registry.conf.in'
53--- data/scope-registry.conf.in 2013-12-04 10:35:00 +0000
54+++ data/scope-registry.conf.in 2014-02-06 05:06:43 +0000
55@@ -1,7 +1,7 @@
56 description "Scope registry"
57 author "Michal Hruby <michal.hruby@canonical.com>"
58
59-start on started dbus
60+start on started smart-scopes-proxy
61 stop on desktop-end
62
63 respawn
64
65=== added file 'data/smart-scopes-proxy.conf.in'
66--- data/smart-scopes-proxy.conf.in 1970-01-01 00:00:00 +0000
67+++ data/smart-scopes-proxy.conf.in 2014-02-06 05:06:43 +0000
68@@ -0,0 +1,12 @@
69+description "Smart scopes proxy"
70+author "Marcus Tomlinson <marcus.tomlinson@canonical.com>"
71+
72+start on started dbus
73+stop on desktop-end
74+
75+respawn
76+respawn limit 10 60
77+
78+expect stop
79+
80+exec @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/smartscopesproxy/smartscopesproxy upstart
81
82=== modified file 'debian/libunity-scopes0.install'
83--- debian/libunity-scopes0.install 2014-02-04 09:28:19 +0000
84+++ debian/libunity-scopes0.install 2014-02-06 05:06:43 +0000
85@@ -1,6 +1,7 @@
86 usr/lib/*/libunity-scopes.so.*
87 usr/lib/*/scoperegistry/*
88 usr/lib/*/scoperunner/*
89+usr/lib/*/smartscopesproxy/*
90 usr/share/unity-scopes-api/*.ini
91 usr/share/unity-scopes-api/scopes
92 usr/share/upstart/sessions/*.conf
93
94=== modified file 'include/unity/scopes/internal/DfltConfig.h.in'
95--- include/unity/scopes/internal/DfltConfig.h.in 2014-02-05 13:08:06 +0000
96+++ include/unity/scopes/internal/DfltConfig.h.in 2014-02-06 05:06:43 +0000
97@@ -29,6 +29,7 @@
98 {
99
100 static constexpr const char* DFLT_RUNTIME_INI = "@CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/Runtime.ini";
101+static constexpr const char* DFLT_SS_RUNTIME_INI = "@CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/SSRuntime.ini";
102 static constexpr const char* DFLT_REGISTRY_INI = "@CMAKE_INSTALL_PREFIX@/@SCOPES_DEFAULT_CONFIGDIR@/Registry.ini";
103
104 } // namespace internal
105
106=== modified file 'smartscopesproxy/CMakeLists.txt'
107--- smartscopesproxy/CMakeLists.txt 2014-01-28 11:42:06 +0000
108+++ smartscopesproxy/CMakeLists.txt 2014-02-06 05:06:43 +0000
109@@ -1,10 +1,6 @@
110-configure_file(SSRegistry.ini.in ${CMAKE_CURRENT_BINARY_DIR}/SSRegistry.ini)
111-configure_file(Runtime.ini.in ${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini)
112-configure_file(Zmq.ini.in ${CMAKE_CURRENT_BINARY_DIR}/Zmq.ini)
113-
114-add_definitions(-DSS_RUNTIME_PATH="${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini")
115-
116 set(SRC smartscopesproxy.cpp)
117
118 add_executable(smartscopesproxy ${SRC})
119 target_link_libraries(smartscopesproxy ${UNITY_SCOPES_LIB} ${OTHER_LIBS})
120+
121+install(TARGETS smartscopesproxy RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/smartscopesproxy)
122
123=== removed file 'smartscopesproxy/Runtime.ini.in'
124--- smartscopesproxy/Runtime.ini.in 2014-01-22 17:18:11 +0000
125+++ smartscopesproxy/Runtime.ini.in 1970-01-01 00:00:00 +0000
126@@ -1,5 +0,0 @@
127-[Runtime]
128-Registry.Identity = SSRegistry
129-Registry.ConfigFile = @CMAKE_CURRENT_BINARY_DIR@/SSRegistry.ini
130-Default.Middleware = Zmq
131-Zmq.ConfigFile = @CMAKE_CURRENT_BINARY_DIR@/Zmq.ini
132
133=== removed file 'smartscopesproxy/SSRegistry.ini.in'
134--- smartscopesproxy/SSRegistry.ini.in 2014-01-22 17:18:11 +0000
135+++ smartscopesproxy/SSRegistry.ini.in 1970-01-01 00:00:00 +0000
136@@ -1,10 +0,0 @@
137-[Runtime]
138-Registry.Identity = SSRegistry
139-
140-[Registry]
141-Middleware = Zmq
142-Zmq.Endpoint = ipc:///tmp/SSRegistry
143-Zmq.EndpointDir = /tmp
144-Zmq.ConfigFile = Zmq.ini
145-Scope.InstallDir = /tmp
146-Scoperunner.Path = /tmp
147
148=== removed file 'smartscopesproxy/Zmq.ini.in'
149--- smartscopesproxy/Zmq.ini.in 2014-01-22 17:18:11 +0000
150+++ smartscopesproxy/Zmq.ini.in 1970-01-01 00:00:00 +0000
151@@ -1,3 +0,0 @@
152-[Zmq]
153-EndpointDir.Public = /tmp
154-EndpointDir.Private = /tmp
155
156=== modified file 'smartscopesproxy/smartscopesproxy.cpp'
157--- smartscopesproxy/smartscopesproxy.cpp 2014-01-30 06:07:44 +0000
158+++ smartscopesproxy/smartscopesproxy.cpp 2014-02-06 05:06:43 +0000
159@@ -21,9 +21,15 @@
160 #include <unity/scopes/internal/smartscopes/SSScopeObject.h>
161 #include <unity/scopes/internal/smartscopes/SSRegistryObject.h>
162
163+#include <unity/scopes/internal/DfltConfig.h>
164+
165 #include <cassert>
166+#include <signal.h>
167+#include <libgen.h>
168 #include <iostream>
169+#include <unistd.h>
170
171+using namespace unity::scopes;
172 using namespace unity::scopes::internal;
173 using namespace unity::scopes::internal::smartscopes;
174
175@@ -35,13 +41,35 @@
176
177 int main(int argc, char* argv[])
178 {
179+ if (argc > 1 && (std::string("-h") == argv[1] || std::string("--help") == argv[1]))
180+ {
181+ char const* prog_name = basename(argv[0]);
182+ std::cout << "usage: " << prog_name << " [sss_url] [runtime.ini]" << std::endl;
183+ return 0;
184+ }
185+
186 int exit_status = 1;
187
188- std::string server_url_env;
189- if (argc > 1)
190- {
191- server_url_env = "SMART_SCOPES_SERVER=" + std::string(argv[1]);
192- ::putenv(const_cast<char*>(server_url_env.c_str()));
193+ bool sig_upstart = false;
194+ std::string config_file;
195+
196+ // check for "upstart" as first arg
197+ if (argc > 1 && std::string(argv[1]) == "upstart")
198+ {
199+ sig_upstart = true;
200+ }
201+ else
202+ {
203+ // argv[1]: server_url_env
204+ std::string server_url_env;
205+ if (argc > 1)
206+ {
207+ server_url_env = "SMART_SCOPES_SERVER=" + std::string(argv[1]);
208+ ::putenv(const_cast<char*>(server_url_env.c_str()));
209+ }
210+
211+ // argv[2]: config_file
212+ config_file = argc > 2 ? argv[2] : "";
213 }
214
215 try
216@@ -54,8 +82,8 @@
217 uint const ss_reg_refresh_rate = 60 * 24; // 24 hour refresh
218
219 // Instantiate SS registry and scopes runtimes
220- RuntimeImpl::UPtr reg_rt = RuntimeImpl::create(ss_reg_id, SS_RUNTIME_PATH);
221- RuntimeImpl::UPtr scope_rt = RuntimeImpl::create(ss_scope_id, SS_RUNTIME_PATH);
222+ RuntimeImpl::UPtr reg_rt = RuntimeImpl::create(ss_reg_id, DFLT_SS_RUNTIME_INI);
223+ RuntimeImpl::UPtr scope_rt = RuntimeImpl::create(ss_scope_id, config_file);
224
225 // Get registry config
226 RegistryConfig reg_conf(ss_reg_id, reg_rt->registry_configfile());
227@@ -77,6 +105,12 @@
228 reg_mw->add_registry_object(reg_rt->registry_identity(), reg);
229 scope_mw->add_dflt_scope_object(std::move(scope));
230
231+ if (sig_upstart)
232+ {
233+ // signal to upstart that we are ready
234+ kill(getpid(), SIGSTOP);
235+ }
236+
237 // Wait until shutdown
238 scope_mw->wait_for_shutdown();
239 reg_mw->wait_for_shutdown();

Subscribers

People subscribed via source and target branches

to all changes: