Merge lp:~zyga/snapcraft/extra-run-features into lp:~snappy-dev/snapcraft/core

Proposed by Zygmunt Krynicki on 2015-08-26
Status: Merged
Approved by: Michael Vogt on 2015-08-26
Approved revision: 139
Merged at revision: 139
Proposed branch: lp:~zyga/snapcraft/extra-run-features
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 29 lines (+15/-3)
1 file modified
snapcraft/cmds.py (+15/-3)
To merge this branch: bzr merge lp:~zyga/snapcraft/extra-run-features
Reviewer Review Type Date Requested Status
Michael Vogt 2015-08-26 Approve on 2015-08-26
Review via email: mp+269202@code.launchpad.net

Commit Message

Add support for SNAPCRAFT_RUN_QEMU_ARGS

To post a comment you must log in.
Michael Vogt (mvo) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snapcraft/cmds.py'
2--- snapcraft/cmds.py 2015-08-26 10:26:38 +0000
3+++ snapcraft/cmds.py 2015-08-26 12:35:24 +0000
4@@ -238,10 +238,22 @@
5 cwd=qemudir)
6 qemu = None
7 try:
8+ # Allow the developer to provide additional arguments to qemu. This
9+ # can be used, for example, to pass through USB devices from the host.
10+ # This can enable a lot of hardware-specific use cases directly inside
11+ # the snapcraft run workflow.
12+ #
13+ # For example:
14+ # $ export SNAPCRAFT_RUN_QEMU_ARGS="-usb -device usb-host,hostbus=1,hostaddr=10"
15+ # $ snapcraft run
16+ qemu_args = os.getenv("SNAPCRAFT_RUN_QEMU_ARGS")
17+ if qemu_args is not None:
18+ qemu_args = shlex.split(qemu_args)
19+ else:
20+ qemu_args = []
21 qemu = subprocess.Popen(
22- ["kvm", "-m", "768", "-nographic",
23- "-snapshot", "-redir", "tcp:8022::22", qemu_img],
24- stdin=subprocess.PIPE)
25+ ["kvm", "-m", "768", "-nographic", "-snapshot", "-redir",
26+ "tcp:8022::22", qemu_img] + qemu_args, stdin=subprocess.PIPE)
27 n = tempfile.NamedTemporaryFile()
28 ssh_opts = [
29 # We want to login with the specified ssh identity (key)

Subscribers

People subscribed via source and target branches