commit: 5fa2b2a910c45401f132e7ed7e9da9a993762252 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> AuthorDate: Tue Feb 12 03:51:52 2013 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Thu Jan 1 05:58:05 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=5fa2b2a9
[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