Merge ~sylvain-pineau/checkbox-snappy/+git/checkbox-snappy-classic:content-interface-s16 into ~checkbox-dev/checkbox-snappy/+git/checkbox-snappy-classic:series16
- Git
- lp:~sylvain-pineau/checkbox-snappy/+git/checkbox-snappy-classic
- content-interface-s16
- Merge into series16
Proposed by
Sylvain Pineau
Status: | Merged |
---|---|
Approved by: | Sylvain Pineau |
Approved revision: | 9d684ab3d84e490e4eafacd5321e39cbce69ff00 |
Merged at revision: | 426198ddaeccefbdad6a1fcec1c186d482f88025 |
Proposed branch: | ~sylvain-pineau/checkbox-snappy/+git/checkbox-snappy-classic:content-interface-s16 |
Merge into: | ~checkbox-dev/checkbox-snappy/+git/checkbox-snappy-classic:series16 |
Diff against target: |
400 lines (+182/-99) 6 files modified
dev/null (+0/-6) launchers/configure (+24/-5) launchers/wrapper_common (+64/-15) snap/hooks/configure (+26/-5) snap/plugins/checkbox_provider.py (+67/-0) snap/snapcraft.yaml (+1/-68) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Checkbox Developers | Pending | ||
Review via email:
|
Commit message
Description of the change
Content interface deployment
Built using the snapcraft snap
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/launchers/checkbox-launcher-wrapper b/launchers/checkbox-launcher-wrapper |
2 | deleted file mode 100755 |
3 | index bf193ee..0000000 |
4 | --- a/launchers/checkbox-launcher-wrapper |
5 | +++ /dev/null |
6 | @@ -1,6 +0,0 @@ |
7 | -#!/bin/bash |
8 | - |
9 | -. $(dirname "$(realpath $BASH_SOURCE)")/wrapper_common |
10 | - |
11 | -cd $HOME |
12 | -exec python3 $(which checkbox-launcher) "$@" |
13 | diff --git a/launchers/configure b/launchers/configure |
14 | index e9b95d1..19863a1 100755 |
15 | --- a/launchers/configure |
16 | +++ b/launchers/configure |
17 | @@ -1,18 +1,37 @@ |
18 | #!/usr/bin/env python3 |
19 | -# Copyright 2017 Canonical Ltd. |
20 | +# Copyright 2018-2019 Canonical Ltd. |
21 | # All rights reserved. |
22 | # |
23 | # Written by: |
24 | # Maciej Kisielewski <maciej.kisielewski@canonical.com> |
25 | +# Sylvain Pineau <sylvain.pineau@canonical.com> |
26 | import os |
27 | import re |
28 | import sys |
29 | |
30 | sys.path.append(os.path.expandvars("$SNAP/usr/lib/python3/dist-packages")) |
31 | -sys.path.append(os.path.expandvars("$SNAP/lib/python3.5/site-packages")) |
32 | - |
33 | -from checkbox_support.snap_utils.config import update_configuration |
34 | -from checkbox_support.snap_utils.config import print_checkbox_conf |
35 | +sitepkgpath = "$SNAP/lib/python{}.{}/site-packages".format( |
36 | + sys.version_info[0], sys.version_info[1]) |
37 | +sys.path.append(os.path.expandvars(sitepkgpath)) |
38 | + |
39 | +sys.path.append(os.path.expandvars( |
40 | + "/snap/checkbox/current/usr/lib/python3/dist-packages")) |
41 | +runtimepath = "/snap/checkbox/current/lib/python{}.{}/site-packages".format( |
42 | + sys.version_info[0], sys.version_info[1]) |
43 | +sys.path.append(os.path.expandvars(runtimepath)) |
44 | + |
45 | +try: |
46 | + from checkbox_support.snap_utils.config import update_configuration |
47 | + from checkbox_support.snap_utils.config import print_checkbox_conf |
48 | +except ImportError: |
49 | + msg = """ |
50 | +checkbox-support not found! |
51 | +You need to install the checkbox snap: |
52 | + |
53 | +snap install checkbox |
54 | + """ |
55 | + print(os.path.expandvars(msg), file=sys.stderr) |
56 | + sys.exit(1) |
57 | |
58 | |
59 | def main(): |
60 | diff --git a/launchers/wrapper_common b/launchers/wrapper_common |
61 | index 3acbd5d..a5ca8ae 100644 |
62 | --- a/launchers/wrapper_common |
63 | +++ b/launchers/wrapper_common |
64 | @@ -12,32 +12,79 @@ case "$SNAP_ARCH" in |
65 | ;; |
66 | esac |
67 | |
68 | +################################################ |
69 | +# Launcher common exports for any checkbox app # |
70 | +################################################ |
71 | + |
72 | +function prepend_dir() { |
73 | + local var="$1" |
74 | + local dir="$2" |
75 | + if [ -d "$dir" ]; then |
76 | + eval "export $var=\"\$dir\${$var:+:\$$var}\"" |
77 | + fi |
78 | +} |
79 | + |
80 | +function append_dir() { |
81 | + local var="$1" |
82 | + local dir="$2" |
83 | + if [ -d "$dir" ]; then |
84 | + eval "export $var=\"\${$var:+\$$var:}\$dir\"" |
85 | + fi |
86 | +} |
87 | + |
88 | +export LC_ALL=C.UTF-8 |
89 | +PERL_VERSION=$(perl -e '$^V=~/^v(\d+\.\d+)/;print $1') |
90 | +export PERL5LIB="$PERL5LIB:$SNAP/usr/lib/$ARCH/perl/$PERL_VERSION:$SNAP/usr/lib/$ARCH/perl5/$PERL_VERSION:$SNAP/usr/share/perl/$PERL_VERSION:$SNAP/usr/share/perl5" |
91 | export GI_TYPELIB_PATH=$SNAP/usr/lib/girepository-1.0:$SNAP/usr/lib/$ARCH/girepository-1.0 |
92 | +export PATH="$SNAP/usr/sbin:$SNAP/sbin:/snap/bin:$PATH" |
93 | +export ALSA_CONFIG_PATH=$SNAP/usr/share/alsa/alsa.conf:$SNAP/usr/share/alsa/pcm/default.conf |
94 | +export PYTHONPATH="$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH" |
95 | + |
96 | +RUNTIME=/snap/checkbox/current |
97 | +if [ ! -d "$RUNTIME" ]; then |
98 | + echo "You need to install the checkbox snap." |
99 | + echo "" |
100 | + echo "You can do this with this command:" |
101 | + echo "snap install checkbox" |
102 | + exit 1 |
103 | +fi |
104 | |
105 | -export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri |
106 | +# add general paths not added by snapcraft due to runtime snap |
107 | +append_dir LD_LIBRARY_PATH $RUNTIME/lib/$ARCH |
108 | +append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH |
109 | +append_dir LD_LIBRARY_PATH $RUNTIME/lib/fwts |
110 | +append_dir GI_TYPELIB_PATH $RUNTIME/usr/lib/girepository-1.0 |
111 | +append_dir GI_TYPELIB_PATH $RUNTIME/usr/lib/$ARCH/girepository-1.0 |
112 | +prepend_dir PATH $RUNTIME/bin |
113 | +prepend_dir PATH $RUNTIME/usr/bin |
114 | +prepend_dir PATH $RUNTIME/sbin |
115 | +prepend_dir PATH $RUNTIME/usr/sbin |
116 | +prepend_dir PATH $RUNTIME/usr/lib/qt5/bin |
117 | +append_dir ALSA_CONFIG_PATH $RUNTIME/usr/share/alsa/alsa.conf |
118 | +append_dir ALSA_CONFIG_PATH $RUNTIME/usr/share/alsa/pcm/default.conf |
119 | +append_dir PYTHONUSERBASE $RUNTIME |
120 | +append_dir PYTHONHOME $RUNTIME/usr |
121 | +append_dir PYTHONPATH $RUNTIME/usr/lib/python3/dist-packages |
122 | +append_dir PYTHONPATH $RUNTIME/lib/python3*/site-packages |
123 | +append_dir PERL5LIB $RUNTIME/usr/lib/$ARCH/perl/$PERL_VERSION |
124 | +append_dir PERL5LIB $RUNTIME/usr/lib/$ARCH/perl5/$PERL_VERSION |
125 | +append_dir PERL5LIB $RUNTIME/usr/share/perl/$PERL_VERSION |
126 | +append_dir PERL5LIB $RUNTIME/usr/share/perl5 |
127 | |
128 | # Use a modules directory which doesn't exist so we don't load random things |
129 | # which may then get deleted (or their dependencies) and potentially segfault |
130 | export GIO_MODULE_DIR=$SNAP/gio/modules-dummy |
131 | |
132 | -export PATH="$SNAP/bin:$SNAP/usr/bin:$SNAP/usr/sbin:$SNAP/sbin:/snap/bin:$PATH" |
133 | - |
134 | -#export LD_LIBRARY_PATH="$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH:$SNAP/lib/fwts:$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH" |
135 | - |
136 | -export QML2_IMPORT_PATH="$SNAP/usr/lib/$ARCH/qt5/qml:$QML2_IMPORT_PATH" |
137 | -export QT_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/qt5/plugins |
138 | +export QML2_IMPORT_PATH="$RUNTIME/usr/lib/$ARCH/qt5/qml:$QML2_IMPORT_PATH" |
139 | +export QT_PLUGIN_PATH=$RUNTIME/usr/lib/$ARCH/qt5/plugins |
140 | export QT_QPA_PLATFORM=xcb |
141 | export QT_QPA_PLATFORMTHEME=appmenu-qt5 |
142 | |
143 | -export PYTHONUSERBASE=$SNAP |
144 | -export PYTHONHOME=$SNAP/usr |
145 | -export PYTHONPATH="$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH" |
146 | - |
147 | # Tell GStreamer where to find its plugins |
148 | -export GST_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/gstreamer-1.0 |
149 | -export GST_PLUGIN_SYSTEM_PATH=$SNAP/usr/lib/$ARCH/gstreamer-1.0 |
150 | +export GST_PLUGIN_PATH=$RUNTIME/usr/lib/$ARCH/gstreamer-1.0 |
151 | +export GST_PLUGIN_SYSTEM_PATH=$RUNTIME/usr/lib/$ARCH/gstreamer-1.0 |
152 | # gst plugin scanner doesn't install in the correct path: https://github.com/ubuntu/snapcraft-desktop-helpers/issues/43 |
153 | -export GST_PLUGIN_SCANNER=$SNAP/usr/lib/$ARCH/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner |
154 | +export GST_PLUGIN_SCANNER=$RUNTIME/usr/lib/$ARCH/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner |
155 | |
156 | # Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR |
157 | if [ -n "$XDG_RUNTIME_DIR" ]; then |
158 | @@ -45,5 +92,7 @@ if [ -n "$XDG_RUNTIME_DIR" ]; then |
159 | export PULSE_SYSTEM=1 |
160 | fi |
161 | |
162 | +BASE_PROVIDERS=($RUNTIME/providers/*) |
163 | +BASE_PROVIDERS_PATH=$(IFS=:; echo "${BASE_PROVIDERS[*]}") |
164 | PROVIDERS=($SNAP/providers/*) |
165 | -export PROVIDERPATH=$(IFS=:; echo "${PROVIDERS[*]}") |
166 | +export PROVIDERPATH=$(IFS=:; echo "${PROVIDERS[*]}"):$BASE_PROVIDERS_PATH |
167 | diff --git a/snap/hooks/configure b/snap/hooks/configure |
168 | index 4b5f324..c93e385 100755 |
169 | --- a/snap/hooks/configure |
170 | +++ b/snap/hooks/configure |
171 | @@ -1,9 +1,10 @@ |
172 | #!/usr/bin/env python3 |
173 | -# Copyright 2017 Canonical Ltd. |
174 | +# Copyright 2017-2019 Canonical Ltd. |
175 | # All rights reserved. |
176 | # |
177 | # Written by: |
178 | # Maciej Kisielewski <maciej.kisielewski@canonical.com> |
179 | +# Sylvain Pineau <sylvain.pineau@canonical.com> |
180 | """ |
181 | This hook reads `config_vars` file from the root of a snap and reenters this |
182 | configuration using snapd's config facilities and rewrites the file to a |
183 | @@ -18,11 +19,15 @@ OPEN_N_SSID |
184 | OPEN_BG_SSID |
185 | STRESS_S3_WAIT_DELAY=60 |
186 | |
187 | -To change those values using `snap set` command, you need to change CAPS to |
188 | -lowercase and underscores to dashes (-). |
189 | +To change those values use the configure launcher. |
190 | +E.g. |
191 | + $ checkbox-snappy-classic.configure OPEN_N_SSID=my-wifi |
192 | + |
193 | +If you __really__ need to change those values using `snap set` command, |
194 | +you need to change CAPS to lowercase and underscores to dashes (-). |
195 | |
196 | E.g. |
197 | - $ snap set checkbox-snappy open-n-ssid=my-wifi |
198 | + $ snap set checkbox-snappy-classic open-n-ssid=my-wifi |
199 | """ |
200 | |
201 | import os |
202 | @@ -33,5 +38,21 @@ sitepkgpath = "$SNAP/lib/python{}.{}/site-packages".format( |
203 | sys.version_info[0], sys.version_info[1]) |
204 | sys.path.append(os.path.expandvars(sitepkgpath)) |
205 | |
206 | -from checkbox_support.snap_utils.config import refresh_configuration |
207 | +sys.path.append(os.path.expandvars( |
208 | + "/snap/checkbox/current/usr/lib/python3/dist-packages")) |
209 | +runtimepath = "/snap/checkbox/current/lib/python{}.{}/site-packages".format( |
210 | + sys.version_info[0], sys.version_info[1]) |
211 | +sys.path.append(os.path.expandvars(runtimepath)) |
212 | + |
213 | +try: |
214 | + from checkbox_support.snap_utils.config import refresh_configuration |
215 | +except ImportError: |
216 | + msg = """ |
217 | +checkbox-support not found! |
218 | +You need to install the checkbox snap: |
219 | + |
220 | +snap install checkbox |
221 | + """ |
222 | + print(os.path.expandvars(msg), file=sys.stderr) |
223 | + sys.exit(1) |
224 | refresh_configuration() |
225 | diff --git a/snap/plugins/checkbox_provider.py b/snap/plugins/checkbox_provider.py |
226 | new file mode 100644 |
227 | index 0000000..eded14b |
228 | --- /dev/null |
229 | +++ b/snap/plugins/checkbox_provider.py |
230 | @@ -0,0 +1,67 @@ |
231 | +# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- |
232 | +# |
233 | +# Copyright (C) 2016-2019 Canonical Ltd |
234 | +# |
235 | +# This program is free software: you can redistribute it and/or modify |
236 | +# it under the terms of the GNU General Public License version 3 as |
237 | +# published by the Free Software Foundation. |
238 | +# |
239 | +# This program is distributed in the hope that it will be useful, |
240 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
241 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
242 | +# GNU General Public License for more details. |
243 | +# |
244 | +# You should have received a copy of the GNU General Public License |
245 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
246 | + |
247 | +import os |
248 | + |
249 | +from snapcraft.internal import mangling |
250 | +from snapcraft.plugins import plainbox_provider |
251 | + |
252 | + |
253 | +class CheckboxProvider(plainbox_provider.PlainboxProviderPlugin): |
254 | + |
255 | + def __init__(self, name, options, project): |
256 | + super().__init__(name, options, project) |
257 | + self.build_snaps.append("checkbox-provider-tools") |
258 | + if project.info.base in (None, "core16"): |
259 | + self.build_snaps.append("checkbox") |
260 | + if project.info.base == "core18": |
261 | + self.build_snaps.append("checkbox18") |
262 | + |
263 | + def build(self): |
264 | + env = os.environ.copy() |
265 | + # Ensure the first provider does not attempt to validate against |
266 | + # providers installed on the build host by initialising PROVIDERPATH |
267 | + # to empty |
268 | + env["PROVIDERPATH"] = "" |
269 | + provider_stage_dir = os.path.join(self.project.stage_dir, "providers") |
270 | + if os.path.exists(provider_stage_dir): |
271 | + provider_dirs = [ |
272 | + os.path.join(provider_stage_dir, provider) |
273 | + for provider in os.listdir(provider_stage_dir) |
274 | + ] |
275 | + env["PROVIDERPATH"] = ":".join(provider_dirs) |
276 | + for snap_name in self.build_snaps: |
277 | + build_snap_provider_dir = os.path.join( |
278 | + "/snap", snap_name, "current", "providers") |
279 | + if os.path.exists(build_snap_provider_dir): |
280 | + provider_dirs = [ |
281 | + os.path.join(build_snap_provider_dir, provider) |
282 | + for provider in os.listdir(build_snap_provider_dir) |
283 | + ] |
284 | + env["PROVIDERPATH"] = ":".join(provider_dirs) |
285 | + cmd = "checkbox-provider-tools" |
286 | + self.run([cmd, "validate"], env=env) |
287 | + self.run([cmd, "build"]) |
288 | + self.run( |
289 | + [ |
290 | + cmd, |
291 | + "install", |
292 | + "--layout=relocatable", |
293 | + "--prefix=/providers/{}".format(self.name), |
294 | + "--root={}".format(self.installdir), |
295 | + ] |
296 | + ) |
297 | + mangling.rewrite_python_shebangs(self.installdir) |
298 | diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml |
299 | index 3a44062..94bef45 100644 |
300 | --- a/snap/snapcraft.yaml |
301 | +++ b/snap/snapcraft.yaml |
302 | @@ -1,13 +1,10 @@ |
303 | name: checkbox-snappy-classic |
304 | summary: Checkbox tests for Snappy devices |
305 | description: "The provider is a collection of tests to be run on Snappy devices.\n" |
306 | -version: '16.9.dev' |
307 | +version: '16.11.dev' |
308 | grade: stable |
309 | confinement: classic |
310 | |
311 | -# Don't forget to add a new slot if a new provider part is added in the parts |
312 | -# section below. |
313 | - |
314 | apps: |
315 | checkbox-cli: |
316 | command: bin/checkbox-cli-wrapper |
317 | @@ -19,8 +16,6 @@ apps: |
318 | command: bin/smoke-test |
319 | snappy-generic-automated: |
320 | command: bin/snappy-generic-automated |
321 | - python3: |
322 | - command: python3 |
323 | engineering-tests: |
324 | command: bin/engineering-tests |
325 | hw-collection: |
326 | @@ -35,74 +30,12 @@ apps: |
327 | command: bin/shell-wrapper |
328 | |
329 | parts: |
330 | - fwts: |
331 | - source-tag: "" |
332 | - stress-ng: |
333 | - source-tag: "" |
334 | - after: [plainbox-provider-checkbox] |
335 | - checkbox-support-dev: |
336 | - source-tag: "" |
337 | - after: [fwts] |
338 | - checkbox-ng-dev: |
339 | - source-tag: "" |
340 | - plainbox-provider-resource: |
341 | - source-tag: "" |
342 | - after: [checkbox-support-dev, checkbox-ng-dev] |
343 | - plainbox-provider-checkbox: |
344 | - source-tag: "" |
345 | - stage: |
346 | - - -usr/bin/stress-ng |
347 | - - -usr/share/man/man1/stress-ng* |
348 | - - -usr/share/stress-ng/* |
349 | - after: [plainbox-provider-resource] |
350 | - plainbox-provider-snappy: |
351 | - source-tag: "" |
352 | - stage: |
353 | - - -usr/bin/stress-ng |
354 | - - -usr/share/man/man1/stress-ng* |
355 | - - -usr/share/stress-ng/* |
356 | - after: [plainbox-provider-checkbox] |
357 | - plainbox-provider-ipdt: |
358 | - source-tag: "" |
359 | - after: [plainbox-provider-snappy] |
360 | - plainbox-provider-docker: |
361 | - source-tag: "" |
362 | - after: [plainbox-provider-ipdt] |
363 | - plainbox-provider-tpm2: |
364 | - source-tag: "" |
365 | - after: [plainbox-provider-docker, tpm2-tools-3] |
366 | - plainbox-provider-sru: |
367 | - source-tag: "" |
368 | - after: [plainbox-provider-tpm2] |
369 | - plainbox-provider-engineering-tests: |
370 | - source-tag: "" |
371 | - after: [plainbox-provider-sru] |
372 | launchers: |
373 | plugin: dump |
374 | source: launchers/ |
375 | organize: |
376 | '*': bin/ |
377 | - i2c-tools: |
378 | - plugin: nil |
379 | - stage-packages: |
380 | - - i2c-tools |
381 | - prime: |
382 | - - usr/sbin/i2cdetect |
383 | - # Keep this, fwts builds are somehow affected by staged libs if not built |
384 | - # first hence the after clause in tpm2-tss-1.4. |
385 | - tpm2-tss-1.4: |
386 | - after: [fwts] |
387 | - parts-meta-info: |
388 | - after: [plainbox-provider-engineering-tests] |
389 | config-variables: |
390 | plugin: dump |
391 | source: . |
392 | stage: [config_vars] |
393 | - # This module is a dependency for the job gpio/gpiomem_loopback_pairs_{model} |
394 | - # in plainbox-provider-snappy only available in pypi and so can't be addded |
395 | - # to stage-packages of the remote part |
396 | - rpi-support-libs: |
397 | - plugin: python |
398 | - python-packages: |
399 | - - RPi.GPIO |
400 | - - netifaces |