Merge lp:~salgado/linaro-image-tools/remove-unneeded-code into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 240
Proposed branch: lp:~salgado/linaro-image-tools/remove-unneeded-code
Merge into: lp:linaro-image-tools/11.11
Diff against target: 70 lines (+0/-30)
3 files modified
linaro-media-create (+0/-3)
linaro_media_create/remove_binary_dir.py (+0/-11)
linaro_media_create/tests/test_media_create.py (+0/-16)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/remove-unneeded-code
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+46329@code.launchpad.net

Description of the change

We used to unpack the binary tarball on the current working dir so we had some
code to remove any directory named 'binary' under the current working
directory before unpacking. As we now unpack it on a temp dir which is removed
when the script exits, we no longer need that code.

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-13 00:00:49 +0000
+++ linaro-media-create 2011-01-14 20:39:08 +0000
@@ -19,7 +19,6 @@
19 setup_partitions,19 setup_partitions,
20 )20 )
21from linaro_media_create.populate_boot import populate_boot21from linaro_media_create.populate_boot import populate_boot
22from linaro_media_create.remove_binary_dir import remove_dir
23from linaro_media_create.rootfs import populate_rootfs22from linaro_media_create.rootfs import populate_rootfs
24from linaro_media_create.unpack_binary_tarball import unpack_binary_tarball23from linaro_media_create.unpack_binary_tarball import unpack_binary_tarball
25from linaro_media_create import get_args_parser24from linaro_media_create import get_args_parser
@@ -85,8 +84,6 @@
85 # All good, move on.84 # All good, move on.
86 pass85 pass
8786
88 # TODO: Combine these two into a single function.
89 remove_dir(ROOTFS_DIR)
90 unpack_binary_tarball(args.binary, TMP_DIR)87 unpack_binary_tarball(args.binary, TMP_DIR)
9188
92 hwpacks = args.hwpacks89 hwpacks = args.hwpacks
9390
=== removed file 'linaro_media_create/remove_binary_dir.py'
--- linaro_media_create/remove_binary_dir.py 2011-01-11 21:26:54 +0000
+++ linaro_media_create/remove_binary_dir.py 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1import os.path
2
3from linaro_media_create import cmd_runner
4
5
6def remove_dir(directory, as_root=True):
7 if os.path.exists(directory):
8 proc = cmd_runner.run(['rm', '-rf', directory], as_root=as_root)
9 proc.wait()
10 return proc.returncode
11 return 0
120
=== modified file 'linaro_media_create/tests/test_media_create.py'
--- linaro_media_create/tests/test_media_create.py 2011-01-13 00:00:49 +0000
+++ linaro_media_create/tests/test_media_create.py 2011-01-14 20:39:08 +0000
@@ -49,7 +49,6 @@
49 run_sfdisk_commands,49 run_sfdisk_commands,
50 setup_partitions,50 setup_partitions,
51 )51 )
52from linaro_media_create.remove_binary_dir import remove_dir
53from linaro_media_create.rootfs import (52from linaro_media_create.rootfs import (
54 create_flash_kernel_config,53 create_flash_kernel_config,
55 has_space_left_for_swap,54 has_space_left_for_swap,
@@ -153,21 +152,6 @@
153 self.assertEqual(expected, boot_cmd)152 self.assertEqual(expected, boot_cmd)
154153
155154
156class TestRemoveBinaryDir(TestCaseWithFixtures):
157
158 def setUp(self):
159 super(TestRemoveBinaryDir, self).setUp()
160 self.temp_dir_fixture = CreateTempDirFixture()
161 self.useFixture(self.temp_dir_fixture)
162
163 def test_remove_dir(self):
164 rc = remove_dir(
165 self.temp_dir_fixture.get_temp_dir(), as_root=False)
166 self.assertEqual(rc, 0)
167 self.assertFalse(
168 os.path.exists(self.temp_dir_fixture.get_temp_dir()))
169
170
171class TestUnpackBinaryTarball(TestCaseWithFixtures):155class TestUnpackBinaryTarball(TestCaseWithFixtures):
172156
173 def setUp(self):157 def setUp(self):

Subscribers

People subscribed via source and target branches