public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: "W. Trevor King" <wking@tremily.us>
To: Catalyst <gentoo-catalyst@lists.gentoo.org>
Cc: "W. Trevor King" <wking@tremily.us>
Subject: [gentoo-catalyst] [PATCH 3/6] generic_stage_target.py: Dedent the bulk of ._build_kernel()
Date: Sat, 09 Feb 2013 15:45:35 -0500	[thread overview]
Message-ID: <cb4b33a281e8849897e60db255c3fb3e424b5338.1360442556.git.wking@tremily.us> (raw)
In-Reply-To: <cover.1360442556.git.wking@tremily.us>
In-Reply-To: <cover.1360442556.git.wking@tremily.us>

From: "W. Trevor King" <wking@tremily.us>

At the beginning of the function, we check for an autoresume point.
If we find it, just return.  This allows us to dedent the `else` block
that had been handling the no-autoresume-found case.
---
 modules/generic_stage_target.py | 121 ++++++++++++++++++++--------------------
 1 file changed, 61 insertions(+), 60 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 2c32c00..337ab16 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1425,74 +1425,75 @@ class generic_stage_target(generic_target):
 			and os.path.exists(self.settings["autoresume_path"]\
 				+"build_kernel_"+kname):
 			print "Resume point detected, skipping build_kernel for "+kname+" operation..."
-		else: # TODO: make this not require a kernel config
-			self._copy_kernel_config(kname=kname)
+			return
+		# TODO: make this not require a kernel config
+		self._copy_kernel_config(kname=kname)
 
-			"""
-			If we need to pass special options to the bootloader
-			for this kernel put them into the environment
-			"""
-			if "boot/kernel/"+kname+"/kernelopts" in self.settings:
-				myopts=self.settings["boot/kernel/"+kname+\
-					"/kernelopts"]
+		"""
+		If we need to pass special options to the bootloader
+		for this kernel put them into the environment
+		"""
+		if "boot/kernel/"+kname+"/kernelopts" in self.settings:
+			myopts=self.settings["boot/kernel/"+kname+\
+				"/kernelopts"]
 
-				if type(myopts) != types.StringType:
-					myopts = string.join(myopts)
-					self.env[kname+"_kernelopts"]=myopts
+			if type(myopts) != types.StringType:
+				myopts = string.join(myopts)
+				self.env[kname+"_kernelopts"]=myopts
 
-				else:
-					self.env[kname+"_kernelopts"]=""
+			else:
+				self.env[kname+"_kernelopts"]=""
 
-			if "boot/kernel/"+kname+"/extraversion" not in self.settings:
-				self.settings["boot/kernel/"+kname+\
-					"/extraversion"]=""
+		if "boot/kernel/"+kname+"/extraversion" not in self.settings:
+			self.settings["boot/kernel/"+kname+\
+				"/extraversion"]=""
 
-			self.env["clst_kextraversion"]=\
-				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)
-
-			""" Execute the script that builds the kernel """
-			cmd("/bin/bash "+self.settings["controller_file"]+\
-				" kernel "+kname,\
-				"Runscript kernel build failed",env=self.env)
+		self.env["clst_kextraversion"]=\
+			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"]
 
-			if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-				if os.path.exists(self.settings["chroot_path"]+\
-					"/tmp/initramfs_overlay/"):
-					print "Cleaning up temporary overlay dir"
-					cmd("rm -R "+self.settings["chroot_path"]+\
-						"/tmp/initramfs_overlay/",env=self.env)
+				cmd("mkdir -p "+\
+					self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"],env=self.env)
 
-			touch(self.settings["autoresume_path"]+\
-				"build_kernel_"+kname)
+				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)
 
-			"""
-			Execute the script that cleans up the kernel build
-			environment
-			"""
-			cmd("/bin/bash "+self.settings["controller_file"]+\
-				" post-kmerge ",
-				"Runscript post-kmerge failed",env=self.env)
+		""" Execute the script that builds the kernel """
+		cmd("/bin/bash "+self.settings["controller_file"]+\
+			" kernel "+kname,\
+			"Runscript kernel build failed",env=self.env)
+
+		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+			if os.path.exists(self.settings["chroot_path"]+\
+				"/tmp/initramfs_overlay/"):
+				print "Cleaning up temporary overlay dir"
+				cmd("rm -R "+self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/",env=self.env)
+
+		touch(self.settings["autoresume_path"]+\
+			"build_kernel_"+kname)
+
+		"""
+		Execute the script that cleans up the kernel build
+		environment
+		"""
+		cmd("/bin/bash "+self.settings["controller_file"]+\
+			" post-kmerge ",
+			"Runscript post-kmerge failed",env=self.env)
 
 	def _copy_kernel_config(self, kname):
 		try:
-- 
1.8.1.336.g94702dd



  parent reply	other threads:[~2013-02-09 20:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09 12:15 [gentoo-catalyst] stage4 kernel config for genkernel? W. Trevor King
2013-02-09 12:56 ` Chris White
2013-02-09 13:18   ` W. Trevor King
2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel() W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 2/6] generic_stage_target: Split ._copy_kernel_config() from ._build_kernel() W. Trevor King
2013-02-09 20:45     ` W. Trevor King [this message]
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 4/6] generic_stage_target: Split ._copy_initramfs_overlay() " W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 5/6] generic_stage_target: Handle unspecified boot/kernel/<kname>/config W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional W. Trevor King
2013-03-01  5:57       ` [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf W. Trevor King
2013-03-01  6:06         ` Matt Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb4b33a281e8849897e60db255c3fb3e424b5338.1360442556.git.wking@tremily.us \
    --to=wking@tremily.us \
    --cc=gentoo-catalyst@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox