Merge lp:~kissiel/checkbox/package-checkbox-touch into lp:checkbox

Proposed by Maciej Kisielewski
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
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+240545@code.launchpad.net

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

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Nice, I made a few comments down below

Revision history for this message
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]"

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Only two minor comments, see below.

review: Needs Fixing
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

Revision history for this message
Maciej Kisielewski (kissiel) wrote :

Fixed issues pointed by Sylvain.
Repushed.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Thanks for the last minutes fixes, +1.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'checkbox-touch/README.md'
--- checkbox-touch/README.md 2014-08-21 19:13:22 +0000
+++ checkbox-touch/README.md 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
1The Checkbox Touch
2==================
3
4This directory contains the implementation of Checkbox Touch. The Ubuntu-SDK
5based touch application that initially, will target the phone form factor (but
6will work on all the form factors).
7
8It is implemented according to a design document (we need to publish that
9document before it can be referenced here) that describes a minimum viable
10product for v1.0
11
12The application works well in an x86 and armhf emulator as well as on the
13desktop. On a desktop system we recommend to use packaged dependencies
14(python3-plainbox and pyotherside). On any of the touch devices you will need
15to build a suitable click package (see below for details) or get a copy from
16the Ubuntu store, once it gets published.
17
18Building the click package
19--------------------------
20
21The click package is built from QML/JavaScript/Python code contained in the
22`py` and `components` directories. It also has `lib` directory that contains
23all necessary libraries needed to run checkbox-touch.
24
25Before building click package make sure you run `./get-libs` to initialize and
26populate `./lib` directory.
27To build the click package run `$ click build path_to_checkbox-touch`.
28
29Deploying on the device
30-----------------------
31
32To run install package on the device/emulator run :
33
34`$ adb push com.canonical.certification.checkbox-touch_0.2_armhf.click`
35`/home/phablet/`
36
37`$ phablet-shell`
38
39`phablet@ubuntu-phablet:$ pkcon install-local`
40`com.canonical.certification.checkbox-touch_0.2_armhf.click`
41
42`phablet@ubuntu-phablet:$ exit`
43
44
45Running on a desktop
46--------------------
47
48To run on a desktop run `qmlscene main.qml`
49Note: Make sure you've ran `./get-libs` first.
50
51
520
=== added file 'checkbox-touch/README.rst'
--- checkbox-touch/README.rst 1970-01-01 00:00:00 +0000
+++ checkbox-touch/README.rst 2014-11-11 09:54:23 +0000
@@ -0,0 +1,83 @@
1The Checkbox Touch
2==================
3
4This directory contains the implementation of Checkbox Touch. The Ubuntu-SDK
5based touch application that initially, will target the phone form factor (but
6will work on all the form factors).
7
8It is implemented according to a design document (http://goo.gl/2agB51),
9that describes a minimum viable product for v1.0
10
11The application works well in an x86 and armhf emulator as well as on the
12desktop. On a desktop system we recommend to use packaged dependencies
13(python3-plainbox and pyotherside). On any of the touch devices you will need
14to build a suitable click package (see below for details) or get a copy from
15the Ubuntu store, once it gets published.
16
17Getting dependencies
18--------------------
19
20The click package is built from QML/JavaScript/Python code contained in the
21`py` and `components` directories. It also has `lib` directory that contains
22all necessary libraries needed to run checkbox-touch.
23
24Before building click package make sure you run `./get-libs` to initialize and
25populate `./lib` directory. Use --get-local-plainbox to embed plainbox code
26that's available in the ../plainbox directory.
27
28Building and installing the click package
29-----------------------------------------
30
31To build Checkbox-Touch click package run:
32
33.. code-block:: bash
34
35 $ ./build-me
36
37to build and install the package run:
38
39.. code-block:: bash
40
41 $ ./build-me --install
42
43Running Checkbox-Touch on a desktop
44-----------------------------------
45
46To run on a desktop run `qmlscene main.qml`
47Note: Make sure you've ran `./get-libs` first.
48
49
50Choosing the default test-plan
51------------------------------
52
53If you wish to run one particular test plan, you may do so, by providing
54./build-me script with --testplan option. E.g.:
55
56.. code-block:: bash
57
58 $ ./build-me --testplan="2013.com.canonical.plainbox::stub"
59
60
61Embedding providers into click package
62--------------------------------------
63
64If you wish to provide extra providers, copy them into `providers` directory.
65Every provider in `providers` directory should have same structure as one
66generated by `plainbox startprovider` command
67
68Default Checkbox-Touch settings
69-------------------------------
70During execution of `./build-me` script, `settings.json` file is generated.
71It contains values that Checkbox-Touch will use as its default ones.
72Altough not required, you may edit this file to suit your needs.
73
74Further assistance
75------------------
76
77For further assistance on packaging Checkbox-Touch, run:
78
79.. code-block:: bash
80
81 $ ./build-me --help
82
83
084
=== added file 'checkbox-touch/build-me'
--- checkbox-touch/build-me 1970-01-01 00:00:00 +0000
+++ checkbox-touch/build-me 2014-11-11 09:54:23 +0000
@@ -0,0 +1,99 @@
1#!/usr/bin/env python3
2import argparse
3from distutils.dir_util import copy_tree
4import json
5import os
6import re
7import subprocess
8import sys
9
10
11def get_revision_string(path='.'):
12
13 # Try getting revno from bazaar vcs
14 try:
15 revno = int(subprocess.check_output(
16 ["bzr", "revno", path], stderr=subprocess.STDOUT))
17 return "bzr revision r{}".format(revno)
18 except subprocess.CalledProcessError:
19 # problem encountered when run bzr revno - falling through
20 pass
21
22 # Try getting version from git
23 try:
24 revno = subprocess.check_output(
25 ["git", "-C", path, "show", "-s", "--format=%H", "HEAD"],
26 stderr=subprocess.STDOUT).decode(
27 sys.stdout.encoding).strip()
28 return "git revision {}".format(revno)
29 except subprocess.CalledProcessError:
30 # problem encountered when run git revision - falling through
31 pass
32
33 return "Unknown revision"
34
35
36def main():
37 parser = argparse.ArgumentParser(
38 description="Get necessary libs for checkbox-touch")
39 parser.add_argument("--embedded-providers-path", action='store', type=str,
40 nargs='*', help="Paths to directories with providers")
41 parser.add_argument("--install",
42 action='store_true',
43 help=("Use adb to push and install click package on"
44 " the device"))
45 parser.add_argument("--testplan",
46 action='store', default="", type=str,
47 help="Test plan to set as the default one")
48
49 args = parser.parse_args()
50
51 # generate setting.json
52 settings = {
53 "_comment": "file generated automatically with {0}"
54 .format(parser.prog),
55 "revision": get_revision_string(),
56 "testplan": args.testplan
57 }
58 settings_file = open('settings.json', 'w')
59 settings_file.write(json.dumps(settings, sort_keys=True, indent=4))
60 settings_file.close()
61
62 if args.embedded_providers_path is not None:
63 for path in args.embedded_providers_path:
64 copy_tree(path, 'providers')
65
66 if not os.path.exists('../build-cbt'):
67 os.makedirs('../build-cbt')
68
69 pkg = build_click()
70 if args.install:
71 install_click(pkg)
72
73
74def build_click():
75 os.chdir('../build-cbt')
76 print('Building click package')
77 click_source_path = '../checkbox-touch'
78 out = subprocess.check_output(['click', 'build', click_source_path])
79 pkg_name = re.search("'\.\/(.*)\.click'", str(out)).group(1) + '.click'
80 return pkg_name
81
82
83def install_click(pkg):
84 print('Pushing to the device')
85 try:
86 subprocess.check_output(['adb', 'push', pkg, '/tmp/'])
87 except subprocess.CalledProcessError:
88 sys.exit('Error ecountered while pushing to the device.')
89 print('Installing click package')
90 path = '/tmp/' + pkg
91 try:
92 subprocess.check_output(['adb', 'shell', ('pkcon install-local'
93 ' --allow-untrusted -p -y {path}').format(
94 path=path)])
95 except subprocess.CalledProcessError:
96 sys.exit('Error ecountered while installing click package.')
97
98if __name__ == "__main__":
99 main()
0100
=== modified file 'checkbox-touch/main.qml'
--- checkbox-touch/main.qml 2014-11-05 10:56:36 +0000
+++ checkbox-touch/main.qml 2014-11-11 09:54:23 +0000
@@ -49,6 +49,32 @@
4949
50 useDeprecatedToolbar: false50 useDeprecatedToolbar: false
5151
52 // appSettings serves as application-wide storage for global variables
53 // it has to have at least one entry to be constructed
54 property var appSettings: {
55 "applicationName" : applicationName,
56 "revision": "unknown revision",
57 "testplan": ""
58 }
59
60 Component.onCompleted: {
61 var xhr = new XMLHttpRequest;
62 xhr.open("GET", "settings.json");
63 xhr.onreadystatechange = function() {
64 if (xhr.readyState == XMLHttpRequest.DONE) {
65 try {
66 appSettings = JSON.parse(xhr.responseText);
67 } catch (x) {
68 // if we cannot parse settings.json, we should leave
69 // deafult values of appSettings
70 console.log("Could not parse settings.json. Using default values")
71 }
72 }
73 }
74 xhr.send();
75 }
76
77
52 // Pyotherside python object that we use to talk to all of plainbox78 // Pyotherside python object that we use to talk to all of plainbox
53 Python {79 Python {
54 id: py80 id: py
@@ -93,19 +119,25 @@
93119
94 WelcomePage {120 WelcomePage {
95 id: welcomePage121 id: welcomePage
96 welcomeText: i18n.tr("Welcome to Checkbox Touch")122 welcomeText: i18n.tr("Welcome to Checkbox Touch\nVersion: " + appSettings.revision)
97 onStartTestingTriggered: {123 onStartTestingTriggered: {
98 app.getTestplans(function(response) {124 if (appSettings.testplan != "") {
99 var tp_list = response.testplan_info_list;125 app.rememberTestplan(appSettings.testplan, function() {
100 if(tp_list.length < 2) {126 categorySelectionPage.setup();
101 app.rememberTestplan(tp_list[0].mod_id, function() {127 });
102 categorySelectionPage.setup();128 } else {
103 });129 app.getTestplans(function(response) {
104 }130 var tp_list = response.testplan_info_list;
105 else {131 if (tp_list.length < 2) {
106 testplanSelectionPage.setup(tp_list)132 app.rememberTestplan(tp_list[0].mod_id, function() {
107 }133 categorySelectionPage.setup();
108 });134 });
135 }
136 else {
137 testplanSelectionPage.setup(tp_list)
138 }
139 });
140 }
109 }141 }
110 }142 }
111 ResumeSessionPage {143 ResumeSessionPage {

Subscribers

People subscribed via source and target branches