Merge lp:~sergiusens/camera-app/click into lp:camera-app
- click
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Gustavo Pichorim Boiko |
Approved revision: | 194 |
Merged at revision: | 201 |
Proposed branch: | lp:~sergiusens/camera-app/click |
Merge into: | lp:camera-app |
Diff against target: |
282 lines (+119/-16) 11 files modified
CMakeLists.txt (+20/-3) CameraApp/CMakeLists.txt (+9/-8) README.click (+15/-0) camera-app.desktop.in (+1/-1) cameraapplication.cpp (+6/-1) click/CMakeLists.txt (+10/-0) click/camera-apparmor.json (+7/-0) click/manifest.json.in (+21/-0) config.h.in (+20/-1) tests/autopilot/CMakeLists.txt (+2/-1) tests/autopilot/camera_app/tests/__init__.py (+8/-1) |
To merge this branch: | bzr merge lp:~sergiusens/camera-app/click |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gustavo Pichorim Boiko (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+187800@code.launchpad.net |
Commit message
Click build support
Description of the change
Still requires a security policy for user metrics input, but aside from that is ok.
PS Jenkins bot (ps-jenkins) wrote : | # |
Gustavo Pichorim Boiko (boiko) wrote : | # |
201 + static bool click = (QString(
This is not reliable: cmake accepts also uppercase ON/OFF, and also lower and upper case true/false as arguments for enabling/disabling the arguments.
For instance, if I don't set CLICK_MODE to anything, the value will already be different:
static bool click = (QString("OFF") != QString("off"))
Can you set the value of another variable in CMakeLists.txt to some value depending on whether CLICK_MODE is enabled or disabled?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:191
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
- 192. By Sergio Schvezov
-
use a fixed tag for config.h
- 193. By Sergio Schvezov
-
Adding a hack to detect if installed and default to click/confined.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:193
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:193
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Gustavo Pichorim Boiko (boiko) wrote : | # |
106 +pkcon install-local com.ubuntu.
It should probably read com.ubuntu.camera_
- 194. By Sergio Schvezov
-
Copy paste typo fix
Gustavo Pichorim Boiko (boiko) wrote : | # |
Looks good now!
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2013-09-23 12:40:33 +0000 |
3 | +++ CMakeLists.txt 2013-09-26 21:51:29 +0000 |
4 | @@ -15,7 +15,23 @@ |
5 | # Standard install paths |
6 | include(GNUInstallDirs) |
7 | |
8 | -set(CAMERA_APP_DIR ${CMAKE_INSTALL_DATADIR}/camera-app) |
9 | +option(INSTALL_TESTS "Install the tests on make install" on) |
10 | +option(CLICK_MODE "Installs to a contained location" off) |
11 | + |
12 | +if(CLICK_MODE) |
13 | + set(CAMERA_APP camera) |
14 | + set(CMAKE_INSTALL_PREFIX /) |
15 | + set(CAMERA_APP_DIR /) |
16 | + set(CMAKE_INSTALL_BINDIR /) |
17 | + set(PLUGIN_BASE lib/${CMAKE_LIBRARY_ARCHITECTURE}) |
18 | + set(PLUGIN_DIR ${PLUGIN_BASE}/CameraApp) |
19 | + set(DESKTOP_EXEC "./${CAMERA_APP}") |
20 | + set(CLICK_TAG click) |
21 | +else(CLICK_MODE) |
22 | + set(CAMERA_APP camera-app) |
23 | + set(CAMERA_APP_DIR ${CMAKE_INSTALL_DATADIR}/${CAMERA_APP}) |
24 | + set(DESKTOP_EXEC ${CAMERA_APP}) |
25 | +endif(CLICK_MODE) |
26 | |
27 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) |
28 | |
29 | @@ -27,8 +43,6 @@ |
30 | ${Qt5Multimedia_INCLUDE_DIRS} |
31 | ) |
32 | |
33 | -set(CAMERA_APP camera-app) |
34 | - |
35 | set(camera_app_HDRS |
36 | cameraapplication.h) |
37 | |
38 | @@ -74,6 +88,8 @@ |
39 | file(STRINGS ${DESKTOP_FILE}.in DESKTOP_FILE_CONTENTS) |
40 | foreach(LINE ${DESKTOP_FILE_CONTENTS}) |
41 | string(REGEX REPLACE "tr\\\(\"(.*)\"\\\)" "\\1" LINE "${LINE}") |
42 | + string(REGEX REPLACE "\@DESKTOP_EXEC\@" |
43 | + "${DESKTOP_EXEC}" LINE "${LINE}") |
44 | file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} "${LINE}\n") |
45 | endforeach(LINE) |
46 | |
47 | @@ -82,6 +98,7 @@ |
48 | ) |
49 | |
50 | add_subdirectory(CameraApp) |
51 | +add_subdirectory(click) |
52 | |
53 | file(GLOB_RECURSE I18N_SRC_FILES |
54 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} |
55 | |
56 | === modified file 'CameraApp/CMakeLists.txt' |
57 | --- CameraApp/CMakeLists.txt 2013-01-18 16:09:32 +0000 |
58 | +++ CameraApp/CMakeLists.txt 2013-09-26 21:51:29 +0000 |
59 | @@ -20,18 +20,19 @@ |
60 | |
61 | |
62 | # Qt5's cmake does not export QT_IMPORTS_DIR, lets query qmake on our own for now |
63 | +if(NOT CLICK_MODE) |
64 | get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) |
65 | -function(QUERY_QMAKE VAR RESULT) |
66 | - exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) |
67 | - if(NOT return_code) |
68 | - file(TO_CMAKE_PATH "${output}" output) |
69 | - set(${RESULT} ${output} PARENT_SCOPE) |
70 | - endif(NOT return_code) |
71 | + function(QUERY_QMAKE VAR RESULT) |
72 | + exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) |
73 | + if(NOT return_code) |
74 | + file(TO_CMAKE_PATH "${output}" output) |
75 | + set(${RESULT} ${output} PARENT_SCOPE) |
76 | + endif(NOT return_code) |
77 | endfunction(QUERY_QMAKE) |
78 | query_qmake(QT_INSTALL_QML QT_IMPORTS_DIR) |
79 | - |
80 | - |
81 | set(PLUGIN_DIR ${QT_IMPORTS_DIR}/CameraApp) |
82 | +endif(NOT CLICK_MODE) |
83 | + |
84 | install(TARGETS camera-qml DESTINATION ${PLUGIN_DIR}) |
85 | install(FILES qmldir DESTINATION ${PLUGIN_DIR}) |
86 | |
87 | |
88 | === added file 'README.click' |
89 | --- README.click 1970-01-01 00:00:00 +0000 |
90 | +++ README.click 2013-09-26 21:51:29 +0000 |
91 | @@ -0,0 +1,15 @@ |
92 | +Building for click |
93 | +================== |
94 | + |
95 | +To build for a click package configure cmake as: |
96 | + |
97 | +mkdir build |
98 | +cd build |
99 | +cmake [path_to_this_location] -DINSTALL_TESTS=off -DCLICK_MODE=on \ |
100 | + -DBZR_REVNO=$(cd [path_to_this_location]; bzr revno) |
101 | +make DESTDIR=package install |
102 | +click build package |
103 | + |
104 | +This package can be installed by running: |
105 | + |
106 | +pkcon install-local com.ubuntu.camera_*.click |
107 | |
108 | === modified file 'camera-app.desktop.in' |
109 | --- camera-app.desktop.in 2013-06-11 16:05:35 +0000 |
110 | +++ camera-app.desktop.in 2013-09-26 21:51:29 +0000 |
111 | @@ -3,7 +3,7 @@ |
112 | Name=tr("Camera") |
113 | GenericName=camera-app |
114 | Comment=tr("Camera application") |
115 | -Exec=camera-app --fullscreen %u |
116 | +Exec=@DESKTOP_EXEC@ --fullscreen %u |
117 | Terminal=false |
118 | Icon=camera-app |
119 | #MimeType=x-scheme-handler/contact;x-scheme-handler/call |
120 | |
121 | === modified file 'cameraapplication.cpp' |
122 | --- cameraapplication.cpp 2013-09-23 12:40:33 +0000 |
123 | +++ cameraapplication.cpp 2013-09-26 21:51:29 +0000 |
124 | @@ -76,8 +76,13 @@ |
125 | m_view->setTitle("Camera"); |
126 | m_view->rootContext()->setContextProperty("application", this); |
127 | m_view->engine()->setBaseUrl(QUrl::fromLocalFile(cameraAppDirectory())); |
128 | + if (isClick()) { |
129 | + m_view->engine()->addImportPath(cameraAppImportDirectory()); |
130 | + qDebug() << "Import path added" << cameraAppImportDirectory(); |
131 | + } |
132 | + qDebug() << "Camera app directory" << cameraAppDirectory(); |
133 | QObject::connect(m_view->engine(), SIGNAL(quit()), this, SLOT(quit())); |
134 | - m_view->setSource(QUrl::fromLocalFile("camera-app.qml")); |
135 | + m_view->setSource(QUrl::fromLocalFile(sourceQml())); |
136 | if (arguments().contains(QLatin1String("--fullscreen"))) m_view->showFullScreen(); |
137 | else m_view->show(); |
138 | |
139 | |
140 | === added directory 'click' |
141 | === added file 'click/CMakeLists.txt' |
142 | --- click/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
143 | +++ click/CMakeLists.txt 2013-09-26 21:51:29 +0000 |
144 | @@ -0,0 +1,10 @@ |
145 | +if(CLICK_MODE) |
146 | + if(NOT BZR_REVNO) |
147 | + set(BZR_REVNO "latest") |
148 | + endif(NOT BZR_REVNO) |
149 | + configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json) |
150 | + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json |
151 | + DESTINATION ${CMAKE_INSTALL_PREFIX}) |
152 | + install(FILES camera-apparmor.json |
153 | + DESTINATION ${CMAKE_INSTALL_PREFIX}) |
154 | +endif(CLICK_MODE) |
155 | |
156 | === added file 'click/camera-apparmor.json' |
157 | --- click/camera-apparmor.json 1970-01-01 00:00:00 +0000 |
158 | +++ click/camera-apparmor.json 2013-09-26 21:51:29 +0000 |
159 | @@ -0,0 +1,7 @@ |
160 | +{ |
161 | + "policy_groups": ["picture_files", |
162 | + "camera", |
163 | + "audio" |
164 | + ], |
165 | + "policy_version": 1.0 |
166 | +} |
167 | |
168 | === added file 'click/manifest.json.in' |
169 | --- click/manifest.json.in 1970-01-01 00:00:00 +0000 |
170 | +++ click/manifest.json.in 2013-09-26 21:51:29 +0000 |
171 | @@ -0,0 +1,21 @@ |
172 | +{ |
173 | + "description": |
174 | + "An application to take pictures and videos with the device cameras", |
175 | + "framework": "ubuntu-sdk-13.10", |
176 | + "architecture": "armhf", |
177 | + "hooks": { |
178 | + "camera": { |
179 | + "apparmor": "camera-apparmor.json", |
180 | + "desktop": "@CMAKE_INSTALL_DATADIR@/applications/@DESKTOP_FILE@" |
181 | + } |
182 | + }, |
183 | + "icon": "camera-app", |
184 | + "maintainer": "Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>", |
185 | + "name": "com.ubuntu.camera", |
186 | + "title": "Camera", |
187 | + "version": "2.9.1", |
188 | + "x-source": { |
189 | + "vcs-bzr": "lp:camera-app", |
190 | + "vcs-bzr-revno": "@BZR_REVNO@" |
191 | + } |
192 | +} |
193 | |
194 | === modified file 'config.h.in' |
195 | --- config.h.in 2012-10-30 15:48:34 +0000 |
196 | +++ config.h.in 2013-09-26 21:51:29 +0000 |
197 | @@ -21,6 +21,11 @@ |
198 | #include <QtCore/QCoreApplication> |
199 | #include <QtCore/QDir> |
200 | |
201 | +inline bool isClick() { |
202 | + static bool click = (QString("@CLICK_TAG@") == QString("click")); |
203 | + return click; |
204 | +} |
205 | + |
206 | inline bool isRunningInstalled() { |
207 | static bool installed = (QCoreApplication::applicationDirPath() == |
208 | QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath()); |
209 | @@ -28,10 +33,24 @@ |
210 | } |
211 | |
212 | inline QString cameraAppDirectory() { |
213 | - if (isRunningInstalled()) { |
214 | + if (isClick()) { |
215 | + return QDir::currentPath(); |
216 | + } else if (isRunningInstalled()) { |
217 | return QString("@CMAKE_INSTALL_PREFIX@/@CAMERA_APP_DIR@/"); |
218 | } else { |
219 | return QString("@CMAKE_SOURCE_DIR@/"); |
220 | } |
221 | } |
222 | |
223 | +inline QString cameraAppImportDirectory() { |
224 | + return QDir::currentPath() + "/@PLUGIN_BASE@"; |
225 | +} |
226 | + |
227 | +inline QString sourceQml() { |
228 | + static QString qmlFile("camera-app.qml"); |
229 | + if (isClick()) { |
230 | + return QDir::currentPath() + "/" + qmlFile; |
231 | + } else { |
232 | + return qmlFile; |
233 | + } |
234 | +} |
235 | |
236 | === modified file 'tests/autopilot/CMakeLists.txt' |
237 | --- tests/autopilot/CMakeLists.txt 2013-01-08 13:44:38 +0000 |
238 | +++ tests/autopilot/CMakeLists.txt 2013-09-26 21:51:29 +0000 |
239 | @@ -3,7 +3,8 @@ |
240 | execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" |
241 | OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) |
242 | |
243 | +if(INSTALL_TESTS) |
244 | install(DIRECTORY ${AUTOPILOT_DIR} |
245 | DESTINATION ${PYTHON_PACKAGE_DIR} |
246 | ) |
247 | - |
248 | +endif(INSTALL_TESTS) |
249 | |
250 | === modified file 'tests/autopilot/camera_app/tests/__init__.py' |
251 | --- tests/autopilot/camera_app/tests/__init__.py 2013-05-25 07:16:22 +0000 |
252 | +++ tests/autopilot/camera_app/tests/__init__.py 2013-09-26 21:51:29 +0000 |
253 | @@ -33,14 +33,17 @@ |
254 | ('with touch', dict(input_device_class=Touch))] |
255 | |
256 | local_location = "../../camera-app" |
257 | + deb_location = '/usr/bin/camera-app' |
258 | |
259 | def setUp(self): |
260 | self.pointing_device = Pointer(self.input_device_class.create()) |
261 | super(CameraAppTestCase, self).setUp() |
262 | if os.path.exists(self.local_location): |
263 | self.launch_test_local() |
264 | - else: |
265 | + elif os.path.exists(self.deb_location): |
266 | self.launch_test_installed() |
267 | + else: |
268 | + self.launch_click_installed() |
269 | |
270 | def launch_test_local(self): |
271 | self.app = self.launch_test_application( |
272 | @@ -57,6 +60,10 @@ |
273 | "--desktop_file_hint=/usr/share/applications/camera-app.desktop", |
274 | app_type='qt') |
275 | |
276 | + def launch_click_installed(self): |
277 | + self.app = self.launch_click_package( |
278 | + "com.ubuntu.camera") |
279 | + |
280 | def get_center(self, object_proxy): |
281 | x, y, w, h = object_proxy.globalRect |
282 | return [x + (w / 2), y + (h / 2)] |
FAILED: Continuous integration, rev:191 jenkins. qa.ubuntu. com/job/ camera- app-ci/ 110/ jenkins. qa.ubuntu. com/job/ camera- app-saucy- amd64-ci/ 63 jenkins. qa.ubuntu. com/job/ camera- app-saucy- armhf-ci/ 62 jenkins. qa.ubuntu. com/job/ camera- app-saucy- armhf-ci/ 62/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ camera- app-saucy- i386-ci/ 63 jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/4050 jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/1667 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-saucy/ 362 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 4150 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 4150/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1669 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1669/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 1398 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/1410
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ camera- app-ci/ 110/rebuild
http://