[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 633: Fix for bug 1195536

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

Commit Message

Tyler Baker July 2, 2013, 6:55 p.m.
Merge authors:
  Yongqin Liu (liuyq0307)
Related merge proposals:
  https://code.launchpad.net/~liuyq0307/lava-dispatcher/fix-1195536/+merge/171954
  proposed by: Yongqin Liu (liuyq0307)
  review: Approve - Tyler Baker (tyler-baker)
------------------------------------------------------------
revno: 633 [merge]
committer: Tyler Baker <tyler.baker@linaro.org>
branch nick: lava-dispatcher
timestamp: Tue 2013-07-02 11:54:12 -0700
message:
  Fix for bug 1195536
modified:
  lava_dispatcher/config.py
  lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf
  lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf
  lava_dispatcher/device/fastmodel.py
  lava_dispatcher/device/target.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2013-06-20 15:37:54 +0000
+++ lava_dispatcher/config.py	2013-07-01 01:46:25 +0000
@@ -85,8 +85,8 @@ 
     simulator_version_command = schema.StringOption()
     simulator_command = schema.StringOption()
     simulator_axf_files = schema.ListOption()
-    simulator_kernel = schema.StringOption(default=None)
-    simulator_initrd = schema.StringOption(default=None)
+    simulator_kernel_files = schema.ListOption(default=None)
+    simulator_initrd_files = schema.ListOption(default=None)
     simulator_dtb = schema.StringOption(default=None)
     simulator_uefi = schema.StringOption(default=None)
     simulator_boot_wrapper = schema.StringOption(default=None)

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf	2013-06-19 16:22:43 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf	2013-06-28 10:01:48 +0000
@@ -45,17 +45,23 @@ 
            sendline 2
 
 simulator_axf_files =
-	img.axf
-	linux-system-ISW.axf
-	rtsm/linux-system-semi.axf
-
-simulator_kernel = vmlinuz.*
-simulator_initrd = initrd.*
+    img.axf
+    linux-system-ISW.axf
+    linux-system-semi.axf
+
+simulator_kernel_files =
+    uImage
+    vmlinuz.*
+
+simulator_initrd_files =
+    uInitrd
+    initrd.*
+
 simulator_dtb = rtsm_ve-ca15x1-ca7x1.dtb
 simulator_uefi = uefi_rtsm_ve-ca15.bin
 
 license_file = 8224@localhost
-sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x4-A7x4/RTSM_VE_Cortex-A15x4-A7x4
+sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x1-A7x1/RTSM_VE_Cortex-A15x1-A7x1
 android_adb_port = 6555
 
 simulator_version_command = %(sim_bin)s --version | grep "Fast Models" | sed 's/Fast Models \[//' | sed 's/\]//'

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf	2013-06-19 16:22:43 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf	2013-06-28 10:01:48 +0000
@@ -45,12 +45,18 @@ 
            sendline 2
 
 simulator_axf_files =
-	img.axf
-	linux-system-ISW.axf
-	rtsm/linux-system-semi.axf
-
-simulator_kernel = vmlinuz.*
-simulator_initrd = initrd.*
+    img.axf
+    linux-system-ISW.axf
+    linux-system-semi.axf
+
+simulator_kernel_files =
+    uImage
+    vmlinuz.*
+
+simulator_initrd_files =
+    uInitrd
+    initrd.*
+
 simulator_dtb = rtsm_ve-ca15x4-ca7x4.dtb
 simulator_uefi = uefi_rtsm_ve-ca15.bin
 

=== modified file 'lava_dispatcher/device/fastmodel.py'
--- lava_dispatcher/device/fastmodel.py	2013-06-25 10:50:02 +0000
+++ lava_dispatcher/device/fastmodel.py	2013-07-01 10:45:36 +0000
@@ -23,10 +23,8 @@ 
 import cStringIO
 import logging
 import os
-import shutil
 import stat
 import subprocess
-import re
 
 import lava_dispatcher.device.boot_options as boot_options
 
@@ -48,7 +46,6 @@ 
     ensure_directory,
     extract_targz,
     DrainConsoleOutput,
-    string_to_list,
     )
 
 
