Merge lp:~kissiel/checkbox/ignore-manifest into lp:checkbox

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4383
Merged at revision: 4379
Proposed branch: lp:~kissiel/checkbox/ignore-manifest
Merge into: lp:checkbox
Diff against target: 167 lines (+42/-48)
3 files modified
checkbox-touch/.gitignore (+1/-0)
checkbox-touch/build-me (+41/-29)
checkbox-touch/manifest.json (+0/-19)
To merge this branch: bzr merge lp:~kissiel/checkbox/ignore-manifest
Reviewer Review Type Date Requested Status
Sylvain Pineau Approve
Review via email: mp+295892@code.launchpad.net

Description of the change

This MR removes manifest.json from versioning and makes build me always generate one.

As an added bonus we are asserted that the version spelled in manifest will always match the one reported by python core code (as it originates from it).

To test it, just run normal build of checkbox-converged (README.rst)

913b4af checkbox-converged: add function that generates manifest
44b5725 checkbox-converged: use generate_manifest
9dd8dde checkbox-converged: remove version comparison
39b5d5c checkbox-converged: remove manifest.json and add it to ignored
5f7c1ad checkbox-converged: fix pep-8 issues in build-me

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

The build process works, +1 for this new feature

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-touch/.gitignore'
2--- checkbox-touch/.gitignore 2015-04-19 19:39:28 +0000
3+++ checkbox-touch/.gitignore 2016-05-26 22:46:01 +0000
4@@ -8,3 +8,4 @@
5 providers/
6 # Ignore auto-generated desktop file
7 checkbox-touch.desktop
8+manifest.json
9
10=== modified file 'checkbox-touch/build-me'
11--- checkbox-touch/build-me 2016-05-24 12:01:35 +0000
12+++ checkbox-touch/build-me 2016-05-26 22:46:01 +0000
13@@ -12,15 +12,14 @@
14 import textwrap
15 import tempfile
16
17-from confinement.generate import generate_confinement
18-sys.path.append('./py')
19-from py.embedded_providers import EmbeddedProvider1PlugInCollection
20-from py.checkbox_touch import CheckboxTouchApplication
21-
22 from utils import get_package_from_url_and_extract
23 from utils import prepare_uris
24 from utils import rsync_tree
25
26+from confinement.generate import generate_confinement
27+sys.path.append('./py')
28+
29+
30 # DEFAULT_PROVIDERS is a list of providers directory names as listed in
31 # ../providers. NOTE: those are directory names, not provider names as reported
32 # by manage.py info
33@@ -55,6 +54,7 @@
34
35
36 def get_confined_jobs(path):
37+ from py.embedded_providers import EmbeddedProvider1PlugInCollection
38 collection = EmbeddedProvider1PlugInCollection(path)
39 # this should be run within provider's directory, so there should be
40 # only one provider loaded
41@@ -82,18 +82,6 @@
42 "{} not found!\nHave you run get-libs?".format(path))
43
44
45-def check_versions_match(manifest):
46- """Check if version coded in python matches one from manifest.json."""
47- res = CheckboxTouchApplication().get_version_pair()
48- version_from_py = res['result']['application_version']
49-
50- if manifest['version'] != version_from_py:
51- raise Exception(
52- ("Version mismatch! Version from checkbox_touch.py: {}, "
53- "version from manifest.json: {}").format(
54- version_from_py, manifest['version']))
55-
56-
57 def get_revision_string(path='.'):
58 # Try getting revno from bazaar vcs
59 try:
60@@ -190,17 +178,8 @@
61 extract_dependencies()
62 copy_provider_libs()
63
64- current_manifest = json.loads(open('manifest.json', 'rt').read())
65- check_versions_match(current_manifest)
66- hooks = {
67- 'checkbox-touch': current_manifest['hooks']['checkbox-touch']
68- }
69- for hook in build_confinement(current_manifest['version']):
70- hooks.update(hook)
71- new_manifest = current_manifest.copy()
72- new_manifest['hooks'] = hooks
73- with open('manifest.json', 'wt') as f:
74- f.write(json.dumps(new_manifest, sort_keys=True, indent=4))
75+ generate_manifest()
76+
77 build_i18n()
78
79 generate_desktop_file(lang=args.forced_lang)
80@@ -274,6 +253,7 @@
81 "provider '{}'.".format(provider_dir))
82 raise e
83
84+
85 def extract_dependencies():
86 print("Extracting dependencies")
87 for provider_dir in os.listdir('providers'):
88@@ -308,6 +288,7 @@
89 if os.path.exists(lib_path):
90 rsync_tree(lib_path, 'lib', preserve_symlinks=1)
91
92+
93 def copy_provider_libs():
94 print("Copy over provider-supplied libs")
95 for provider_dir in os.listdir('providers'):
96@@ -317,7 +298,8 @@
97
98
99 def generate_desktop_file(lang=None):
100- exec_line = "qmlscene --settings=settings.json {import_options} $@ checkbox-touch.qml"
101+ exec_line = ("qmlscene --settings=settings.json "
102+ "{import_options} $@ checkbox-touch.qml")
103 if lang:
104 exec_line = 'bash -c "LANGUAGE={} {}"'.format(lang, exec_line)
105 template = textwrap.dedent("""
106@@ -341,6 +323,36 @@
107 f.write(template.format(import_options=" ".join(import_opts)))
108
109
110+def generate_manifest():
111+ from py.checkbox_touch import CheckboxTouchApplication
112+ res = CheckboxTouchApplication().get_version_pair()
113+ version = res['result']['application_version']
114+ hooks = {
115+ 'checkbox-touch': {
116+ 'apparmor': 'checkbox-touch.json',
117+ 'desktop': 'checkbox-touch.desktop'
118+ }
119+ }
120+ for hook in build_confinement(version):
121+ hooks.update(hook)
122+ manifest = {
123+ 'architecture': 'armhf',
124+ 'description': 'System testing utility for Ubuntu',
125+ 'framework': 'ubuntu-sdk-14.10',
126+ 'hooks': hooks,
127+ 'maintainer': 'Checkbox Developers <checkbox-dev@lists.launchpad.net>',
128+ 'name': 'com.ubuntu.checkbox',
129+ 'title': 'Checkbox',
130+ 'version': version,
131+ 'x-source': {
132+ 'vcs-bzr': 'lp:checkbox',
133+ 'vcs-bzr-revno': version
134+ }
135+ }
136+ with open('manifest.json', 'wt') as f:
137+ f.write(json.dumps(manifest, sort_keys=True, indent=4))
138+
139+
140 def build_click():
141 print('Building click package')
142 base_path = os.path.normpath(os.path.join(os.getcwd(), '..'))
143
144=== removed file 'checkbox-touch/manifest.json'
145--- checkbox-touch/manifest.json 2016-04-29 02:50:45 +0000
146+++ checkbox-touch/manifest.json 1970-01-01 00:00:00 +0000
147@@ -1,19 +0,0 @@
148-{
149- "architecture": "armhf",
150- "description": "System testing utility for Ubuntu",
151- "framework": "ubuntu-sdk-14.10",
152- "hooks": {
153- "checkbox-touch": {
154- "apparmor": "checkbox-touch.json",
155- "desktop": "checkbox-touch.desktop"
156- }
157- },
158- "maintainer": "Zygmunt Krynicki <zkrynicki@ubuntu.com>",
159- "name": "com.ubuntu.checkbox",
160- "title": "Checkbox",
161- "version": "1.3.dev",
162- "x-source": {
163- "vcs-bzr": "lp:checkbox",
164- "vcs-bzr-revno": "checkbox-touch-v1.3.dev0"
165- }
166-}
167\ No newline at end of file

Subscribers

People subscribed via source and target branches