diff mbox

[Branch,~linaro-maintainers/linaro-image-tools/trunk] Rev 291: l-m-c now stores the original boot script (before we feed it to mkimage) in the boot partition as...

Message ID 20110301162730.9480.47376.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Guilherme Salgado March 1, 2011, 4:27 p.m. UTC
Merge authors:
  Guilherme Salgado (salgado)
Related merge proposals:
  https://code.launchpad.net/~salgado/linaro-image-tools/save-plain-boot-script/+merge/51574
  proposed by: Guilherme Salgado (salgado)
  review: Approve - Loïc Minier (lool)
  review: Abstain - James Westby (james-w)
------------------------------------------------------------
revno: 291 [merge]
committer: Guilherme Salgado <guilherme.salgado@linaro.org>
branch nick: trunk
timestamp: Tue 2011-03-01 13:23:52 -0300
message:
  l-m-c now stores the original boot script (before we feed it to mkimage) in the boot partition as boot.txt
modified:
  linaro_media_create/boards.py
  linaro_media_create/tests/test_media_create.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-maintainers/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-maintainers/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro_media_create/boards.py'
--- linaro_media_create/boards.py	2011-02-25 13:19:31 +0000
+++ linaro_media_create/boards.py	2011-03-01 16:23:52 +0000
@@ -24,11 +24,9 @@ 
 board_configs at the bottom of this file.
 """
 
-import atexit
 import glob
 import os
 import re
-import tempfile
 
 from linaro_media_create import cmd_runner
 from linaro_media_create.partitions import SECTOR_SIZE
@@ -498,12 +496,12 @@ 
 def make_boot_script(boot_script_data, boot_script):
     # Need to save the boot script data into a file that will be passed to
     # mkimage.
-    _, tmpfile = tempfile.mkstemp()
-    atexit.register(os.unlink, tmpfile)
-    with open(tmpfile, 'w') as fd:
+    plain_boot_script = os.path.join(
+        os.path.dirname(boot_script), 'boot.txt')
+    with open(plain_boot_script, 'w') as fd:
         fd.write(boot_script_data)
     return _run_mkimage(
-        'script', '0', '0', 'boot script', tmpfile, boot_script)
+        'script', '0', '0', 'boot script', plain_boot_script, boot_script)
 
 
 def install_mx5_boot_loader(imx_file, boot_device_or_file):

=== modified file 'linaro_media_create/tests/test_media_create.py'
--- linaro_media_create/tests/test_media_create.py	2011-02-25 13:19:31 +0000
+++ linaro_media_create/tests/test_media_create.py	2011-03-01 16:23:52 +0000
@@ -606,15 +606,16 @@ 
         self.assertEqual(expected, fixture.mock.calls)
 
     def test_make_boot_script(self):
-        self.useFixture(MockSomethingFixture(
-            tempfile, 'mkstemp', lambda: (-1, '/tmp/random-abxzr')))
+        tempdir = self.useFixture(CreateTempDirFixture()).tempdir
         self._mock_get_file_matching()
         fixture = self._mock_Popen()
-        make_boot_script('boot script data', 'boot_script')
+        boot_script_path = os.path.join(tempdir, 'boot.scr')
+        plain_boot_script_path = os.path.join(tempdir, 'boot.txt')
+        make_boot_script('boot script data', boot_script_path)
         expected = [
             'sudo', 'mkimage', '-A', 'arm', '-O', 'linux', '-T', 'script',
             '-C', 'none', '-a', '0', '-e', '0', '-n', 'boot script',
-            '-d', '/tmp/random-abxzr', 'boot_script']
+            '-d', plain_boot_script_path, boot_script_path]
         self.assertEqual([expected], fixture.mock.calls)
 
     def test_get_file_matching(self):