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