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
1=== modified file 'linaro-media-create'
2--- linaro-media-create 2011-01-04 12:08:13 +0000
3+++ linaro-media-create 2011-01-04 14:31:19 +0000
4@@ -394,11 +394,13 @@
5 }
6
7 setup_partitions() {
8- boot_and_root_devices=$(python -m media_create.partitions \
9+ python -m media_create.partitions ${TMP_DIR}/boot_and_root_devices \
10 "$DEVIMAGE" "${DEVICE-$IMAGE_FILE}" "$FAT_SIZE" "$IMAGE_SIZE" \
11 "$BOOT_LABEL" "$RFS_LABEL" "$RFS" "$RFS_UUID" \
12- "$SHOULD_CREATE_PARTITIONS" "$BOOTFS_STEP" "$ROOTFS_STEP")
13- eval $boot_and_root_devices
14+ "$SHOULD_CREATE_PARTITIONS" "$BOOTFS_STEP" "$ROOTFS_STEP"
15+ # The above call will write the BOOTFS and ROOTFS shell variables to the
16+ # file given as the first argument so here we just need to source it.
17+ . ${TMP_DIR}/boot_and_root_devices
18
19 if [ "${IMAGE_FILE}" ]; then
20 register_loopback "$BOOTFS"
21
22=== modified file 'media_create/partitions.py'
23--- media_create/partitions.py 2010-12-17 12:42:47 +0000
24+++ media_create/partitions.py 2011-01-04 14:31:19 +0000
25@@ -269,7 +269,8 @@
26 if __name__ == "__main__":
27 (board, device, fat_size, image_size, bootfs_label, rootfs_label,
28 rootfs_type, rootfs_uuid, should_create_partitions, bootfs_step,
29- rootfs_step) = sys.argv[1:]
30+ rootfs_step) = sys.argv[2:]
31+ out_file = sys.argv[1]
32 fat_size = int(fat_size)
33 should_format_bootfs = True
34 should_format_rootfs = True
35@@ -281,4 +282,7 @@
36 board, Media(device), fat_size, image_size, bootfs_label,
37 rootfs_label, rootfs_type, rootfs_uuid, should_create_partitions,
38 should_format_bootfs, should_format_rootfs)
39- print "BOOTFS=%s ROOTFS=%s" % (boot, root)
40+ # Write the boot/root partitions to the given out file to be later sourced
41+ # in the shell script.
42+ with open(out_file, 'w') as fd:
43+ fd.write("BOOTFS=%s ROOTFS=%s\n" % (boot, root))
44
45=== modified file 'tests/integration.txt'
46--- tests/integration.txt 2010-12-17 12:42:47 +0000
47+++ tests/integration.txt 2011-01-04 14:31:19 +0000
48@@ -11,18 +11,20 @@
49
50 # Partition (for real!) /dev/sdb for a beagle board and return the devices
51 # for the boot and root partitions.
52- >>> python -m media_create.partitions beagle /dev/sdb 32 2G boot root ext3
53- ... 2e82008e-1af3-4699-8521-3bf5bac1e67a yes format-bootfs format-rootfs
54+ >>> python -m media_create.partitions /tmp/out_file beagle /dev/sdb 32 2G
55+ ... boot root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes
56+ ... format-bootfs format-rootfs
57 Checking that no-one is using this disk right now
58 ...
59+ >>> cat /tmp/out_file
60 BOOTFS=/dev/sdb1 ROOTFS=/dev/sdb2
61
62 # Partition /tmp/beagle.img for a beagle board and return the loopback
63 # devices for the boot and root partitions.
64- >>> python -m media_create.partitions beagle /tmp/beagle.img 32 2G boot
65- ... root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes
66+ >>> python -m media_create.partitions /tmp/out_file beagle /tmp/beagle.img
67+ ... 32 2G boot root ext3 2e82008e-1af3-4699-8521-3bf5bac1e67a yes
68 ... format-bootfs format-rootfs
69 Warning: /tmp/beagle.img is not a block device
70 ...
71- BOOTFS=/dev/loop0
72- ROOTFS=/dev/loop1
73+ >>> cat /tmp/out_file
74+ BOOTFS=/dev/loop0 ROOTFS=/dev/loop1

Subscribers

People subscribed via source and target branches