diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 423: Logs the output of linaro-media-create as run by linaro-fetch-image[-ui].

Message ID 20110824102713.5918.30964.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

James Tunnicliffe Aug. 24, 2011, 10:27 a.m. UTC
Merge authors:
  James Tunnicliffe (dooferlad)
Related merge proposals:
  https://code.launchpad.net/~dooferlad/linaro-image-tools/fetch_image_add_lmc_log/+merge/72462
  proposed by: James Tunnicliffe (dooferlad)
  review: Approve - James Westby (james-w)
------------------------------------------------------------
revno: 423 [merge]
committer: James Tunnicliffe <james.tunnicliffe@linaro.org>
branch nick: linaro-image-tools
timestamp: Wed 2011-08-24 11:26:01 +0100
message:
  Logs the output of linaro-media-create as run by linaro-fetch-image[-ui].
modified:
  linaro_image_tools/fetch_image.py
  linaro_image_tools/fetch_image_settings.yaml


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/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-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro_image_tools/fetch_image.py'
--- linaro_image_tools/fetch_image.py	2011-08-19 12:15:02 +0000
+++ linaro_image_tools/fetch_image.py	2011-08-22 17:04:07 +0000
@@ -36,6 +36,7 @@ 
 import threading
 import subprocess
 import utils
+import xdg.BaseDirectory as xdgBaseDir
 
 QEMU = "qemu"
 HARDWARE = "hardware"
@@ -529,8 +530,7 @@ 
     """Downloads files and creates images from them by calling
     linaro-media-create"""
     def __init__(self):
-        import xdg.BaseDirectory as xdgBaseDir
-        self.homedir = os.path.join(xdgBaseDir.xdg_config_home,
+        self.datadir = os.path.join(xdgBaseDir.xdg_data_home,
                                      "linaro",
                                      "image-tools",
                                      "fetch_image")
@@ -611,6 +611,12 @@ 
         args.append("--hwpack")
         args.append(hwpack_file)
 
+        if not os.path.isdir(self.datadir):
+            os.makedirs(self.datadir)
+        with open(os.path.join(self.datadir, "linaro-media-create.log"),
+                               mode='w') as lmc_log:
+            lmc_log.write(" ".join(args) + "\n")
+
         logging.info(" ".join(args))
 
         return args
@@ -656,6 +662,11 @@ 
             self.settings       = settings
             self.tools_dir      = tools_dir
 
+            self.datadir = os.path.join(xdgBaseDir.xdg_data_home,
+                                     "linaro",
+                                     "image-tools",
+                                     "fetch_image")
+
         def run(self):
             """
             1. Download required files.
@@ -699,6 +710,9 @@ 
             self.waiting_for_event_response = False
             self.event_queue.put(("start", "unpack"))
 
+            lmc_log = open(os.path.join(self.datadir,
+                                        "linaro-media-create.log"), mode='a')
+
             while(1):
                 if self.create_process.poll() != None:
                     # linaro-media-create has finished. Tell the GUI the return
@@ -722,6 +736,8 @@ 
                     if self.save_lines:
                         self.saved_lines += self.line
 
+                    lmc_log.write(self.line + "\n")
+                    lmc_log.flush()
                     self.line = ""
                 else:
                     self.line += self.input
@@ -765,6 +781,8 @@ 
                 while self.waiting_for_event_response:
                     time.sleep(0.2)
 
+            lmc_log.close()
+
         def send_to_create_process(self, text):
             print >> self.create_process.stdin, text
             self.waiting_for_event_response = False

=== modified file 'linaro_image_tools/fetch_image_settings.yaml'
--- linaro_image_tools/fetch_image_settings.yaml	2011-08-22 17:34:18 +0000
+++ linaro_image_tools/fetch_image_settings.yaml	2011-08-24 10:26:01 +0000
@@ -78,7 +78,6 @@ 
     - imx51
     
     mx53loco:
-    - lt-mx53loco
     - lt-mx5
      
     u8500: