public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-06-14  5:58 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-06-14  5:58 UTC (permalink / raw
  To: gentoo-commits

commit:     fe2a3542674d2a387bd20055145f3f8af6d720fd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Jun 14 05:07:40 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=fe2a3542

Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

Conflicts:
	catalyst/targets/embedded_target.py
	catalyst/targets/grp_target.py
	catalyst/targets/livecd_stage1_target.py
	catalyst/targets/livecd_stage2_target.py
	catalyst/targets/netboot2_target.py
	catalyst/targets/netboot_target.py
	catalyst/targets/stage1_target.py
	catalyst/targets/stage2_target.py
	catalyst/targets/stage3_target.py
	catalyst/targets/stage4_target.py
	catalyst/targets/tinderbox_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index 83c7a2f..173cc68 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-06-15 14:56 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-06-15 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     abdcb6eefe46c34dd23108db5a6dbe3ee650b7dd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 14:03:46 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=abdcb6ee

Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

Conflicts:
	catalyst/targets/embedded_target.py
	catalyst/targets/grp_target.py
	catalyst/targets/livecd_stage1_target.py
	catalyst/targets/livecd_stage2_target.py
	catalyst/targets/netboot2_target.py
	catalyst/targets/netboot_target.py
	catalyst/targets/stage1_target.py
	catalyst/targets/stage2_target.py
	catalyst/targets/stage3_target.py
	catalyst/targets/stage4_target.py
	catalyst/targets/tinderbox_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index e6b8864..5bedbb8 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-09-02  2:43 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-09-02  2:43 UTC (permalink / raw
  To: gentoo-commits

commit:     b3e19d0a7286f294a1745cad6b41e55b4040f3f9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 02:13:44 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=b3e19d0a

Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

Conflicts:
	catalyst/targets/embedded_target.py
	catalyst/targets/grp_target.py
	catalyst/targets/livecd_stage1_target.py
	catalyst/targets/livecd_stage2_target.py
	catalyst/targets/netboot2_target.py
	catalyst/targets/netboot_target.py
	catalyst/targets/stage1_target.py
	catalyst/targets/stage2_target.py
	catalyst/targets/stage3_target.py
	catalyst/targets/stage4_target.py
	catalyst/targets/tinderbox_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index f65c770..9cceb35 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-09-02  5:54 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-09-02  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     3bf3321550ee4de50b96c3d4a0302cf3fdf947f8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 05:51:54 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=3bf33215

Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

Conflicts:
	catalyst/targets/embedded_target.py
	catalyst/targets/grp_target.py
	catalyst/targets/livecd_stage1_target.py
	catalyst/targets/livecd_stage2_target.py
	catalyst/targets/netboot2_target.py
	catalyst/targets/netboot_target.py
	catalyst/targets/stage1_target.py
	catalyst/targets/stage2_target.py
	catalyst/targets/stage3_target.py
	catalyst/targets/stage4_target.py
	catalyst/targets/tinderbox_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index 296eee3..bebb5dc 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-09-02  7:12 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-09-02  7:12 UTC (permalink / raw
  To: gentoo-commits

commit:     77cb5e19ae082f9fe8d6c4cb9e4acdd229a0a18b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 06:31:58 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=77cb5e19

Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

Conflicts:
	catalyst/targets/embedded_target.py
	catalyst/targets/grp_target.py
	catalyst/targets/livecd_stage1_target.py
	catalyst/targets/livecd_stage2_target.py
	catalyst/targets/netboot2_target.py
	catalyst/targets/netboot_target.py
	catalyst/targets/stage1_target.py
	catalyst/targets/stage2_target.py
	catalyst/targets/stage3_target.py
	catalyst/targets/stage4_target.py
	catalyst/targets/tinderbox_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index 296eee3..bebb5dc 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-09-02 23:10 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-09-02 23:10 UTC (permalink / raw
  To: gentoo-commits

commit:     8b81f6c6b0bc8d62db97dbfc877147f4599d18de
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep  2 23:04:58 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=8b81f6c6

[1 of 3] Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index 296eee3..bebb5dc 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2014-09-11  3:08 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2014-09-11  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     4da45d94282c002abb546fa379975717ce018ead
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 03:51:52 2013 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep 11 03:05:37 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4da45d94

[1 of 3] Move base stage and target files to thier own sub-pkg

Fix an indent error in grp_target.py

---
 catalyst/base/__init__.py                          |  1 +
 catalyst/{targets => base}/clearbase.py            |  0
 catalyst/{targets => base}/genbase.py              |  0
 .../generic_stage_target.py => base/stagebase.py}  |  8 ++---
 catalyst/{targets => base}/targetbase.py           |  0
 catalyst/targets/embedded_target.py                | 12 ++++----
 catalyst/targets/grp_target.py                     | 34 +++++++++++++---------
 catalyst/targets/livecd_stage1_target.py           | 21 ++++++++-----
 catalyst/targets/livecd_stage2_target.py           | 13 +++++----
 catalyst/targets/netboot2_target.py                | 17 +++++++----
 catalyst/targets/netboot_target.py                 | 15 ++++++----
 catalyst/targets/snapshot_target.py                |  4 +--
 catalyst/targets/stage1_target.py                  | 17 ++++++-----
 catalyst/targets/stage2_target.py                  | 15 ++++++----
 catalyst/targets/stage3_target.py                  | 12 ++++----
 catalyst/targets/stage4_target.py                  |  8 ++---
 catalyst/targets/tinderbox_target.py               | 11 ++++---
 17 files changed, 113 insertions(+), 75 deletions(-)

diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/catalyst/base/__init__.py
@@ -0,0 +1 @@
+

diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
similarity index 100%
rename from catalyst/targets/clearbase.py
rename to catalyst/base/clearbase.py

diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
similarity index 100%
rename from catalyst/targets/genbase.py
rename to catalyst/base/genbase.py

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
similarity index 99%
rename from catalyst/targets/generic_stage_target.py
rename to catalyst/base/stagebase.py
index 296eee3..bebb5dc 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/base/stagebase.py
@@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
 	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.clearbase import ClearBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.clearbase import ClearBase
+from catalyst.base.genbase import GenBase
 from catalyst.lock import LockDir
 
 
-class generic_stage_target(TargetBase, ClearBase, GenBase):
+class StageBase(TargetBase, ClearBase, GenBase):
 	"""
 	This class does all of the chroot setup, copying of files, etc. It is
 	the driver class for pretty much everything that Catalyst does.

diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
similarity index 100%
rename from catalyst/targets/targetbase.py
rename to catalyst/base/targetbase.py

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
index 7cee7a6..528d545 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded_target.py
@@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
 
-class embedded_target(generic_stage_target):
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+class embedded_target(StageBase):
 	"""
 	Builder class for embedded target
 	"""
@@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
 		if "embedded/fs-type" in addlargs:
 			self.valid_values.append("embedded/fs-ops")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):

diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
index 033db75..deba80a 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp_target.py
@@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
 
-class grp_target(generic_stage_target):
+
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class grp_target(StageBase):
 	"""
 	The builder class for GRP (Gentoo Reference Platform) builds.
 	"""
@@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
 			self.required_values.append("grp/"+x+"/packages")
 			self.required_values.append("grp/"+x+"/type")
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
@@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
 				raise CatalystError,"GRP build aborting due to error."
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
-		if "BINDIST" in self.settings:
-			if "use" in self.settings:
-				self.settings["use"].append("bindist")
-			else:
-				self.settings["use"]=["bindist"]
+		StageBase.set_use(self)
+		if "use" in self.settings:
+			self.settings["use"].append("bindist")
+		else:
+			self.settings["use"]=["bindist"]
 
 	def set_mounts(self):
-	    self.mounts.append("/tmp/grp")
-            self.mountmap["/tmp/grp"]=self.settings["target_path"]
+		self.mounts.append("/tmp/grp")
+		self.mountmap["/tmp/grp"]=self.settings["target_path"]
 
 	def generate_digests(self):
 		for pkgset in self.settings["grp"]:
@@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
 						self.gen_digest_file(normpath(destdir+"/"+i))
 
 	def set_action_sequence(self):
-	    self.settings["action_sequence"]=["unpack","unpack_snapshot",\
+		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
 					"config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
 					"setup_environment","run_local","unbind",\
 					"generate_digests","clear_autoresume"]

diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
index 6273c9e..a19f4ac 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1_target.py
@@ -3,10 +3,17 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
 
-class livecd_stage1_target(generic_stage_target):
+from catalyst.support import (normpath,
+	touch, cmd)
+
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage1_target(StageBase):
 	"""
 	Builder class for LiveCD stage1.
 	"""
@@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
 		self.valid_values=self.required_values[:]
 
 		self.valid_values.extend(["livecd/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
@@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
 	                self.settings["spec_prefix"]="livecd"
 
 	def set_use(self):
-		generic_stage_target.set_use(self)
+		StageBase.set_use(self)
 		if "use" in self.settings:
 			self.settings["use"].append("livecd")
 			if "BINDIST" in self.settings:
@@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
 				self.settings["use"].append("bindist")
 
 	def set_packages(self):
-		generic_stage_target.set_packages(self)
+		StageBase.set_packages(self)
 		if self.settings["spec_prefix"]+"/packages" in self.settings:
 			if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
 				self.settings[self.settings["spec_prefix"]+"/packages"] = \
@@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
 			if type(self.settings["pkgcache_path"]) != types.StringType:
 				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
 		else:
-			generic_stage_target.set_pkgcache_path(self)
+			StageBase.set_pkgcache_path(self)
 
 def register(foo):
 	foo.update({"livecd-stage1":livecd_stage1_target})

diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
index 11b1219..e7ae212 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2_target.py
@@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class livecd_stage2_target(generic_stage_target):
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+	read_from_clst, touch)
+from catalyst.base.stagebase import StageBase
+
+
+class livecd_stage2_target(StageBase):
 	"""
 	Builder class for a LiveCD stage2 build.
 	"""
@@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
 			"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
 			"gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		if "livecd/type" not in self.settings:
 			self.settings["livecd/type"] = "generic-livecd"
 

diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
index ea07d76..987afd8 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2_target.py
@@ -3,11 +3,18 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
 
-class netboot2_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	touch, cmd, list_bashify)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot2_target(StageBase):
 	"""
 	Builder class for a netboot build, version 2
 	"""
@@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot2/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 

diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
index ae1eb04..c880289 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot_target.py
@@ -3,11 +3,16 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
 
-class netboot_target(generic_stage_target):
+from catalyst.support import (CatalystError, normpath,
+	cmd, list_bashify, file_locate)
+
+from catalyst.base.stagebase import StageBase
+
+
+class netboot_target(StageBase):
 	"""
 	Builder class for a netboot build.
 	"""
@@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
 		except:
 			raise CatalystError,"configuration error in netboot/packages."
 
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])

diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 3289bbd..337ff1d 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 
 
 from catalyst.support import normpath, cmd
-from catalyst.targets.targetbase import TargetBase
-from catalyst.targets.genbase import GenBase
+from catalyst.base.targetbase import TargetBase
+from catalyst.base.genbase import GenBase
 
 class snapshot_target(TargetBase, GenBase):
 	"""

diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
index 8d5a674..0a36432 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1_target.py
@@ -3,10 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage1_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage1_target(StageBase):
 	"""
 	Builder class for a stage1 installation tarball build.
 	"""
@@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
 		self.required_values=[]
 		self.valid_values=["chost"]
 		self.valid_values.extend(["update_seed","update_seed_command"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
@@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
 		print "stage1 root path is "+self.settings["root_path"]
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 		self.settings["cleanables"].extend([\
 		"/usr/share/zoneinfo", "/etc/portage/package*"])
 
-	# XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
+	# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
index 94d4a1e..783d42e 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2_target.py
@@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class stage2_target(generic_stage_target):
+from catalyst.support import normpath, list_to_string
+from catalyst.base.stagebase import StageBase
+
+
+class stage2_target(StageBase):
 	"""
 	Builder class for a stage2 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=["chost"]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_source_path(self):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
@@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
 			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
-	# generic_stage_target and why aren't they in stage3_target?
+	# StageBase and why aren't they in stage3_target?
 
 	def override_chost(self):
 		if "chost" in self.settings:
@@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			generic_stage_target.set_portage_overlay(self)
+			StageBase.set_portage_overlay(self)
 			if "portage_overlay" in self.settings:
 				print "\nWARNING !!!!!"
 				print "\tUsing an portage overlay for earlier stages could cause build issues."

diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
index 89edd66..28021b1 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3_target.py
@@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage3_target(generic_stage_target):
+
+class stage3_target(StageBase):
 	"""
 	Builder class for a stage3 installation tarball build.
 	"""
 	def __init__(self,spec,addlargs):
 		self.required_values=[]
 		self.valid_values=[]
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_portage_overlay(self):
-		generic_stage_target.set_portage_overlay(self)
+		StageBase.set_portage_overlay(self)
 		if "portage_overlay" in self.settings:
 			print "\nWARNING !!!!!"
 			print "\tUsing an overlay for earlier stages could cause build issues."
@@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
 			print "\tDont say we did not warn you\n"
 
 	def set_cleanables(self):
-		generic_stage_target.set_cleanables(self)
+		StageBase.set_cleanables(self)
 
 def register(foo):
 	foo.update({"stage3":stage3_target})

diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
index e2b8a79..0d725c7 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4_target.py
@@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+from catalyst.base.stagebase import StageBase
 
-class stage4_target(generic_stage_target):
+
+class stage4_target(StageBase):
 	"""
 	Builder class for stage4.
 	"""
@@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
 				"stage4/gk_mainargs","splash_theme",\
 				"portage_overlay","stage4/rcadd","stage4/rcdel",\
 				"stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def set_cleanables(self):
 		self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]

diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
index ea11d3f..1e245f2 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox_target.py
@@ -3,10 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
 
-class tinderbox_target(generic_stage_target):
+from catalyst.support import cmd, list_bashify, CatalystError
+from catalyst.base.stagebase import StageBase
+
+
+class tinderbox_target(StageBase):
 	"""
 	Builder class for the tinderbox target
 	"""
@@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
 		self.required_values=["tinderbox/packages"]
 		self.valid_values=self.required_values[:]
 		self.valid_values.extend(["tinderbox/use"])
-		generic_stage_target.__init__(self,spec,addlargs)
+		StageBase.__init__(self,spec,addlargs)
 
 	def run_local(self):
 		# tinderbox


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-02-26 19:25 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-02-26 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     5c79385fc2a02d4e539ef5fe646397da98f72bde
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  1 07:31:59 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 19:15:20 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=5c79385f

Rename local unpack var to _unpack

The method name was unpack, so rename the local var to _unpack to help avoid confusion.

---
 catalyst/base/stagebase.py        | 18 +++++++++---------
 catalyst/targets/livecd_stage2.py |  6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index f8443d8..bdeaedd 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -662,7 +662,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 					raise CatalystError("Unable to auto-unbind " + target)
 
 	def unpack(self):
-		unpack=True
+		_unpack=True
 
 		clst_unpack_hash = self.resume.get("unpack")
 
@@ -712,49 +712,49 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			if os.path.isdir(self.settings["source_path"]) \
 				and self.resume.is_enabled("unpack"):
 				""" Autoresume is valid, SEEDCACHE is valid """
-				unpack=False
+				_unpack=False
 				invalid_snapshot=False
 
 			elif os.path.isfile(self.settings["source_path"]) \
 				and self.settings["source_path_hash"]==clst_unpack_hash:
 				""" Autoresume is valid, tarball is valid """
-				unpack=False
+				_unpack=False
 				invalid_snapshot=True
 
 			elif os.path.isdir(self.settings["source_path"]) \
 				and self.resume.is_disabled("unpack"):
 				""" Autoresume is invalid, SEEDCACHE """
-				unpack=True
+				_unpack=True
 				invalid_snapshot=False
 
 			elif os.path.isfile(self.settings["source_path"]) \
 				and self.settings["source_path_hash"]!=clst_unpack_hash:
 				""" Autoresume is invalid, tarball """
-				unpack=True
+				_unpack=True
 				invalid_snapshot=True
 		else:
 			""" No autoresume, SEEDCACHE """
 			if "seedcache" in self.settings["options"]:
 				""" SEEDCACHE so let's run rsync and let it clean up """
 				if os.path.isdir(self.settings["source_path"]):
-					unpack=True
+					_unpack=True
 					invalid_snapshot=False
 				elif os.path.isfile(self.settings["source_path"]):
 					""" Tarball so unpack and remove anything already there """
-					unpack=True
+					_unpack=True
 					invalid_snapshot=True
 				""" No autoresume, no SEEDCACHE """
 			else:
 				""" Tarball so unpack and remove anything already there """
 				if os.path.isfile(self.settings["source_path"]):
-					unpack=True
+					_unpack=True
 					invalid_snapshot=True
 				elif os.path.isdir(self.settings["source_path"]):
 					""" We should never reach this, so something is very wrong """
 					raise CatalystError(
 						"source path is a dir but seedcache is not enabled")
 
-		if unpack:
+		if _unpack:
 			self.mount_safety_check()
 
 			if invalid_snapshot:

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 38b6884..45a6767 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -86,7 +86,7 @@ class livecd_stage2(StageBase):
 			myf.close()
 
 	def unpack(self):
-		unpack=True
+		_unpack=True
 		display_msg=None
 
 		clst_unpack_hash = self.resume.get("unpack")
@@ -102,12 +102,12 @@ class livecd_stage2(StageBase):
 			if os.path.isdir(self.settings["source_path"]) and \
 				self.resume.is_enabled("unpack"):
 				print "Resume point detected, skipping unpack operation..."
-				unpack=False
+				_unpack=False
 			elif "source_path_hash" in self.settings:
 				if self.settings["source_path_hash"] != clst_unpack_hash:
 					invalid_snapshot=True
 
-		if unpack:
+		if _unpack:
 			self.mount_safety_check()
 			if invalid_snapshot:
 				print "No Valid Resume point detected, cleaning up  ..."


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-02-26 19:25 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-02-26 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     f811fbc991ba1a9fef8e62f84ecc21e56d1191fb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  1 06:32:49 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 19:15:03 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f811fbc9

Remove some dead code

---
 catalyst/base/stagebase.py        | 2 --
 catalyst/targets/livecd_stage2.py | 2 --
 2 files changed, 4 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index edb6032..f8443d8 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -508,8 +508,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
 				"setup_confdir","portage_overlay",\
 				"base_dirs","bind","chroot_setup","setup_environment",\
 				"run_local","preclean","unbind","clean"]
-#		if "TARBALL" in self.settings or \
-#			"fetch" not in self.settings["options"]:
 		if "fetch" not in self.settings["options"]:
 			self.settings["action_sequence"].append("capture")
 		self.settings["action_sequence"].append("clear_autoresume")

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 78bed82..38b6884 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -111,10 +111,8 @@ class livecd_stage2(StageBase):
 			self.mount_safety_check()
 			if invalid_snapshot:
 				print "No Valid Resume point detected, cleaning up  ..."
-				#os.remove(self.settings["autoresume_path"]+"dir_setup")
 				self.clear_autoresume()
 				self.clear_chroot()
-				#self.dir_setup()
 
 			ensure_dirs(self.settings["chroot_path"]+"/tmp", mode=1777)
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-02-26 19:25 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-02-26 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     d4408f858c4c3eb71ef0efdef5f23ebf6526dd87
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  1 06:28:19 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 08:32:57 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d4408f85

Fix some paths/normpath usage

Use pjoin to join paths.
Use os.path.dirname() instead of splitting and rejoining without the filename.
Don't remove the trailing slash from the seedcache path in set_source_path(),
fix supplied by GMsoft. Rebase it into this original commit that broke it.

---
 catalyst/base/stagebase.py        | 21 ++++++++++-----------
 catalyst/targets/livecd_stage2.py |  2 +-
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index f3cb3e3..edb6032 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -306,7 +306,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if "pkgcache_path" in self.settings:
 			if type(self.settings["pkgcache_path"])!=types.StringType:
 				self.settings["pkgcache_path"]=\
-					normpath(string.join(self.settings["pkgcache_path"]))
+					normpath(self.settings["pkgcache_path"])
 		else:
 			self.settings["pkgcache_path"]=\
 				normpath(self.settings["storedir"]+"/packages/"+\
@@ -316,7 +316,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if "kerncache_path" in self.settings:
 			if type(self.settings["kerncache_path"])!=types.StringType:
 				self.settings["kerncache_path"]=\
-					normpath(string.join(self.settings["kerncache_path"]))
+					normpath(self.settings["kerncache_path"])
 		else:
 			self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\
 				"/kerncache/"+self.settings["target_subpath"]+"/")
@@ -339,7 +339,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 #					+self.settings["target_path"],env=self.env)
 			self.resume.enable("setup_target_path")
 
-			ensure_dirs(self.settings["storedir"] + "/builds/")
+			ensure_dirs(self.settings["storedir"] + "/builds")
 
 	def set_fsscript(self):
 		if self.settings["spec_prefix"]+"/fsscript" in self.settings:
@@ -403,8 +403,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		if "seedcache" in self.settings["options"]\
 			and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\
 				self.settings["source_subpath"]+"/")):
-			self.settings["source_path"]=normpath(self.settings["storedir"]+\
-				"/tmp/"+self.settings["source_subpath"]+"/")
+			self.settings["source_path"] = normpath(self.settings["storedir"] +
+				"/tmp/" + self.settings["source_subpath"] + "/")
 		else:
 			self.settings["source_path"]=normpath(self.settings["storedir"]+\
 				"/builds/"+self.settings["source_subpath"]+".tar.bz2")
@@ -461,8 +461,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 	def set_snapcache_path(self):
 		if "snapcache" in self.settings["options"]:
 			self.settings["snapshot_cache_path"] = \
-				normpath(self.settings["snapshot_cache"] + "/" +
-					self.settings["snapshot"])
+				normpath(pjoin(self.settings["snapshot_cache"],
+					self.settings["snapshot"]))
 			self.snapcache_lock=\
 				LockDir(self.settings["snapshot_cache_path"])
 			print "Caching snapshot to "+self.settings["snapshot_cache_path"]
@@ -824,7 +824,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			unpack_errmsg="Error unpacking snapshot"
 
 			if "autoresume" in self.settings["options"] \
-				and os.path.exists(self.settings["chroot_path"]+\
+				and os.path.exists(self.settings["chroot_path"] +
 					self.settings["portdir"]) \
 				and self.resume.is_enabled("unpack_portage") \
 				and self.settings["snapshot_path_hash"] == snapshot_hash:
@@ -1235,10 +1235,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			and self.resume.is_enabled("capture"):
 			print "Resume point detected, skipping capture operation..."
 		else:
-			""" Capture target in a tarball """
-			mypath=self.settings["target_path"].split("/")
+			print """ Capture target in a tarball """
 			""" Remove filename from path """
-			mypath=string.join(mypath[:-1],"/")
+			mypath = os.path.dirname(self.settings["target_path"])
 
 			""" Now make sure path exists """
 			ensure_dirs(mypath)

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 973a734..78bed82 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -43,7 +43,7 @@ class livecd_stage2(StageBase):
 				self.settings["hash_map"].generate_hash(
 					self.settings["source_path"])
 		else:
-			self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
+			self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"])
 		if not os.path.exists(self.settings["source_path"]):
 			raise CatalystError("Source Path: " +
 				self.settings["source_path"] + " does not exist.",


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-02-26 20:44 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-02-26 20:44 UTC (permalink / raw
  To: gentoo-commits

commit:     7c94f3f7e2dce6860e847c841cdcfc6f3d41f3db
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 23:41:39 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 20:00:56 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=7c94f3f7

Strip trailing slash from subpath's if they exist when creating filenames.

This bug was introduced in commit 52c9d37ff5de18981d6ecbe5bdde524b2bf4ebda when a trailing slash was added to target_subpath.

---
 catalyst/base/stagebase.py        | 10 +++++-----
 catalyst/targets/livecd_stage2.py |  2 +-
 catalyst/targets/stage2.py        |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index eec74df..7395351 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -323,7 +323,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
 	def set_target_path(self):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+\
-			"/builds/"+self.settings["target_subpath"]+".tar.bz2")
+			"/builds/"+self.settings["target_subpath"].rstrip('/')+".tar.bz2")
 		if "autoresume" in self.settings["options"]\
 			and self.resume.is_enabled("setup_target_path"):
 			print \
@@ -407,7 +407,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 				"/tmp/" + self.settings["source_subpath"] + "/")
 		else:
 			self.settings["source_path"]=normpath(self.settings["storedir"]+\
-				"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+				"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
 			if os.path.isfile(self.settings["source_path"]):
 				# XXX: Is this even necessary if the previous check passes?
 				if os.path.exists(self.settings["source_path"]):
@@ -422,7 +422,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			print "\tseedcache in the options of catalyst.conf the source path"
 			print "\twill then be "+\
 				normpath(self.settings["storedir"]+"/builds/"+\
-				self.settings["source_subpath"]+".tar.bz2\n")
+				self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
 
 	def set_dest_path(self):
 		if "root_path" in self.settings:
@@ -438,7 +438,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 	def set_snapshot_path(self):
 		self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
 			"/snapshots/" + self.settings["snapshot_name"] +
-			self.settings["snapshot"] + ".tar.xz")
+			self.settings["snapshot"].rstrip('/')+".tar.xz")
 
 		if os.path.exists(self.settings["snapshot_path"]):
 			self.settings["snapshot_path_hash"] = \
@@ -449,7 +449,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		else:
 			self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
 				"/snapshots/" + self.settings["snapshot_name"] +
-				self.settings["snapshot"] + ".tar.bz2")
+				self.settings["snapshot"].rstrip('/')+".tar.bz2")
 
 			if os.path.exists(self.settings["snapshot_path"]):
 				self.settings["snapshot_path_hash"] = \

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 55e6897..9f0733e 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -37,7 +37,7 @@ class livecd_stage2(StageBase):
 		file_locate(self.settings, ["cdtar","controller_file"])
 
 	def set_source_path(self):
-		self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+		self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
 		if os.path.isfile(self.settings["source_path"]):
 			self.settings["source_path_hash"] = \
 				self.settings["hash_map"].generate_hash(

diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index 884b20d..e54b5c9 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -22,7 +22,7 @@ class stage2(StageBase):
 		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
 			self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
 		else:
-			self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+			self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
 			if os.path.isfile(self.settings["source_path"]):
 				if os.path.exists(self.settings["source_path"]):
 				# XXX: Is this even necessary if the previous check passes?
@@ -34,7 +34,7 @@ class stage2(StageBase):
 		print "Source path set to "+self.settings["source_path"]
 		if os.path.isdir(self.settings["source_path"]):
 			print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf"
-			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
+			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
 
 	# XXX: How do these override_foo() functions differ from the ones in
 	# StageBase and why aren't they in stage3_target?


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-09-04 15:20 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-09-04 15:20 UTC (permalink / raw
  To: gentoo-commits

commit:     28f158b701e7984a9982c2916825f729bb79c7ea
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 15 23:10:50 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Sep  4 15:19:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=28f158b7

Fix a couple print() uses back to print statements for consistency

 catalyst/base/stagebase.py   | 4 ++--
 catalyst/targets/snapshot.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 7212409..8f12ac6 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1308,8 +1308,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			target_filename = ".".join([self.settings["target_path"].rstrip('/'),
 				self.compressor.extension(pack_info['mode'])])
 
-			print("Creating stage tarball... mode:",
-				self.settings["compression_mode"])
+			print "Creating stage tarball... mode:", \
+				self.settings["compression_mode"]
 
 			if self.compressor.compress(pack_info):
 				self.gen_contents_file(target_filename)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index ad96d37..1edcd02 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -72,11 +72,11 @@ class snapshot(TargetBase, GenBase):
 			auto_extension=True
 			)
 		if not compressor.compress(infodict):
-			print("Snapshot compression failure")
+			print "Snapshot compression failure"
 		else:
 			filename = '.'.join([self.settings["snapshot_path"],
 				compressor.extension(self.settings["compression_mode"])])
-			print("COMPRESSOR success!!!! filename", filename)
+			print "COMPRESSOR success!!!! filename", filename
 			self.gen_contents_file(filename)
 			self.gen_digest_file(filename)
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/
@ 2015-09-06 21:18 Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-09-06 21:18 UTC (permalink / raw
  To: gentoo-commits

commit:     a708728d812020ee630fe4182e07b1f3ddbbb1e2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 15 23:10:50 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Sep  6 21:18:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a708728d

Fix a couple print() uses back to print statements for consistency

 catalyst/base/stagebase.py   | 4 ++--
 catalyst/targets/snapshot.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 7212409..8f12ac6 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1308,8 +1308,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			target_filename = ".".join([self.settings["target_path"].rstrip('/'),
 				self.compressor.extension(pack_info['mode'])])
 
-			print("Creating stage tarball... mode:",
-				self.settings["compression_mode"])
+			print "Creating stage tarball... mode:", \
+				self.settings["compression_mode"]
 
 			if self.compressor.compress(pack_info):
 				self.gen_contents_file(target_filename)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index ad96d37..1edcd02 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -72,11 +72,11 @@ class snapshot(TargetBase, GenBase):
 			auto_extension=True
 			)
 		if not compressor.compress(infodict):
-			print("Snapshot compression failure")
+			print "Snapshot compression failure"
 		else:
 			filename = '.'.join([self.settings["snapshot_path"],
 				compressor.extension(self.settings["compression_mode"])])
-			print("COMPRESSOR success!!!! filename", filename)
+			print "COMPRESSOR success!!!! filename", filename
 			self.gen_contents_file(filename)
 			self.gen_digest_file(filename)
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/
@ 2015-11-20 21:26 Brian Dolbec
  2015-11-21  1:33 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
  0 siblings, 1 reply; 14+ messages in thread
From: Brian Dolbec @ 2015-11-20 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     3228dec78968e5f0b831cd477039decee6c79838
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 20 21:20:35 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Nov 20 21:24:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=3228dec7

Debug autoextension detection not working for stage2

Remove the set_source_path() re-definition from stage2.  This only modified the 
seedcache location from the normal one to the previous build directory.
This is wrong.  The previous build location is normally cleaned and removed.
Also, if this is actually needed, then it should be done globally and configurable.
Add extra log messages to stagebase.
Clean out a no longer relevant log.info message

 catalyst/base/stagebase.py | 17 ++++++++---------
 catalyst/targets/stage2.py | 21 ---------------------
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index df19c0b..69b7b0d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -420,10 +420,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
 			self.settings["source_path"] = normpath(self.settings["storedir"] +
 				"/tmp/" + self.settings["source_subpath"] + "/")
 		else:
+			log.debug('Checking source path existence and '
+				'get the final filepath. subpath: %s',
+				self.settings["source_subpath"])
 			self.settings["source_path"] = file_check(
 				normpath(self.settings["storedir"] + "/builds/" +
 					self.settings["source_subpath"])
 				)
+			log.debug('Source path returned from file_check is: %s',
+				self.settings["source_path"])
 			if os.path.isfile(self.settings["source_path"]):
 				# XXX: Is this even necessary if the previous check passes?
 				if os.path.exists(self.settings["source_path"]):
@@ -431,14 +436,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 						self.settings["hash_map"].generate_hash(
 							self.settings["source_path"],
 							hash_=self.settings["hash_function"])
-		log.info('Source path set to %s', self.settings['source_path'])
-		if os.path.isdir(self.settings["source_path"]):
-			log.warning(
-				'If this is not desired, remove this directory or turn off\n'
-				'seedcache in the options of catalyst.conf the source path\n'
-				'will then be %s',
-				normpath(self.settings['storedir'] + '/builds/' +
-					self.settings['source_subpath']))
+		log.notice('Source path set to %s', self.settings['source_path'])
 
 	def set_dest_path(self):
 		if "root_path" in self.settings:
@@ -749,7 +747,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 				elif os.path.isdir(self.settings["source_path"]):
 					# We should never reach this, so something is very wrong
 					raise CatalystError(
-						"source path is a dir but seedcache is not enabled")
+						"source path is a dir but seedcache is not enabled: %s"
+						% self.settings["source_path"])
 
 		if _unpack:
 			self.mount_safety_check()

diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index ff060d2..9658a49 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -3,10 +3,8 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os
 
 from catalyst import log
-from catalyst.support import normpath
 from catalyst.base.stagebase import StageBase
 
 
@@ -19,25 +17,6 @@ class stage2(StageBase):
 		self.valid_values=["chost"]
 		StageBase.__init__(self,spec,addlargs)
 
-	def set_source_path(self):
-		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")):
-			self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")
-		else:
-			self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"])
-			if os.path.isfile(self.settings["source_path"]):
-				if os.path.exists(self.settings["source_path"]):
-				# XXX: Is this even necessary if the previous check passes?
-					self.settings["source_path_hash"] = \
-						self.settings["hash_map"].generate_hash(
-							self.settings["source_path"],\
-							hash_=self.settings["hash_function"])
-		log.notice('Source path set to %s', self.settings['source_path'])
-		if os.path.isdir(self.settings["source_path"]):
-			log.warning(
-				'If this is not desired, remove this directory or turn off seedcache in the\n'
-				'options of catalyst.conf.  The source path will then be:\n%s',
-				normpath(self.settings['storedir'] + '/builds/' + self.settings['source_subpath']))
-
 	# XXX: How do these override_foo() functions differ from the ones in
 	# StageBase and why aren't they in stage3_target?
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-11-21  1:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-14  5:58 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/targets/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-06-15 14:56 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  7:12 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2015-02-26 19:25 Brian Dolbec
2015-02-26 19:25 Brian Dolbec
2015-02-26 19:25 Brian Dolbec
2015-02-26 20:44 Brian Dolbec
2015-09-04 15:20 Brian Dolbec
2015-09-06 21:18 Brian Dolbec
2015-11-20 21:26 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-11-21  1:33 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox