Merge lp:~phablet-team/trust-store/mir-deprecations into lp:trust-store

Proposed by Cemil Azizoglu on 2017-02-17
Status: Needs review
Proposed branch: lp:~phablet-team/trust-store/mir-deprecations
Merge into: lp:trust-store
Diff against target: 407 lines (+67/-124)
7 files modified
debian/control.in (+2/-1)
src/core/trust/mir/agent.cpp (+19/-33)
src/core/trust/mir/agent.h (+1/-13)
tests/CMakeLists.txt (+41/-76)
tests/cached_agent_test.cpp (+2/-0)
tests/mir_agent_test.cpp (+1/-1)
tests/remote_agent_test.cpp (+1/-0)
To merge this branch: bzr merge lp:~phablet-team/trust-store/mir-deprecations
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) 2017-02-17 Approve on 2017-03-31
Review via email: mp+317695@code.launchpad.net

Commit message

Updated to eliminate the Mir deprecations.

Description of the change

Updated to eliminate the Mir deprecations.

The legacy entry points will soon be removed from Mir.

To post a comment you must log in.
166. By Cemil Azizoglu on 2017-02-20

Require mirclient 0.26.1

Alberto Aguirre (albaguirre) wrote :

LGTM,

Nit, "constexpr const" is redundant in this case.

review: Approve
167. By Brandon Schaefer on 2017-04-04

* Fix up for zesty

168. By Brandon Schaefer on 2017-04-05

* Opps wrong files

Unmerged revisions

168. By Brandon Schaefer on 2017-04-05

* Opps wrong files

167. By Brandon Schaefer on 2017-04-04

* Fix up for zesty

166. By Cemil Azizoglu on 2017-02-20

Require mirclient 0.26.1

165. By Cemil Azizoglu on 2017-02-17

