[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/4] refactor: split make_initramfs_runtime out of compress()



No code changes here.
---
 src/pylorax/installtree.py |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py
index 8501954..c3bfda4 100644
--- a/src/pylorax/installtree.py
+++ b/src/pylorax/installtree.py
@@ -505,7 +505,6 @@ class LoraxInstallTree(BaseLoraxClass):
         shutil.copy2(src, dst)
 
     def compress(self, initrd, kernel, type="xz", args="-9"):
-        chdir = lambda: os.chdir(self.root)
         start = time.time()
 
         # move corresponding modules to the tree
@@ -513,6 +512,19 @@ class LoraxInstallTree(BaseLoraxClass):
         shutil.move(joinpaths(self.workdir, kernel.version),
                     joinpaths(self.root, "modules"))
 
+        self.make_initramfs_runtime(initrd, kernel, type, args)
+
+        # move modules out of the tree again
+        logger.debug("moving modules outside initrd")
+        shutil.move(joinpaths(self.root, "modules", kernel.version),
+                    self.workdir)
+
+        elapsed = time.time() - start
+
+        return True, elapsed
+
+    def make_initramfs_runtime(self, initrd, kernel, type, args):
+        chdir = lambda: os.chdir(self.root)
         find = subprocess.Popen([self.lcmds.FIND, "."], stdout=subprocess.PIPE,
                                 preexec_fn=chdir)
 
@@ -531,14 +543,6 @@ class LoraxInstallTree(BaseLoraxClass):
         logger.debug("compressing")
         rc = compressed.wait()
 
-        # move modules out of the tree again
-        logger.debug("moving modules outside initrd")
-        shutil.move(joinpaths(self.root, "modules", kernel.version),
-                    self.workdir)
-
-        elapsed = time.time() - start
-
-        return True, elapsed
 
     @property
     def kernels(self):
-- 
1.7.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]