From 0512e64d538b484ddc4d7aaa5419f9c2c3fd9f7e Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Mon, 11 Feb 2013 19:51:52 -0800 Subject: [PATCH] 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 .../stagebase.py} | 8 +++---- catalyst/{targets => base}/targetbase.py | 0 catalyst/targets/embedded_target.py | 6 ++--- catalyst/targets/grp_target.py | 23 +++++++++---------- catalyst/targets/livecd_stage1_target.py | 12 +++++----- catalyst/targets/livecd_stage2_target.py | 6 ++--- catalyst/targets/netboot2_target.py | 6 ++--- catalyst/targets/netboot_target.py | 6 ++--- catalyst/targets/snapshot_target.py | 4 ++-- catalyst/targets/stage1_target.py | 12 +++++----- catalyst/targets/stage2_target.py | 10 ++++---- catalyst/targets/stage3_target.py | 10 ++++---- catalyst/targets/stage4_target.py | 6 ++--- catalyst/targets/tinderbox_target.py | 6 ++--- 17 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 catalyst/base/__init__.py rename catalyst/{targets => base}/clearbase.py (100%) rename catalyst/{targets => base}/genbase.py (100%) rename catalyst/{targets/generic_stage_target.py => base/stagebase.py} (99%) rename catalyst/{targets => base}/targetbase.py (100%) diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py new file mode 100644 index 00000000..8b137891 --- /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 f7649370..8f4bad8e 100644 --- a/catalyst/targets/generic_stage_target.py +++ b/catalyst/base/stagebase.py @@ -10,13 +10,13 @@ from stat import ST_UID, ST_GID, ST_MODE 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 cbc2684d..528d5457 100644 --- a/catalyst/targets/embedded_target.py +++ b/catalyst/targets/embedded_target.py @@ -13,9 +13,9 @@ ROOT=/tmp/submerge emerge --something foo bar . from catalyst.support import normpath -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class embedded_target(generic_stage_target): +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 abc6b964..02279c3f 100644 --- a/catalyst/targets/grp_target.py +++ b/catalyst/targets/grp_target.py @@ -11,10 +11,10 @@ import glob from catalyst.support import (CatalystError, normpath, touch, cmd, list_bashify) -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class grp_target(generic_stage_target): +class grp_target(StageBase): """ The builder class for GRP (Gentoo Reference Platform) builds. """ @@ -39,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"]+"/") @@ -70,16 +70,15 @@ class grp_target(generic_stage_target): print_traceback=True) 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"]: @@ -116,7 +115,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 9a53fd13..30ba6054 100644 --- a/catalyst/targets/livecd_stage1_target.py +++ b/catalyst/targets/livecd_stage1_target.py @@ -11,10 +11,10 @@ import string from catalyst.support import (normpath, touch, cmd) -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class livecd_stage1_target(generic_stage_target): +class livecd_stage1_target(StageBase): """ Builder class for LiveCD stage1. """ @@ -23,7 +23,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",\ @@ -50,7 +50,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: @@ -61,7 +61,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"] = \ @@ -73,7 +73,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 ed398578..c63c94ce 100644 --- a/catalyst/targets/livecd_stage2_target.py +++ b/catalyst/targets/livecd_stage2_target.py @@ -8,10 +8,10 @@ import os from catalyst.support import (normpath, file_locate, CatalystError, cmd, read_from_clst, touch) -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class livecd_stage2_target(generic_stage_target): +class livecd_stage2_target(StageBase): """ Builder class for a LiveCD stage2 build. """ @@ -30,7 +30,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 4f02ae98..ff7c0a97 100644 --- a/catalyst/targets/netboot2_target.py +++ b/catalyst/targets/netboot2_target.py @@ -12,10 +12,10 @@ from stat import ST_UID, ST_GID, ST_MODE from catalyst.support import (CatalystError, normpath, touch, cmd, list_bashify) -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class netboot2_target(generic_stage_target): +class netboot2_target(StageBase): """ Builder class for a netboot build, version 2 """ @@ -46,7 +46,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 b8ffae71..eae35a96 100644 --- a/catalyst/targets/netboot_target.py +++ b/catalyst/targets/netboot_target.py @@ -10,10 +10,10 @@ import types from catalyst.support import (CatalystError, normpath, cmd, list_bashify, file_locate) -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class netboot_target(generic_stage_target): +class netboot_target(StageBase): """ Builder class for a netboot build. """ @@ -42,7 +42,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 de5ab39e..49d8e6d6 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 57d2b6aa..d70c5ec1 100644 --- a/catalyst/targets/stage1_target.py +++ b/catalyst/targets/stage1_target.py @@ -8,10 +8,10 @@ import os from catalyst.support import normpath, list_to_string -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class stage1_target(generic_stage_target): +class stage1_target(StageBase): """ Builder class for a stage1 installation tarball build. """ @@ -19,7 +19,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"]) @@ -31,11 +31,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: @@ -54,7 +54,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 ad06935f..490bca71 100644 --- a/catalyst/targets/stage2_target.py +++ b/catalyst/targets/stage2_target.py @@ -7,17 +7,17 @@ import os from catalyst.support import normpath, list_to_string -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class stage2_target(generic_stage_target): +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/")): @@ -38,7 +38,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: @@ -57,7 +57,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 63b9ebc7..be73a6c3 100644 --- a/catalyst/targets/stage3_target.py +++ b/catalyst/targets/stage3_target.py @@ -4,20 +4,20 @@ stage3 target, builds upon previous stage2/stage3 tarball # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation. -from generic_stage_target import generic_stage_target +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." @@ -25,7 +25,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 9b48e6f9..bbdb048c 100644 --- a/catalyst/targets/stage4_target.py +++ b/catalyst/targets/stage4_target.py @@ -4,10 +4,10 @@ stage4 target, builds upon previous stage3/stage4 tarball # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation. -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class stage4_target(generic_stage_target): +class stage4_target(StageBase): """ Builder class for stage4. """ @@ -19,7 +19,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 4afc3ea0..c415d744 100644 --- a/catalyst/targets/tinderbox_target.py +++ b/catalyst/targets/tinderbox_target.py @@ -8,10 +8,10 @@ import os from catalyst.support import cmd, list_bashify, CatalystError -from generic_stage_target import generic_stage_target +from catalyst.base.stagebase import StageBase -class tinderbox_target(generic_stage_target): +class tinderbox_target(StageBase): """ Builder class for the tinderbox target """ @@ -19,7 +19,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 -- 2.26.2