Merge lp:~alecu/unity-scope-click/launcher-integration into lp:unity-scope-click/devel
- launcher-integration
- Merge into devel
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 308 |
Merged at revision: | 297 |
Proposed branch: | lp:~alecu/unity-scope-click/launcher-integration |
Merge into: | lp:unity-scope-click/devel |
Diff against target: |
744 lines (+494/-50) 19 files modified
CMakeLists.txt (+1/-0) bin/CMakeLists.txt (+1/-0) bin/install-helper (+77/-0) debian/control (+1/-0) debian/unity-scope-click.install (+2/-1) libclickscope/click/CMakeLists.txt (+2/-0) libclickscope/click/dbus_constants.h (+37/-0) libclickscope/click/download-manager.cpp (+9/-18) libclickscope/click/download-manager.h (+1/-2) libclickscope/click/launcher.cpp (+26/-0) libclickscope/click/launcher.h (+56/-0) libclickscope/click/launcher.xml (+16/-0) libclickscope/click/preview.cpp (+15/-2) libclickscope/click/preview.h (+1/-1) libclickscope/tests/test_download_manager.cpp (+0/-26) scope/tests/CMakeLists.txt (+1/-0) scope/tests/fake_launcher/CMakeLists.txt (+14/-0) scope/tests/fake_launcher/fake_launcher.cpp (+118/-0) scope/tests/fake_launcher/fake_launcher.h (+116/-0) |
To merge this branch: | bzr merge lp:~alecu/unity-scope-click/launcher-integration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+223461@code.launchpad.net |
Commit message
Send the dbus signals to the launcher, when a download is started and when it's completed.
Description of the change
To test this branch irl: start scope/tests/
PS Jenkins bot (ps-jenkins) wrote : | # |
- 296. By Alejandro J. Cura
-
Call installationStarted from the scope; use package_name instead of download_id
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:296
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 297. By Alejandro J. Cura
-
a skeleton for install_helper
- 298. By Alejandro J. Cura
-
merged with /devel
- 299. By Alejandro J. Cura
-
merged from /devel
- 300. By Alejandro J. Cura
-
remove skeleton of the install-helper
- 301. By Alejandro J. Cura
-
The install helper
- 302. By Alejandro J. Cura
-
Typo in helper
- 303. By Alejandro J. Cura
-
Use the install-helper instead of the hacky commandline
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:302
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:303
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 304. By Alejandro J. Cura
-
Use CMake to install and find the install-helper
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:304
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 305. By Alejandro J. Cura
-
Install the helper in the proper directory
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:305
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 306. By Alejandro J. Cura
-
Pass the right commandline, and return the proper errors
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:306
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 307. By Alejandro J. Cura
-
Fix the dbus command line to refresh the launcher
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:307
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
dobey (dobey) wrote : | # |
A few small issues. I'll let the lack of unit tests mocking the new dbus calls slide for now, as the fake_launcher is added as well. I also don't like having the generated code, and dbus XML (especially when the scope is the client, not the service) here, but I don't guess there is much we can do about that for the time being. We'll likely need to migrate away from using QDbus here though, and use dbus-cpp in the future. There's no particular need for us to use QDbus here AFAICT, as we're just the client, and not a service trying to provide magic introspected paths.
- 308. By Alejandro J. Cura
-
Fixes requested on review
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:308
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-06-16 12:40:06 +0000 |
3 | +++ CMakeLists.txt 2014-06-20 20:01:57 +0000 |
4 | @@ -49,6 +49,7 @@ |
5 | |
6 | # Add our own subdirectories. |
7 | add_subdirectory(autopilot) |
8 | +add_subdirectory(bin) |
9 | add_subdirectory(libclickscope) |
10 | add_subdirectory(scope) |
11 | add_subdirectory(data) |
12 | |
13 | === added directory 'bin' |
14 | === added file 'bin/CMakeLists.txt' |
15 | --- bin/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
16 | +++ bin/CMakeLists.txt 2014-06-20 20:01:57 +0000 |
17 | @@ -0,0 +1,1 @@ |
18 | +install(PROGRAMS install-helper DESTINATION lib/unity-scope-click/) |
19 | |
20 | === added file 'bin/install-helper' |
21 | --- bin/install-helper 1970-01-01 00:00:00 +0000 |
22 | +++ bin/install-helper 2014-06-20 20:01:57 +0000 |
23 | @@ -0,0 +1,77 @@ |
24 | +#!/bin/bash |
25 | +# |
26 | +# Copyright (C) 2014 Canonical Ltd. |
27 | +# |
28 | +# This program is free software: you can redistribute it and/or modify it |
29 | +# under the terms of the GNU General Public License version 3, as published |
30 | +# by the Free Software Foundation. |
31 | +# |
32 | +# This program is distributed in the hope that it will be useful, but |
33 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
34 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
35 | +# PURPOSE. See the GNU General Public License for more details. |
36 | +# |
37 | +# You should have received a copy of the GNU General Public License along |
38 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
39 | +# |
40 | +# In addition, as a special exception, the copyright holders give |
41 | +# permission to link the code of portions of this program with the |
42 | +# OpenSSL library under certain conditions as described in each |
43 | +# individual source file, and distribute linked combinations |
44 | +# including the two. |
45 | +# You must obey the GNU General Public License in all respects |
46 | +# for all of the code used other than OpenSSL. If you modify |
47 | +# file(s) with this exception, you may extend this exception to your |
48 | +# version of the file(s), but you are not obligated to do so. If you |
49 | +# do not wish to do so, delete this exception statement from your |
50 | +# version. If you delete this exception statement from all source |
51 | +# files in the program, then also delete it here. |
52 | +# |
53 | + |
54 | +FILE_NAME="$1" |
55 | +PACKAGE_NAME="$2" |
56 | + |
57 | +SCOPES_OBJECTPATH=/com/canonical/unity/scopes |
58 | +SCOPES_INTERFACE=com.canonical.unity.scopes |
59 | +SCOPES_METHOD=InvalidateResults |
60 | + |
61 | +LAUNCHER_BUS=com.ubuntu.unity.launcher |
62 | +LAUNCHER_OBJECTPATH=/com/ubuntu/unity/launcher/installations |
63 | +LAUNCHER_INTERFACE=com.ubuntu.unity.launcher.Installations |
64 | +LAUNCHER_METHOD=completeInstallation |
65 | + |
66 | +function invalidate-scope { |
67 | + SCOPE_ID=$1 |
68 | + dbus-send $SCOPES_OBJECTPATH $SCOPES_INTERFACE.$SCOPES_METHOD string:$SCOPE_ID |
69 | +} |
70 | + |
71 | +function install-package { |
72 | + FILE_NAME="$1" |
73 | + pkcon -p install-local "$FILE_NAME" |
74 | +} |
75 | + |
76 | +function app_id-from-package_name { |
77 | + PACKAGE_NAME=$1 |
78 | + IFS=_ |
79 | + TRIPLET=($(ubuntu-app-triplet $PACKAGE_NAME)) |
80 | + unset IFS |
81 | + echo ${TRIPLET[0]}_${TRIPLET[1]}_current-user-version |
82 | +} |
83 | + |
84 | +function complete-installation { |
85 | + PACKAGE_NAME=$1 |
86 | + APP_ID=$2 |
87 | + dbus-send --dest=$LAUNCHER_BUS --type=method_call $LAUNCHER_OBJECTPATH $LAUNCHER_INTERFACE.$LAUNCHER_METHOD string:$PACKAGE_NAME string:$APP_ID |
88 | +} |
89 | + |
90 | +if install-package "$FILE_NAME" ; then |
91 | + invalidate-scope clickscope |
92 | + invalidate-scope com.canonical.scopes.clickstore |
93 | + APP_ID=$(app_id-from-package_name $PACKAGE_NAME) |
94 | + complete-installation $PACKAGE_NAME $APP_ID |
95 | +else |
96 | + PKCON_STATUS=$? |
97 | + NO_APP_ID="" |
98 | + complete-installation $PACKAGE_NAME $NO_APP_ID |
99 | + exit $PKCON_STATUS |
100 | +fi |
101 | |
102 | === modified file 'debian/control' |
103 | --- debian/control 2014-06-18 12:32:49 +0000 |
104 | +++ debian/control 2014-06-20 20:01:57 +0000 |
105 | @@ -26,6 +26,7 @@ |
106 | Architecture: armhf i386 amd64 |
107 | Depends: account-plugin-ubuntuone, |
108 | packagekit-tools, |
109 | + ubuntu-app-launch-tools, |
110 | ubuntu-download-manager, |
111 | ubuntu-sdk-libs, |
112 | ${misc:Depends}, |
113 | |
114 | === modified file 'debian/unity-scope-click.install' |
115 | --- debian/unity-scope-click.install 2014-05-06 21:28:13 +0000 |
116 | +++ debian/unity-scope-click.install 2014-06-20 20:01:57 +0000 |
117 | @@ -1,3 +1,4 @@ |
118 | usr/lib/*/unity-scopes/* |
119 | +usr/lib/unity-scope-click/* |
120 | usr/share/unity/scopes/* |
121 | -usr/share/locale/*/LC_MESSAGES/unity-scope-click.mo |
122 | \ No newline at end of file |
123 | +usr/share/locale/*/LC_MESSAGES/unity-scope-click.mo |
124 | |
125 | === modified file 'libclickscope/click/CMakeLists.txt' |
126 | --- libclickscope/click/CMakeLists.txt 2014-06-13 15:21:16 +0000 |
127 | +++ libclickscope/click/CMakeLists.txt 2014-06-20 20:01:57 +0000 |
128 | @@ -6,6 +6,7 @@ |
129 | add_definitions( |
130 | -DGETTEXT_PACKAGE=\"${PROJECT_NAME}\" |
131 | -DGETTEXT_LOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}\" |
132 | + -DCLICK_INSTALL_HELPER=\"${CMAKE_INSTALL_PREFIX}/lib/unity-scope-click/install-helper\" |
133 | ) |
134 | |
135 | add_library(${SCOPE_LIB_NAME} STATIC |
136 | @@ -14,6 +15,7 @@ |
137 | index.cpp |
138 | interface.cpp |
139 | key_file_locator.cpp |
140 | + launcher.cpp |
141 | network_access_manager.cpp |
142 | package.cpp |
143 | preview.cpp |
144 | |
145 | === added file 'libclickscope/click/dbus_constants.h' |
146 | --- libclickscope/click/dbus_constants.h 1970-01-01 00:00:00 +0000 |
147 | +++ libclickscope/click/dbus_constants.h 2014-06-20 20:01:57 +0000 |
148 | @@ -0,0 +1,37 @@ |
149 | +/* |
150 | + * Copyright (C) 2014 Canonical Ltd. |
151 | + * |
152 | + * This program is free software: you can redistribute it and/or modify it |
153 | + * under the terms of the GNU General Public License version 3, as published |
154 | + * by the Free Software Foundation. |
155 | + * |
156 | + * This program is distributed in the hope that it will be useful, but |
157 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
158 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
159 | + * PURPOSE. See the GNU General Public License for more details. |
160 | + * |
161 | + * You should have received a copy of the GNU General Public License along |
162 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
163 | + * |
164 | + * In addition, as a special exception, the copyright holders give |
165 | + * permission to link the code of portions of this program with the |
166 | + * OpenSSL library under certain conditions as described in each |
167 | + * individual source file, and distribute linked combinations |
168 | + * including the two. |
169 | + * You must obey the GNU General Public License in all respects |
170 | + * for all of the code used other than OpenSSL. If you modify |
171 | + * file(s) with this exception, you may extend this exception to your |
172 | + * version of the file(s), but you are not obligated to do so. If you |
173 | + * do not wish to do so, delete this exception statement from your |
174 | + * version. If you delete this exception statement from all source |
175 | + * files in the program, then also delete it here. |
176 | + */ |
177 | + |
178 | +#ifndef DBUS_CONSTANTS_H |
179 | +#define DBUS_CONSTANTS_H |
180 | + |
181 | +#define LAUNCHER_BUSNAME "com.ubuntu.unity.launcher" |
182 | +#define LAUNCHER_OBJECT_PATH "/com/ubuntu/unity/launcher/installations" |
183 | +#define LAUNCHER_INTERFACE "com.ubuntu.unity.launcher.Installations" |
184 | + |
185 | +#endif // DBUS_CONSTANTS_H |
186 | |
187 | === modified file 'libclickscope/click/download-manager.cpp' |
188 | --- libclickscope/click/download-manager.cpp 2014-05-26 14:02:45 +0000 |
189 | +++ libclickscope/click/download-manager.cpp 2014-06-20 20:01:57 +0000 |
190 | @@ -52,19 +52,7 @@ |
191 | static const QString DOWNLOAD_APP_ID_KEY = "app_id"; |
192 | static const QString DOWNLOAD_COMMAND_KEY = "post-download-command"; |
193 | |
194 | -// Pass two commands using sh -c because UDM expects a single |
195 | -// executable. |
196 | -// Use a single string for both commands because the |
197 | -// list is eventually given to QProcess, which adds quotes around each |
198 | -// argument, while -c expects a single quoted string. |
199 | -// Then, use the $0 positional variable in the pkcon command to let us |
200 | -// pass "$file" as a separate list element, which UDM requires for |
201 | -// substitution. |
202 | - |
203 | -static const QString DOWNLOAD_COMMAND = QStringLiteral("pkcon -p install-local ") % click::QUOTED_ARG0 % QStringLiteral(" && ") % click::DBUSSEND_COMMAND; |
204 | -static const QVariant DOWNLOAD_CMDLINE = QVariant(QStringList() |
205 | - << "/bin/sh" << "-c" << |
206 | - DOWNLOAD_COMMAND << "$file"); |
207 | +static const QString DOWNLOAD_COMMAND = CLICK_INSTALL_HELPER; |
208 | |
209 | static const QString DOWNLOAD_MANAGER_DO_NOT_HASH = ""; |
210 | static const QString DOWNLOAD_MANAGER_IGNORE_HASH_ALGORITHM = ""; |
211 | @@ -90,7 +78,7 @@ |
212 | QSharedPointer<udm::Manager> systemDownloadManager; |
213 | QSharedPointer<click::network::Reply> reply; |
214 | QString downloadUrl; |
215 | - QString appId; |
216 | + QString package_name; |
217 | }; |
218 | |
219 | const QByteArray& click::CLICK_TOKEN_HEADER() |
220 | @@ -133,9 +121,9 @@ |
221 | click::DownloadManager::~DownloadManager(){ |
222 | } |
223 | |
224 | -void click::DownloadManager::startDownload(const QString& downloadUrl, const QString& appId) |
225 | +void click::DownloadManager::startDownload(const QString& downloadUrl, const QString& package_name) |
226 | { |
227 | - impl->appId = appId; |
228 | + impl->package_name = package_name; |
229 | |
230 | // NOTE: using SIGNAL/SLOT macros here because new-style |
231 | // connections are flaky on ARM. |
232 | @@ -151,8 +139,11 @@ |
233 | void click::DownloadManager::handleClickTokenFetched(const QString& clickToken) |
234 | { |
235 | QVariantMap metadata; |
236 | - metadata[DOWNLOAD_COMMAND_KEY] = DOWNLOAD_CMDLINE; |
237 | - metadata[DOWNLOAD_APP_ID_KEY] = impl->appId; |
238 | + |
239 | + QVariant commandline = QVariant(QStringList() << DOWNLOAD_COMMAND << "$file" << impl->package_name); |
240 | + metadata[DOWNLOAD_COMMAND_KEY] = commandline; |
241 | + metadata[DOWNLOAD_APP_ID_KEY] = impl->package_name; |
242 | + metadata["package_name"] = impl->package_name; |
243 | |
244 | QMap<QString, QString> headers; |
245 | headers[CLICK_TOKEN_HEADER()] = clickToken; |
246 | |
247 | === modified file 'libclickscope/click/download-manager.h' |
248 | --- libclickscope/click/download-manager.h 2014-05-26 14:02:45 +0000 |
249 | +++ libclickscope/click/download-manager.h 2014-06-20 20:01:57 +0000 |
250 | @@ -49,7 +49,6 @@ |
251 | |
252 | namespace click |
253 | { |
254 | -static const QString QUOTED_ARG0 = QStringLiteral("\"$0\""); |
255 | // The dbus-send command to refresh the search results in the dash. |
256 | static const QString DBUSSEND_COMMAND = QStringLiteral("dbus-send /com/canonical/unity/scopes com.canonical.unity.scopes.InvalidateResults string:clickscope"); |
257 | |
258 | @@ -67,7 +66,7 @@ |
259 | virtual ~DownloadManager(); |
260 | |
261 | public slots: |
262 | - virtual void startDownload(const QString& downloadUrl, const QString& appId); |
263 | + virtual void startDownload(const QString& downloadUrl, const QString& package_name); |
264 | virtual void fetchClickToken(const QString& downloadUrl); |
265 | |
266 | signals: |
267 | |
268 | === added file 'libclickscope/click/launcher.cpp' |
269 | --- libclickscope/click/launcher.cpp 1970-01-01 00:00:00 +0000 |
270 | +++ libclickscope/click/launcher.cpp 2014-06-20 20:01:57 +0000 |
271 | @@ -0,0 +1,26 @@ |
272 | +/* |
273 | + * This file was generated by qdbusxml2cpp version 0.8 |
274 | + * Command line was: qdbusxml2cpp launcher.xml -p launcher -c Launcher -N |
275 | + * |
276 | + * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). |
277 | + * |
278 | + * This is an auto-generated file. |
279 | + * This file may have been hand-edited. Look for HAND-EDIT comments |
280 | + * before re-generating it. |
281 | + */ |
282 | + |
283 | +#include "launcher.h" |
284 | + |
285 | +/* |
286 | + * Implementation of interface class Launcher |
287 | + */ |
288 | + |
289 | +Launcher::Launcher(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) |
290 | + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) |
291 | +{ |
292 | +} |
293 | + |
294 | +Launcher::~Launcher() |
295 | +{ |
296 | +} |
297 | + |
298 | |
299 | === added file 'libclickscope/click/launcher.h' |
300 | --- libclickscope/click/launcher.h 1970-01-01 00:00:00 +0000 |
301 | +++ libclickscope/click/launcher.h 2014-06-20 20:01:57 +0000 |
302 | @@ -0,0 +1,56 @@ |
303 | +/* |
304 | + * This file was generated by qdbusxml2cpp version 0.8 |
305 | + * Command line was: qdbusxml2cpp launcher.xml -p launcher -c Launcher -N |
306 | + * |
307 | + * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). |
308 | + * |
309 | + * This is an auto-generated file. |
310 | + * Do not edit! All changes made to it will be lost. |
311 | + */ |
312 | + |
313 | +#ifndef LAUNCHER_H_1403062747 |
314 | +#define LAUNCHER_H_1403062747 |
315 | + |
316 | +#include <QtCore/QObject> |
317 | +#include <QtCore/QByteArray> |
318 | +#include <QtCore/QList> |
319 | +#include <QtCore/QMap> |
320 | +#include <QtCore/QString> |
321 | +#include <QtCore/QStringList> |
322 | +#include <QtCore/QVariant> |
323 | +#include <QtDBus/QtDBus> |
324 | + |
325 | +/* |
326 | + * Proxy class for interface com.ubuntu.unity.launcher.Installations |
327 | + */ |
328 | +class Launcher: public QDBusAbstractInterface |
329 | +{ |
330 | + Q_OBJECT |
331 | +public: |
332 | + static inline const char *staticInterfaceName() |
333 | + { return "com.ubuntu.unity.launcher.Installations"; } |
334 | + |
335 | +public: |
336 | + Launcher(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); |
337 | + |
338 | + ~Launcher(); |
339 | + |
340 | +public Q_SLOTS: // METHODS |
341 | + inline Q_NOREPLY void completeInstallation(const QString &package_name, const QString &app_id) |
342 | + { |
343 | + QList<QVariant> argumentList; |
344 | + argumentList << QVariant::fromValue(package_name) << QVariant::fromValue(app_id); |
345 | + callWithArgumentList(QDBus::NoBlock, QLatin1String("completeInstallation"), argumentList); |
346 | + } |
347 | + |
348 | + inline Q_NOREPLY void startInstallation(const QString &title, const QString &icon_url, const QString &package_name) |
349 | + { |
350 | + QList<QVariant> argumentList; |
351 | + argumentList << QVariant::fromValue(title) << QVariant::fromValue(icon_url) << QVariant::fromValue(package_name); |
352 | + callWithArgumentList(QDBus::NoBlock, QLatin1String("startInstallation"), argumentList); |
353 | + } |
354 | + |
355 | +Q_SIGNALS: // SIGNALS |
356 | +}; |
357 | + |
358 | +#endif |
359 | |
360 | === added file 'libclickscope/click/launcher.xml' |
361 | --- libclickscope/click/launcher.xml 1970-01-01 00:00:00 +0000 |
362 | +++ libclickscope/click/launcher.xml 2014-06-20 20:01:57 +0000 |
363 | @@ -0,0 +1,16 @@ |
364 | +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
365 | +<node> |
366 | + <interface name="com.ubuntu.unity.launcher.Installations"> |
367 | + <method name="startInstallation"> |
368 | + <arg name="title" type="s" direction="in"/> |
369 | + <arg name="icon_url" type="s" direction="in"/> |
370 | + <arg name="package_name" type="s" direction="in"/> |
371 | + <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/> |
372 | + </method> |
373 | + <method name="completeInstallation"> |
374 | + <arg name="package_name" type="s" direction="in"/> |
375 | + <arg name="app_id" type="s" direction="in"/> |
376 | + <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/> |
377 | + </method> |
378 | + </interface> |
379 | +</node> |
380 | |
381 | === modified file 'libclickscope/click/preview.cpp' |
382 | --- libclickscope/click/preview.cpp 2014-06-19 16:55:02 +0000 |
383 | +++ libclickscope/click/preview.cpp 2014-06-20 20:01:57 +0000 |
384 | @@ -32,6 +32,8 @@ |
385 | #include "preview.h" |
386 | #include <click/qtbridge.h> |
387 | #include <click/download-manager.h> |
388 | +#include <click/launcher.h> |
389 | +#include <click/dbus_constants.h> |
390 | |
391 | #include <boost/algorithm/string/replace.hpp> |
392 | |
393 | @@ -354,6 +356,15 @@ |
394 | { |
395 | } |
396 | |
397 | +void InstallingPreview::startLauncherAnimation(const PackageDetails &details) |
398 | +{ |
399 | + Launcher l(LAUNCHER_BUSNAME, LAUNCHER_OBJECT_PATH, QDBusConnection::sessionBus()); |
400 | + l.startInstallation(QString::fromStdString(details.package.title), |
401 | + QString::fromStdString(details.package.icon_url), |
402 | + QString::fromStdString(details.package.name)); |
403 | + |
404 | +} |
405 | + |
406 | void InstallingPreview::run(const unity::scopes::PreviewReplyProxy &reply) |
407 | { |
408 | downloader->startDownload(download_url, result["name"].get_string(), |
409 | @@ -370,11 +381,13 @@ |
410 | reply->push(downloadErrorWidgets()); |
411 | return; |
412 | default: |
413 | + std::string object_path = rc.first; |
414 | qDebug() << "Successfully created UDM Download."; |
415 | - populateDetails([this, reply, rc](const PackageDetails &details){ |
416 | + populateDetails([this, reply, object_path](const PackageDetails &details){ |
417 | reply->push(headerWidgets(details)); |
418 | - reply->push(progressBarWidget(rc.first)); |
419 | + reply->push(progressBarWidget(object_path)); |
420 | reply->push(descriptionWidgets(details)); |
421 | + startLauncherAnimation(details); |
422 | }, |
423 | [this, reply](const ReviewList& reviewlist, |
424 | click::Reviews::Error error) { |
425 | |
426 | === modified file 'libclickscope/click/preview.h' |
427 | --- libclickscope/click/preview.h 2014-06-12 21:05:25 +0000 |
428 | +++ libclickscope/click/preview.h 2014-06-20 20:01:57 +0000 |
429 | @@ -150,7 +150,7 @@ |
430 | virtual scopes::PreviewWidgetList progressBarWidget(const std::string& object_path); |
431 | std::string download_url; |
432 | QSharedPointer<click::Downloader> downloader; |
433 | - |
434 | + void startLauncherAnimation(const PackageDetails& details); |
435 | }; |
436 | |
437 | class InstalledPreview : public PreviewStrategy |
438 | |
439 | === modified file 'libclickscope/tests/test_download_manager.cpp' |
440 | --- libclickscope/tests/test_download_manager.cpp 2014-05-26 14:27:31 +0000 |
441 | +++ libclickscope/tests/test_download_manager.cpp 2014-06-20 20:01:57 +0000 |
442 | @@ -482,29 +482,3 @@ |
443 | StartDownloadTestParameters(true, false, false), |
444 | StartDownloadTestParameters(false, true, false) |
445 | )); |
446 | - |
447 | -class ArgZeroTest : public ::testing::TestWithParam<QString> {}; |
448 | - |
449 | -TEST_P(ArgZeroTest, testArgZero) |
450 | -{ |
451 | - auto expected_arg = GetParam(); |
452 | - auto fake_command = "for n in " % click::QUOTED_ARG0 % "; do echo $n; done"; |
453 | - QStringList arguments; |
454 | - arguments << "-c" << fake_command << expected_arg; |
455 | - |
456 | - QProcess sh; |
457 | - sh.start("/bin/sh", arguments); |
458 | - |
459 | - EXPECT_TRUE(sh.waitForStarted()); |
460 | - sh.closeWriteChannel(); |
461 | - |
462 | - EXPECT_TRUE(sh.waitForFinished()); |
463 | - QByteArray result = sh.readAll().trimmed(); |
464 | - EXPECT_EQ(sh.exitCode(), 0); |
465 | - |
466 | - ASSERT_EQ(expected_arg, QString(result)); |
467 | -} |
468 | - |
469 | -INSTANTIATE_TEST_CASE_P(TestSampleFilenames, |
470 | - ArgZeroTest, |
471 | - ::testing::Values("sample_filename.click", "spaced_filename (1).click")); |
472 | |
473 | === modified file 'scope/tests/CMakeLists.txt' |
474 | --- scope/tests/CMakeLists.txt 2014-05-26 15:56:40 +0000 |
475 | +++ scope/tests/CMakeLists.txt 2014-06-20 20:01:57 +0000 |
476 | @@ -59,3 +59,4 @@ |
477 | add_subdirectory(integration) |
478 | add_subdirectory(download_manager_tool) |
479 | add_subdirectory(click_interface_tool) |
480 | +add_subdirectory(fake_launcher) |
481 | |
482 | === added directory 'scope/tests/fake_launcher' |
483 | === added file 'scope/tests/fake_launcher/CMakeLists.txt' |
484 | --- scope/tests/fake_launcher/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
485 | +++ scope/tests/fake_launcher/CMakeLists.txt 2014-06-20 20:01:57 +0000 |
486 | @@ -0,0 +1,14 @@ |
487 | +set(FAKE_LAUNCHER_TARGET fake_launcher) |
488 | + |
489 | +include_directories ( |
490 | + ${CMAKE_SOURCE_DIR}/scope/click |
491 | +) |
492 | + |
493 | +add_executable (${FAKE_LAUNCHER_TARGET} |
494 | + fake_launcher.cpp |
495 | + fake_launcher.h |
496 | +) |
497 | + |
498 | +target_link_libraries (${FAKE_LAUNCHER_TARGET} |
499 | + ${STORE_LIB_UNVERSIONED} |
500 | +) |
501 | |
502 | === added file 'scope/tests/fake_launcher/fake_launcher.cpp' |
503 | --- scope/tests/fake_launcher/fake_launcher.cpp 1970-01-01 00:00:00 +0000 |
504 | +++ scope/tests/fake_launcher/fake_launcher.cpp 2014-06-20 20:01:57 +0000 |
505 | @@ -0,0 +1,118 @@ |
506 | +/* |
507 | + * Copyright (C) 2014 Canonical Ltd. |
508 | + * |
509 | + * This program is free software: you can redistribute it and/or modify it |
510 | + * under the terms of the GNU General Public License version 3, as published |
511 | + * by the Free Software Foundation. |
512 | + * |
513 | + * This program is distributed in the hope that it will be useful, but |
514 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
515 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
516 | + * PURPOSE. See the GNU General Public License for more details. |
517 | + * |
518 | + * You should have received a copy of the GNU General Public License along |
519 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
520 | + * |
521 | + * In addition, as a special exception, the copyright holders give |
522 | + * permission to link the code of portions of this program with the |
523 | + * OpenSSL library under certain conditions as described in each |
524 | + * individual source file, and distribute linked combinations |
525 | + * including the two. |
526 | + * You must obey the GNU General Public License in all respects |
527 | + * for all of the code used other than OpenSSL. If you modify |
528 | + * file(s) with this exception, you may extend this exception to your |
529 | + * version of the file(s), but you are not obligated to do so. If you |
530 | + * do not wish to do so, delete this exception statement from your |
531 | + * version. If you delete this exception statement from all source |
532 | + * files in the program, then also delete it here. |
533 | + */ |
534 | + |
535 | +#include <ubuntu/download_manager/download.h> |
536 | +#include <ubuntu/download_manager/downloads_list.h> |
537 | +#include <ubuntu/download_manager/error.h> |
538 | + |
539 | +#include <QCoreApplication> |
540 | +#include <QDBusConnection> |
541 | +#include <QDebug> |
542 | +#include <QString> |
543 | +#include <QTimer> |
544 | +#include <QTextStream> |
545 | + |
546 | +#include <iostream> |
547 | + |
548 | +#include <boost/optional.hpp> |
549 | + |
550 | +#include <fake_launcher.h> |
551 | + |
552 | +void FakeLauncher::startInstallation(QString title, QString icon_url, QString package_name) |
553 | +{ |
554 | + qDebug() << "startInstallation" << title << icon_url << package_name; |
555 | + installations.insert(package_name, new FakeIcon(title, icon_url, this)); |
556 | + manager->getAllDownloadsWithMetadata("package_name", package_name); |
557 | +} |
558 | + |
559 | +void FakeLauncher::handleDownloadsFound(const QString& key, const QString& value, DownloadsList *download_list) |
560 | +{ |
561 | + Q_UNUSED(key) |
562 | + Q_UNUSED(value) |
563 | + foreach (const QSharedPointer<Download> download, download_list->downloads()) { |
564 | + QString package_name{download->metadata()["package_name"].toString()}; |
565 | + qDebug() << "download found for" << package_name; |
566 | + installations[package_name]->downloadFound(*download); |
567 | + } |
568 | +} |
569 | + |
570 | +void FakeLauncher::completeInstallation(QString package_name, QString app_id) |
571 | +{ |
572 | + qDebug() << "completeInstallation" << package_name << app_id; |
573 | + installations[package_name]->complete(app_id); |
574 | +} |
575 | + |
576 | +void FakeIcon::downloadFound(Download& download) |
577 | +{ |
578 | + connect(&download, SIGNAL(progress(qulonglong,qulonglong)), this, SLOT(handleProgress(qulonglong,qulonglong))); |
579 | + connect(&download, SIGNAL(error(Error*)), this, SLOT(handleDownloadError(Error*))); |
580 | + qDebug() << title << "starting installation"; |
581 | + // TODO: add icon to the launcher |
582 | +} |
583 | + |
584 | +void FakeIcon::handleProgress(qulonglong transferred, qulonglong total) |
585 | +{ |
586 | + qDebug() << title << "download progress" << double(transferred)/total*80; |
587 | + // TODO: update progress bar |
588 | +} |
589 | + |
590 | +void FakeIcon::handleDownloadError(Error *error) |
591 | +{ |
592 | + failure(error->errorString()); |
593 | +} |
594 | + |
595 | +void FakeIcon::failure(QString message) |
596 | +{ |
597 | + qDebug() << title << "installation failed" << message; |
598 | + // TODO: remove icon from the launcher |
599 | +} |
600 | + |
601 | +void FakeIcon::complete(QString app_id) |
602 | +{ |
603 | + if (app_id.isEmpty()) { |
604 | + failure("Failed to install"); |
605 | + } else { |
606 | + qDebug() << title << "installation completed" << app_id; |
607 | + // TODO: update icon with proper app_id |
608 | + } |
609 | +} |
610 | + |
611 | +int main(int argc, char *argv[]) |
612 | +{ |
613 | + |
614 | + QCoreApplication app(argc, argv); |
615 | + FakeLauncher launcher; |
616 | + new FakeLauncherAdaptor(&launcher); |
617 | + qDebug() << "starting"; |
618 | + auto bus = QDBusConnection::sessionBus(); |
619 | + bus.registerObject(LAUNCHER_OBJECT_PATH, &launcher); |
620 | + bus.registerService(LAUNCHER_BUSNAME); |
621 | + return app.exec(); |
622 | +} |
623 | + |
624 | |
625 | === added file 'scope/tests/fake_launcher/fake_launcher.h' |
626 | --- scope/tests/fake_launcher/fake_launcher.h 1970-01-01 00:00:00 +0000 |
627 | +++ scope/tests/fake_launcher/fake_launcher.h 2014-06-20 20:01:57 +0000 |
628 | @@ -0,0 +1,116 @@ |
629 | +/* |
630 | + * Copyright (C) 2014 Canonical Ltd. |
631 | + * |
632 | + * This program is free software: you can redistribute it and/or modify it |
633 | + * under the terms of the GNU General Public License version 3, as published |
634 | + * by the Free Software Foundation. |
635 | + * |
636 | + * This program is distributed in the hope that it will be useful, but |
637 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
638 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
639 | + * PURPOSE. See the GNU General Public License for more details. |
640 | + * |
641 | + * You should have received a copy of the GNU General Public License along |
642 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
643 | + * |
644 | + * In addition, as a special exception, the copyright holders give |
645 | + * permission to link the code of portions of this program with the |
646 | + * OpenSSL library under certain conditions as described in each |
647 | + * individual source file, and distribute linked combinations |
648 | + * including the two. |
649 | + * You must obey the GNU General Public License in all respects |
650 | + * for all of the code used other than OpenSSL. If you modify |
651 | + * file(s) with this exception, you may extend this exception to your |
652 | + * version of the file(s), but you are not obligated to do so. If you |
653 | + * do not wish to do so, delete this exception statement from your |
654 | + * version. If you delete this exception statement from all source |
655 | + * files in the program, then also delete it here. |
656 | + */ |
657 | + |
658 | +#ifndef _FAKE_LAUNCHER_H_ |
659 | +#define _FAKE_LAUNCHER_H_ |
660 | + |
661 | +#include <QObject> |
662 | +#include <QDBusObjectPath> |
663 | +#include <QDBusAbstractAdaptor> |
664 | + |
665 | +#include <click/dbus_constants.h> |
666 | +#include <ubuntu/download_manager/manager.h> |
667 | + |
668 | +class FakeIcon : public QObject { |
669 | + Q_OBJECT |
670 | + |
671 | +public: |
672 | + explicit FakeIcon(QString title, QString icon_url, QObject *parent=0) |
673 | + : QObject(parent), title(title), icon_url(icon_url) |
674 | + { |
675 | + } |
676 | + void downloadFound(Download& download); |
677 | + void complete(QString app_id); |
678 | + |
679 | +private slots: |
680 | + void handleProgress(qulonglong transferred, qulonglong total); |
681 | + void handleDownloadError(Error* error); |
682 | + |
683 | +private: |
684 | + Download* download; |
685 | + QString title; |
686 | + QString icon_url; |
687 | + void failure(QString message); |
688 | +}; |
689 | + |
690 | +class FakeLauncher : public QObject { |
691 | + Q_OBJECT |
692 | + |
693 | +public: |
694 | + explicit FakeLauncher(QObject *parent=0) : QObject(parent) |
695 | + { |
696 | + manager = Ubuntu::DownloadManager::Manager::createSessionManager(); |
697 | + connect(manager, SIGNAL(downloadsWithMetadataFound(QString,QString,DownloadsList*)), |
698 | + this, SLOT(handleDownloadsFound(QString,QString,DownloadsList*))); |
699 | + } |
700 | + |
701 | +public slots: |
702 | + void startInstallation(QString title, QString icon_url, QString package_name); |
703 | + void completeInstallation(QString package_name, QString app_id); |
704 | + |
705 | +private slots: |
706 | + void handleDownloadsFound(const QString& key, const QString& value, DownloadsList* downloads); |
707 | + |
708 | +signals: |
709 | + |
710 | +private: |
711 | + Ubuntu::DownloadManager::Manager* manager; |
712 | + QMap<QString, FakeIcon*> installations; |
713 | +}; |
714 | + |
715 | + |
716 | +class FakeLauncherAdaptor : public QDBusAbstractAdaptor |
717 | +{ |
718 | + Q_OBJECT |
719 | + Q_CLASSINFO("D-Bus Interface", LAUNCHER_INTERFACE) |
720 | + |
721 | +private: |
722 | + FakeLauncher *_launcher; |
723 | + |
724 | +public: |
725 | + FakeLauncherAdaptor(FakeLauncher *launcher) : QDBusAbstractAdaptor(launcher), _launcher(launcher) |
726 | + { |
727 | + } |
728 | + |
729 | +public slots: |
730 | + Q_NOREPLY void startInstallation(QString title, QString icon_url, QString package_name) |
731 | + { |
732 | + _launcher->startInstallation(title, icon_url, package_name); |
733 | + } |
734 | + |
735 | + Q_NOREPLY void completeInstallation(QString package_name, QString app_id) |
736 | + { |
737 | + _launcher->completeInstallation(package_name, app_id); |
738 | + } |
739 | +}; |
740 | + |
741 | + |
742 | +#endif /* _FAKE_LAUNCHER_H_ */ |
743 | + |
744 | + |
FAILED: Continuous integration, rev:295 /code.launchpad .net/~alecu/ unity-scope- click/launcher- integration/ +merge/ 223461/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- ci/119/ jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- amd64-ci/ 94 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 93/console jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- i386-ci/ 93
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- team-unity- scope-click- devel-ci/ 119/rebuild
http://