[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, targets/stage3/, catalyst/base/

2017-11-29 Thread Brian Dolbec
commit: 7d0d7fda6bdf8d2fe73a7623eba1b943bfabb9ce
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Nov 29 17:15:41 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Nov 29 17:33:43 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7d0d7fda

WIP: Add an updates step to stage3 just before the pre-clean step

Can be used to correct an issue with the stage that hats the precean step.

 catalyst/base/stagebase.py  | 16 
 catalyst/targets/stage3.py  |  9 +
 targets/stage3/stage3-controller.sh |  4 
 targets/stage3/stage3-updates.sh| 10 ++
 4 files changed, 39 insertions(+)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 7a41973c..63a577a0 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -882,6 +882,22 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "snapcache" in self.settings["options"]:
self.snapcache_lock.unlock()
 
+   def update_stage(self):
+   if "autoresume" in self.settings["options"] \
+   and self.resume.is_enabled("update_stage"):
+   log.notice('Resume point detected, skipping 
update_stage operation...')
+   else:
+   if self.settings["update_stage_command"]:
+   try:
+   if 
os.path.exists(self.settings["controller_file"]):
+   
cmd([self.settings['controller_file'], 'update_stage'],
+   env=self.env)
+   
self.resume.enable("update_stage")
+
+   except:
+   self.unbind()
+   raise CatalystError("Build failed, 
could not execute update_stage")
+
def config_profile_link(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("config_profile_link"):

diff --git a/catalyst/targets/stage3.py b/catalyst/targets/stage3.py
index f0831932..1120349f 100644
--- a/catalyst/targets/stage3.py
+++ b/catalyst/targets/stage3.py
@@ -14,6 +14,7 @@ class stage3(StageBase):
def __init__(self,spec,addlargs):
self.required_values=[]
self.valid_values=[]
+   self.valid_values.extend(["update_stage_command"])
StageBase.__init__(self,spec,addlargs)
 
def set_portage_overlay(self):
@@ -24,5 +25,13 @@ class stage3(StageBase):
"If you break it, you buy it.  Don't complain 
to us about it.\n"
"Don't say we did not warn you.")
 
+   def set_action_sequence(self):
+   """Set basic stage1, 2, 3 action sequences"""
+   self.settings["action_sequence"] = ["unpack", "unpack_snapshot",
+   "setup_confdir", "portage_overlay",
+   "base_dirs", "bind", "chroot_setup", 
"setup_environment",
+   "run_local", "update_stage", "preclean", 
"unbind", "clean"]
+   self.set_completion_action_sequences()
+
def set_cleanables(self):
StageBase.set_cleanables(self)

diff --git a/targets/stage3/stage3-controller.sh 
b/targets/stage3/stage3-controller.sh
index df1479ea..ff958d67 100755
--- a/targets/stage3/stage3-controller.sh
+++ b/targets/stage3/stage3-controller.sh
@@ -15,6 +15,10 @@ case $1 in
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
 
+   update_stage)
+   exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-updates.sh
+   ;;
+
preclean)
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;

diff --git a/targets/stage3/stage3-updates.sh b/targets/stage3/stage3-updates.sh
new file mode 100644
index ..1b376de5
--- /dev/null
+++ b/targets/stage3/stage3-updates.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Update stage3 (rebuilds, etc. needed to fix emerge complaints)
+if [ -n "${clst_update_stage_command}" ]; then
+   echo "Updating stage..."
+   ${clst_update_stage_command}
+else
+   echo "Skipping seed stage update..."
+fi
+



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-11-22 Thread Brian Dolbec
commit: 61527e6db7c2ac195741a243f3ab504f2652e26e
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Nov 22 01:16:21 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=61527e6d

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd9..087834eb 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -22,7 +22,7 @@ class snapshot(TargetBase, GenBase):
TargetBase.__init__(self, myspec, addlargs)
GenBase.__init__(self,myspec)
#self.settings=myspec
-   self.settings["target_subpath"]="portage"
+   self.settings["target_subpath"]="repos"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
+ self.settings["snapshot_name"]
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])
@@ -93,9 +94,9 @@ class snapshot(TargetBase, GenBase):
def kill_chroot_pids(self):
pass
 
-   @staticmethod
-   def cleanup():
+   def cleanup(self):
log.info('Cleaning up ...')
+   self.purge()
 
def purge(self):
clear_dir(self.settings['tmp_path'])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/, targets/stage3/, catalyst/base/, targets/stage2/, targets/support/, ...

2017-11-22 Thread Brian Dolbec
commit: 1eb7a1208dfe34d126f0f700b62214f01042b271
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Mar 19 22:06:11 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Nov 22 01:16:22 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1eb7a120

Unify stage cleaning

Move the clear_portage() code to the python side clean().
Put that code behind the sticky-config option.

 catalyst/base/stagebase.py  |  9 +
 catalyst/fileops.py |  2 +-
 targets/stage2/stage2-controller.sh |  1 -
 targets/stage3/stage3-controller.sh |  1 -
 targets/stage4/stage4-controller.sh |  1 -
 targets/support/functions.sh| 11 ---
 6 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index a7aa7f41..7a41973c 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1201,6 +1201,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
if os.path.exists(hosts_file + '.catalyst'):
os.rename(hosts_file + '.catalyst', hosts_file)
 
+   # optionally clean up portage configs
+   if ("portage_prefix" in self.settings and
+   "sticky-config" not in self.settings["options"]):
+   for _dir in "keywords", "mask", "unmask", "use":
+   target = pjoin([self.settings['chroot_path'],
+   "/etc/portage/package.%s" % _dir,
+   self.settings["portage_prefix"]])
+   clear_path(target)
+
# Remove our overlay
if os.path.exists(self.settings["chroot_path"] + 
self.settings["local_overlay"]):
clear_path(self.settings["chroot_path"] + 
self.settings["local_overlay"])

diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index d2bd4530..ef4ee8d1 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -71,7 +71,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, 
remove=False,
 
mystat = None
if os.path.isdir(target) and not os.path.islink(target):
-   log.info('Emptying directory: %s', target)
+   log.notice('Emptying directory: %s', target)
# stat the dir, delete the dir, recreate the dir and set
# the proper perms and ownership
try:

diff --git a/targets/stage2/stage2-controller.sh 
b/targets/stage2/stage2-controller.sh
index 2eee79f3..25e51208 100755
--- a/targets/stage2/stage2-controller.sh
+++ b/targets/stage2/stage2-controller.sh
@@ -17,7 +17,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
 

diff --git a/targets/stage3/stage3-controller.sh 
b/targets/stage3/stage3-controller.sh
index 2d415e40..df1479ea 100755
--- a/targets/stage3/stage3-controller.sh
+++ b/targets/stage3/stage3-controller.sh
@@ -16,7 +16,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
 

diff --git a/targets/stage4/stage4-controller.sh 
b/targets/stage4/stage4-controller.sh
index 6a876c82..d42f302f 100755
--- a/targets/stage4/stage4-controller.sh
+++ b/targets/stage4/stage4-controller.sh
@@ -41,7 +41,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
;;
 

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index ac4ec6c7..cca2fd82 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -16,17 +16,6 @@ delete_from_chroot(){
fi
 }
 
-clear_portage() {
-   if [ -n "${clst_portage_prefix}" ]; then
-   for dir in "keywords", "mask", "unmask", "use"; do
-   [ -d 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
-   echo "Clear 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
-   [ -d 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
-   rm -R 
"${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
-   done
-   fi
-}
-
 exec_in_chroot(){
 # Takes the full path to the source file as its argument
 # copies the file to the /tmp directory of the chroot



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/

2017-04-06 Thread Brian Dolbec
commit: 42747d0193e1914270a65cfa81df5e3a017a53e2
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Apr  6 20:51:23 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Apr  6 20:52:26 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=42747d01

stage1: Fix seedcache to clean out the original seed root, keep only the 
stage1root

Signed-off-by: Brian Dolbec  gentoo.org>

 catalyst/fileops.py| 23 +++
 catalyst/targets/stage1.py | 39 ++-
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index ef4ee8d1..5e51f1fc 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -107,3 +107,26 @@ def clear_dir(target, mode=0o755, chg_flags=False, 
remove=False,
 def clear_path(target):
"""Nuke |target| regardless of it being a dir or file."""
clear_dir(target, remove=True)
+
+
+def move_path(src, dest):
+   '''Move a source target to a new destination
+
+   :param src: source path to move
+   :param dest: destination path to move it to
+   :returns: boolean
+   '''
+   log.debug('Start move_path(%s, %s)', src, dest)
+   if os.path.isdir(src) and not os.path.islink(src):
+   if os.path.exists(dest):
+   log.warning('Removing existing target destination: %s', 
dest)
+   if not clear_dir(dest, remove=True):
+   return False
+   log.debug('Moving source...')
+   try:
+   shutil.move(src, dest)
+   except Exception:
+   log.error('move_path failed', exc_info=True)
+   return False
+   return True
+   return False

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 18ef520d..cc4366b6 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from snakeoil import fileutils
 
 from catalyst import log
 from catalyst.support import normpath
-from catalyst.fileops import ensure_dirs
+from catalyst.fileops import ensure_dirs, move_path
 from catalyst.base.stagebase import StageBase
 
 
@@ -86,3 +86,40 @@ class stage1(StageBase):
self.mounts.append("stage1root/proc")
self.target_mounts["stage1root/proc"] = "/tmp/stage1root/proc"
self.mountmap["stage1root/proc"] = "/proc"
+
+   def set_completion_action_sequences(self):
+   '''Override function for stage1
+
+   Its purpose is to move the new stage1root out of the seed stage
+   and rename it to the stage1 chroot_path after cleaning the seed 
stage
+   chroot for re-use in stage2 without the need to unpack it.
+   '''
+   if "fetch" not in self.settings["options"]:
+   self.settings["action_sequence"].append("capture")
+   if "keepwork" in self.settings["options"]:
+   
self.settings["action_sequence"].append("clear_autoresume")
+   elif "seedcache" in self.settings["options"]:
+   
self.settings["action_sequence"].append("remove_autoresume")
+   self.settings["action_sequence"].append("clean_stage1")
+   else:
+   
self.settings["action_sequence"].append("remove_autoresume")
+   self.settings["action_sequence"].append("remove_chroot")
+   return
+
+
+   def clean_stage1(self):
+   '''seedcache is enabled, so salvage the /tmp/stage1root,
+   remove the seed chroot'''
+   log.notice('Salvaging the stage1root from the chroot path ...')
+   # move the self.settings["stage_path"] outside of the 
self.settings["chroot_path"]
+   tmp_path = normpath(self.settings["storedir"] + "/tmp/" + 
"stage1root")
+   if move_path(self.settings["stage_path"], tmp_path):
+   self.remove_chroot()
+   # move it to self.settings["chroot_path"]
+   if not move_path(tmp_path, 
self.settings["chroot_path"]):
+   log.error('clean_stage1 failed, see previous 
log messages for details')
+   return False
+   log.notice('Successfully moved and cleaned the 
stage1root for the seedcache')
+   return True
+   log.error('clean_stage1 failed to move the stage1root to a 
temporary loation')
+   return False



[gentoo-commits] proj/catalyst:pending commit in: catalyst/, targets/stage2/, targets/support/, targets/stage3/, targets/stage4/, ...

2017-03-19 Thread Brian Dolbec
commit: 2e9135319c1fca1f6d3ed84d9f13b0e300db49c7
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Mar 19 22:06:11 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Mar 19 22:06:11 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=2e913531

Unify stage cleaning

Move the clear_portage() code to the python side clean().
Put that code behind the sticky-config option.

 catalyst/base/stagebase.py  |  9 +
 catalyst/fileops.py |  2 +-
 targets/stage2/stage2-controller.sh |  1 -
 targets/stage3/stage3-controller.sh |  1 -
 targets/stage4/stage4-controller.sh |  1 -
 targets/support/functions.sh| 11 ---
 6 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index a7aa7f41..7a41973c 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1201,6 +1201,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
if os.path.exists(hosts_file + '.catalyst'):
os.rename(hosts_file + '.catalyst', hosts_file)
 
+   # optionally clean up portage configs
+   if ("portage_prefix" in self.settings and
+   "sticky-config" not in self.settings["options"]):
+   for _dir in "keywords", "mask", "unmask", "use":
+   target = pjoin([self.settings['chroot_path'],
+   "/etc/portage/package.%s" % _dir,
+   self.settings["portage_prefix"]])
+   clear_path(target)
+
# Remove our overlay
if os.path.exists(self.settings["chroot_path"] + 
self.settings["local_overlay"]):
clear_path(self.settings["chroot_path"] + 
self.settings["local_overlay"])

diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index d2bd4530..ef4ee8d1 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -71,7 +71,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, 
remove=False,
 
mystat = None
if os.path.isdir(target) and not os.path.islink(target):
-   log.info('Emptying directory: %s', target)
+   log.notice('Emptying directory: %s', target)
# stat the dir, delete the dir, recreate the dir and set
# the proper perms and ownership
try:

diff --git a/targets/stage2/stage2-controller.sh 
b/targets/stage2/stage2-controller.sh
index 2eee79f3..25e51208 100755
--- a/targets/stage2/stage2-controller.sh
+++ b/targets/stage2/stage2-controller.sh
@@ -17,7 +17,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
 

diff --git a/targets/stage3/stage3-controller.sh 
b/targets/stage3/stage3-controller.sh
index 2d415e40..df1479ea 100755
--- a/targets/stage3/stage3-controller.sh
+++ b/targets/stage3/stage3-controller.sh
@@ -16,7 +16,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
 

diff --git a/targets/stage4/stage4-controller.sh 
b/targets/stage4/stage4-controller.sh
index 6a876c82..d42f302f 100755
--- a/targets/stage4/stage4-controller.sh
+++ b/targets/stage4/stage4-controller.sh
@@ -41,7 +41,6 @@ case $1 in
;;
 
preclean)
-   clear_portage
exec_in_chroot 
${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
;;
 

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index ac4ec6c7..cca2fd82 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -16,17 +16,6 @@ delete_from_chroot(){
fi
 }
 
-clear_portage() {
-   if [ -n "${clst_portage_prefix}" ]; then
-   for dir in "keywords", "mask", "unmask", "use"; do
-   [ -d 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
-   echo "Clear 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
-   [ -d 
${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix} ] &&
-   rm -R 
"${clst_chroot_path}/etc/portage/package.${dir}/${clst_portage_prefix}"
-   done
-   fi
-}
-
 exec_in_chroot(){
 # Takes the full path to the source file as its argument
 # copies the file to the /tmp directory of the chroot



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, targets/stage3/, etc/, targets/stage4/, catalyst/base/, ...

2017-03-19 Thread Brian Dolbec
commit: 587b7e303c4cbd01185d832a19e6b58bfe081d07
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Mar 19 07:58:13 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Mar 19 07:58:13 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=587b7e30

Unify all make.conf settings and writing

This excludes stage1 builds which needs to modify the seed stage's make.conf for
initial stage building.

 catalyst/base/stagebase.py  | 220 ++--
 catalyst/targets/stage1.py  |   2 +
 etc/catalyst.conf   |   8 ++
 targets/stage2/stage2-controller.sh |   2 -
 targets/stage3/stage3-controller.sh |   2 -
 targets/stage4/stage4-controller.sh |   2 -
 targets/support/chroot-functions.sh |  16 +--
 targets/support/functions.sh|  12 --
 8 files changed, 130 insertions(+), 134 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index d44db985..11a9f178 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -548,27 +548,29 @@ class StageBase(TargetBase, ClearBase, GenBase):
return
 
def set_use(self):
-   if self.settings["spec_prefix"] + "/use" in self.settings:
-   self.settings["use"] = \
-   self.settings[self.settings["spec_prefix"] + 
"/use"]
-   del self.settings[self.settings["spec_prefix"] + "/use"]
-   if "use" not in self.settings:
-   self.settings["use"] = ""
-   if isinstance(self.settings['use'], str):
-   self.settings["use"] = self.settings["use"].split()
+   use = self.settings["spec_prefix"] + "/use"
+   if use in self.settings:
+   if isinstance(self.settings[use], str):
+   self.settings["use"] = 
self.settings[use].split()
+   self.settings["use"] = self.settings[use]
+   del self.settings[use]
+   else:
+   self.settings["use"] = []
 
def set_catalyst_use(self):
-   if self.settings["spec_prefix"] + "/catalyst_use" in 
self.settings:
-   self.settings["catalyst_use"] = \
-   
self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
-   del 
self.settings[self.settings["spec_prefix"]+"/catalyst_use"]
-   if "catalyst_use" not in self.settings:
-   self.settings["catalyst_use"] = ""
-   if isinstance(self.settings['catalyst_use'], str):
-   self.settings["catalyst_use"] = 
self.settings["catalyst_use"].split()
+   catalyst_use = self.settings["spec_prefix"] + "/catalyst_use"
+   if catalyst_use in self.settings:
+   if isinstance(self.settings[catalyst_use], str):
+   self.settings["catalyst_use"] = 
self.settings[catalyst_use].split()
+   else:
+   self.settings["catalyst_use"] = 
self.settings[catalyst_use]
+   del self.settings[catalyst_use]
+   else:
+   self.settings["catalyst_use"] = []
 
# Force bindist when options ask for it
-   if "BINDIST" in self.settings:
+   if "bindist" in self.settings["options"]:
+   log.debug("Enabling bindist USE flag")
self.settings["catalyst_use"].append("bindist")
 
def set_stage_path(self):
@@ -1071,92 +1073,98 @@ class StageBase(TargetBase, ClearBase, GenBase):
makepath = normpath(self.settings["chroot_path"] +
self.settings["make_conf"])
clear_path(makepath)
-   myf = open(makepath, "w")
-   myf.write("# These settings were set by the catalyst build 
script "
-   "that automatically\n# built this stage.\n")
-   myf.write("# Please consult "
-   "/usr/share/portage/config/make.conf.example "
-   "for a more\n# detailed example.\n")
-
-   for flags in ["CFLAGS", "CXXFLAGS", "FCFLAGS", "FFLAGS", 
"LDFLAGS",
-   "ASFLAGS"]:
-   if not flags in self.settings:
-   continue
-   if flags in ["LDFLAGS", "ASFLAGS"]:
-   myf.write("# %s is unsupported.  USE AT YOUR 
OWN RISK!\n"
-   % flags)
-   if (flags is not "CFLAGS" and
-   self.settings[flags] == 
self.settings["CFLAGS"]):
-   myf.write('%s="${CFLAGS}"\n' % flags)
-   elif 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-03-16 Thread Brian Dolbec
commit: d463bea02a4d6bae7f3018a297167b1a1fb21953
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 16 22:56:11 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d463bea0

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd..087834e 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -22,7 +22,7 @@ class snapshot(TargetBase, GenBase):
TargetBase.__init__(self, myspec, addlargs)
GenBase.__init__(self,myspec)
#self.settings=myspec
-   self.settings["target_subpath"]="portage"
+   self.settings["target_subpath"]="repos"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
+ self.settings["snapshot_name"]
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])
@@ -93,9 +94,9 @@ class snapshot(TargetBase, GenBase):
def kill_chroot_pids(self):
pass
 
-   @staticmethod
-   def cleanup():
+   def cleanup(self):
log.info('Cleaning up ...')
+   self.purge()
 
def purge(self):
clear_dir(self.settings['tmp_path'])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-03-10 Thread Brian Dolbec
commit: 1d304f0bf42c963d7d830c8b9ab29835ff84217b
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Mar 11 02:58:29 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1d304f0b

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd..087834e 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -22,7 +22,7 @@ class snapshot(TargetBase, GenBase):
TargetBase.__init__(self, myspec, addlargs)
GenBase.__init__(self,myspec)
#self.settings=myspec
-   self.settings["target_subpath"]="portage"
+   self.settings["target_subpath"]="repos"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
+ self.settings["snapshot_name"]
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])
@@ -93,9 +94,9 @@ class snapshot(TargetBase, GenBase):
def kill_chroot_pids(self):
pass
 
-   @staticmethod
-   def cleanup():
+   def cleanup(self):
log.info('Cleaning up ...')
+   self.purge()
 
def purge(self):
clear_dir(self.settings['tmp_path'])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-03-10 Thread Brian Dolbec
commit: b5410d1285fca19e01cfdcbb37e87b6f21ff
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 10 18:37:33 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b5410d12

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd..087834e 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -22,7 +22,7 @@ class snapshot(TargetBase, GenBase):
TargetBase.__init__(self, myspec, addlargs)
GenBase.__init__(self,myspec)
#self.settings=myspec
-   self.settings["target_subpath"]="portage"
+   self.settings["target_subpath"]="repos"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
+ self.settings["snapshot_name"]
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])
@@ -93,9 +94,9 @@ class snapshot(TargetBase, GenBase):
def kill_chroot_pids(self):
pass
 
-   @staticmethod
-   def cleanup():
+   def cleanup(self):
log.info('Cleaning up ...')
+   self.purge()
 
def purge(self):
clear_dir(self.settings['tmp_path'])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-03-09 Thread Brian Dolbec
commit: 7e820b90119b020719cda016e2100b1f2e435ee0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar  9 09:59:40 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7e820b90

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd..904a731 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2017-03-09 Thread Brian Dolbec
commit: a95409751436e4f56045a0e6d6c9528e0922ab36
Author: Brian Dolbec  gentoo  org>
AuthorDate: Thu Mar  9 09:17:07 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar  9 09:35:39 2017 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a9540975

targets/snapshot.py: Update the code and log messages to use the configured 
repo_name

One more portage name seperation from being used to represent the ebuild 
repository.

 catalyst/targets/snapshot.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 8a9acdd..904a731 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -46,8 +46,9 @@ class snapshot(TargetBase, GenBase):
 
success = True
self.setup()
-   log.notice('Creating Portage tree snapshot %s from %s ...',
-   self.settings['version_stamp'], 
self.settings['portdir'])
+   log.notice('Creating %s tree snapshot %s from %s ...',
+   self.settings["repo_name"], 
self.settings['version_stamp'],
+   self.settings['portdir'])
 
mytmp=self.settings["tmp_path"]
ensure_dirs(mytmp)
@@ -63,7 +64,7 @@ class snapshot(TargetBase, GenBase):
mytmp + '/' + self.settings['repo_name'] + '/'],
env=self.env)
 
-   log.notice('Compressing Portage snapshot tarball ...')
+   log.notice('Compressing %s snapshot tarball ...', 
self.settings["repo_name"])
compressor = CompressMap(self.settings["compress_definitions"],
env=self.env, 
default_mode=self.settings['compression_mode'],
comp_prog=self.settings["comp_prog"])



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/, catalyst/, etc/, examples/

2015-09-06 Thread Brian Dolbec
commit: 9a280f3988a20e7d5e66dd42aaba4033be0ddba0
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun May 24 07:36:49 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Sep  6 21:18:00 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=9a280f39

Apply new compress code, normalize paths

Fix the target_filename ending in a slash

 catalyst/base/stagebase.py   | 171 +++
 catalyst/defaults.py |   4 +
 catalyst/main.py |   8 ++
 catalyst/targets/grp.py  |   2 +-
 catalyst/targets/livecd_stage1.py|   2 +-
 catalyst/targets/livecd_stage2.py|   6 +-
 catalyst/targets/netboot.py  |   8 +-
 catalyst/targets/netboot2.py |   2 +-
 catalyst/targets/stage2.py   |   8 +-
 etc/catalyst.conf|  11 ++-
 examples/generic_stage_template.spec |  32 ++-
 11 files changed, 159 insertions(+), 95 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index d898e95..655ea06 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -10,6 +10,8 @@ from stat import ST_UID, ST_GID, ST_MODE
 # for convienience
 pjoin = os.path.join
 
+from decomp.compress import CompressMap
+
 from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
@@ -264,6 +266,14 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.env["PORT_LOGDIR"] = self.settings["port_logdir"]
self.env["PORT_LOGDIR_CLEAN"] = PORT_LOGDIR_CLEAN
 
+   # Initialize our (de)compressor's)
+   self.decompressor = 
CompressMap(self.settings["decompress_definitions"],
+   env=self.env,
+   search_order=self.settings["decompressor_search_order"])
+
+   # save resources, it is not always needed
+   self.compressor = None
+
def override_cbuild(self):
if "CBUILD" in self.makeconf:
self.settings["CBUILD"]=self.makeconf["CBUILD"]
@@ -332,11 +342,11 @@ class StageBase(TargetBase, ClearBase, GenBase):

normpath(self.settings["kerncache_path"])
else:

self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\
-   
"/kerncache/"+self.settings["target_subpath"]+"/")
+   "/kerncache/"+self.settings["target_subpath"])
 
def set_target_path(self):

self.settings["target_path"]=normpath(self.settings["storedir"]+\
-   
"/builds/"+self.settings["target_subpath"].rstrip('/')+".tar.bz2")
+   "/builds/"+self.settings["target_subpath"])
if "autoresume" in self.settings["options"]\
and self.resume.is_enabled("setup_target_path"):
print \
@@ -420,7 +430,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"].rstrip('/')+".tar.bz2")
+   "/builds/"+self.settings["source_subpath"])
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"]):
@@ -435,7 +445,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"].rstrip('/')+".tar.bz2\n")
+   self.settings["source_subpath"]+"\n")
 
def set_dest_path(self):
if "root_path" in self.settings:
@@ -462,7 +472,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:

self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
"/snapshots/" + self.settings["snapshot_name"] +
-   
self.settings["snapshot"].rstrip('/')+".tar.bz2")
+   self.settings["snapshot"])
 
if os.path.exists(self.settings["snapshot_path"]):
self.settings["snapshot_path_hash"] = \
@@ -472,6 +482,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
  

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/

2015-09-03 Thread Brian Dolbec
commit: 07d13a24c6b28369c63c9cfcc955df6547300243
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 15 23:10:50 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Sep  3 15:12:39 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=07d13a24

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 e0e9023..f774ce8 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"],
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)
 



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/

2015-08-31 Thread Brian Dolbec
commit: 515546abb3859533a1a64a64253e661b19676b77
Author: Brian Dolbec  gentoo  org>
AuthorDate: Mon Jun 15 23:10:50 2015 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Sep  1 05:54:12 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=515546ab

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 c23c8b7..f4bed03 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1279,8 +1279,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
target_filename = 
".".join([self.settings["target_path"],
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)
 



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2015-02-26 Thread Brian Dolbec
commit: 276c6969c79c810b059f525dd218b6b6271a967a
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sat Jun  1 06:33:15 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Feb 26 19:15:20 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=276c6969

Fix a long line.

---
 catalyst/targets/netboot2.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
index acffb05..b492e6a 100644
--- a/catalyst/targets/netboot2.py
+++ b/catalyst/targets/netboot2.py
@@ -137,7 +137,8 @@ class netboot2(StageBase):
# we're going to shell out for all 
these cleaning operations,
# so we get easy glob handling
print netboot2: removing  + x
-   os.system(rm -rf  + 
self.settings[chroot_path] + self.settings[merge_path] + x)
+   os.system(rm -rf  + 
self.settings[chroot_path] +
+   self.settings[merge_path] + x)
 
def empty(self):
if autoresume in self.settings[options] \



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/

2015-02-26 Thread Brian Dolbec
commit: 5b08b471611670b4cc996e45c387ecd951fb2142
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Wed Jun 12 14:40:12 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Feb 26 19:58:28 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=5b08b471

Fix livecd source and target paths not ending with a slash

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

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index bdeaedd..eec74df 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -294,7 +294,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
def set_target_subpath(self):
self.settings[target_subpath]=self.settings[rel_type]+/+\

self.settings[target]+-+self.settings[subarch]+-+\
-   self.settings[version_stamp]
+   self.settings[version_stamp] +'/'
 
def set_source_subpath(self):
if type(self.settings[source_subpath])!=types.StringType:

diff --git a/catalyst/targets/livecd_stage1.py 
b/catalyst/targets/livecd_stage1.py
index 55859bc..8402e7a 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -33,7 +33,7 @@ class livecd_stage1(StageBase):
unbind, clean,clear_autoresume]
 
def set_target_path(self):
-   
self.settings[target_path]=normpath(self.settings[storedir]+/builds/+self.settings[target_subpath])
+   
self.settings[target_path]=normpath(self.settings[storedir]+/builds/+self.settings[target_subpath]+'/')
if autoresume in self.settings[options] \
and self.resume.is_enabled(setup_target_path):
print Resume point detected, skipping target 
path setup operation...
@@ -43,7 +43,6 @@ class livecd_stage1(StageBase):
cmd(rm -rf +self.settings[target_path],\
Could not remove existing directory: 
+self.settings[target_path],env=self.env)
self.resume.enable(setup_target_path)
-
ensure_dirs(self.settings[target_path])
 
def set_spec_prefix(self):

diff --git a/catalyst/targets/livecd_stage2.py 
b/catalyst/targets/livecd_stage2.py
index 45a6767..55e6897 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.,



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/

2014-12-31 Thread Brian Dolbec
commit: 5fa2b2a910c45401f132e7ed7e9da9a993762252
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Feb 12 03:51:52 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:05 2015 +
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 000..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 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-12-31 Thread Brian Dolbec
commit: a5e07c9892a288eac19062e1c0ee40eb54982476
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:06 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a5e07c98

[3 of 3] Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/

2014-12-31 Thread Brian Dolbec
commit: d4bc8e3c5ba7bca5656ea597e3ad013a4e61c8b5
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Jan 20 08:10:03 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:05 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d4bc8e3c

Begin splitting up generic_stage_target into smaller code blocks.

This so snapshot_target does not need to import it since most of it was
not used or initialized properly.

---
 catalyst/defaults.py   |   2 +-
 catalyst/targets/clearbase.py  | 115 ++
 catalyst/targets/genbase.py|  58 +++
 catalyst/targets/generic_stage_target.py   | 167 +++--
 catalyst/targets/snapshot_target.py|  16 +-
 .../targets/{generic_target.py = targetbase.py}   |   6 +-
 6 files changed, 208 insertions(+), 156 deletions(-)

diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index b36eff7..f6b2163 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -1,7 +1,7 @@
 
 
 # these should never be touched
-required_build_targets = [generic_target, generic_stage_target]
+required_build_targets = [targetbase, generic_stage_target]
 
 # new build types should be added here
 valid_build_targets = [stage1_target, stage2_target, stage3_target,

diff --git a/catalyst/targets/clearbase.py b/catalyst/targets/clearbase.py
new file mode 100644
index 000..8519acc
--- /dev/null
+++ b/catalyst/targets/clearbase.py
@@ -0,0 +1,115 @@
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import cmd, countdown
+
+
+class ClearBase(object):
+   
+   This class does all of clearing after task completion
+   
+   def __init__(self, myspec):
+   self.settings = myspec
+
+
+
+   def clear_autoresume(self):
+Clean resume points since they are no longer needed 
+   if autoresume in self.settings[options]:
+   print Removing AutoResume Points: ...
+   myemp=self.settings[autoresume_path]
+   if os.path.isdir(myemp):
+   if autoresume in self.settings[options]:
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   if os.uname()[0] == FreeBSD:
+   cmd(chflags -R noschg +myemp,\
+   Could not remove immutable 
flag for file \
+   +myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_chroot(self):
+   myemp=self.settings[chroot_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove existing file: 
+myemp,env=self.env)
+There's no easy way to change flags recursively in 
python 
+   if os.uname()[0] == FreeBSD:
+   os.system(chflags -R noschg +myemp)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_packages(self):
+   if pkgcache in self.settings[options]:
+   print purging the pkgcache ...
+
+   myemp=self.settings[pkgcache_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env=self.env)
+   shutil.rmtree(myemp)
+   

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/

2014-12-31 Thread Brian Dolbec
commit: 36610754ba2daca723064021001c5128d83e8f21
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Feb 12 03:43:37 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:05 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=36610754

Remove redundant /bin/bash additions in cmd() calls

Remove old spawn_* functions copied from portage.
cmd() now uses subprocess.Popen().

---
 catalyst/support.py  | 301 +++
 catalyst/targets/generic_stage_target.py |  26 +--
 catalyst/targets/grp_target.py   |   2 +-
 catalyst/targets/netboot2_target.py  |   4 +-
 catalyst/targets/netboot_target.py   |   8 +-
 catalyst/targets/tinderbox_target.py |   2 +-
 6 files changed, 42 insertions(+), 301 deletions(-)

diff --git a/catalyst/support.py b/catalyst/support.py
index e2d64a1..aaacaa9 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -4,9 +4,10 @@ import string
 import os
 import types
 import re
-import signal
 import traceback
 import time
+from subprocess import Popen
+
 
 from catalyst.defaults import verbosity, valid_config_file_values
 
@@ -31,34 +32,6 @@ except:
 spawned_pids = []
 
 
-def cleanup(pids,block_exceptions=True):
-   function to go through and reap the list of pids passed to it
-   global spawned_pids
-   if type(pids) == int:
-   pids = [pids]
-   for x in pids:
-   try:
-   os.kill(x,signal.SIGTERM)
-   if os.waitpid(x,os.WNOHANG)[1] == 0:
-   # feisty bugger, still alive.
-   os.kill(x,signal.SIGKILL)
-   os.waitpid(x,0)
-   except OSError, oe:
-   if block_exceptions:
-   pass
-   if oe.errno not in (10,3):
-   raise oe
-   except SystemExit:
-   raise
-   except Exception:
-   if block_exceptions:
-   pass
-   try:
-   spawned_pids.remove(x)
-   except IndexError:
-   pass
-
-
 # a function to turn a string of non-printable characters
 # into a string of hex characters
 def hexify(str):
@@ -79,8 +52,8 @@ def read_from_clst(file):
return -1
#raise CatalystError, Could not open file +file
for line in myf.readlines():
-   #line = string.replace(line, \n, ) # drop newline
-   myline = myline + line
+   #line = string.replace(line, \n, ) # drop newline
+   myline = myline + line
myf.close()
return myline
 
@@ -145,259 +118,27 @@ def find_binary(myc):
return None
 
 
-def spawn_bash(mycommand,env={},debug=False,opt_name=None,**keywords):
-   spawn mycommand as an arguement to bash
-   args=[BASH_BINARY]
-   if not opt_name:
-   opt_name=mycommand.split()[0]
-   if BASH_ENV not in env:
-   env[BASH_ENV] = /etc/spork/is/not/valid/profile.env
-   if debug:
-   args.append(-x)
-   args.append(-c)
-   args.append(mycommand)
-   return spawn(args,env=env,opt_name=opt_name,**keywords)
-
-
-def spawn_get_output(mycommand,raw_exit_code=False,emulate_gso=True, \
-   collect_fds=[1],fd_pipes=None,**keywords):
-   call spawn, collecting the output to fd's specified in collect_fds 
list
-   emulate_gso is a compatability hack to emulate 
commands.getstatusoutput's return, minus the
-   requirement it always be a bash call (spawn_type controls the actual 
spawn call), and minus the
-   'lets let log only stdin and let stderr slide by'.
-
-   emulate_gso was deprecated from the day it was added, so convert your 
code over.
-   spawn_type is the passed in function to call- typically spawn_bash, 
spawn, spawn_sandbox, or spawn_fakeroot
-   global selinux_capable
-   pr,pw=os.pipe()
-
-   if fd_pipes==None:
-   fd_pipes={}
-   fd_pipes[0] = 0
-
-   for x in collect_fds:
-   fd_pipes[x] = pw
-   keywords[returnpid]=True
-
-   mypid=spawn_bash(mycommand,fd_pipes=fd_pipes,**keywords)
-   os.close(pw)
-   if type(mypid) != types.ListType:
-   os.close(pr)
-   return [mypid, %s: No such file or directory % 
mycommand.split()[0]]
-
-   fd=os.fdopen(pr,r)
-   mydata=fd.readlines()
-   fd.close()
-   if emulate_gso:
-   mydata=string.join(mydata)
-   if len(mydata) and mydata[-1] == \n:
-   mydata=mydata[:-1]
-   retval=os.waitpid(mypid[0],0)[1]
-   cleanup(mypid)
-   if raw_exit_code:
-

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/, catalyst/base/

2014-12-31 Thread Brian Dolbec
commit: a1c2785438593104d7c3d2ec20dd4fb25cb19884
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sat Jun  1 06:23:46 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:07 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a1c27854

Create AutoResume class to handle all file creation, deletion...

Create catalyst/base/resume.py.
Migrate all auto_resume operations to using the new class.

---
 catalyst/base/clearbase.py|  21 +
 catalyst/base/resume.py   | 166 ++
 catalyst/base/stagebase.py| 156 +++
 catalyst/targets/grp.py   |   4 +-
 catalyst/targets/livecd_stage1.py |   4 +-
 catalyst/targets/livecd_stage2.py |  14 ++--
 catalyst/targets/netboot2.py  |  19 +++--
 7 files changed, 250 insertions(+), 134 deletions(-)

diff --git a/catalyst/base/clearbase.py b/catalyst/base/clearbase.py
index 8462a3c..0ebe299 100644
--- a/catalyst/base/clearbase.py
+++ b/catalyst/base/clearbase.py
@@ -13,31 +13,14 @@ class ClearBase(object):

def __init__(self, myspec):
self.settings = myspec
-
+   self.resume = None
 
 
def clear_autoresume(self):
 Clean resume points since they are no longer needed 
if autoresume in self.settings[options]:
print Removing AutoResume Points: ...
-   myemp=self.settings[autoresume_path]
-   if os.path.isdir(myemp):
-   if autoresume in self.settings[options]:
-   print Emptying directory,myemp
-   
-   stat the dir, delete the dir, recreate the dir 
and set
-   the proper perms and ownership
-   
-   mystat=os.stat(myemp)
-   if os.uname()[0] == FreeBSD:
-   cmd(chflags -R noschg +myemp,\
-   Could not remove immutable 
flag for file \
-   +myemp)
-   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
-   shutil.rmtree(myemp)
-   ensure_dirs(myemp, 0755)
-   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
-   os.chmod(myemp,mystat[ST_MODE])
+   self.resume.clear_all()
 
 
def clear_chroot(self):

diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
new file mode 100644
index 000..e42c7dc
--- /dev/null
+++ b/catalyst/base/resume.py
@@ -0,0 +1,166 @@
+#!/usr/bin/python
+
+# Maintained in full by:
+# Catalyst Team catal...@gentoo.org
+# Release Engineering Team rel...@gentoo.org
+# Copyright 2013 Brian Dolbec dol...@gentoo.org
+
+'''resume.py
+
+Performs autoresume tracking file operations such as
+set, unset, is_set, is_unset, enabled, clear_all
+'''
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+import traceback
+
+from catalyst.fileops import ensure_dirs, pjoin, listdir_files
+from catalyst.support import touch
+
+
+class AutoResumeError(Exception):
+   def __init__(self, message, print_traceback=False):
+   if message:
+   if print_traceback:
+   (type,value)=sys.exc_info()[:2]
+   if value!=None:
+   print
+   print Traceback values found.  
listing...
+   print 
traceback.print_exc(file=sys.stdout)
+   print !!! catalyst: AutoResumeError  + message
+   print
+
+
+class AutoResume(object):
+   '''Class for tracking and handling all aspects of
+   the autoresume option and related files.
+   '''
+
+
+   def __init__(self, basedir, mode=0755):
+   self.basedir = basedir
+   ensure_dirs(basedir, mode=mode, fatal=True)
+   self._points = {}
+   self._init_points_()
+
+
+   def _init_points_(self):
+   '''Internal function which reads the autoresume directory and
+   for existing autoresume points and adds them to our _points 
variable
+   '''
+   existing = listdir_files(self.basedir, False)
+   for point in existing:
+   self._points[point] = pjoin(self.basedir, point)
+
+
+   def enable(self, point, data=None):
+   '''Sets the resume point 'ON'
+
+   @param point: string.  name of the resume point to enable
+   @param data: string of information to store, or None
+ 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-12-31 Thread Brian Dolbec
commit: 9ce3a9131514a1ea831d26a9cedeb5f3fb9677c3
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Mon Feb 25 00:29:52 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:06 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=9ce3a913

Mixed spaces/tabs and indent cleanup.

---
 catalyst/targets/livecd_stage2.py |  2 +-
 catalyst/targets/netboot.py   | 11 +--
 catalyst/targets/netboot2.py  | 10 +-
 catalyst/targets/stage4.py| 18 +-
 catalyst/targets/tinderbox.py |  8 
 5 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/catalyst/targets/livecd_stage2.py 
b/catalyst/targets/livecd_stage2.py
index 949ee98..b1cf6b2 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -49,7 +49,7 @@ class livecd_stage2(StageBase):
print_traceback=True)
 
def set_spec_prefix(self):
-   self.settings[spec_prefix]=livecd
+   self.settings[spec_prefix]=livecd
 
def set_target_path(self):

self.settings[target_path]=normpath(self.settings[storedir]+/builds/+self.settings[target_subpath]+/)

diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index 7ae1d75..de8dc85 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -122,13 +122,12 @@ class netboot(StageBase):
self.unbind()
raise CatalystError(netboot build aborting due to 
error.,
print_traceback=True)
-
# end
print netboot: build finished !
 
def set_action_sequence(self):
-   self.settings[action_sequence]=[unpack,unpack_snapshot,
-   
config_profile_link,setup_confdir,bind,chroot_setup,\
-   
setup_environment,build_packages,build_busybox,\
-   
build_kernel,copy_files_to_image,\
-   
clean,create_netboot_files,unbind,clear_autoresume]
+   self.settings[action_sequence]=[unpack,unpack_snapshot,
+   
config_profile_link,setup_confdir,bind,chroot_setup,\
+   setup_environment,build_packages,build_busybox,\
+   build_kernel,copy_files_to_image,\
+   
clean,create_netboot_files,unbind,clear_autoresume]

diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
index dbbb6a9..e9e2625 100644
--- a/catalyst/targets/netboot2.py
+++ b/catalyst/targets/netboot2.py
@@ -164,8 +164,8 @@ class netboot2(StageBase):
touch(self.settings[autoresume_path]+empty)
 
def set_action_sequence(self):
-   
self.settings[action_sequence]=[unpack,unpack_snapshot,config_profile_link,
-   
setup_confdir,portage_overlay,bind,chroot_setup,\
-   
setup_environment,build_packages,root_overlay,\
-   
copy_files_to_image,setup_overlay,build_kernel,move_kernels,\
-   
remove,empty,unbind,clean,clear_autoresume]
+   
self.settings[action_sequence]=[unpack,unpack_snapshot,config_profile_link,
+   
setup_confdir,portage_overlay,bind,chroot_setup,\
+   setup_environment,build_packages,root_overlay,\
+   
copy_files_to_image,setup_overlay,build_kernel,move_kernels,\
+   remove,empty,unbind,clean,clear_autoresume]

diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py
index 4aef33f..857976b 100644
--- a/catalyst/targets/stage4.py
+++ b/catalyst/targets/stage4.py
@@ -14,10 +14,10 @@ class stage4(StageBase):
self.required_values=[stage4/packages]
self.valid_values=self.required_values[:]
self.valid_values.extend([stage4/use,boot/kernel,\
-   stage4/root_overlay,stage4/fsscript,\
-   stage4/gk_mainargs,splash_theme,\
-   
portage_overlay,stage4/rcadd,stage4/rcdel,\
-   
stage4/linuxrc,stage4/unmerge,stage4/rm,stage4/empty])
+   stage4/root_overlay,stage4/fsscript,\
+   stage4/gk_mainargs,splash_theme,\
+   portage_overlay,stage4/rcadd,stage4/rcdel,\
+   
stage4/linuxrc,stage4/unmerge,stage4/rm,stage4/empty])
StageBase.__init__(self,spec,addlargs)
 
def set_cleanables(self):
@@ -25,11 +25,11 @@ class stage4(StageBase):
 
def set_action_sequence(self):
self.settings[action_sequence]=[unpack,unpack_snapshot,\
-  

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-12-31 Thread Brian Dolbec
commit: 8dbbd3792cc3de96736a812393ad3f22b14e52af
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Mon May 27 23:08:16 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu Jan  1 05:58:06 2015 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=8dbbd379

fix indent.

---
 catalyst/targets/livecd_stage1.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/livecd_stage1.py 
b/catalyst/targets/livecd_stage1.py
index 6cbd91a..3b19c3f 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -47,7 +47,7 @@ class livecd_stage1(StageBase):
os.makedirs(self.settings[target_path])
 
def set_spec_prefix(self):
-   self.settings[spec_prefix]=livecd
+   self.settings[spec_prefix]=livecd
 
def set_use(self):
StageBase.set_use(self)



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-10 Thread Brian Dolbec
commit: 0ed3f9facb1f8faadbc0aa5cdc621551ba97f7c1
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Thu Sep 11 03:05:37 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0ed3f9fa

[3 of 3] Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-02 Thread Brian Dolbec
commit: 278b95a4224d12d3b6b580784458018f97bdbab7
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 06:31:58 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=278b95a4

Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-02 Thread Brian Dolbec
commit: 2d156b7341fe4d4af347333cc930f419d687228c
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 23:07:29 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=2d156b73

[3 of 3] Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-01 Thread Brian Dolbec
commit: 136470235e52c0373c173e3804ccc9f70e4a25b2
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Jan 20 08:10:03 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 02:13:43 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=13647023

Begin splitting up generic_stage_target into smaller code blocks.

This so snapshot_target does not need to import it since most of it was
not used or initialized properly.

Conflicts:
catalyst/targets/generic_stage_target.py
catalyst/targets/snapshot_target.py

---
 catalyst/targets/clearbase.py  | 115 ++
 catalyst/targets/genbase.py|  58 +++
 catalyst/targets/generic_stage_target.py   | 167 +++--
 catalyst/targets/snapshot_target.py|  16 +-
 .../targets/{generic_target.py = targetbase.py}   |   6 +-
 5 files changed, 207 insertions(+), 155 deletions(-)

diff --git a/catalyst/targets/clearbase.py b/catalyst/targets/clearbase.py
new file mode 100644
index 000..8519acc
--- /dev/null
+++ b/catalyst/targets/clearbase.py
@@ -0,0 +1,115 @@
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import cmd, countdown
+
+
+class ClearBase(object):
+   
+   This class does all of clearing after task completion
+   
+   def __init__(self, myspec):
+   self.settings = myspec
+
+
+
+   def clear_autoresume(self):
+Clean resume points since they are no longer needed 
+   if autoresume in self.settings[options]:
+   print Removing AutoResume Points: ...
+   myemp=self.settings[autoresume_path]
+   if os.path.isdir(myemp):
+   if autoresume in self.settings[options]:
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   if os.uname()[0] == FreeBSD:
+   cmd(chflags -R noschg +myemp,\
+   Could not remove immutable 
flag for file \
+   +myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_chroot(self):
+   myemp=self.settings[chroot_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove existing file: 
+myemp,env=self.env)
+There's no easy way to change flags recursively in 
python 
+   if os.uname()[0] == FreeBSD:
+   os.system(chflags -R noschg +myemp)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_packages(self):
+   if pkgcache in self.settings[options]:
+   print purging the pkgcache ...
+
+   myemp=self.settings[pkgcache_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env=self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_kerncache(self):
+   if kerncache in self.settings[options]:
+   print purging the kerncache ...
+
+   myemp=self.settings[kerncache_path]
+   

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-01 Thread Brian Dolbec
commit: 4107e4347b3444e606c479a13d437292b51a43d3
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 02:13:44 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4107e434

Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-01 Thread Brian Dolbec
commit: d1c8dce78d8615d17602f131dca159daf52dcdaa
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 05:51:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d1c8dce7

Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-09-01 Thread Brian Dolbec
commit: 0b02e0694153a668c6bce73dbd70dea2da14258e
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Jan 20 08:10:03 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Sep  2 05:51:54 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0b02e069

Begin splitting up generic_stage_target into smaller code blocks.

This so snapshot_target does not need to import it since most of it was
not used or initialized properly.

Conflicts:
catalyst/targets/generic_stage_target.py
catalyst/targets/snapshot_target.py

---
 catalyst/targets/clearbase.py  | 115 ++
 catalyst/targets/genbase.py|  58 +++
 catalyst/targets/generic_stage_target.py   | 167 +++--
 catalyst/targets/snapshot_target.py|  16 +-
 .../targets/{generic_target.py = targetbase.py}   |   6 +-
 5 files changed, 207 insertions(+), 155 deletions(-)

diff --git a/catalyst/targets/clearbase.py b/catalyst/targets/clearbase.py
new file mode 100644
index 000..8519acc
--- /dev/null
+++ b/catalyst/targets/clearbase.py
@@ -0,0 +1,115 @@
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import cmd, countdown
+
+
+class ClearBase(object):
+   
+   This class does all of clearing after task completion
+   
+   def __init__(self, myspec):
+   self.settings = myspec
+
+
+
+   def clear_autoresume(self):
+Clean resume points since they are no longer needed 
+   if autoresume in self.settings[options]:
+   print Removing AutoResume Points: ...
+   myemp=self.settings[autoresume_path]
+   if os.path.isdir(myemp):
+   if autoresume in self.settings[options]:
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   if os.uname()[0] == FreeBSD:
+   cmd(chflags -R noschg +myemp,\
+   Could not remove immutable 
flag for file \
+   +myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_chroot(self):
+   myemp=self.settings[chroot_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove existing file: 
+myemp,env=self.env)
+There's no easy way to change flags recursively in 
python 
+   if os.uname()[0] == FreeBSD:
+   os.system(chflags -R noschg +myemp)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_packages(self):
+   if pkgcache in self.settings[options]:
+   print purging the pkgcache ...
+
+   myemp=self.settings[pkgcache_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env=self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_kerncache(self):
+   if kerncache in self.settings[options]:
+   print purging the kerncache ...
+
+   myemp=self.settings[kerncache_path]
+   

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-06-15 Thread Brian Dolbec
commit: c18fdd285804efa213b43933704a6e765eb1ad47
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Jan 20 08:10:03 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sun Jun 15 14:03:40 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=c18fdd28

Begin splitting up generic_stage_target into smaller code blocks.

This so snapshot_target does not need to import it since most of it was
not used or initialized properly.

Conflicts:
catalyst/targets/generic_stage_target.py
catalyst/targets/snapshot_target.py

---
 catalyst/targets/clearbase.py  | 115 ++
 catalyst/targets/genbase.py|  58 +++
 catalyst/targets/generic_stage_target.py   | 167 +++--
 catalyst/targets/snapshot_target.py|  16 +-
 .../targets/{generic_target.py = targetbase.py}   |   6 +-
 5 files changed, 207 insertions(+), 155 deletions(-)

diff --git a/catalyst/targets/clearbase.py b/catalyst/targets/clearbase.py
new file mode 100644
index 000..8519acc
--- /dev/null
+++ b/catalyst/targets/clearbase.py
@@ -0,0 +1,115 @@
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import cmd, countdown
+
+
+class ClearBase(object):
+   
+   This class does all of clearing after task completion
+   
+   def __init__(self, myspec):
+   self.settings = myspec
+
+
+
+   def clear_autoresume(self):
+Clean resume points since they are no longer needed 
+   if autoresume in self.settings[options]:
+   print Removing AutoResume Points: ...
+   myemp=self.settings[autoresume_path]
+   if os.path.isdir(myemp):
+   if autoresume in self.settings[options]:
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   if os.uname()[0] == FreeBSD:
+   cmd(chflags -R noschg +myemp,\
+   Could not remove immutable 
flag for file \
+   +myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_chroot(self):
+   myemp=self.settings[chroot_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove existing file: 
+myemp,env=self.env)
+There's no easy way to change flags recursively in 
python 
+   if os.uname()[0] == FreeBSD:
+   os.system(chflags -R noschg +myemp)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_packages(self):
+   if pkgcache in self.settings[options]:
+   print purging the pkgcache ...
+
+   myemp=self.settings[pkgcache_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env=self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_kerncache(self):
+   if kerncache in self.settings[options]:
+   print purging the kerncache ...
+
+   myemp=self.settings[kerncache_path]
+   

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-06-15 Thread Brian Dolbec
commit: a00a729072e5ca26ba84c99db8e2a851287e7527
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sun Jun 15 14:05:53 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a00a7290

Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-06-13 Thread Brian Dolbec
commit: 4eddcf963a9366aea9230c688f3f86e06171b472
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Jan 20 08:10:03 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Jun 14 04:49:26 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4eddcf96

Begin splitting up generic_stage_target into smaller code blocks.

This so snapshot_target does not need to import it since most of it was
not used or initialized properly.

Conflicts:
catalyst/targets/generic_stage_target.py
catalyst/targets/snapshot_target.py

---
 catalyst/targets/clearbase.py  | 115 ++
 catalyst/targets/genbase.py|  58 +++
 catalyst/targets/generic_stage_target.py   | 169 +++--
 catalyst/targets/snapshot_target.py|  16 +-
 .../targets/{generic_target.py = targetbase.py}   |   6 +-
 5 files changed, 208 insertions(+), 156 deletions(-)

diff --git a/catalyst/targets/clearbase.py b/catalyst/targets/clearbase.py
new file mode 100644
index 000..8519acc
--- /dev/null
+++ b/catalyst/targets/clearbase.py
@@ -0,0 +1,115 @@
+
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import cmd, countdown
+
+
+class ClearBase(object):
+   
+   This class does all of clearing after task completion
+   
+   def __init__(self, myspec):
+   self.settings = myspec
+
+
+
+   def clear_autoresume(self):
+Clean resume points since they are no longer needed 
+   if autoresume in self.settings[options]:
+   print Removing AutoResume Points: ...
+   myemp=self.settings[autoresume_path]
+   if os.path.isdir(myemp):
+   if autoresume in self.settings[options]:
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   if os.uname()[0] == FreeBSD:
+   cmd(chflags -R noschg +myemp,\
+   Could not remove immutable 
flag for file \
+   +myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env-self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_chroot(self):
+   myemp=self.settings[chroot_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove existing file: 
+myemp,env=self.env)
+There's no easy way to change flags recursively in 
python 
+   if os.uname()[0] == FreeBSD:
+   os.system(chflags -R noschg +myemp)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_packages(self):
+   if pkgcache in self.settings[options]:
+   print purging the pkgcache ...
+
+   myemp=self.settings[pkgcache_path]
+   if os.path.isdir(myemp):
+   print Emptying directory,myemp
+   
+   stat the dir, delete the dir, recreate the dir 
and set
+   the proper perms and ownership
+   
+   mystat=os.stat(myemp)
+   #cmd(rm -rf +myemp, Could not remove 
existing file: +myemp,env=self.env)
+   shutil.rmtree(myemp)
+   os.makedirs(myemp,0755)
+   os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
+   os.chmod(myemp,mystat[ST_MODE])
+
+
+   def clear_kerncache(self):
+   if kerncache in self.settings[options]:
+   print purging the kerncache ...
+
+   myemp=self.settings[kerncache_path]
+   

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-06-13 Thread Brian Dolbec
commit: 260e6b68530a0adf30494df2cc78c5edd3dd4afd
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Tue Jan 22 00:10:51 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Jun 14 05:21:50 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=260e6b68

Rename all target .py files and classes without _target in them.

This is so they are the named the same as the target .sh files
and work with the now simplified module loading.

---
 catalyst/targets/{embedded_target.py = embedded.py}   | 2 +-
 catalyst/targets/{grp_target.py = grp.py} | 2 +-
 catalyst/targets/{livecd_stage1_target.py = livecd_stage1.py} | 2 +-
 catalyst/targets/{livecd_stage2_target.py = livecd_stage2.py} | 2 +-
 catalyst/targets/{netboot_target.py = netboot.py} | 2 +-
 catalyst/targets/{netboot2_target.py = netboot2.py}   | 2 +-
 catalyst/targets/{stage1_target.py = stage1.py}   | 2 +-
 catalyst/targets/{stage2_target.py = stage2.py}   | 2 +-
 catalyst/targets/{stage3_target.py = stage3.py}   | 2 +-
 catalyst/targets/{stage4_target.py = stage4.py}   | 2 +-
 catalyst/targets/{tinderbox_target.py = tinderbox.py} | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded.py
similarity index 98%
rename from catalyst/targets/embedded_target.py
rename to catalyst/targets/embedded.py
index aee0f00..3309278 100644
--- a/catalyst/targets/embedded_target.py
+++ b/catalyst/targets/embedded.py
@@ -15,7 +15,7 @@ from catalyst.support import normpath
 
 from catalyst.base.stagebase import StageBase
 
-class embedded_target(StageBase):
+class embedded(StageBase):

Builder class for embedded target


diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp.py
similarity index 99%
rename from catalyst/targets/grp_target.py
rename to catalyst/targets/grp.py
index e3f08a2..0075714 100644
--- a/catalyst/targets/grp_target.py
+++ b/catalyst/targets/grp.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class grp_target(StageBase):
+class grp(StageBase):

The builder class for GRP (Gentoo Reference Platform) builds.


diff --git a/catalyst/targets/livecd_stage1_target.py 
b/catalyst/targets/livecd_stage1.py
similarity index 98%
rename from catalyst/targets/livecd_stage1_target.py
rename to catalyst/targets/livecd_stage1.py
index 9c74253..661e06e 100644
--- a/catalyst/targets/livecd_stage1_target.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -13,7 +13,7 @@ from catalyst.support import (normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage1_target(StageBase):
+class livecd_stage1(StageBase):

Builder class for LiveCD stage1.


diff --git a/catalyst/targets/livecd_stage2_target.py 
b/catalyst/targets/livecd_stage2.py
similarity index 99%
rename from catalyst/targets/livecd_stage2_target.py
rename to catalyst/targets/livecd_stage2.py
index a4630e6..20f6014 100644
--- a/catalyst/targets/livecd_stage2_target.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -10,7 +10,7 @@ from catalyst.support import (normpath, file_locate, 
CatalystError, cmd,
 from catalyst.base.stagebase import StageBase
 
 
-class livecd_stage2_target(StageBase):
+class livecd_stage2(StageBase):

Builder class for a LiveCD stage2 build.


diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot.py
similarity index 99%
rename from catalyst/targets/netboot_target.py
rename to catalyst/targets/netboot.py
index 9d92ef2..f753c7f 100644
--- a/catalyst/targets/netboot_target.py
+++ b/catalyst/targets/netboot.py
@@ -12,7 +12,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot_target(StageBase):
+class netboot(StageBase):

Builder class for a netboot build.


diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2.py
similarity index 99%
rename from catalyst/targets/netboot2_target.py
rename to catalyst/targets/netboot2.py
index 130e2b6..fc8c64c 100644
--- a/catalyst/targets/netboot2_target.py
+++ b/catalyst/targets/netboot2.py
@@ -14,7 +14,7 @@ from catalyst.support import (CatalystError, normpath,
 from catalyst.base.stagebase import StageBase
 
 
-class netboot2_target(StageBase):
+class netboot2(StageBase):

Builder class for a netboot build, version 2


diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1.py
similarity index 99%
rename from catalyst/targets/stage1_target.py
rename to catalyst/targets/stage1.py
index 2329b58..e72cbcc 100644
--- a/catalyst/targets/stage1_target.py
+++ b/catalyst/targets/stage1.py
@@ -9,7 +9,7 @@ from catalyst.support import 

[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-05-05 Thread Brian Dolbec
commit: 938e55e150d20d8f5ea03541498bd28e49e8f36d
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sat Apr  5 07:26:58 2014 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Apr  5 07:41:57 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=938e55e1

generic_stage_target: Add a trailing / to the cp /etc/reolv.conf command

---
 catalyst/targets/generic_stage_target.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/generic_stage_target.py 
b/catalyst/targets/generic_stage_target.py
index 05c61e8..1f26e65 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -1025,7 +1025,7 @@ class generic_stage_target(generic_target):
 

#self.makeconf=read_makeconf(self.settings[chroot_path]+/etc/portage/make.conf)
 
-   cmd(cp /etc/resolv.conf 
+self.settings[chroot_path]+/etc,\
+   cmd(cp /etc/resolv.conf  + 
self.settings[chroot_path] + /etc/,
Could not copy resolv.conf into 
place.,env=self.env)
 
 Copy over the envscript, if applicable 



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-03-22 Thread Brian Dolbec
commit: 509d4ead51fbb861cfa783131b22907c8b8636db
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sat Jan 11 00:13:06 2014 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Mar 22 18:01:29 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=509d4ead

generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror

---
 catalyst/targets/generic_stage_target.py | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/catalyst/targets/generic_stage_target.py 
b/catalyst/targets/generic_stage_target.py
index 9c39d00..eaf2c1f 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -215,13 +215,14 @@ class generic_stage_target(generic_target):
self.mountmap = SOURCE_MOUNTS_DEFAULTS.copy()
# update them from settings
self.mountmap[distdir] = self.settings[distdir]
-   self.mountmap[portdir] = normpath(/.join([
-   self.settings[snapshot_cache_path],
-   self.settings[repo_name],
-   ]))
if SNAPCACHE not in self.settings:
self.mounts.remove(portdir)
-   #self.mountmap[portdir] = None
+   self.mountmap[portdir] = None
+   else:
+   self.mountmap[portdir] = normpath(/.join([
+   self.settings[snapshot_cache_path],
+   self.settings[repo_name],
+   ]))
if os.uname()[0] == Linux:
self.mounts.append(devpts)
self.mounts.append(shm)



[gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/

2014-03-22 Thread Brian Dolbec
commit: f37553c47eef08bf064e7923ff11b4ec154db895
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Mon Dec 30 06:14:48 2013 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Mar 22 18:01:21 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f37553c4

Fix autoresume file paths to only be configured once.

Use: pjoin as a shorter alias to os.path.join()

---
 catalyst/targets/generic_stage_target.py | 175 +--
 1 file changed, 95 insertions(+), 80 deletions(-)

diff --git a/catalyst/targets/generic_stage_target.py 
b/catalyst/targets/generic_stage_target.py
index 2b3d7ce..9c39d00 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -33,6 +33,9 @@ SOURCE_MOUNTS_DEFAULTS = {
shm: shmfs,
}
 
+# for convienience
+pjoin = os.path.join
+
 
 class generic_stage_target(generic_target):

@@ -334,9 +337,10 @@ class generic_stage_target(generic_target):
def set_target_path(self):

self.settings[target_path]=normpath(self.settings[storedir]+\
/builds/+self.settings[target_subpath]+.tar.bz2)
-   if AUTORESUME in self.settings\
-   and os.path.exists(self.settings[autoresume_path]+\
-   setup_target_path):
+   setup_target_path_resume = 
pjoin(self.settings[autoresume_path],
+   setup_target_path)
+   if AUTORESUME in self.settings and \
+   os.path.exists(setup_target_path_resume):
print \
Resume point detected, skipping target path 
setup operation...
else:
@@ -348,7 +352,7 @@ class generic_stage_target(generic_target):
 #  cmd(rm -f +self.settings[target_path],\
 #  Could not remove existing file: \
 #  
+self.settings[target_path],env=self.env)
-   
touch(self.settings[autoresume_path]+setup_target_path)
+   touch(setup_target_path_resume)
 
if not 
os.path.exists(self.settings[storedir]+/builds/):

os.makedirs(self.settings[storedir]+/builds/)
@@ -484,10 +488,12 @@ class generic_stage_target(generic_target):
self.chroot_lock=LockDir(self.settings[chroot_path])
 
def set_autoresume_path(self):
-   
self.settings[autoresume_path]=normpath(self.settings[storedir]+\
-   /tmp/+self.settings[rel_type]+/+.autoresume-+\
-   
self.settings[target]+-+self.settings[subarch]+-+\
-   self.settings[version_stamp]+/)
+   self.settings[autoresume_path] = normpath(pjoin(
+   self.settings[storedir], tmp, 
self.settings[rel_type],
+   .autoresume-%s-%s-%s
+   %(self.settings[target], self.settings[subarch],
+   self.settings[version_stamp])
+   ))
if AUTORESUME in self.settings:
print The autoresume path is  + 
self.settings[autoresume_path]
if not os.path.exists(self.settings[autoresume_path]):
@@ -673,8 +679,8 @@ class generic_stage_target(generic_target):
def unpack(self):
unpack=True
 
-   
clst_unpack_hash=read_from_clst(self.settings[autoresume_path]+\
-   unpack)
+   unpack_resume = pjoin(self.settings[autoresume_path], 
unpack)
+   clst_unpack_hash=read_from_clst(unpack_resume)
 
if SEEDCACHE in self.settings:
if os.path.isdir(self.settings[source_path]):
@@ -720,7 +726,7 @@ class generic_stage_target(generic_target):
 
if AUTORESUME in self.settings:
if os.path.isdir(self.settings[source_path]) \
-   and 
os.path.exists(self.settings[autoresume_path]+unpack):
+   and os.path.exists(unpack_resume):
 Autoresume is valid, SEEDCACHE is valid 
unpack=False
invalid_snapshot=False
@@ -732,8 +738,7 @@ class generic_stage_target(generic_target):
invalid_snapshot=True
 
elif os.path.isdir(self.settings[source_path]) \
-   and not 
os.path.exists(self.settings[autoresume_path]+\
-   unpack):
+   and not os.path.exists(unpack_resume):
 Autoresume is invalid, SEEDCACHE 
unpack=True
invalid_snapshot=False
@@