Merge lp:~kissiel/checkbox/package-checkbox-touch into lp:checkbox
- package-checkbox-touch
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Sylvain Pineau | ||||
Approved revision: | 3395 | ||||
Merged at revision: | 3397 | ||||
Proposed branch: | lp:~kissiel/checkbox/package-checkbox-touch | ||||
Merge into: | lp:checkbox | ||||
Diff against target: |
322 lines (+226/-63) 4 files modified
checkbox-touch/README.md (+0/-51) checkbox-touch/README.rst (+83/-0) checkbox-touch/build-me (+99/-0) checkbox-touch/main.qml (+44/-12) |
||||
To merge this branch: | bzr merge lp:~kissiel/checkbox/package-checkbox-touch | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sylvain Pineau (community) | Approve | ||
Review via email: mp+240545@code.launchpad.net |
Commit message
Description of the change
This MR brings packaging of checkbox-touch, together with default settings forwarding to app and documentation.
fca0846 checkbox-touch: documentation update
30ff9e9 checkbox-touch: add click packaging stuff
Zygmunt Krynicki (zyga) wrote : | # |
Zygmunt Krynicki (zyga) wrote : | # |
I've added two ideas below, I'll make sure you can use those today
- 3383. By Zygmunt Krynicki
-
"automatic merge of lp:~zkrynicki/checkbox/travis/ by tarmac [r=sylvain-
pineau] [bug=][ author= zkrynicki] " - 3384. By Zygmunt Krynicki
-
"automatic merge of lp:~zkrynicki/checkbox/decorators/ by tarmac [r=sylvain-
pineau] [bug=][ author= zkrynicki] " - 3385. By Zygmunt Krynicki
-
"automatic merge of lp:~zkrynicki/checkbox/decorators/ by tarmac [r=kissiel]
[bug=][ author= zkrynicki] " - 3386. By Zygmunt Krynicki
-
"automatic merge of lp:~zkrynicki/checkbox/travis-more/ by tarmac [r=sylvain-
pineau] [bug=][ author= zkrynicki] " - 3387. By Sylvain Pineau
-
"automatic merge of lp:~sylvain-pineau/checkbox/export-touch-results/ by tarmac [r=sylvain-
pineau, zkrynicki] [bug=1375591][author= sylvain- pineau] " - 3388. By Sylvain Pineau
-
"automatic merge of lp:~sylvain-pineau/checkbox/fix-1389253/ by tarmac [r=apulido,
zkrynicki] [bug=1389253][author= sylvain- pineau] " - 3389. By Sylvain Pineau
-
"automatic merge of lp:~sylvain-pineau/checkbox/fix-1387843/ by tarmac [r=roadmr][bug=1387843][author=
sylvain- pineau] " - 3390. By Rod Smith
-
"automatic merge of lp:~rodsmith/checkbox/dmitest/ by tarmac [r=roadmr]
[bug=][ author= rodsmith] "
Sylvain Pineau (sylvain-pineau) wrote : | # |
Only two minor comments, see below.
- 3391. By Sylvain Pineau
-
"Release_
2014_Week45 [r=sylvain-pineau][bug=1331302,1341769, 1347120, 1383447, 1387782, 1387843, 1388055, 1388747, 1389253] [author= checkbox- dev]" - 3392. By Sylvain Pineau
-
Restore dev version
- 3393. By Launchpad Translations on behalf of checkbox-dev
-
Launchpad automatic translations update.
- 3394. By Maciej Kisielewski
-
checkbox-touch: add click packaging stuff
This patch adds scripts building click package.
- 3395. By Maciej Kisielewski
-
checkbox-touch: documentation update
Maciej Kisielewski (kissiel) wrote : | # |
Fixed issues pointed by Sylvain.
Repushed.
Sylvain Pineau (sylvain-pineau) wrote : | # |
Thanks for the last minutes fixes, +1.
Preview Diff
1 | === removed file 'checkbox-touch/README.md' |
2 | --- checkbox-touch/README.md 2014-08-21 19:13:22 +0000 |
3 | +++ checkbox-touch/README.md 1970-01-01 00:00:00 +0000 |
4 | @@ -1,51 +0,0 @@ |
5 | -The Checkbox Touch |
6 | -================== |
7 | - |
8 | -This directory contains the implementation of Checkbox Touch. The Ubuntu-SDK |
9 | -based touch application that initially, will target the phone form factor (but |
10 | -will work on all the form factors). |
11 | - |
12 | -It is implemented according to a design document (we need to publish that |
13 | -document before it can be referenced here) that describes a minimum viable |
14 | -product for v1.0 |
15 | - |
16 | -The application works well in an x86 and armhf emulator as well as on the |
17 | -desktop. On a desktop system we recommend to use packaged dependencies |
18 | -(python3-plainbox and pyotherside). On any of the touch devices you will need |
19 | -to build a suitable click package (see below for details) or get a copy from |
20 | -the Ubuntu store, once it gets published. |
21 | - |
22 | -Building the click package |
23 | --------------------------- |
24 | - |
25 | -The click package is built from QML/JavaScript/Python code contained in the |
26 | -`py` and `components` directories. It also has `lib` directory that contains |
27 | -all necessary libraries needed to run checkbox-touch. |
28 | - |
29 | -Before building click package make sure you run `./get-libs` to initialize and |
30 | -populate `./lib` directory. |
31 | -To build the click package run `$ click build path_to_checkbox-touch`. |
32 | - |
33 | -Deploying on the device |
34 | ------------------------ |
35 | - |
36 | -To run install package on the device/emulator run : |
37 | - |
38 | -`$ adb push com.canonical.certification.checkbox-touch_0.2_armhf.click` |
39 | -`/home/phablet/` |
40 | - |
41 | -`$ phablet-shell` |
42 | - |
43 | -`phablet@ubuntu-phablet:$ pkcon install-local` |
44 | -`com.canonical.certification.checkbox-touch_0.2_armhf.click` |
45 | - |
46 | -`phablet@ubuntu-phablet:$ exit` |
47 | - |
48 | - |
49 | -Running on a desktop |
50 | --------------------- |
51 | - |
52 | -To run on a desktop run `qmlscene main.qml` |
53 | -Note: Make sure you've ran `./get-libs` first. |
54 | - |
55 | - |
56 | |
57 | === added file 'checkbox-touch/README.rst' |
58 | --- checkbox-touch/README.rst 1970-01-01 00:00:00 +0000 |
59 | +++ checkbox-touch/README.rst 2014-11-11 09:54:23 +0000 |
60 | @@ -0,0 +1,83 @@ |
61 | +The Checkbox Touch |
62 | +================== |
63 | + |
64 | +This directory contains the implementation of Checkbox Touch. The Ubuntu-SDK |
65 | +based touch application that initially, will target the phone form factor (but |
66 | +will work on all the form factors). |
67 | + |
68 | +It is implemented according to a design document (http://goo.gl/2agB51), |
69 | +that describes a minimum viable product for v1.0 |
70 | + |
71 | +The application works well in an x86 and armhf emulator as well as on the |
72 | +desktop. On a desktop system we recommend to use packaged dependencies |
73 | +(python3-plainbox and pyotherside). On any of the touch devices you will need |
74 | +to build a suitable click package (see below for details) or get a copy from |
75 | +the Ubuntu store, once it gets published. |
76 | + |
77 | +Getting dependencies |
78 | +-------------------- |
79 | + |
80 | +The click package is built from QML/JavaScript/Python code contained in the |
81 | +`py` and `components` directories. It also has `lib` directory that contains |
82 | +all necessary libraries needed to run checkbox-touch. |
83 | + |
84 | +Before building click package make sure you run `./get-libs` to initialize and |
85 | +populate `./lib` directory. Use --get-local-plainbox to embed plainbox code |
86 | +that's available in the ../plainbox directory. |
87 | + |
88 | +Building and installing the click package |
89 | +----------------------------------------- |
90 | + |
91 | +To build Checkbox-Touch click package run: |
92 | + |
93 | +.. code-block:: bash |
94 | + |
95 | + $ ./build-me |
96 | + |
97 | +to build and install the package run: |
98 | + |
99 | +.. code-block:: bash |
100 | + |
101 | + $ ./build-me --install |
102 | + |
103 | +Running Checkbox-Touch on a desktop |
104 | +----------------------------------- |
105 | + |
106 | +To run on a desktop run `qmlscene main.qml` |
107 | +Note: Make sure you've ran `./get-libs` first. |
108 | + |
109 | + |
110 | +Choosing the default test-plan |
111 | +------------------------------ |
112 | + |
113 | +If you wish to run one particular test plan, you may do so, by providing |
114 | +./build-me script with --testplan option. E.g.: |
115 | + |
116 | +.. code-block:: bash |
117 | + |
118 | + $ ./build-me --testplan="2013.com.canonical.plainbox::stub" |
119 | + |
120 | + |
121 | +Embedding providers into click package |
122 | +-------------------------------------- |
123 | + |
124 | +If you wish to provide extra providers, copy them into `providers` directory. |
125 | +Every provider in `providers` directory should have same structure as one |
126 | +generated by `plainbox startprovider` command |
127 | + |
128 | +Default Checkbox-Touch settings |
129 | +------------------------------- |
130 | +During execution of `./build-me` script, `settings.json` file is generated. |
131 | +It contains values that Checkbox-Touch will use as its default ones. |
132 | +Altough not required, you may edit this file to suit your needs. |
133 | + |
134 | +Further assistance |
135 | +------------------ |
136 | + |
137 | +For further assistance on packaging Checkbox-Touch, run: |
138 | + |
139 | +.. code-block:: bash |
140 | + |
141 | + $ ./build-me --help |
142 | + |
143 | + |
144 | |
145 | === added file 'checkbox-touch/build-me' |
146 | --- checkbox-touch/build-me 1970-01-01 00:00:00 +0000 |
147 | +++ checkbox-touch/build-me 2014-11-11 09:54:23 +0000 |
148 | @@ -0,0 +1,99 @@ |
149 | +#!/usr/bin/env python3 |
150 | +import argparse |
151 | +from distutils.dir_util import copy_tree |
152 | +import json |
153 | +import os |
154 | +import re |
155 | +import subprocess |
156 | +import sys |
157 | + |
158 | + |
159 | +def get_revision_string(path='.'): |
160 | + |
161 | + # Try getting revno from bazaar vcs |
162 | + try: |
163 | + revno = int(subprocess.check_output( |
164 | + ["bzr", "revno", path], stderr=subprocess.STDOUT)) |
165 | + return "bzr revision r{}".format(revno) |
166 | + except subprocess.CalledProcessError: |
167 | + # problem encountered when run bzr revno - falling through |
168 | + pass |
169 | + |
170 | + # Try getting version from git |
171 | + try: |
172 | + revno = subprocess.check_output( |
173 | + ["git", "-C", path, "show", "-s", "--format=%H", "HEAD"], |
174 | + stderr=subprocess.STDOUT).decode( |
175 | + sys.stdout.encoding).strip() |
176 | + return "git revision {}".format(revno) |
177 | + except subprocess.CalledProcessError: |
178 | + # problem encountered when run git revision - falling through |
179 | + pass |
180 | + |
181 | + return "Unknown revision" |
182 | + |
183 | + |
184 | +def main(): |
185 | + parser = argparse.ArgumentParser( |
186 | + description="Get necessary libs for checkbox-touch") |
187 | + parser.add_argument("--embedded-providers-path", action='store', type=str, |
188 | + nargs='*', help="Paths to directories with providers") |
189 | + parser.add_argument("--install", |
190 | + action='store_true', |
191 | + help=("Use adb to push and install click package on" |
192 | + " the device")) |
193 | + parser.add_argument("--testplan", |
194 | + action='store', default="", type=str, |
195 | + help="Test plan to set as the default one") |
196 | + |
197 | + args = parser.parse_args() |
198 | + |
199 | + # generate setting.json |
200 | + settings = { |
201 | + "_comment": "file generated automatically with {0}" |
202 | + .format(parser.prog), |
203 | + "revision": get_revision_string(), |
204 | + "testplan": args.testplan |
205 | + } |
206 | + settings_file = open('settings.json', 'w') |
207 | + settings_file.write(json.dumps(settings, sort_keys=True, indent=4)) |
208 | + settings_file.close() |
209 | + |
210 | + if args.embedded_providers_path is not None: |
211 | + for path in args.embedded_providers_path: |
212 | + copy_tree(path, 'providers') |
213 | + |
214 | + if not os.path.exists('../build-cbt'): |
215 | + os.makedirs('../build-cbt') |
216 | + |
217 | + pkg = build_click() |
218 | + if args.install: |
219 | + install_click(pkg) |
220 | + |
221 | + |
222 | +def build_click(): |
223 | + os.chdir('../build-cbt') |
224 | + print('Building click package') |
225 | + click_source_path = '../checkbox-touch' |
226 | + out = subprocess.check_output(['click', 'build', click_source_path]) |
227 | + pkg_name = re.search("'\.\/(.*)\.click'", str(out)).group(1) + '.click' |
228 | + return pkg_name |
229 | + |
230 | + |
231 | +def install_click(pkg): |
232 | + print('Pushing to the device') |
233 | + try: |
234 | + subprocess.check_output(['adb', 'push', pkg, '/tmp/']) |
235 | + except subprocess.CalledProcessError: |
236 | + sys.exit('Error ecountered while pushing to the device.') |
237 | + print('Installing click package') |
238 | + path = '/tmp/' + pkg |
239 | + try: |
240 | + subprocess.check_output(['adb', 'shell', ('pkcon install-local' |
241 | + ' --allow-untrusted -p -y {path}').format( |
242 | + path=path)]) |
243 | + except subprocess.CalledProcessError: |
244 | + sys.exit('Error ecountered while installing click package.') |
245 | + |
246 | +if __name__ == "__main__": |
247 | + main() |
248 | |
249 | === modified file 'checkbox-touch/main.qml' |
250 | --- checkbox-touch/main.qml 2014-11-05 10:56:36 +0000 |
251 | +++ checkbox-touch/main.qml 2014-11-11 09:54:23 +0000 |
252 | @@ -49,6 +49,32 @@ |
253 | |
254 | useDeprecatedToolbar: false |
255 | |
256 | + // appSettings serves as application-wide storage for global variables |
257 | + // it has to have at least one entry to be constructed |
258 | + property var appSettings: { |
259 | + "applicationName" : applicationName, |
260 | + "revision": "unknown revision", |
261 | + "testplan": "" |
262 | + } |
263 | + |
264 | + Component.onCompleted: { |
265 | + var xhr = new XMLHttpRequest; |
266 | + xhr.open("GET", "settings.json"); |
267 | + xhr.onreadystatechange = function() { |
268 | + if (xhr.readyState == XMLHttpRequest.DONE) { |
269 | + try { |
270 | + appSettings = JSON.parse(xhr.responseText); |
271 | + } catch (x) { |
272 | + // if we cannot parse settings.json, we should leave |
273 | + // deafult values of appSettings |
274 | + console.log("Could not parse settings.json. Using default values") |
275 | + } |
276 | + } |
277 | + } |
278 | + xhr.send(); |
279 | + } |
280 | + |
281 | + |
282 | // Pyotherside python object that we use to talk to all of plainbox |
283 | Python { |
284 | id: py |
285 | @@ -93,19 +119,25 @@ |
286 | |
287 | WelcomePage { |
288 | id: welcomePage |
289 | - welcomeText: i18n.tr("Welcome to Checkbox Touch") |
290 | + welcomeText: i18n.tr("Welcome to Checkbox Touch\nVersion: " + appSettings.revision) |
291 | onStartTestingTriggered: { |
292 | - app.getTestplans(function(response) { |
293 | - var tp_list = response.testplan_info_list; |
294 | - if(tp_list.length < 2) { |
295 | - app.rememberTestplan(tp_list[0].mod_id, function() { |
296 | - categorySelectionPage.setup(); |
297 | - }); |
298 | - } |
299 | - else { |
300 | - testplanSelectionPage.setup(tp_list) |
301 | - } |
302 | - }); |
303 | + if (appSettings.testplan != "") { |
304 | + app.rememberTestplan(appSettings.testplan, function() { |
305 | + categorySelectionPage.setup(); |
306 | + }); |
307 | + } else { |
308 | + app.getTestplans(function(response) { |
309 | + var tp_list = response.testplan_info_list; |
310 | + if (tp_list.length < 2) { |
311 | + app.rememberTestplan(tp_list[0].mod_id, function() { |
312 | + categorySelectionPage.setup(); |
313 | + }); |
314 | + } |
315 | + else { |
316 | + testplanSelectionPage.setup(tp_list) |
317 | + } |
318 | + }); |
319 | + } |
320 | } |
321 | } |
322 | ResumeSessionPage { |
Nice, I made a few comments down below