Merge lp:~salgado/linaro-image-tools/bug-697238 into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 228
Proposed branch: lp:~salgado/linaro-image-tools/bug-697238
Merge into: lp:linaro-image-tools/11.11
Diff against target: 74 lines (+19/-11)
3 files modified
linaro-media-create (+5/-3)
media_create/partitions.py (+6/-2)
tests/integration.txt (+8/-6)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/bug-697238
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+45127@code.launchpad.net

Description of the change

Use a temp file rather than stdout to pass data from a python script to l-m-c

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro-media-create'
--- linaro-media-create 2011-01-04 12:08:13 +0000
+++ linaro-media-create 2011-01-04 14:31:19 +0000
@@ -394,11 +394,13 @@
394}394}
395395
396setup_partitions() {396setup_partitions() {
397 boot_and_root_devices=$(python -m media_create.partitions \397 python -m media_create.partitions ${TMP_DIR}/boot_and_root_devices \
398 "$DEVIMAGE" "${DEVICE-$IMAGE_FILE}" "$FAT_SIZE" "$IMAGE_SIZE" \398 "$DEVIMAGE" "${DEVICE-$IMAGE_FILE}" "$FAT_SIZE" "$IMAGE_SIZE" \
399 "$BOOT_LABEL" "$RFS_LABEL" "$RFS" "$RFS_UUID" \399 "$BOOT_LABEL" "$RFS_LABEL" "$RFS" "$RFS_UUID" \
400 "$SHOULD_CREATE_PARTITIONS" "$BOOTFS_STEP" "$ROOTFS_STEP")400 "$SHOULD_CREATE_PARTITIONS" "$BOOTFS_STEP" "$ROOTFS_STEP"
401 eval $boot_and_root_devices401 # The above call will write the BOOTFS and ROOTFS shell variables to the
402 # file given as the first argument so here we just need to source it.
403 . ${TMP_DIR}/boot_and_root_devices
402404
403 if [ "${IMAGE_FILE}" ]; then405 if [ "${IMAGE_FILE}" ]; then
404 register_loopback "$BOOTFS"406 register_loopback "$BOOTFS"
405407
=== modified file 'media_create/partitions.py'
--- media_create/partitions.py 2010-12-17 12:42:47 +0000
+++ media_create/partitions.py 2011-01-04 14:31:19 +0000
@@ -269,7 +269,8 @@
269if __name__ == "__main__":269if __name__ == "__main__":
270 (board, device, fat_size, image_size, bootfs_label, rootfs_label,270 (board, device, fat_size, image_size, bootfs_label, rootfs_label,
271 rootfs_type, rootfs_uuid, should_create_partitions, bootfs_step,271 rootfs_type, rootfs_uuid, should_create_partitions, bootfs_step,
272 rootfs_step) = sys.argv[1:]272 rootfs_step) = sys.argv[2:]
273 out_file = sys.argv[1]
273 fat_size = int(fat_size)274 fat_size = int(fat_size)
274 should_format_bootfs = True275 should_format_bootfs = True
275 should_format_rootfs = True276 should_format_rootfs = True
@@ -281,4 +282,7 @@
281 board, Media(device), fat_size, image_size, bootfs_label,282 board, Media(device), fat_size, image_size, bootfs_label,
282 rootfs_label, rootfs_type, rootfs_uuid, should_create_partitions,283 rootfs_label, rootfs_type, rootfs_uuid, should_create_partitions,
283 should_format_bootfs, should_format_rootfs)284 should_format_bootfs, should_format_rootfs)
284 print "BOOTFS=%s ROOTFS=%s" % (boot, root)285 # Write the boot/root partitions to the given out file to be later sourced
286 # in the shell script.
287 with open(out_file, 'w') as fd:
288 fd.write("BOOTFS=%s ROOTFS=%s\n" % (boot, root))
285289
=== modified file 'tests/integration.txt'
--- tests/integration.txt 2010-12-17 12:42:47 +0000
+++ tests/integration.txt 2011-01-04 14:31:19 +0000
@@ -11,18 +11,20 @@
1111
12 # Partition (for real!) /dev/sdb for a beagle board and return the devices12 # Partition (for real!) /dev/sdb for a beagle board and return the devices
13 # for the boot and root partitions.13 # for the boot and root partitions.
14 >>> python -m media_create.partitions beagle /dev/sdb 32 2G boot root ext314 >>> python -m media_create.partitions /tmp/out_file beagle /dev/sdb 32 2G
15 ... 2e82008e-1af3-4699-8521-3bf5bac1e67a yes format-bootfs format-rootfs15 ... boot root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes
16 ... format-bootfs format-rootfs
16 Checking that no-one is using this disk right now17 Checking that no-one is using this disk right now
17 ...18 ...
19 >>> cat /tmp/out_file
18 BOOTFS=/dev/sdb1 ROOTFS=/dev/sdb220 BOOTFS=/dev/sdb1 ROOTFS=/dev/sdb2
1921
20 # Partition /tmp/beagle.img for a beagle board and return the loopback22 # Partition /tmp/beagle.img for a beagle board and return the loopback
21 # devices for the boot and root partitions.23 # devices for the boot and root partitions.
22 >>> python -m media_create.partitions beagle /tmp/beagle.img 32 2G boot24 >>> python -m media_create.partitions /tmp/out_file beagle /tmp/beagle.img
23 ... root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes25 ... 32 2G boot root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes
24 ... format-bootfs format-rootfs26 ... format-bootfs format-rootfs
25 Warning: /tmp/beagle.img is not a block device27 Warning: /tmp/beagle.img is not a block device
26 ...28 ...
27 BOOTFS=/dev/loop029 >>> cat /tmp/out_file
28 ROOTFS=/dev/loop130 BOOTFS=/dev/loop0 ROOTFS=/dev/loop1

Subscribers

People subscribed via source and target branches