generic_stage_target: Split ._copy_initramfs_overlay() from ._build_kernel()
authorW. Trevor King <wking@tremily.us>
Sat, 9 Feb 2013 20:45:36 +0000 (15:45 -0500)
committerMatt Turner <mattst88@gmail.com>
Sat, 23 Feb 2013 02:02:15 +0000 (18:02 -0800)
_copy_initramfs_overlay() is long enough that it makes reading
_build_kernel() difficult.

Reviewed-by: Matt Turner <mattst88@gmail.com>
modules/generic_stage_target.py

index 337ab16529852b982d07b18743175cb532f45797..e741fcd7fb60a268ba402c3ffd85401d0af030ca 100644 (file)
@@ -1452,25 +1452,7 @@ class generic_stage_target(generic_target):
                        self.settings["boot/kernel/"+kname+\
                        "/extraversion"]
 
-               if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-                       if os.path.exists(self.settings["boot/kernel/"+\
-                               kname+"/initramfs_overlay"]):
-                               print "Copying initramfs_overlay dir "+\
-                                       self.settings["boot/kernel/"+kname+\
-                                       "/initramfs_overlay"]
-
-                               cmd("mkdir -p "+\
-                                       self.settings["chroot_path"]+\
-                                       "/tmp/initramfs_overlay/"+\
-                                       self.settings["boot/kernel/"+kname+\
-                                       "/initramfs_overlay"],env=self.env)
-
-                               cmd("cp -R "+self.settings["boot/kernel/"+\
-                                       kname+"/initramfs_overlay"]+"/* "+\
-                                       self.settings["chroot_path"]+\
-                                       "/tmp/initramfs_overlay/"+\
-                                       self.settings["boot/kernel/"+kname+\
-                                       "/initramfs_overlay"],env=self.env)
+               self._copy_initramfs_overlay(kname=kname)
 
                """ Execute the script that builds the kernel """
                cmd("/bin/bash "+self.settings["controller_file"]+\
@@ -1520,6 +1502,27 @@ class generic_stage_target(generic_target):
                except CatalystError:
                        self.unbind()
 
+       def _copy_initramfs_overlay(self, kname):
+               if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+                       if os.path.exists(self.settings["boot/kernel/"+\
+                               kname+"/initramfs_overlay"]):
+                               print "Copying initramfs_overlay dir "+\
+                                       self.settings["boot/kernel/"+kname+\
+                                       "/initramfs_overlay"]
+
+                               cmd("mkdir -p "+\
+                                       self.settings["chroot_path"]+\
+                                       "/tmp/initramfs_overlay/"+\
+                                       self.settings["boot/kernel/"+kname+\
+                                       "/initramfs_overlay"],env=self.env)
+
+                               cmd("cp -R "+self.settings["boot/kernel/"+\
+                                       kname+"/initramfs_overlay"]+"/* "+\
+                                       self.settings["chroot_path"]+\
+                                       "/tmp/initramfs_overlay/"+\
+                                       self.settings["boot/kernel/"+kname+\
+                                       "/initramfs_overlay"],env=self.env)
+
        def bootloader(self):
                if "AUTORESUME" in self.settings \
                        and os.path.exists(self.settings["autoresume_path"]+"bootloader"):