Merge lp:~lool/linaro-image-tools/drop-qemu-img into lp:linaro-image-tools/11.11

Proposed by Loïc Minier
Status: Merged
Merged at revision: 333
Proposed branch: lp:~lool/linaro-image-tools/drop-qemu-img
Merge into: lp:linaro-image-tools/11.11
Diff against target: 101 lines (+10/-16)
5 files modified
README (+1/-5)
linaro-android-media-create (+0/-1)
linaro-media-create (+0/-1)
linaro_image_tools/media_create/partitions.py (+3/-3)
linaro_image_tools/media_create/tests/test_media_create.py (+6/-6)
To merge this branch: bzr merge lp:~lool/linaro-image-tools/drop-qemu-img
Reviewer Review Type Date Requested Status
Guilherme Salgado (community) Approve
Review via email: mp+59491@code.launchpad.net

Description of the change

Removes the need for qemu-img (uses dd instead); this was only tested on an ext4 filesystem on my host, testing on other fses welcome.

To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

Looks good to me. It'd be good to have testing on other fses, but I can't help with that.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2011-01-31 11:54:44 +0000
3+++ README 2011-04-29 11:16:35 +0000
4@@ -13,11 +13,7 @@
5 - python-dbus
6 - python-debian >= 0.1.16ubuntu1
7 - python-parted
8- - qemu-kvm-extras-static >= 0.13.0 (only if you're running on x86).
9- If you're not running Natty, you can get them from
10- - http://tinyurl.com/6yqzkre for 64-bit
11- - http://tinyurl.com/68rvuoz for 32-bit
12- - qemu-kvm
13+ - qemu-user-static >= 0.13.0 (only if you're running on x86)
14 - btrfs-tools
15 - command-not-found
16
17
18=== modified file 'linaro-android-media-create'
19--- linaro-android-media-create 2011-04-26 16:37:19 +0000
20+++ linaro-android-media-create 2011-04-29 11:16:35 +0000
21@@ -82,7 +82,6 @@
22 'mkfs.vfat', 'sfdisk', 'mkimage', 'parted']
23 if not is_arm_host():
24 required_commands.append('qemu-arm-static')
25- required_commands.append('qemu-img')
26 for command in required_commands:
27 ensure_command(command)
28
29
30=== modified file 'linaro-media-create'
31--- linaro-media-create 2011-04-27 11:49:00 +0000
32+++ linaro-media-create 2011-04-29 11:16:35 +0000
33@@ -80,7 +80,6 @@
34 'mkfs.vfat', 'sfdisk', 'mkimage', 'parted', 'gpg', 'sha1sum']
35 if not is_arm_host():
36 required_commands.append('qemu-arm-static')
37- required_commands.append('qemu-img')
38 if args.rootfs in ['btrfs', 'ext2', 'ext3', 'ext4']:
39 required_commands.append('mkfs.%s' % args.rootfs)
40 else:
41
42=== modified file 'linaro_image_tools/media_create/partitions.py'
43--- linaro_image_tools/media_create/partitions.py 2011-04-11 16:41:55 +0000
44+++ linaro_image_tools/media_create/partitions.py 2011-04-29 11:16:35 +0000
45@@ -111,9 +111,9 @@
46 image_size_in_bytes = convert_size_to_bytes(image_size)
47 cylinders = image_size_in_bytes / CYLINDER_SIZE
48 proc = cmd_runner.run(
49- ['qemu-img', 'create', '-f', 'raw', media.path,
50- str(image_size_in_bytes)],
51- stdout=open('/dev/null', 'w'))
52+ ['dd', 'of=%s' % media.path,
53+ 'bs=1', 'seek=%s' % image_size_in_bytes, 'count=0'],
54+ stderr=open('/dev/null', 'w'))
55 proc.wait()
56
57 if should_create_partitions:
58
59=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
60--- linaro_image_tools/media_create/tests/test_media_create.py 2011-04-21 13:13:59 +0000
61+++ linaro_image_tools/media_create/tests/test_media_create.py 2011-04-29 11:16:35 +0000
62@@ -812,8 +812,8 @@
63 def test_run_sfdisk_commands(self):
64 tmpfile = self.createTempFileAsFixture()
65 proc = cmd_runner.run(
66- ['qemu-img', 'create', '-f', 'raw', tmpfile, '10M'],
67- stdout=subprocess.PIPE)
68+ ['dd', 'of=%s' % tmpfile, 'bs=1', 'seek=10M', 'count=0'],
69+ stderr=open('/dev/null', 'w'))
70 proc.communicate()
71 stdout, stderr = run_sfdisk_commands(
72 '2,16063,0xDA', HEADS, SECTORS, '', tmpfile, as_root=False,
73@@ -899,8 +899,8 @@
74 def _create_qemu_img_with_partitions(self, sfdisk_commands):
75 tmpfile = self.createTempFileAsFixture()
76 proc = cmd_runner.run(
77- ['qemu-img', 'create', '-f', 'raw', tmpfile, '30M'],
78- stdout=subprocess.PIPE)
79+ ['dd', 'of=%s' % tmpfile, 'bs=1', 'seek=30M', 'count=0'],
80+ stderr=open('/dev/null', 'w'))
81 proc.communicate()
82 stdout, stderr = run_sfdisk_commands(
83 sfdisk_commands, HEADS, SECTORS, '', tmpfile, as_root=False,
84@@ -958,7 +958,7 @@
85 def test_setup_partitions_for_image_file(self):
86 # In practice we could pass an empty image file to setup_partitions,
87 # but here we mock Popen() and thanks to that the image is not setup
88- # (via qemu-img) inside setup_partitions. That's why we pass an
89+ # (via dd) inside setup_partitions. That's why we pass an
90 # already setup image file.
91 tmpfile = self._create_tmpfile()
92 popen_fixture = self.useFixture(MockCmdRunnerPopenFixture())
93@@ -981,7 +981,7 @@
94 'root', 'ext3', True, True, True)
95 self.assertEqual(
96 # This is the call that would create a 2 GiB image file.
97- ['qemu-img create -f raw %s 2147483648' % tmpfile,
98+ ['dd of=%s bs=1 seek=2147483648 count=0' % tmpfile,
99 # This call would partition the image file.
100 '%s sfdisk --force -D -uS -H %s -S %s -C 1024 %s' % (
101 sudo_args, HEADS, SECTORS, tmpfile),

Subscribers

People subscribed via source and target branches