Updated to do away with Mir 0.26.1 deprecations.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control.in'
2--- debian/control.in 2016-03-24 18:14:51 +0000
3+++ debian/control.in 2017-04-05 02:45:31 +0000
4@@ -2,6 +2,7 @@
5 Priority: optional
6 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
7 Build-Depends: cmake,
8+ cmake-extras,
9 debhelper (>= 9),
10 doxygen,
11 google-mock,
12@@ -18,7 +19,7 @@
13 libgoogle-glog-dev,
14 libgtest-dev,
15 libjson-c-dev,
16- libmirclient-dev [amd64 arm64 i386 armhf],
17+ libmirclient-dev (>= 0.26.1) [amd64 arm64 i386 armhf],
18 libprocess-cpp-dev,
19 libsqlite3-dev,
20 lsb-release,
21
22=== modified file 'src/core/trust/mir/agent.cpp'
23--- src/core/trust/mir/agent.cpp 2015-12-11 08:58:11 +0000
24+++ src/core/trust/mir/agent.cpp 2017-04-05 02:45:31 +0000
25@@ -38,27 +38,6 @@
26 return lhs.icon == rhs.icon && lhs.id == rhs.id && lhs.name == rhs.name;
27 }
28
29-// Invoked whenever a request for creation of pre-authenticated fds succeeds.
30-void mir::PromptSessionVirtualTable::mir_client_fd_callback(MirPromptSession */*prompt_session*/, size_t count, int const* fds, void* context)
31-{
32- if (count == 0)
33- return;
34-
35- auto ctxt = static_cast<mir::PromptSessionVirtualTable::Context*>(context);
36-
37- if (not ctxt)
38- return;
39-
40- ctxt->fd = fds[0];
41-
42- // Upstart enables FD_CLOEXEC by default. We have to counteract.
43- if (::fcntl(ctxt->fd, F_SETFD, 0) == -1) throw std::system_error
44- {
45- errno,
46- std::system_category()
47- };
48-}
49-
50 mir::PromptSessionVirtualTable::PromptSessionVirtualTable(MirPromptSession* prompt_session)
51 : prompt_session(prompt_session)
52 {
53@@ -76,21 +55,28 @@
54 int mir::PromptSessionVirtualTable::new_fd_for_prompt_provider()
55 {
56 static const unsigned int fd_count = 1;
57-
58- mir::PromptSessionVirtualTable::Context context;
59-
60- mir_wait_for(mir_prompt_session_new_fds_for_prompt_providers(
61- prompt_session,
62- fd_count,
63- PromptSessionVirtualTable::mir_client_fd_callback,
64- &context));
65-
66- if (context.fd == Context::invalid_fd) throw std::runtime_error
67+ // Marks the value of an invalid fd.
68+ static constexpr const int invalid_fd{-1};
69+ int fd;
70+
71+ mir_prompt_session_new_fds_for_prompt_providers_sync(
72+ prompt_session,
73+ fd_count,
74+ &fd);
75+
76+ if (fd == invalid_fd) throw std::runtime_error
77 {
78 "Could not acquire pre-authenticated file descriptors for Mir prompt session."
79 };
80
81- return context.fd;
82+ // Upstart enables FD_CLOEXEC by default. We have to counteract.
83+ if (::fcntl(fd, F_SETFD, 0) == -1) throw std::system_error
84+ {
85+ errno,
86+ std::system_category()
87+ };
88+
89+ return fd;
90 }
91
92 void mir::PromptSessionVirtualTable::release_sync()
93@@ -116,7 +102,7 @@
94 // The process id of the requesting app/service
95 core::trust::Pid app_pid,
96 // Callback handling prompt session state changes.
97- mir_prompt_session_state_change_callback cb,
98+ MirPromptSessionStateChangeCallback cb,
99 // Callback context
100 void* context)
101 {
102
103=== modified file 'src/core/trust/mir/agent.h'
104--- src/core/trust/mir/agent.h 2015-11-26 15:25:34 +0000
105+++ src/core/trust/mir/agent.h 2017-04-05 02:45:31 +0000
106@@ -58,18 +58,6 @@
107 // Just a convenience typedef
108 typedef std::shared_ptr<PromptSessionVirtualTable> Ptr;
109
110- // Just a helper struct to be passed to client_fd_callbacks.
111- struct Context
112- {
113- // Marks the value of an invalid fd.
114- static constexpr const int invalid_fd{-1};
115- // The fd contained within this context instance.
116- int fd{invalid_fd};
117- };
118-
119- // Invoked whenever a request for creation of pre-authenticated fds succeeds.
120- static void mir_client_fd_callback(MirPromptSession */*prompt_session*/, size_t count, int const* fds, void* context);
121-
122 // Create a MirPromptSessionVirtualTable for a given prompt session instance.
123 // Please note that no change of ownwership is happening here. Instead, we expect
124 // the calling code to handle object lifetimes.
125@@ -111,7 +99,7 @@
126 // The process id of the requesting app/service
127 Pid app_pid,
128 // Callback handling prompt session state changes.
129- mir_prompt_session_state_change_callback cb,
130+ MirPromptSessionStateChangeCallback cb,
131 // Callback context
132 void* context);
133 protected:
134
135=== modified file 'tests/CMakeLists.txt'
136--- tests/CMakeLists.txt 2016-01-11 09:51:51 +0000
137+++ tests/CMakeLists.txt 2017-04-05 02:45:31 +0000
138@@ -1,11 +1,6 @@
139 include_directories(${CMAKE_BINARY_DIR}/src)
140
141-# Build with system gmock and embedded gtest
142-set (GMOCK_INCLUDE_DIR "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
143-set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
144-set (GTEST_INCLUDE_DIR "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
145-
146-add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
147+find_package(GMock)
148
149 pkg_check_modules(DBUS dbus-1)
150
151@@ -13,12 +8,22 @@
152
153 configure_file(test_data.h.in test_data.h @ONLY)
154
155+include(CheckCXXCompilerFlag)
156+check_cxx_compiler_flag(-Wgnu-zero-variadic-macro-arguments HAS_W_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
157+
158+if (HAS_W_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
159+ # INSTANTIATE_TEST_CASE_P hits this like a slice of lemon wrapped around a large gold brick.
160+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
161+else()
162+ # GCC is a bit less flexible than clang and needs a bigger hammer...
163+ # Work around the Google Test headers not being C++11 friendly (LP: #1658604)
164+ string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
165+endif()
166+
167 include_directories(
168 ${CMAKE_SOURCE_DIR}/src
169
170 ${CMAKE_CURRENT_BINARY_DIR}
171- ${GMOCK_INCLUDE_DIR}
172- ${GTEST_INCLUDE_DIR}
173 ${PROCESS_CPP_INCLUDE_DIRS}
174 ${DBUS_INCLUDE_DIRS}
175 )
176@@ -91,10 +96,8 @@
177
178 trust-store
179
180- gmock
181-
182- gtest
183- gtest_main
184+ ${GMOCK_LIBRARIES}
185+ ${GTEST_BOTH_LIBRARIES}
186 )
187
188 target_link_libraries(
189@@ -102,10 +105,8 @@
190
191 trust-store
192
193- gmock
194-
195- gtest
196- gtest_main
197+ ${GMOCK_LIBRARIES}
198+ ${GTEST_BOTH_LIBRARIES}
199 )
200
201 target_link_libraries(
202@@ -113,11 +114,8 @@
203
204 trust-store
205
206- gmock
207-
208- gtest
209- gtest_main
210-
211+ ${GMOCK_LIBRARIES}
212+ ${GTEST_BOTH_LIBRARIES}
213 ${PROCESS_CPP_LIBRARIES}
214 )
215
216@@ -126,11 +124,8 @@
217
218 trust-store
219
220- gmock
221-
222- gtest
223- gtest_main
224-
225+ ${GMOCK_LIBRARIES}
226+ ${GTEST_BOTH_LIBRARIES}
227 ${PROCESS_CPP_LIBRARIES}
228 )
229
230@@ -139,11 +134,8 @@
231
232 trust-store
233
234- gmock
235-
236- gtest
237- gtest_main
238-
239+ ${GMOCK_LIBRARIES}
240+ ${GTEST_BOTH_LIBRARIES}
241 ${PROCESS_CPP_LIBRARIES}
242 )
243
244@@ -152,11 +144,8 @@
245
246 trust-store
247
248- gmock
249-
250- gtest
251- gtest_main
252-
253+ ${GMOCK_LIBRARIES}
254+ ${GTEST_BOTH_LIBRARIES}
255 ${PROCESS_CPP_LIBRARIES}
256 )
257
258@@ -165,11 +154,8 @@
259
260 trust-store
261
262- gmock
263-
264- gtest
265- gtest_main
266-
267+ ${GMOCK_LIBRARIES}
268+ ${GTEST_BOTH_LIBRARIES}
269 ${PROCESS_CPP_LIBRARIES}
270 )
271
272@@ -178,11 +164,8 @@
273
274 trust-store
275
276- gmock
277-
278- gtest
279- gtest_main
280-
281+ ${GMOCK_LIBRARIES}
282+ ${GTEST_BOTH_LIBRARIES}
283 ${PROCESS_CPP_LIBRARIES}
284 )
285
286@@ -192,11 +175,8 @@
287
288 trust-store
289
290- gmock
291-
292- gtest
293- gtest_main
294-
295+ ${GMOCK_LIBRARIES}
296+ ${GTEST_BOTH_LIBRARIES}
297 ${PROCESS_CPP_LIBRARIES}
298 )
299
300@@ -206,11 +186,8 @@
301 trust-store
302 trust-stored
303
304- gmock
305-
306- gtest
307- gtest_main
308-
309+ ${GMOCK_LIBRARIES}
310+ ${GTEST_BOTH_LIBRARIES}
311 ${PROCESS_CPP_LIBRARIES}
312 )
313
314@@ -220,11 +197,8 @@
315 trust-store
316 trust-stored
317
318- gmock
319-
320- gtest
321- gtest_main
322-
323+ ${GMOCK_LIBRARIES}
324+ ${GTEST_BOTH_LIBRARIES}
325 ${PROCESS_CPP_LIBRARIES}
326 )
327
328@@ -233,11 +207,8 @@
329
330 trust-store-preseed-helper
331
332- gmock
333-
334- gtest
335- gtest_main
336-
337+ ${GMOCK_LIBRARIES}
338+ ${GTEST_BOTH_LIBRARIES}
339 ${PROCESS_CPP_LIBRARIES}
340 )
341
342@@ -277,11 +248,8 @@
343 trust-store
344 xdg
345
346- gmock
347-
348- gtest
349- gtest_main
350-
351+ ${GMOCK_LIBRARIES}
352+ ${GTEST_BOTH_LIBRARIES}
353 ${PROCESS_CPP_LIBRARIES}
354 )
355
356@@ -290,11 +258,8 @@
357
358 trust-store
359
360- gmock
361-
362- gtest
363- gtest_main
364-
365+ ${GMOCK_LIBRARIES}
366+ ${GTEST_BOTH_LIBRARIES}
367 ${PROCESS_CPP_LIBRARIES}
368 )
369
370
371=== modified file 'tests/cached_agent_test.cpp'
372--- tests/cached_agent_test.cpp 2014-08-19 14:11:30 +0000
373+++ tests/cached_agent_test.cpp 2017-04-05 02:45:31 +0000
374@@ -22,6 +22,8 @@
375 #include "mock_store.h"
376 #include "the.h"
377
378+#include <random>
379+
380 namespace
381 {
382 struct MockReporter : public core::trust::CachedAgent::Reporter
383
384=== modified file 'tests/mir_agent_test.cpp'
385--- tests/mir_agent_test.cpp 2015-11-26 15:25:34 +0000
386+++ tests/mir_agent_test.cpp 2017-04-05 02:45:31 +0000
387@@ -66,7 +66,7 @@
388 // The process id of the requesting app/service
389 core::trust::Pid app_pid,
390 // Callback handling prompt session state changes.
391- mir_prompt_session_state_change_callback,
392+ MirPromptSessionStateChangeCallback,
393 // Callback context
394 void*));
395 };
396
397=== modified file 'tests/remote_agent_test.cpp'
398--- tests/remote_agent_test.cpp 2016-01-11 21:28:55 +0000
399+++ tests/remote_agent_test.cpp 2017-04-05 02:45:31 +0000
400@@ -34,6 +34,7 @@
401 #include <gtest/gtest.h>
402
403 #include <thread>
404+#include <random>
405
406 namespace
407 {

Subscribers

People subscribed via source and target branches

to all changes: