From fc000a51e19223f57006d6d3184badc91c31fb0f Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 9 Jun 2011 13:03:04 -0400 Subject: [PATCH] refactor: split make_initramfs_runtime out of compress() No code changes here. --- src/pylorax/installtree.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 85019549..c3bfda4e 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):