@@ -93,24 +90,30 @@ 
             subdir = os.path.join(mntdir, subdir)
             self._copy_needed_files_from_directory(subdir)
 
+    def _copy_first_find_from_list(self, subdir, odir, file_list):
+        f_path = None
+        for fname in file_list:
+            f_path = self._find_and_copy(subdir, odir, fname)
+            if f_path:
+                break
+
+        return f_path
+
     def _copy_needed_files_from_directory(self, subdir):
         odir = os.path.dirname(self._sd_image)
         if self._bootloader == 'u_boot':
             # Extract the bootwrapper from the image
-            for fname in self.config.simulator_axf_files:
-                if self._axf is None:
-                    self._axf = self._find_and_copy(
-                                   subdir, odir, fname)
-                else:
-                    break
+            if self.config.simulator_axf_files and self._axf is None:
+                self._axf = self._copy_first_find_from_list(subdir, odir,
+                                            self.config.simulator_axf_files)
             # Extract the kernel from the image
-            if self.config.simulator_kernel and self._kernel is None:
-                self._kernel = self._find_and_copy(
-                                   subdir, odir, self.config.simulator_kernel)
+            if self.config.simulator_kernel_files and self._kernel is None:
+                self._kernel = self._copy_first_find_from_list(subdir, odir,
+                                            self.config.simulator_kernel_files)
             # Extract the initrd from the image
-            if self.config.simulator_initrd and self._initrd is None:
-                self._initrd = self._find_and_copy(
-                                   subdir, odir, self.config.simulator_initrd)
+            if self.config.simulator_initrd_files and self._initrd is None:
+                self._initrd = self._copy_first_find_from_list(subdir, odir,
+                                            self.config.simulator_initrd_files)
             # Extract the dtb from the image
             if self.config.simulator_dtb and self._dtb is None:
                 self._dtb = self._find_and_copy(
@@ -128,13 +131,13 @@ 
                 raise RuntimeError('No AXF found, %r' %
                                    self.config.simulator_axf_files)
             # Kernel is needed only for b.L models
-            if self._kernel is None and self.config.simulator_kernel:
+            if self._kernel is None and self.config.simulator_kernel_files:
                 raise RuntimeError('No KERNEL found, %r' %
-                                   self.config.simulator_kernel)
+                                   self.config.simulator_kernel_files)
             # Initrd is needed only for b.L models
-            if self._initrd is None and self.config.simulator_initrd:
+            if self._initrd is None and self.config.simulator_initrd_files:
                 raise RuntimeError('No INITRD found, %r' %
-                                   self.config.simulator_initrd)
+                                   self.config.simulator_initrd_files)
             # DTB is needed only for b.L models
             if self._dtb is None and self.config.simulator_dtb:
                 raise RuntimeError('No DTB found, %r' %

=== modified file 'lava_dispatcher/device/target.py'
--- lava_dispatcher/device/target.py	2013-06-19 21:49:04 +0000
+++ lava_dispatcher/device/target.py	2013-06-28 02:52:46 +0000
@@ -158,14 +158,14 @@ 
     def _find_and_copy(self, rootdir, odir, pattern, name=None):
         dest = None
         for root, dirs, files in os.walk(rootdir):
-            for file in files:
-                if re.match(pattern, file):
+            for file_name in files:
+                if re.match(pattern, file_name):
                     if name:
                         dest = os.path.join(odir, name)
                     else:
-                        dest = os.path.join(odir, file)
+                        dest = os.path.join(odir, file_name)
                     if rootdir != odir:
-                        src = os.path.join(rootdir, file)
+                        src = os.path.join(root, file_name)
                         shutil.copyfile(src, dest)
                         return dest
                     else: