Merge lp:~kissiel/checkbox/fixes-confinement into lp:checkbox

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4317
Merged at revision: 4314
Proposed branch: lp:~kissiel/checkbox/fixes-confinement
Merge into: lp:checkbox
Diff against target: 105 lines (+40/-5)
3 files modified
checkbox-touch/build-me (+15/-0)
checkbox-touch/manifest.json (+7/-3)
checkbox-touch/py/checkbox_touch.py (+18/-2)
To merge this branch: bzr merge lp:~kissiel/checkbox/fixes-confinement
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+292264@code.launchpad.net

Description of the change

This MR fixes confined jobs.

In addition it also brings version string checking when running build-me, so the problem can be avoided in the future.

Details in commit messages.

30d0bac checkbox-touch: add fake pyotherside to let importing of checkbox_touch.py
2868b5d checkbox-touch: correct version string in manifest.json
bd310da checkbox-touch: add version match checks to build-me
6e66010 checkbox-touch: change formatting in manifest.json

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Good catch with the version mismatch. thanks (and +1 for the check in build-me)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-touch/build-me'
2--- checkbox-touch/build-me 2015-11-25 11:37:14 +0000
3+++ checkbox-touch/build-me 2016-04-19 12:29:16 +0000
4@@ -11,7 +11,9 @@
5 import textwrap
6
7 from confinement.generate import generate_confinement
8+sys.path.append('./py')
9 from py.embedded_providers import EmbeddedProvider1PlugInCollection
10+from py.checkbox_touch import CheckboxTouchApplication
11
12 # DEFAULT_PROVIDERS is a list of providers directory names as listed in
13 # ../providers. NOTE: those are directory names, not provider names as reported
14@@ -59,6 +61,18 @@
15 "{} not found!\nHave you run get-libs?".format(path))
16
17
18+def check_versions_match(manifest):
19+ """Check if version coded in python matches one from manifest.json."""
20+ res = CheckboxTouchApplication().get_version_pair()
21+ version_from_py = res['result']['application_version']
22+
23+ if manifest['version'] != version_from_py:
24+ raise Exception(
25+ ("Version mismatch! Version from checkbox_touch.py: {}, "
26+ "version from manifest.json: {}").format(
27+ version_from_py, manifest['version']))
28+
29+
30 def get_revision_string(path='.'):
31 # Try getting revno from bazaar vcs
32 try:
33@@ -140,6 +154,7 @@
34 sys.exit('Provider validation failed.')
35
36 current_manifest = json.loads(open('manifest.json', 'rt').read())
37+ check_versions_match(current_manifest)
38 hooks = {
39 'checkbox-touch': current_manifest['hooks']['checkbox-touch']
40 }
41
42=== modified file 'checkbox-touch/manifest.json'
43--- checkbox-touch/manifest.json 2016-04-19 06:28:06 +0000
44+++ checkbox-touch/manifest.json 2016-04-19 12:29:16 +0000
45@@ -1,5 +1,9 @@
46 {
47- "architecture": ["armhf", "i386", "amd64"],
48+ "architecture": [
49+ "armhf",
50+ "i386",
51+ "amd64"
52+ ],
53 "description": "System testing utility for Ubuntu",
54 "framework": "ubuntu-sdk-14.10",
55 "hooks": {
56@@ -11,9 +15,9 @@
57 "maintainer": "Zygmunt Krynicki <zkrynicki@ubuntu.com>",
58 "name": "com.ubuntu.checkbox",
59 "title": "Checkbox",
60- "version": "1.3.dev0",
61+ "version": "1.3.dev",
62 "x-source": {
63 "vcs-bzr": "lp:checkbox",
64 "vcs-bzr-revno": "checkbox-touch-v1.3.dev0"
65 }
66-}
67+}
68\ No newline at end of file
69
70=== modified file 'checkbox-touch/py/checkbox_touch.py'
71--- checkbox-touch/py/checkbox_touch.py 2016-02-17 09:31:44 +0000
72+++ checkbox-touch/py/checkbox_touch.py 2016-04-19 12:29:16 +0000
73@@ -1,6 +1,6 @@
74 # This file is part of Checkbox.
75 #
76-# Copyright 2014-2015 Canonical Ltd.
77+# Copyright 2014-2016 Canonical Ltd.
78 # Written by:
79 # Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
80 # Maciej Kisielewski <maciej.kisielewski@canonical.com>
81@@ -35,7 +35,23 @@
82 import json
83 import logging
84 import os
85-import pyotherside
86+try:
87+ import pyotherside
88+except ImportError:
89+ class FakePyOtherSide():
90+ """
91+ Bogus pyotherside that does nothing.
92+
93+ CheckboxTouchUI uses pyotherside to propagate the output of running
94+ job's command to the QML side.
95+
96+ pyotherside module is only available when python is run by PyOtherSide;
97+ If this module is imported elsewhere (e.g. tests, packaging, etc.),
98+ this bogus class is used instead.
99+ """
100+ def send(self, event, *args):
101+ pass
102+ pyotherside = FakePyOtherSide()
103 import sqlite3
104 import re
105 import time

Subscribers

People subscribed via source and target branches