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

Proposed by Cemil Azizoglu
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) Approve
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

Require mirclient 0.26.1

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM,

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

review: Approve
167. By Brandon Schaefer

* Fix up for zesty

168. By Brandon Schaefer

* Opps wrong files

Unmerged revisions

168. By Brandon Schaefer

* Opps wrong files

167. By Brandon Schaefer

* Fix up for zesty

166. By Cemil Azizoglu

Require mirclient 0.26.1

165. By Cemil Azizoglu

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
=== modified file 'debian/control.in'
--- debian/control.in 2016-03-24 18:14:51 +0000
+++ debian/control.in 2017-04-05 02:45:31 +0000
@@ -2,6 +2,7 @@
2Priority: optional2Priority: optional
3Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>3Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
4Build-Depends: cmake,4Build-Depends: cmake,
5 cmake-extras,
5 debhelper (>= 9),6 debhelper (>= 9),
6 doxygen,7 doxygen,
7 google-mock,8 google-mock,
@@ -18,7 +19,7 @@
18 libgoogle-glog-dev,19 libgoogle-glog-dev,
19 libgtest-dev,20 libgtest-dev,
20 libjson-c-dev,21 libjson-c-dev,
21 libmirclient-dev [amd64 arm64 i386 armhf],22 libmirclient-dev (>= 0.26.1) [amd64 arm64 i386 armhf],
22 libprocess-cpp-dev,23 libprocess-cpp-dev,
23 libsqlite3-dev,24 libsqlite3-dev,
24 lsb-release,25 lsb-release,
2526
=== modified file 'src/core/trust/mir/agent.cpp'
--- src/core/trust/mir/agent.cpp 2015-12-11 08:58:11 +0000
+++ src/core/trust/mir/agent.cpp 2017-04-05 02:45:31 +0000
@@ -38,27 +38,6 @@
38 return lhs.icon == rhs.icon && lhs.id == rhs.id && lhs.name == rhs.name;38 return lhs.icon == rhs.icon && lhs.id == rhs.id && lhs.name == rhs.name;
39}39}
4040
41// Invoked whenever a request for creation of pre-authenticated fds succeeds.
42void mir::PromptSessionVirtualTable::mir_client_fd_callback(MirPromptSession */*prompt_session*/, size_t count, int const* fds, void* context)
43{
44 if (count == 0)
45 return;
46
47 auto ctxt = static_cast<mir::PromptSessionVirtualTable::Context*>(context);
48
49 if (not ctxt)
50 return;
51
52 ctxt->fd = fds[0];
53
54 // Upstart enables FD_CLOEXEC by default. We have to counteract.
55 if (::fcntl(ctxt->fd, F_SETFD, 0) == -1) throw std::system_error
56 {
57 errno,
58 std::system_category()
59 };
60}
61
62mir::PromptSessionVirtualTable::PromptSessionVirtualTable(MirPromptSession* prompt_session)41mir::PromptSessionVirtualTable::PromptSessionVirtualTable(MirPromptSession* prompt_session)
63 : prompt_session(prompt_session)42 : prompt_session(prompt_session)
64{43{
@@ -76,21 +55,28 @@
76int mir::PromptSessionVirtualTable::new_fd_for_prompt_provider()55int mir::PromptSessionVirtualTable::new_fd_for_prompt_provider()
77{56{
78 static const unsigned int fd_count = 1;57 static const unsigned int fd_count = 1;
7958 // Marks the value of an invalid fd.
80 mir::PromptSessionVirtualTable::Context context;59 static constexpr const int invalid_fd{-1};
8160 int fd;
82 mir_wait_for(mir_prompt_session_new_fds_for_prompt_providers(61
83 prompt_session,62 mir_prompt_session_new_fds_for_prompt_providers_sync(
84 fd_count,63 prompt_session,
85 PromptSessionVirtualTable::mir_client_fd_callback,64 fd_count,
86 &context));65 &fd);
8766
88 if (context.fd == Context::invalid_fd) throw std::runtime_error67 if (fd == invalid_fd) throw std::runtime_error
89 {68 {
90 "Could not acquire pre-authenticated file descriptors for Mir prompt session."69 "Could not acquire pre-authenticated file descriptors for Mir prompt session."
91 };70 };
9271
93 return context.fd;72 // Upstart enables FD_CLOEXEC by default. We have to counteract.
73 if (::fcntl(fd, F_SETFD, 0) == -1) throw std::system_error
74 {
75 errno,
76 std::system_category()
77 };
78
79 return fd;
94}80}
9581
96void mir::PromptSessionVirtualTable::release_sync()82void mir::PromptSessionVirtualTable::release_sync()
@@ -116,7 +102,7 @@
116 // The process id of the requesting app/service102 // The process id of the requesting app/service
117 core::trust::Pid app_pid,103 core::trust::Pid app_pid,
118 // Callback handling prompt session state changes.104 // Callback handling prompt session state changes.
119 mir_prompt_session_state_change_callback cb,105 MirPromptSessionStateChangeCallback cb,
120 // Callback context106 // Callback context
121 void* context)107 void* context)
122{108{
123109
=== modified file 'src/core/trust/mir/agent.h'
--- src/core/trust/mir/agent.h 2015-11-26 15:25:34 +0000
+++ src/core/trust/mir/agent.h 2017-04-05 02:45:31 +0000
@@ -58,18 +58,6 @@
58 // Just a convenience typedef58 // Just a convenience typedef
59 typedef std::shared_ptr<PromptSessionVirtualTable> Ptr;59 typedef std::shared_ptr<PromptSessionVirtualTable> Ptr;
6060
61 // Just a helper struct to be passed to client_fd_callbacks.
62 struct Context
63 {
64 // Marks the value of an invalid fd.
65 static constexpr const int invalid_fd{-1};
66 // The fd contained within this context instance.
67 int fd{invalid_fd};
68 };
69
70 // Invoked whenever a request for creation of pre-authenticated fds succeeds.
71 static void mir_client_fd_callback(MirPromptSession */*prompt_session*/, size_t count, int const* fds, void* context);
72
73 // Create a MirPromptSessionVirtualTable for a given prompt session instance.61 // Create a MirPromptSessionVirtualTable for a given prompt session instance.
74 // Please note that no change of ownwership is happening here. Instead, we expect62 // Please note that no change of ownwership is happening here. Instead, we expect
75 // the calling code to handle object lifetimes.63 // the calling code to handle object lifetimes.
@@ -111,7 +99,7 @@
111 // The process id of the requesting app/service99 // The process id of the requesting app/service
112 Pid app_pid,100 Pid app_pid,
113 // Callback handling prompt session state changes.101 // Callback handling prompt session state changes.
114 mir_prompt_session_state_change_callback cb,102 MirPromptSessionStateChangeCallback cb,
115 // Callback context103 // Callback context
116 void* context);104 void* context);
117protected:105protected:
118106
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2016-01-11 09:51:51 +0000
+++ tests/CMakeLists.txt 2017-04-05 02:45:31 +0000
@@ -1,11 +1,6 @@
1include_directories(${CMAKE_BINARY_DIR}/src)1include_directories(${CMAKE_BINARY_DIR}/src)
22
3# Build with system gmock and embedded gtest3find_package(GMock)
4set (GMOCK_INCLUDE_DIR "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
5set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
6set (GTEST_INCLUDE_DIR "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
7
8add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
94
10pkg_check_modules(DBUS dbus-1)5pkg_check_modules(DBUS dbus-1)
116
@@ -13,12 +8,22 @@
138
14configure_file(test_data.h.in test_data.h @ONLY)9configure_file(test_data.h.in test_data.h @ONLY)
1510
11include(CheckCXXCompilerFlag)
12check_cxx_compiler_flag(-Wgnu-zero-variadic-macro-arguments HAS_W_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
13
14if (HAS_W_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
15 # INSTANTIATE_TEST_CASE_P hits this like a slice of lemon wrapped around a large gold brick.
16 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
17else()
18 # GCC is a bit less flexible than clang and needs a bigger hammer...
19 # Work around the Google Test headers not being C++11 friendly (LP: #1658604)
20 string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
21endif()
22
16include_directories(23include_directories(
17 ${CMAKE_SOURCE_DIR}/src24 ${CMAKE_SOURCE_DIR}/src
1825
19 ${CMAKE_CURRENT_BINARY_DIR}26 ${CMAKE_CURRENT_BINARY_DIR}
20 ${GMOCK_INCLUDE_DIR}
21 ${GTEST_INCLUDE_DIR}
22 ${PROCESS_CPP_INCLUDE_DIRS}27 ${PROCESS_CPP_INCLUDE_DIRS}
23 ${DBUS_INCLUDE_DIRS}28 ${DBUS_INCLUDE_DIRS}
24)29)
@@ -91,10 +96,8 @@
9196
92 trust-store97 trust-store
9398
94 gmock99 ${GMOCK_LIBRARIES}
95100 ${GTEST_BOTH_LIBRARIES}
96 gtest
97 gtest_main
98)101)
99102
100target_link_libraries(103target_link_libraries(
@@ -102,10 +105,8 @@
102105
103 trust-store106 trust-store
104107
105 gmock108 ${GMOCK_LIBRARIES}
106109 ${GTEST_BOTH_LIBRARIES}
107 gtest
108 gtest_main
109)110)
110111
111target_link_libraries(112target_link_libraries(
@@ -113,11 +114,8 @@
113114
114 trust-store115 trust-store
115116
116 gmock117 ${GMOCK_LIBRARIES}
117118 ${GTEST_BOTH_LIBRARIES}
118 gtest
119 gtest_main
120
121 ${PROCESS_CPP_LIBRARIES}119 ${PROCESS_CPP_LIBRARIES}
122)120)
123121
@@ -126,11 +124,8 @@
126124
127 trust-store125 trust-store
128126
129 gmock127 ${GMOCK_LIBRARIES}
130128 ${GTEST_BOTH_LIBRARIES}
131 gtest
132 gtest_main
133
134 ${PROCESS_CPP_LIBRARIES}129 ${PROCESS_CPP_LIBRARIES}
135)130)
136131
@@ -139,11 +134,8 @@
139134
140 trust-store135 trust-store
141136
142 gmock137 ${GMOCK_LIBRARIES}
143138 ${GTEST_BOTH_LIBRARIES}
144 gtest
145 gtest_main
146
147 ${PROCESS_CPP_LIBRARIES}139 ${PROCESS_CPP_LIBRARIES}
148)140)
149141
@@ -152,11 +144,8 @@
152144
153 trust-store145 trust-store
154146
155 gmock147 ${GMOCK_LIBRARIES}
156148 ${GTEST_BOTH_LIBRARIES}
157 gtest
158 gtest_main
159
160 ${PROCESS_CPP_LIBRARIES}149 ${PROCESS_CPP_LIBRARIES}
161)150)
162151
@@ -165,11 +154,8 @@
165154
166 trust-store155 trust-store
167156
168 gmock157 ${GMOCK_LIBRARIES}
169158 ${GTEST_BOTH_LIBRARIES}
170 gtest
171 gtest_main
172
173 ${PROCESS_CPP_LIBRARIES}159 ${PROCESS_CPP_LIBRARIES}
174)160)
175161
@@ -178,11 +164,8 @@
178164
179 trust-store165 trust-store
180166
181 gmock167 ${GMOCK_LIBRARIES}
182168 ${GTEST_BOTH_LIBRARIES}
183 gtest
184 gtest_main
185
186 ${PROCESS_CPP_LIBRARIES}169 ${PROCESS_CPP_LIBRARIES}
187)170)
188171
@@ -192,11 +175,8 @@
192175
193 trust-store176 trust-store
194177
195 gmock178 ${GMOCK_LIBRARIES}
196179 ${GTEST_BOTH_LIBRARIES}
197 gtest
198 gtest_main
199
200 ${PROCESS_CPP_LIBRARIES}180 ${PROCESS_CPP_LIBRARIES}
201)181)
202182
@@ -206,11 +186,8 @@
206 trust-store186 trust-store
207 trust-stored187 trust-stored
208188
209 gmock189 ${GMOCK_LIBRARIES}
210190 ${GTEST_BOTH_LIBRARIES}
211 gtest
212 gtest_main
213
214 ${PROCESS_CPP_LIBRARIES}191 ${PROCESS_CPP_LIBRARIES}
215)192)
216193
@@ -220,11 +197,8 @@
220 trust-store197 trust-store
221 trust-stored198 trust-stored
222199
223 gmock200 ${GMOCK_LIBRARIES}
224201 ${GTEST_BOTH_LIBRARIES}
225 gtest
226 gtest_main
227
228 ${PROCESS_CPP_LIBRARIES}202 ${PROCESS_CPP_LIBRARIES}
229)203)
230204
@@ -233,11 +207,8 @@
233207
234 trust-store-preseed-helper208 trust-store-preseed-helper
235209
236 gmock210 ${GMOCK_LIBRARIES}
237211 ${GTEST_BOTH_LIBRARIES}
238 gtest
239 gtest_main
240
241 ${PROCESS_CPP_LIBRARIES}212 ${PROCESS_CPP_LIBRARIES}
242)213)
243214
@@ -277,11 +248,8 @@
277 trust-store248 trust-store
278 xdg249 xdg
279250
280 gmock251 ${GMOCK_LIBRARIES}
281252 ${GTEST_BOTH_LIBRARIES}
282 gtest
283 gtest_main
284
285 ${PROCESS_CPP_LIBRARIES}253 ${PROCESS_CPP_LIBRARIES}
286 )254 )
287255
@@ -290,11 +258,8 @@
290258
291 trust-store259 trust-store
292260
293 gmock261 ${GMOCK_LIBRARIES}
294262 ${GTEST_BOTH_LIBRARIES}
295 gtest
296 gtest_main
297
298 ${PROCESS_CPP_LIBRARIES}263 ${PROCESS_CPP_LIBRARIES}
299 )264 )
300265
301266
=== modified file 'tests/cached_agent_test.cpp'
--- tests/cached_agent_test.cpp 2014-08-19 14:11:30 +0000
+++ tests/cached_agent_test.cpp 2017-04-05 02:45:31 +0000
@@ -22,6 +22,8 @@
22#include "mock_store.h"22#include "mock_store.h"
23#include "the.h"23#include "the.h"
2424
25#include <random>
26
25namespace27namespace
26{28{
27struct MockReporter : public core::trust::CachedAgent::Reporter29struct MockReporter : public core::trust::CachedAgent::Reporter
2830
=== modified file 'tests/mir_agent_test.cpp'
--- tests/mir_agent_test.cpp 2015-11-26 15:25:34 +0000
+++ tests/mir_agent_test.cpp 2017-04-05 02:45:31 +0000
@@ -66,7 +66,7 @@
66 // The process id of the requesting app/service66 // The process id of the requesting app/service
67 core::trust::Pid app_pid,67 core::trust::Pid app_pid,
68 // Callback handling prompt session state changes.68 // Callback handling prompt session state changes.
69 mir_prompt_session_state_change_callback,69 MirPromptSessionStateChangeCallback,
70 // Callback context70 // Callback context
71 void*));71 void*));
72};72};
7373
=== modified file 'tests/remote_agent_test.cpp'
--- tests/remote_agent_test.cpp 2016-01-11 21:28:55 +0000
+++ tests/remote_agent_test.cpp 2017-04-05 02:45:31 +0000
@@ -34,6 +34,7 @@
34#include <gtest/gtest.h>34#include <gtest/gtest.h>
3535
36#include <thread>36#include <thread>
37#include <random>
3738
38namespace39namespace
39{40{

Subscribers

People subscribed via source and target branches

to all changes: