* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 5:54 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 5:54 UTC (permalink / raw
To: gentoo-commits
commit: 0b02e0694153a668c6bce73dbd70dea2da14258e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 20 08:10:03 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 05:51:54 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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 0000000..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"]
+ 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 purge(self):
+ countdown(10,"Purging Caches ...")
+ if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
+ print "clearing autoresume ..."
+ self.clear_autoresume()
+
+ print "clearing chroot ..."
+ self.clear_chroot()
+
+ if "PURGETMPONLY" not in self.settings:
+ print "clearing package cache ..."
+ self.clear_packages()
+
+ print "clearing kerncache ..."
+ self.clear_kerncache()
+
diff --git a/catalyst/targets/genbase.py b/catalyst/targets/genbase.py
new file mode 100644
index 0000000..e818781
--- /dev/null
+++ b/catalyst/targets/genbase.py
@@ -0,0 +1,58 @@
+
+
+import os
+
+
+class GenBase(object):
+ """
+ This class does generation of the contents and digests files.
+ """
+ def __init__(self,myspec):
+ self.settings = myspec
+
+
+ def gen_contents_file(self,file):
+ if os.path.exists(file+".CONTENTS"):
+ os.remove(file+".CONTENTS")
+ if "contents" in self.settings:
+ contents_map = self.settings["contents_map"]
+ if os.path.exists(file):
+ myf=open(file+".CONTENTS","w")
+ keys={}
+ for i in self.settings["contents"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for j in array:
+ contents = contents_map.generate_contents(file, j,
+ verbose="VERBOSE" in self.settings)
+ if contents:
+ myf.write(contents)
+ myf.close()
+
+ def gen_digest_file(self,file):
+ if os.path.exists(file+".DIGESTS"):
+ os.remove(file+".DIGESTS")
+ if "digests" in self.settings:
+ hash_map = self.settings["hash_map"]
+ if os.path.exists(file):
+ myf=open(file+".DIGESTS","w")
+ keys={}
+ for i in self.settings["digests"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for f in [file, file+'.CONTENTS']:
+ if os.path.exists(f):
+ if "all" in array:
+ for k in list(hash_map.hash_map):
+ hash = hash_map.generate_hash(f,hash_=k,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ else:
+ for j in array:
+ hash = hash_map.generate_hash(f,hash_=j,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ myf.close()
+
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 0b506e2..c6b8dcc 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -1,17 +1,26 @@
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_target import *
-from stat import *
-from catalyst.lock import LockDir
-from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
- PORT_LOGDIR_CLEAN)
+import os
+import string
+import imp
+import types
+import shutil
+import sys
+from stat import ST_UID, ST_GID, ST_MODE
# for convienience
pjoin = os.path.join
+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.lock import LockDir
+
-class generic_stage_target(generic_target):
+class generic_stage_target(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.
@@ -26,7 +35,9 @@ class generic_stage_target(generic_target):
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
self.set_valid_build_kernel_vars(addlargs)
- generic_target.__init__(self,myspec,addlargs)
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self, myspec)
+ ClearBase.__init__(self, myspec)
"""
The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
@@ -1616,142 +1627,4 @@ class generic_stage_target(generic_target):
self.unbind()
raise CatalystError,"build aborting due to livecd_update error."
- 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"]
- 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_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 gen_contents_file(self,file):
- if os.path.exists(file+".CONTENTS"):
- os.remove(file+".CONTENTS")
- if "contents" in self.settings:
- contents_map = self.settings["contents_map"]
- if os.path.exists(file):
- myf=open(file+".CONTENTS","w")
- keys={}
- for i in self.settings["contents"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for j in array:
- contents = contents_map.generate_contents(file, j,
- verbose="VERBOSE" in self.settings)
- if contents:
- myf.write(contents)
- myf.close()
-
- def gen_digest_file(self,file):
- if os.path.exists(file+".DIGESTS"):
- os.remove(file+".DIGESTS")
- if "digests" in self.settings:
- hash_map = self.settings["hash_map"]
- if os.path.exists(file):
- myf=open(file+".DIGESTS","w")
- keys={}
- for i in self.settings["digests"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for f in [file, file+'.CONTENTS']:
- if os.path.exists(f):
- if "all" in array:
- for k in list(hash_map.hash_map):
- hash = hash_map.generate_hash(f, hash_ = k,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- else:
- for j in array:
- hash = hash_map.generate_hash(f, hash_ = j,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- myf.close()
-
- def purge(self):
- countdown(10,"Purging Caches ...")
- if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
- print "clearing autoresume ..."
- self.clear_autoresume()
-
- print "clearing chroot ..."
- self.clear_chroot()
-
- if "PURGETMPONLY" not in self.settings:
- print "clearing package cache ..."
- self.clear_packages()
-
- print "clearing kerncache ..."
- self.clear_kerncache()
-
# vim: ts=4 sw=4 sta et sts=4 ai
diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 50133ec..3289bbd 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -3,10 +3,15 @@ Snapshot target
"""
import os
-from catalyst.support import *
-from generic_stage_target import *
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
-class snapshot_target(generic_stage_target):
+
+from catalyst.support import normpath, cmd
+from catalyst.targets.targetbase import TargetBase
+from catalyst.targets.genbase import GenBase
+
+class snapshot_target(TargetBase, GenBase):
"""
Builder class for snapshots.
"""
@@ -14,8 +19,9 @@ class snapshot_target(generic_stage_target):
self.required_values=["version_stamp","target"]
self.valid_values=["version_stamp","target"]
- generic_target.__init__(self,myspec,addlargs)
- self.settings=myspec
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self,myspec)
+ #self.settings=myspec
self.settings["target_subpath"]="portage"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/targetbase.py
similarity index 64%
rename from catalyst/targets/generic_target.py
rename to catalyst/targets/targetbase.py
index 382f1c7..e0c03df 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/targetbase.py
@@ -2,11 +2,11 @@ import os
from catalyst.support import *
-class generic_target:
+class TargetBase(object):
"""
- The toplevel class for generic_stage_target. This is about as generic as we get.
+ The toplevel class for all targets. This is about as generic as we get.
"""
- def __init__(self,myspec,addlargs):
+ def __init__(self, myspec, addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
self.env = {
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
@ 2017-11-29 17:20 Brian Dolbec
2017-11-22 15:52 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
0 siblings, 1 reply; 68+ messages in thread
From: Brian Dolbec @ 2017-11-29 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 61527e6db7c2ac195741a243f3ab504f2652e26e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Nov 22 01:16:21 2017 +0000
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'])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
2017-11-29 17:20 [gentoo-commits] proj/catalyst:master " Brian Dolbec
@ 2017-11-22 15:52 ` Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-11-22 15:52 UTC (permalink / raw
To: gentoo-commits
commit: 61527e6db7c2ac195741a243f3ab504f2652e26e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Nov 22 01:16:21 2017 +0000
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.
| 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--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'])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2017-03-16 22:57 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-03-16 22:57 UTC (permalink / raw
To: gentoo-commits
commit: d463bea02a4d6bae7f3018a297167b1a1fb21953
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 16 22:56:11 2017 +0000
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'])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2017-03-11 7:07 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-03-11 7:07 UTC (permalink / raw
To: gentoo-commits
commit: 1d304f0bf42c963d7d830c8b9ab29835ff84217b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 11 02:58:29 2017 +0000
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'])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2017-03-10 18:38 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-03-10 18:38 UTC (permalink / raw
To: gentoo-commits
commit: b5410d12852222fca19e01cfdcbb37e87b6f21ff
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Mar 10 18:37:33 2017 +0000
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'])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2017-03-09 10:02 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-03-09 10:02 UTC (permalink / raw
To: gentoo-commits
commit: 7e820b90119b020719cda016e2100b1f2e435ee0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 9 09:59:40 2017 +0000
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"])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2017-03-09 9:39 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2017-03-09 9:39 UTC (permalink / raw
To: gentoo-commits
commit: a95409751436e4f56045a0e6d6c9528e0922ab36
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 9 09:17:07 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 9 09:35:39 2017 +0000
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"])
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
@ 2015-11-12 16:24 Brian Dolbec
2015-11-21 1:33 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
0 siblings, 1 reply; 68+ messages in thread
From: Brian Dolbec @ 2015-11-12 16:24 UTC (permalink / raw
To: gentoo-commits
commit: a38ad7ad605a788fa1e84a4cfb2a6ee289b03670
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 12 16:16:07 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 16:16:07 2015 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a38ad7ad
targets/livecd_stage2.py: Fix regression in path setting
Since:
Commit: 5cce2772eda7d0885c9d7cfea184a3f5606dddef
Subject: catalyst: Convert nearly all use of open() to use the with statement.
I incorrectly changed a "+" to a comma in the code move.
catalyst/targets/livecd_stage2.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 943466e..7d9919b 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -68,7 +68,7 @@ class livecd_stage2(StageBase):
def run_local(self):
# what modules do we want to blacklist?
if "livecd/modblacklist" in self.settings:
- path = normpath(self.settings["chroot_path"],
+ path = normpath(self.settings["chroot_path"] +
"/etc/modprobe.d/blacklist.conf")
try:
with open(path, "a") as myf:
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
2015-11-12 16:24 [gentoo-commits] proj/catalyst:master " Brian Dolbec
@ 2015-11-21 1:33 ` Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2015-11-21 1:33 UTC (permalink / raw
To: gentoo-commits
commit: a38ad7ad605a788fa1e84a4cfb2a6ee289b03670
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 12 16:16:07 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 16:16:07 2015 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a38ad7ad
targets/livecd_stage2.py: Fix regression in path setting
Since:
Commit: 5cce2772eda7d0885c9d7cfea184a3f5606dddef
Subject: catalyst: Convert nearly all use of open() to use the with statement.
I incorrectly changed a "+" to a comma in the code move.
catalyst/targets/livecd_stage2.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 943466e..7d9919b 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -68,7 +68,7 @@ class livecd_stage2(StageBase):
def run_local(self):
# what modules do we want to blacklist?
if "livecd/modblacklist" in self.settings:
- path = normpath(self.settings["chroot_path"],
+ path = normpath(self.settings["chroot_path"] +
"/etc/modprobe.d/blacklist.conf")
try:
with open(path, "a") as myf:
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
@ 2015-02-26 20:12 Brian Dolbec
2015-01-01 5:59 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
0 siblings, 1 reply; 68+ messages in thread
From: Brian Dolbec @ 2015-02-26 20:12 UTC (permalink / raw
To: gentoo-commits
commit: 8dbbd3792cc3de96736a812393ad3f22b14e52af
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon May 27 23:08:16 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 1 05:58:06 2015 +0000
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)
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2015-02-26 19:25 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2015-02-26 19:25 UTC (permalink / raw
To: gentoo-commits
commit: 276c6969c79c810b059f525dd218b6b6271a967a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 1 06:33:15 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 19:15:20 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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"] \
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2015-01-01 5:59 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2015-01-01 5:59 UTC (permalink / raw
To: gentoo-commits
commit: 9ce3a9131514a1ea831d26a9cedeb5f3fb9677c3
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 25 00:29:52 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 1 05:58:06 2015 +0000
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",\
- "config_profile_link","setup_confdir","portage_overlay",\
- "bind","chroot_setup","setup_environment","build_packages",\
- "build_kernel","bootloader","root_overlay","fsscript",\
- "preclean","rcupdate","unmerge","unbind","remove","empty",\
- "clean"]
+ "config_profile_link","setup_confdir","portage_overlay",\
+ "bind","chroot_setup","setup_environment","build_packages",\
+ "build_kernel","bootloader","root_overlay","fsscript",\
+ "preclean","rcupdate","unmerge","unbind","remove","empty",\
+ "clean"]
# if "TARBALL" in self.settings or \
# "fetch" not in self.settings['options']:
diff --git a/catalyst/targets/tinderbox.py b/catalyst/targets/tinderbox.py
index 59e85d0..c9ed9b8 100644
--- a/catalyst/targets/tinderbox.py
+++ b/catalyst/targets/tinderbox.py
@@ -24,7 +24,7 @@ class tinderbox(StageBase):
# example call: "grp.sh run xmms vim sys-apps/gleep"
try:
if os.path.exists(self.settings["controller_file"]):
- cmd(self.settings["controller_file"]+" run "+\
+ cmd(self.settings["controller_file"]+" run "+\
list_bashify(self.settings["tinderbox/packages"]),"run script failed.",env=self.env)
except CatalystError:
@@ -43,6 +43,6 @@ class tinderbox(StageBase):
def set_action_sequence(self):
#Default action sequence for run method
self.settings["action_sequence"]=["unpack","unpack_snapshot",\
- "config_profile_link","setup_confdir","bind","chroot_setup",\
- "setup_environment","run_local","preclean","unbind","clean",\
- "clear_autoresume"]
+ "config_profile_link","setup_confdir","bind","chroot_setup",\
+ "setup_environment","run_local","preclean","unbind","clean",\
+ "clear_autoresume"]
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2015-01-01 5:59 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2015-01-01 5:59 UTC (permalink / raw
To: gentoo-commits
commit: a5e07c9892a288eac19062e1c0ee40eb54982476
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 1 05:58:06 2015 +0000
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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-11 3:08 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-11 3:08 UTC (permalink / raw
To: gentoo-commits
commit: 0ed3f9facb1f8faadbc0aa5cdc621551ba97f7c1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Sep 11 03:05:37 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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 import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 23:10 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 23:10 UTC (permalink / raw
To: gentoo-commits
commit: 2d156b7341fe4d4af347333cc930f419d687228c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 23:07:29 2014 +0000
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 import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 7:12 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 7:12 UTC (permalink / raw
To: gentoo-commits
commit: 278b95a4224d12d3b6b580784458018f97bdbab7
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 06:31:58 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 5:54 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 5:54 UTC (permalink / raw
To: gentoo-commits
commit: d1c8dce78d8615d17602f131dca159daf52dcdaa
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 05:51:54 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 2:43 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 2:43 UTC (permalink / raw
To: gentoo-commits
commit: 136470235e52c0373c173e3804ccc9f70e4a25b2
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 20 08:10:03 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 02:13:43 2014 +0000
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 0000000..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"]
+ 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 purge(self):
+ countdown(10,"Purging Caches ...")
+ if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
+ print "clearing autoresume ..."
+ self.clear_autoresume()
+
+ print "clearing chroot ..."
+ self.clear_chroot()
+
+ if "PURGETMPONLY" not in self.settings:
+ print "clearing package cache ..."
+ self.clear_packages()
+
+ print "clearing kerncache ..."
+ self.clear_kerncache()
+
diff --git a/catalyst/targets/genbase.py b/catalyst/targets/genbase.py
new file mode 100644
index 0000000..e818781
--- /dev/null
+++ b/catalyst/targets/genbase.py
@@ -0,0 +1,58 @@
+
+
+import os
+
+
+class GenBase(object):
+ """
+ This class does generation of the contents and digests files.
+ """
+ def __init__(self,myspec):
+ self.settings = myspec
+
+
+ def gen_contents_file(self,file):
+ if os.path.exists(file+".CONTENTS"):
+ os.remove(file+".CONTENTS")
+ if "contents" in self.settings:
+ contents_map = self.settings["contents_map"]
+ if os.path.exists(file):
+ myf=open(file+".CONTENTS","w")
+ keys={}
+ for i in self.settings["contents"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for j in array:
+ contents = contents_map.generate_contents(file, j,
+ verbose="VERBOSE" in self.settings)
+ if contents:
+ myf.write(contents)
+ myf.close()
+
+ def gen_digest_file(self,file):
+ if os.path.exists(file+".DIGESTS"):
+ os.remove(file+".DIGESTS")
+ if "digests" in self.settings:
+ hash_map = self.settings["hash_map"]
+ if os.path.exists(file):
+ myf=open(file+".DIGESTS","w")
+ keys={}
+ for i in self.settings["digests"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for f in [file, file+'.CONTENTS']:
+ if os.path.exists(f):
+ if "all" in array:
+ for k in list(hash_map.hash_map):
+ hash = hash_map.generate_hash(f,hash_=k,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ else:
+ for j in array:
+ hash = hash_map.generate_hash(f,hash_=j,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ myf.close()
+
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 1dad8cb..f297524 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -1,17 +1,26 @@
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_target import *
-from stat import *
-from catalyst.lock import LockDir
-from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
- PORT_LOGDIR_CLEAN)
+import os
+import string
+import imp
+import types
+import shutil
+import sys
+from stat import ST_UID, ST_GID, ST_MODE
# for convienience
pjoin = os.path.join
+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.lock import LockDir
+
-class generic_stage_target(generic_target):
+class generic_stage_target(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.
@@ -26,7 +35,9 @@ class generic_stage_target(generic_target):
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
self.set_valid_build_kernel_vars(addlargs)
- generic_target.__init__(self,myspec,addlargs)
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self, myspec)
+ ClearBase.__init__(self, myspec)
"""
The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
@@ -1616,142 +1627,4 @@ class generic_stage_target(generic_target):
self.unbind()
raise CatalystError,"build aborting due to livecd_update error."
- 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"]
- 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_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 gen_contents_file(self,file):
- if os.path.exists(file+".CONTENTS"):
- os.remove(file+".CONTENTS")
- if "contents" in self.settings:
- contents_map = self.settings["contents_map"]
- if os.path.exists(file):
- myf=open(file+".CONTENTS","w")
- keys={}
- for i in self.settings["contents"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for j in array:
- contents = contents_map.generate_contents(file, j,
- verbose="VERBOSE" in self.settings)
- if contents:
- myf.write(contents)
- myf.close()
-
- def gen_digest_file(self,file):
- if os.path.exists(file+".DIGESTS"):
- os.remove(file+".DIGESTS")
- if "digests" in self.settings:
- hash_map = self.settings["hash_map"]
- if os.path.exists(file):
- myf=open(file+".DIGESTS","w")
- keys={}
- for i in self.settings["digests"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for f in [file, file+'.CONTENTS']:
- if os.path.exists(f):
- if "all" in array:
- for k in list(hash_map.hash_map):
- hash = hash_map.generate_hash(f, hash_ = k,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- else:
- for j in array:
- hash = hash_map.generate_hash(f, hash_ = j,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- myf.close()
-
- def purge(self):
- countdown(10,"Purging Caches ...")
- if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
- print "clearing autoresume ..."
- self.clear_autoresume()
-
- print "clearing chroot ..."
- self.clear_chroot()
-
- if "PURGETMPONLY" not in self.settings:
- print "clearing package cache ..."
- self.clear_packages()
-
- print "clearing kerncache ..."
- self.clear_kerncache()
-
# vim: ts=4 sw=4 sta et sts=4 ai
diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 50133ec..3289bbd 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -3,10 +3,15 @@ Snapshot target
"""
import os
-from catalyst.support import *
-from generic_stage_target import *
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
-class snapshot_target(generic_stage_target):
+
+from catalyst.support import normpath, cmd
+from catalyst.targets.targetbase import TargetBase
+from catalyst.targets.genbase import GenBase
+
+class snapshot_target(TargetBase, GenBase):
"""
Builder class for snapshots.
"""
@@ -14,8 +19,9 @@ class snapshot_target(generic_stage_target):
self.required_values=["version_stamp","target"]
self.valid_values=["version_stamp","target"]
- generic_target.__init__(self,myspec,addlargs)
- self.settings=myspec
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self,myspec)
+ #self.settings=myspec
self.settings["target_subpath"]="portage"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/targetbase.py
similarity index 64%
rename from catalyst/targets/generic_target.py
rename to catalyst/targets/targetbase.py
index 382f1c7..e0c03df 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/targetbase.py
@@ -2,11 +2,11 @@ import os
from catalyst.support import *
-class generic_target:
+class TargetBase(object):
"""
- The toplevel class for generic_stage_target. This is about as generic as we get.
+ The toplevel class for all targets. This is about as generic as we get.
"""
- def __init__(self,myspec,addlargs):
+ def __init__(self, myspec, addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
self.env = {
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-09-02 2:43 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-09-02 2:43 UTC (permalink / raw
To: gentoo-commits
commit: 4107e4347b3444e606c479a13d437292b51a43d3
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Sep 2 02:13:44 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-06-15 14:56 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-06-15 14:56 UTC (permalink / raw
To: gentoo-commits
commit: a00a729072e5ca26ba84c99db8e2a851287e7527
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 14:05:53 2014 +0000
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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-06-15 14:56 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-06-15 14:56 UTC (permalink / raw
To: gentoo-commits
commit: c18fdd285804efa213b43933704a6e765eb1ad47
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 20 08:10:03 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 14:03:40 2014 +0000
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 0000000..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"]
+ 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 purge(self):
+ countdown(10,"Purging Caches ...")
+ if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
+ print "clearing autoresume ..."
+ self.clear_autoresume()
+
+ print "clearing chroot ..."
+ self.clear_chroot()
+
+ if "PURGETMPONLY" not in self.settings:
+ print "clearing package cache ..."
+ self.clear_packages()
+
+ print "clearing kerncache ..."
+ self.clear_kerncache()
+
diff --git a/catalyst/targets/genbase.py b/catalyst/targets/genbase.py
new file mode 100644
index 0000000..e818781
--- /dev/null
+++ b/catalyst/targets/genbase.py
@@ -0,0 +1,58 @@
+
+
+import os
+
+
+class GenBase(object):
+ """
+ This class does generation of the contents and digests files.
+ """
+ def __init__(self,myspec):
+ self.settings = myspec
+
+
+ def gen_contents_file(self,file):
+ if os.path.exists(file+".CONTENTS"):
+ os.remove(file+".CONTENTS")
+ if "contents" in self.settings:
+ contents_map = self.settings["contents_map"]
+ if os.path.exists(file):
+ myf=open(file+".CONTENTS","w")
+ keys={}
+ for i in self.settings["contents"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for j in array:
+ contents = contents_map.generate_contents(file, j,
+ verbose="VERBOSE" in self.settings)
+ if contents:
+ myf.write(contents)
+ myf.close()
+
+ def gen_digest_file(self,file):
+ if os.path.exists(file+".DIGESTS"):
+ os.remove(file+".DIGESTS")
+ if "digests" in self.settings:
+ hash_map = self.settings["hash_map"]
+ if os.path.exists(file):
+ myf=open(file+".DIGESTS","w")
+ keys={}
+ for i in self.settings["digests"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for f in [file, file+'.CONTENTS']:
+ if os.path.exists(f):
+ if "all" in array:
+ for k in list(hash_map.hash_map):
+ hash = hash_map.generate_hash(f,hash_=k,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ else:
+ for j in array:
+ hash = hash_map.generate_hash(f,hash_=j,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ myf.close()
+
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index db6e9a2..be62dca 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -1,17 +1,26 @@
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_target import *
-from stat import *
-from catalyst.lock import LockDir
-from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
- PORT_LOGDIR_CLEAN)
+import os
+import string
+import imp
+import types
+import shutil
+import sys
+from stat import ST_UID, ST_GID, ST_MODE
# for convienience
pjoin = os.path.join
+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.lock import LockDir
+
-class generic_stage_target(generic_target):
+class generic_stage_target(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.
@@ -26,7 +35,9 @@ class generic_stage_target(generic_target):
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
self.set_valid_build_kernel_vars(addlargs)
- generic_target.__init__(self,myspec,addlargs)
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self, myspec)
+ ClearBase.__init__(self, myspec)
"""
The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
@@ -1609,142 +1620,4 @@ class generic_stage_target(generic_target):
self.unbind()
raise CatalystError,"build aborting due to livecd_update error."
- 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"]
- 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_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 gen_contents_file(self,file):
- if os.path.exists(file+".CONTENTS"):
- os.remove(file+".CONTENTS")
- if "contents" in self.settings:
- contents_map = self.settings["contents_map"]
- if os.path.exists(file):
- myf=open(file+".CONTENTS","w")
- keys={}
- for i in self.settings["contents"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for j in array:
- contents = contents_map.generate_contents(file, j,
- verbose="VERBOSE" in self.settings)
- if contents:
- myf.write(contents)
- myf.close()
-
- def gen_digest_file(self,file):
- if os.path.exists(file+".DIGESTS"):
- os.remove(file+".DIGESTS")
- if "digests" in self.settings:
- hash_map = self.settings["hash_map"]
- if os.path.exists(file):
- myf=open(file+".DIGESTS","w")
- keys={}
- for i in self.settings["digests"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for f in [file, file+'.CONTENTS']:
- if os.path.exists(f):
- if "all" in array:
- for k in list(hash_map.hash_map):
- hash = hash_map.generate_hash(f, hash_ = k,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- else:
- for j in array:
- hash = hash_map.generate_hash(f, hash_ = j,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- myf.close()
-
- def purge(self):
- countdown(10,"Purging Caches ...")
- if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
- print "clearing autoresume ..."
- self.clear_autoresume()
-
- print "clearing chroot ..."
- self.clear_chroot()
-
- if "PURGETMPONLY" not in self.settings:
- print "clearing package cache ..."
- self.clear_packages()
-
- print "clearing kerncache ..."
- self.clear_kerncache()
-
# vim: ts=4 sw=4 sta et sts=4 ai
diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 50133ec..3289bbd 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -3,10 +3,15 @@ Snapshot target
"""
import os
-from catalyst.support import *
-from generic_stage_target import *
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
-class snapshot_target(generic_stage_target):
+
+from catalyst.support import normpath, cmd
+from catalyst.targets.targetbase import TargetBase
+from catalyst.targets.genbase import GenBase
+
+class snapshot_target(TargetBase, GenBase):
"""
Builder class for snapshots.
"""
@@ -14,8 +19,9 @@ class snapshot_target(generic_stage_target):
self.required_values=["version_stamp","target"]
self.valid_values=["version_stamp","target"]
- generic_target.__init__(self,myspec,addlargs)
- self.settings=myspec
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self,myspec)
+ #self.settings=myspec
self.settings["target_subpath"]="portage"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/targetbase.py
similarity index 64%
rename from catalyst/targets/generic_target.py
rename to catalyst/targets/targetbase.py
index 382f1c7..e0c03df 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/targetbase.py
@@ -2,11 +2,11 @@ import os
from catalyst.support import *
-class generic_target:
+class TargetBase(object):
"""
- The toplevel class for generic_stage_target. This is about as generic as we get.
+ The toplevel class for all targets. This is about as generic as we get.
"""
- def __init__(self,myspec,addlargs):
+ def __init__(self, myspec, addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
self.env = {
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-06-14 5:58 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-06-14 5:58 UTC (permalink / raw
To: gentoo-commits
commit: 260e6b68530a0adf30494df2cc78c5edd3dd4afd
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 00:10:51 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Jun 14 05:21:50 2014 +0000
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 normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage1_target(StageBase):
+class stage1(StageBase):
"""
Builder class for a stage1 installation tarball build.
"""
diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2.py
similarity index 98%
rename from catalyst/targets/stage2_target.py
rename to catalyst/targets/stage2.py
index ec6d78d..884b20d 100644
--- a/catalyst/targets/stage2_target.py
+++ b/catalyst/targets/stage2.py
@@ -9,7 +9,7 @@ from catalyst.support import normpath, list_to_string
from catalyst.base.stagebase import StageBase
-class stage2_target(StageBase):
+class stage2(StageBase):
"""
Builder class for a stage2 installation tarball build.
"""
diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3.py
similarity index 96%
rename from catalyst/targets/stage3_target.py
rename to catalyst/targets/stage3.py
index 103242d..cc3e520 100644
--- a/catalyst/targets/stage3_target.py
+++ b/catalyst/targets/stage3.py
@@ -6,7 +6,7 @@ stage3 target, builds upon previous stage2/stage3 tarball
from catalyst.base.stagebase import StageBase
-class stage3_target(StageBase):
+class stage3(StageBase):
"""
Builder class for a stage3 installation tarball build.
"""
diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4.py
similarity index 97%
rename from catalyst/targets/stage4_target.py
rename to catalyst/targets/stage4.py
index 4dbdb45..4aef33f 100644
--- a/catalyst/targets/stage4_target.py
+++ b/catalyst/targets/stage4.py
@@ -6,7 +6,7 @@ stage4 target, builds upon previous stage3/stage4 tarball
from catalyst.base.stagebase import StageBase
-class stage4_target(StageBase):
+class stage4(StageBase):
"""
Builder class for stage4.
"""
diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox.py
similarity index 97%
rename from catalyst/targets/tinderbox_target.py
rename to catalyst/targets/tinderbox.py
index 0c389e6..4cb7537 100644
--- a/catalyst/targets/tinderbox_target.py
+++ b/catalyst/targets/tinderbox.py
@@ -9,7 +9,7 @@ from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
-class tinderbox_target(StageBase):
+class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-06-14 5:58 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-06-14 5:58 UTC (permalink / raw
To: gentoo-commits
commit: 4eddcf963a9366aea9230c688f3f86e06171b472
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 20 08:10:03 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Jun 14 04:49:26 2014 +0000
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 0000000..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"]
+ 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 purge(self):
+ countdown(10,"Purging Caches ...")
+ if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
+ print "clearing autoresume ..."
+ self.clear_autoresume()
+
+ print "clearing chroot ..."
+ self.clear_chroot()
+
+ if "PURGETMPONLY" not in self.settings:
+ print "clearing package cache ..."
+ self.clear_packages()
+
+ print "clearing kerncache ..."
+ self.clear_kerncache()
+
diff --git a/catalyst/targets/genbase.py b/catalyst/targets/genbase.py
new file mode 100644
index 0000000..e818781
--- /dev/null
+++ b/catalyst/targets/genbase.py
@@ -0,0 +1,58 @@
+
+
+import os
+
+
+class GenBase(object):
+ """
+ This class does generation of the contents and digests files.
+ """
+ def __init__(self,myspec):
+ self.settings = myspec
+
+
+ def gen_contents_file(self,file):
+ if os.path.exists(file+".CONTENTS"):
+ os.remove(file+".CONTENTS")
+ if "contents" in self.settings:
+ contents_map = self.settings["contents_map"]
+ if os.path.exists(file):
+ myf=open(file+".CONTENTS","w")
+ keys={}
+ for i in self.settings["contents"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for j in array:
+ contents = contents_map.generate_contents(file, j,
+ verbose="VERBOSE" in self.settings)
+ if contents:
+ myf.write(contents)
+ myf.close()
+
+ def gen_digest_file(self,file):
+ if os.path.exists(file+".DIGESTS"):
+ os.remove(file+".DIGESTS")
+ if "digests" in self.settings:
+ hash_map = self.settings["hash_map"]
+ if os.path.exists(file):
+ myf=open(file+".DIGESTS","w")
+ keys={}
+ for i in self.settings["digests"].split():
+ keys[i]=1
+ array=keys.keys()
+ array.sort()
+ for f in [file, file+'.CONTENTS']:
+ if os.path.exists(f):
+ if "all" in array:
+ for k in list(hash_map.hash_map):
+ hash = hash_map.generate_hash(f,hash_=k,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ else:
+ for j in array:
+ hash = hash_map.generate_hash(f,hash_=j,
+ verbose = "VERBOSE" in self.settings)
+ myf.write(hash)
+ myf.close()
+
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 516454b..cc91133 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -1,17 +1,26 @@
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_target import *
-from stat import *
-from catalyst.lock import LockDir
-from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
- PORT_LOGDIR_CLEAN)
+import os
+import string
+import imp
+import types
+import shutil
+import sys
+from stat import ST_UID, ST_GID, ST_MODE
# for convienience
pjoin = os.path.join
+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.lock import LockDir
+
-class generic_stage_target(generic_target):
+class generic_stage_target(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.
@@ -26,7 +35,9 @@ class generic_stage_target(generic_target):
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
self.set_valid_build_kernel_vars(addlargs)
- generic_target.__init__(self,myspec,addlargs)
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self, myspec)
+ ClearBase.__init__(self, myspec)
"""
The semantics of subarchmap and machinemap changed a bit in 2.0.3 to
@@ -315,7 +326,7 @@ class generic_stage_target(generic_target):
setup_target_path_resume = pjoin(self.settings["autoresume_path"],
"setup_target_path")
if "autoresume" in self.settings["options"]\
- os.path.exists(setup_target_path_resume):
+ and os.path.exists(setup_target_path_resume):
print \
"Resume point detected, skipping target path setup operation..."
else:
@@ -1609,142 +1620,4 @@ class generic_stage_target(generic_target):
self.unbind()
raise CatalystError,"build aborting due to livecd_update error."
- 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"]
- 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_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 gen_contents_file(self,file):
- if os.path.exists(file+".CONTENTS"):
- os.remove(file+".CONTENTS")
- if "contents" in self.settings:
- contents_map = self.settings["contents_map"]
- if os.path.exists(file):
- myf=open(file+".CONTENTS","w")
- keys={}
- for i in self.settings["contents"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for j in array:
- contents = contents_map.generate_contents(file, j,
- verbose="VERBOSE" in self.settings)
- if contents:
- myf.write(contents)
- myf.close()
-
- def gen_digest_file(self,file):
- if os.path.exists(file+".DIGESTS"):
- os.remove(file+".DIGESTS")
- if "digests" in self.settings:
- hash_map = self.settings["hash_map"]
- if os.path.exists(file):
- myf=open(file+".DIGESTS","w")
- keys={}
- for i in self.settings["digests"].split():
- keys[i]=1
- array=keys.keys()
- array.sort()
- for f in [file, file+'.CONTENTS']:
- if os.path.exists(f):
- if "all" in array:
- for k in list(hash_map.hash_map):
- hash = hash_map.generate_hash(f, hash_ = k,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- else:
- for j in array:
- hash = hash_map.generate_hash(f, hash_ = j,
- verbose = "VERBOSE" in self.settings)
- myf.write(hash)
- myf.close()
-
- def purge(self):
- countdown(10,"Purging Caches ...")
- if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
- print "clearing autoresume ..."
- self.clear_autoresume()
-
- print "clearing chroot ..."
- self.clear_chroot()
-
- if "PURGETMPONLY" not in self.settings:
- print "clearing package cache ..."
- self.clear_packages()
-
- print "clearing kerncache ..."
- self.clear_kerncache()
-
# vim: ts=4 sw=4 sta et sts=4 ai
diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
index 50133ec..3289bbd 100644
--- a/catalyst/targets/snapshot_target.py
+++ b/catalyst/targets/snapshot_target.py
@@ -3,10 +3,15 @@ Snapshot target
"""
import os
-from catalyst.support import *
-from generic_stage_target import *
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
-class snapshot_target(generic_stage_target):
+
+from catalyst.support import normpath, cmd
+from catalyst.targets.targetbase import TargetBase
+from catalyst.targets.genbase import GenBase
+
+class snapshot_target(TargetBase, GenBase):
"""
Builder class for snapshots.
"""
@@ -14,8 +19,9 @@ class snapshot_target(generic_stage_target):
self.required_values=["version_stamp","target"]
self.valid_values=["version_stamp","target"]
- generic_target.__init__(self,myspec,addlargs)
- self.settings=myspec
+ TargetBase.__init__(self, myspec, addlargs)
+ GenBase.__init__(self,myspec)
+ #self.settings=myspec
self.settings["target_subpath"]="portage"
st=self.settings["storedir"]
self.settings["snapshot_path"] = normpath(st + "/snapshots/"
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/targetbase.py
similarity index 64%
rename from catalyst/targets/generic_target.py
rename to catalyst/targets/targetbase.py
index 382f1c7..e0c03df 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/targetbase.py
@@ -2,11 +2,11 @@ import os
from catalyst.support import *
-class generic_target:
+class TargetBase(object):
"""
- The toplevel class for generic_stage_target. This is about as generic as we get.
+ The toplevel class for all targets. This is about as generic as we get.
"""
- def __init__(self,myspec,addlargs):
+ def __init__(self, myspec, addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
self.env = {
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
@ 2014-05-05 19:17 Brian Dolbec
2014-05-05 19:15 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
0 siblings, 1 reply; 68+ messages in thread
From: Brian Dolbec @ 2014-05-05 19:17 UTC (permalink / raw
To: gentoo-commits
commit: 938e55e150d20d8f5ea03541498bd28e49e8f36d
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 5 07:26:58 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Apr 5 07:41:57 2014 +0000
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 """
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-04-02 20:09 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-04-02 20:09 UTC (permalink / raw
To: gentoo-commits
commit: c7539118560247bbc182cd8c9602d323533a23a6
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Apr 2 20:04:22 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=c7539118
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-04-02 20:09 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-04-02 20:09 UTC (permalink / raw
To: gentoo-commits
commit: d7c96f12c2c20165ab0b8c410366846a91e859da
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Apr 2 20:04:22 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d7c96f12
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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists(config_protect_link_resume):
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-04-02 20:09 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-04-02 20:09 UTC (permalink / raw
To: gentoo-commits
commit: e2cf676cffe44e4048113a48a4362b57867d11b6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Apr 2 20:04:22 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=e2cf676c
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")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-22 22:25 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-22 22:25 UTC (permalink / raw
To: gentoo-commits
commit: f37553c47eef08bf064e7923ff11b4ec154db895
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 22 18:01:21 2014 +0000
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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists(config_protect_link_resume):
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-22 22:25 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-22 22:25 UTC (permalink / raw
To: gentoo-commits
commit: 509d4ead51fbb861cfa783131b22907c8b8636db
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 22 18:01:29 2014 +0000
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")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-22 22:25 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-22 22:25 UTC (permalink / raw
To: gentoo-commits
commit: c6fe2266fd2355d6a15f95b1b6c4f8f40a309214
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 22 18:01:29 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=c6fe2266
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-02 16:07 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-02 16:07 UTC (permalink / raw
To: gentoo-commits
commit: db605e682e255c9331a9ead62208e2bf00e7f14a
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 2 16:07:07 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=db605e68
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-02 16:07 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-02 16:07 UTC (permalink / raw
To: gentoo-commits
commit: 91f92349d0b3cc3ff5dbe5fab02f8755668a2ca2
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 2 16:07:07 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=91f92349
generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror
---
catalyst/targets/generic_stage_target.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 095327a..7fd583e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -470,10 +470,10 @@ class generic_stage_target(generic_target):
hash_function=self.settings["hash_function"],verbose=False)
def set_snapcache_path(self):
+ self.settings["snapshot_cache_path"] = \
+ normpath(self.settings["snapshot_cache"] + "/" +
+ self.settings["snapshot"])
if "SNAPCACHE" in self.settings:
- self.settings["snapshot_cache_path"] = \
- normpath(self.settings["snapshot_cache"] + "/" +
- self.settings["snapshot"])
self.snapcache_lock=\
LockDir(self.settings["snapshot_cache_path"])
print "Caching snapshot to "+self.settings["snapshot_cache_path"]
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-03-02 16:07 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-03-02 16:07 UTC (permalink / raw
To: gentoo-commits
commit: 5cd770ad3d33ba365174bbb7eb95b17554450442
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 2 16:07:07 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=5cd770ad
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..095327a 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 21:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 21:48 UTC (permalink / raw
To: gentoo-commits
commit: eea6c80dec49e4fa7b0df6170dcb1b455f1ac837
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 21:43:18 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=eea6c80d
generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror
---
catalyst/targets/generic_stage_target.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 095327a..7fd583e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -470,10 +470,10 @@ class generic_stage_target(generic_target):
hash_function=self.settings["hash_function"],verbose=False)
def set_snapcache_path(self):
+ self.settings["snapshot_cache_path"] = \
+ normpath(self.settings["snapshot_cache"] + "/" +
+ self.settings["snapshot"])
if "SNAPCACHE" in self.settings:
- self.settings["snapshot_cache_path"] = \
- normpath(self.settings["snapshot_cache"] + "/" +
- self.settings["snapshot"])
self.snapcache_lock=\
LockDir(self.settings["snapshot_cache_path"])
print "Caching snapshot to "+self.settings["snapshot_cache_path"]
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 21:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 21:48 UTC (permalink / raw
To: gentoo-commits
commit: 2d158d62f6593f68b899db7a25d512739ce75294
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 21:43:18 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=2d158d62
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 21:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 21:48 UTC (permalink / raw
To: gentoo-commits
commit: 09a6022fde8ae146db5c385da8d32f160877cde8
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 21:43:18 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=09a6022f
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..095327a 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 18:43 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 18:43 UTC (permalink / raw
To: gentoo-commits
commit: c69cf2cf1df08898fa19e0c0519a45334aeffed9
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 18:32:03 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=c69cf2cf
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 18:43 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 18:43 UTC (permalink / raw
To: gentoo-commits
commit: 8f9a2140ebb394fe4210ac6273e0916cf96438fd
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 18:31:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=8f9a2140
generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror
---
catalyst/targets/generic_stage_target.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 095327a..7fd583e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -470,10 +470,10 @@ class generic_stage_target(generic_target):
hash_function=self.settings["hash_function"],verbose=False)
def set_snapcache_path(self):
+ self.settings["snapshot_cache_path"] = \
+ normpath(self.settings["snapshot_cache"] + "/" +
+ self.settings["snapshot"])
if "SNAPCACHE" in self.settings:
- self.settings["snapshot_cache_path"] = \
- normpath(self.settings["snapshot_cache"] + "/" +
- self.settings["snapshot"])
self.snapcache_lock=\
LockDir(self.settings["snapshot_cache_path"])
print "Caching snapshot to "+self.settings["snapshot_cache_path"]
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-02-22 18:43 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-02-22 18:43 UTC (permalink / raw
To: gentoo-commits
commit: 9e8b25471e1d5cc8b83ade3c774d24d21f4681f8
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Feb 22 18:31:22 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=9e8b2547
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..095327a 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-22 15:52 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-22 15:52 UTC (permalink / raw
To: gentoo-commits
commit: 85fab40de0d932247cf1b492cb58aec0be6c5a7d
Author: W. Trevor King <wking <AT> tremily <DOT> us>
AuthorDate: Fri Dec 27 02:40:10 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jan 12 20:49:46 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=85fab40d
catalyst/targets/generic_target.py: Pass TERM through to the chroot
Avoid:
Running stage1-chroot.sh in chroot /var/tmp/catalyst/tmp/default/...
tput: No value for $TERM and no -T specified
by passing the caller's TERM environment variable [1] through to the
chroot. If the caller does not supply TERM, default to 'dumb' which
disables color etc., but should be the most portable. On Gentoo, the
dumb terminfo (/usr/share/terminfo/d/dumb) is distributed as part of
ncurses [2]. You can list supported terminals with toe, which is also
distributed with ncurses [2]:
$ toe
ansi ansi/pc-term compatible with color
dumb 80-column dumb tty
linux linux console
...
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: http://www.gnu.org/software/ncurses/
---
catalyst/targets/generic_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_target.py b/catalyst/targets/generic_target.py
index de51994..382f1c7 100644
--- a/catalyst/targets/generic_target.py
+++ b/catalyst/targets/generic_target.py
@@ -1,3 +1,5 @@
+import os
+
from catalyst.support import *
class generic_target:
@@ -7,5 +9,7 @@ class generic_target:
def __init__(self,myspec,addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
- self.env={}
- self.env["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ self.env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'TERM': os.getenv('TERM', 'dumb'),
+ }
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-22 15:52 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-22 15:52 UTC (permalink / raw
To: gentoo-commits
commit: cdb6215e52a0cbfa154690d4c72a5840245bb3a3
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jan 12 20:48:21 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=cdb6215e
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..095327a 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -868,7 +873,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -876,9 +881,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -892,12 +898,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -905,7 +912,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1029,8 +1036,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1126,32 +1134,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1182,11 +1192,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1210,11 +1220,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1229,29 +1239,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1272,18 +1282,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1350,8 +1360,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1379,22 +1389,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1404,11 +1417,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1418,15 +1431,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1442,7 +1456,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1450,8 +1464,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1467,7 +1482,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1475,9 +1490,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1519,8 +1534,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1573,29 +1587,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-22 15:52 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-22 15:52 UTC (permalink / raw
To: gentoo-commits
commit: 7c08037610deeffd7bbcaccffb37742a7a0dce38
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 00:13:06 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jan 12 20:49:42 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=7c080376
generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror
---
catalyst/targets/generic_stage_target.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 095327a..7fd583e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -470,10 +470,10 @@ class generic_stage_target(generic_target):
hash_function=self.settings["hash_function"],verbose=False)
def set_snapcache_path(self):
+ self.settings["snapshot_cache_path"] = \
+ normpath(self.settings["snapshot_cache"] + "/" +
+ self.settings["snapshot"])
if "SNAPCACHE" in self.settings:
- self.settings["snapshot_cache_path"] = \
- normpath(self.settings["snapshot_cache"] + "/" +
- self.settings["snapshot"])
self.snapcache_lock=\
LockDir(self.settings["snapshot_cache_path"])
print "Caching snapshot to "+self.settings["snapshot_cache_path"]
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 6:41 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 6:41 UTC (permalink / raw
To: gentoo-commits
commit: 458698a07ecb44a2b06486775b699a0fe5aafc32
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 06:40:04 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=458698a0
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 4ca9791..3d93405 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -867,7 +872,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -875,9 +880,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -891,12 +897,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -904,7 +911,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1028,8 +1035,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1125,32 +1133,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1181,11 +1191,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1209,11 +1219,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1228,29 +1238,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1271,18 +1281,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1349,8 +1359,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1378,22 +1388,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1403,11 +1416,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1417,15 +1430,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1441,7 +1455,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1449,8 +1463,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1466,7 +1481,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1474,9 +1489,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1518,8 +1533,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1572,29 +1586,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 6:12 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 6:12 UTC (permalink / raw
To: gentoo-commits
commit: 1933ed25ef89936cb79ad428bb4aa007bdf98785
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:41:26 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=1933ed25
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 4ca9791..3d93405 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
@@ -793,18 +798,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -841,8 +847,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -867,7 +872,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -875,9 +880,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -891,12 +897,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -904,7 +911,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1028,8 +1035,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1125,32 +1133,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1181,11 +1191,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1209,11 +1219,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1228,29 +1238,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1271,18 +1281,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1349,8 +1359,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1378,22 +1388,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1403,11 +1416,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1417,15 +1430,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1441,7 +1455,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1449,8 +1463,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1466,7 +1481,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1474,9 +1489,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1518,8 +1533,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1572,29 +1586,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: 54506fd5b861971098915a66827d0614aa8fd411
Author: Douglas Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Wed Jan 1 21:18:22 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:00:45 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=54506fd5
Mount /dev/shm in the chroot with the right options
Bind mounting /dev/shm into the chroot isn't a good idea, as there may
be collisions and result in weird side effects. Instead, we can just
mount a new tmpfs there, with the right options to ensure security.
(Forward ported to pending branch from 2.X Brian Dolbec)
Conflicts:
catalyst/targets/generic_stage_target.py
---
catalyst/targets/generic_stage_target.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 2ca3913..3d93405 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -30,7 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
- "shm": "/dev/shm",
+ "shm": "shmfs",
}
# for convienience
@@ -949,7 +949,7 @@ class generic_stage_target(generic_target):
os.makedirs(target, 0755)
if not os.path.exists(self.mountmap[x]):
- if not self.mountmap[x] == "tmpfs":
+ if self.mountmap[x] not in ["tmpfs", "shmfs"]:
os.makedirs(self.mountmap[x], 0755)
src=self.mountmap[x]
@@ -970,6 +970,9 @@ class generic_stage_target(generic_target):
self.settings["var_tmpfs_portage"] + "G " + \
src + " " + target
retval=os.system(cmd)
+ elif src == "shmfs":
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
+ retval=os.system(cmd)
else:
cmd = "mount --bind " + src + " " + target
#print "bind(); cmd =", cmd
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: 725cd694007bc31e773b0a2f0feb7ba73b5eae45
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:00:45 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=725cd694
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index bbd3ce8..65d3133 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: f1bc8f67a7c1c5251593a762f4f5b5c042626332
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 18:55:19 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:00:45 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f1bc8f67
catalyst/targets/generic_stage_target.py: mount /dev/shm on linux
Some build systems require /dev/shm to be mounted, like python's
build system. We make sure that on Linux systems, /dev/shm is
mounted in the stage chroots. See bug #496328.
---
catalyst/targets/generic_stage_target.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 65d3133..2ca3913 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -224,6 +224,7 @@ class generic_stage_target(generic_target):
#self.mountmap["portdir"] = None
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
+ self.mounts.append("shm")
self.set_mounts()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: d6b6da6183633607144d56d12682f3a698f8d9a6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 05:00:37 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d6b6da61
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location.
This will simplify the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 39 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 2edb3a5..bbd3ce8 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ "proc": "/proc",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,23 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "dev": "/dev",
- "devpts": "/dev/pts",
- "distdir": self.settings["distdir"],
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "port_tmpdir": "tmpfs",
- "proc": "/proc",
- }
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-03 5:03 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-03 5:03 UTC (permalink / raw
To: gentoo-commits
commit: d9c754c4464038defff3c703a10246a3f52dffb0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Jan 3 04:39:29 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d9c754c4
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 2602e5d..2edb3a5 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -326,9 +329,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:
@@ -340,7 +344,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/")
@@ -476,10 +480,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"]):
@@ -665,8 +671,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"]):
@@ -712,7 +718,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
@@ -724,8 +730,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
@@ -785,18 +790,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -833,8 +839,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -859,7 +864,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -867,9 +872,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -883,12 +889,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -896,7 +903,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1017,8 +1024,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1114,32 +1122,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1170,11 +1180,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1198,11 +1208,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1217,29 +1227,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1260,18 +1270,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1338,8 +1348,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1367,22 +1377,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1392,11 +1405,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1406,15 +1419,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1430,7 +1444,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1438,8 +1452,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1455,7 +1470,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1463,9 +1478,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1507,8 +1522,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1561,29 +1575,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: 9e3e5221124d36f44af0d01b677fde1b1e657b91
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 18:55:19 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:48 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=9e3e5221
catalyst/targets/generic_stage_target.py: mount /dev/shm on linux
Some build systems require /dev/shm to be mounted, like python's
build system. We make sure that on Linux systems, /dev/shm is
mounted in the stage chroots. See bug #496328.
---
catalyst/targets/generic_stage_target.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 65d3133..2ca3913 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -224,6 +224,7 @@ class generic_stage_target(generic_target):
#self.mountmap["portdir"] = None
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
+ self.mounts.append("shm")
self.set_mounts()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: 9e6fc449744411579593f4f1104e0cd2f16cc7e2
Author: Douglas Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Wed Jan 1 21:18:22 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=9e6fc449
Mount /dev/shm in the chroot with the right options
Bind mounting /dev/shm into the chroot isn't a good idea, as there may
be collisions and result in weird side effects. Instead, we can just
mount a new tmpfs there, with the right options to ensure security.
(Forward ported to pending branch from 2.X Brian Dolbec)
Conflicts:
catalyst/targets/generic_stage_target.py
---
catalyst/targets/generic_stage_target.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 2ca3913..3d93405 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -30,7 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
- "shm": "/dev/shm",
+ "shm": "shmfs",
}
# for convienience
@@ -949,7 +949,7 @@ class generic_stage_target(generic_target):
os.makedirs(target, 0755)
if not os.path.exists(self.mountmap[x]):
- if not self.mountmap[x] == "tmpfs":
+ if self.mountmap[x] not in ["tmpfs", "shmfs"]:
os.makedirs(self.mountmap[x], 0755)
src=self.mountmap[x]
@@ -970,6 +970,9 @@ class generic_stage_target(generic_target):
self.settings["var_tmpfs_portage"] + "G " + \
src + " " + target
retval=os.system(cmd)
+ elif src == "shmfs":
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
+ retval=os.system(cmd)
else:
cmd = "mount --bind " + src + " " + target
#print "bind(); cmd =", cmd
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: a650d9636bad5f4380a19d71bcba189fa4401f78
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:48 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a650d963
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index bbd3ce8..65d3133 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: 2d969069fd3868e9e114d8a0d75fc4c4454097c5
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:47 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=2d969069
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location.
This will simplify the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 38 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index ef6a55e..bbd3ce8 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ "proc": "/proc",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,22 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "dev": "/dev",
- "devpts": "/dev/pts",
- "distdir": self.settings["distdir"],
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "port_tmpdir": "tmpfs"}
- "proc": "/proc",
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-02 0:04 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-02 0:04 UTC (permalink / raw
To: gentoo-commits
commit: cb3e3bf4f8f2aa9ce54d64a0d89b2c775daa2071
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 23:55:47 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=cb3e3bf4
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 62e6eda..ef6a55e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -325,9 +328,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:
@@ -339,7 +343,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/")
@@ -475,10 +479,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"]):
@@ -664,8 +670,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"]):
@@ -711,7 +717,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
@@ -723,8 +729,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
@@ -784,18 +789,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -832,8 +838,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -858,7 +863,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -866,9 +871,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -882,12 +888,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -895,7 +902,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1016,8 +1023,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1113,32 +1121,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1169,11 +1179,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1197,11 +1207,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1216,29 +1226,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1259,18 +1269,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1337,8 +1347,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1366,22 +1376,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1391,11 +1404,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1405,15 +1418,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1429,7 +1443,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1437,8 +1451,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1454,7 +1469,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1462,9 +1477,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1506,8 +1521,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1560,29 +1574,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-01 22:27 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-01 22:27 UTC (permalink / raw
To: gentoo-commits
commit: 4f440bac775218c2790f9a0420c2d9730a9db2bb
Author: Douglas Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Wed Jan 1 21:18:22 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 22:26:03 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4f440bac
Mount /dev/shm in the chroot with the right options
Bind mounting /dev/shm into the chroot isn't a good idea, as there may
be collisions and result in weird side effects. Instead, we can just
mount a new tmpfs there, with the right options to ensure security.
(Forward ported to pending branch from 2.X Brian Dolbec)
Conflicts:
catalyst/targets/generic_stage_target.py
---
catalyst/targets/generic_stage_target.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 068abe6..2d7a2ea 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -30,7 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
- "shm": "/dev/shm",
+ "shm": "shmfs",
}
# for convienience
@@ -949,7 +949,7 @@ class generic_stage_target(generic_target):
os.makedirs(target, 0755)
if not os.path.exists(self.mountmap[x]):
- if not self.mountmap[x] == "tmpfs":
+ if self.mountmap[x] not in ["tmpfs", "shmfs"]:
os.makedirs(self.mountmap[x], 0755)
src=self.mountmap[x]
@@ -970,6 +970,9 @@ class generic_stage_target(generic_target):
self.settings["var_tmpfs_portage"] + "G " + \
src + " " + target
retval=os.system(cmd)
+ elif src == "shmfs":
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
+ retval=os.system(cmd)
else:
cmd = "mount --bind " + src + " " + target
#print "bind(); cmd =", cmd
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2014-01-01 22:13 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2014-01-01 22:13 UTC (permalink / raw
To: gentoo-commits
commit: f98060c981f45d85993cefa43caac3716dd0080d
Author: Douglas Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Wed Jan 1 21:18:22 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 1 22:09:38 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f98060c9
Mount /dev/shm in the chroot with the right options
Bind mounting /dev/shm into the chroot isn't a good idea, as there may
be collisions and result in weird side effects. Instead, we can just
mount a new tmpfs there, with the right options to ensure security.
(Forward ported to pending branch from 2.X Brian Dolbec)
Conflicts:
catalyst/targets/generic_stage_target.py
---
catalyst/targets/generic_stage_target.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 068abe6..262bb8e 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -30,7 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
- "shm": "/dev/shm",
+ "shm": "shmfs",
}
# for convienience
@@ -949,7 +949,7 @@ class generic_stage_target(generic_target):
os.makedirs(target, 0755)
if not os.path.exists(self.mountmap[x]):
- if not self.mountmap[x] == "tmpfs":
+ if self.mountmap[x] != "tmpfs" and self.mountmap[x] != "shmfs":
os.makedirs(self.mountmap[x], 0755)
src=self.mountmap[x]
@@ -970,6 +970,10 @@ class generic_stage_target(generic_target):
self.settings["var_tmpfs_portage"] + "G " + \
src + " " + target
retval=os.system(cmd)
+ elif src == "shmfs":
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + \
+ self.settings["chroot_path"] + x
+ retval=os.system(cmd)
else:
cmd = "mount --bind " + src + " " + target
#print "bind(); cmd =", cmd
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 18:56 Anthony G. Basile
0 siblings, 0 replies; 68+ messages in thread
From: Anthony G. Basile @ 2013-12-31 18:56 UTC (permalink / raw
To: gentoo-commits
commit: a937ae889ebe9e4c955da0fdf9a8a3557faf51a6
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 18:55:19 2013 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 31 18:55:19 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a937ae88
catalyst/targets/generic_stage_target.py: mount /dev/shm on linux
Some build systems require /dev/shm to be mounted, like python's
build system. We make sure that on Linux systems, /dev/shm is
mounted in the stage chroots. See bug #496328.
---
catalyst/targets/generic_stage_target.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 356eec1..068abe6 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -224,6 +224,7 @@ class generic_stage_target(generic_target):
#self.mountmap["portdir"] = None
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
+ self.mounts.append("shm")
self.set_mounts()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 18:14 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 18:14 UTC (permalink / raw
To: gentoo-commits
commit: a338869a02f15b6cef14a6c977792a38720fb2d6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 17:59:08 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a338869a
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location.
This will simplify the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 38 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index f0abe08..47513d1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ "proc": "/proc",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,22 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "dev": "/dev",
- "devpts": "/dev/pts",
- "distdir": self.settings["distdir"],
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "port_tmpdir": "tmpfs"}
- "proc": "/proc",
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 18:14 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 18:14 UTC (permalink / raw
To: gentoo-commits
commit: f6311f60c9fa90608449817ecef3a8f312a338ed
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 17:59:07 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=f6311f60
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 58aba71..f0abe08 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -325,9 +328,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:
@@ -339,7 +343,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/")
@@ -475,10 +479,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"]):
@@ -664,8 +670,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"]):
@@ -711,7 +717,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
@@ -723,8 +729,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
@@ -784,18 +789,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -832,8 +838,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -858,7 +863,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -866,9 +871,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -882,12 +888,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -895,7 +902,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1016,8 +1023,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1113,32 +1121,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1169,11 +1179,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1197,11 +1207,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1216,29 +1226,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1259,18 +1269,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1337,8 +1347,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1366,22 +1376,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1391,11 +1404,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1405,15 +1418,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1429,7 +1443,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1437,8 +1451,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1454,7 +1469,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1462,9 +1477,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1506,8 +1521,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1560,29 +1574,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 18:14 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 18:14 UTC (permalink / raw
To: gentoo-commits
commit: dba5255731c229832d1d5a8d9d883d01c81e7fe7
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 17:59:08 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=dba52557
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 47513d1..356eec1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:48 UTC (permalink / raw
To: gentoo-commits
commit: fb9b4c2ea27740d3a68e7b0c1d4fd79dac9fe459
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:40:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=fb9b4c2e
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 58aba71..f0abe08 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -325,9 +328,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:
@@ -339,7 +343,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/")
@@ -475,10 +479,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"]):
@@ -664,8 +670,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"]):
@@ -711,7 +717,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
@@ -723,8 +729,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
@@ -784,18 +789,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -832,8 +838,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -858,7 +863,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -866,9 +871,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -882,12 +888,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -895,7 +902,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1016,8 +1023,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1113,32 +1121,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1169,11 +1179,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1197,11 +1207,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1216,29 +1226,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1259,18 +1269,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1337,8 +1347,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1366,22 +1376,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1391,11 +1404,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1405,15 +1418,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1429,7 +1443,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1437,8 +1451,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1454,7 +1469,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1462,9 +1477,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1506,8 +1521,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1560,29 +1574,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:48 UTC (permalink / raw
To: gentoo-commits
commit: 8e60dd3b193222a64d1fc885a3c57797b20feccc
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:40:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=8e60dd3b
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location.
This will simplify the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 38 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index f0abe08..47513d1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ "proc": "/proc",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,22 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "dev": "/dev",
- "devpts": "/dev/pts",
- "distdir": self.settings["distdir"],
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "port_tmpdir": "tmpfs"}
- "proc": "/proc",
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:48 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:48 UTC (permalink / raw
To: gentoo-commits
commit: 8b42aaa4142a76a8625002acad988655130ceb37
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:40:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=8b42aaa4
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 47513d1..356eec1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:39 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:39 UTC (permalink / raw
To: gentoo-commits
commit: b6fd8439492608db1e4e5f442eeaafd1e61ce794
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:38:24 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=b6fd8439
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 47513d1..356eec1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
"proc": "/proc",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:39 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:39 UTC (permalink / raw
To: gentoo-commits
commit: 0a552dc4b144b6231da78e032c64162ab461eec6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:36:24 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=0a552dc4
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location.
This will simplify the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 38 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index f0abe08..47513d1 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ "proc": "/proc",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,22 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "dev": "/dev",
- "devpts": "/dev/pts",
- "distdir": self.settings["distdir"],
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "port_tmpdir": "tmpfs"}
- "proc": "/proc",
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:39 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:39 UTC (permalink / raw
To: gentoo-commits
commit: 30c2c2f3b4ccf863c104ee384ecbfa588396c118
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:33:36 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=30c2c2f3
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 58aba71..f0abe08 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -325,9 +328,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:
@@ -339,7 +343,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/")
@@ -475,10 +479,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"]):
@@ -664,8 +670,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"]):
@@ -711,7 +717,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
@@ -723,8 +729,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
@@ -784,18 +789,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -832,8 +838,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -858,7 +863,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -866,9 +871,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -882,12 +888,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -895,7 +902,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1016,8 +1023,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1113,32 +1121,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1169,11 +1179,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1197,11 +1207,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1216,29 +1226,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1259,18 +1269,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1337,8 +1347,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1366,22 +1376,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1391,11 +1404,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1405,15 +1418,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1429,7 +1443,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1437,8 +1451,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1454,7 +1469,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1462,9 +1477,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1506,8 +1521,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1560,29 +1574,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:22 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:22 UTC (permalink / raw
To: gentoo-commits
commit: 1e7d906277a89e247c9c16b617ef2912dfb16e2b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:56:02 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 03:59:34 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=1e7d9062
modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Similarly to TARGET_MOUNTS_DEFAULTS this will simplify
the migration to being fully configurable.
It also simplifies initialization somewhat.
---
catalyst/targets/generic_stage_target.py | 38 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index d4cbc77..6634a08 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+SOURCE_MOUNTS_DEFAULTS = {
+ "proc": "/proc",
+ "dev": "/dev",
+ "devpts": "/dev/pts",
+ "distdir": "/usr/portage/distfiles",
+ "portdir": "/usr/portage",
+ "port_tmpdir": "tmpfs",
+ }
+
# for convienience
pjoin = os.path.join
@@ -198,22 +207,19 @@ class generic_stage_target(generic_target):
""" Setup our mount points """
# initialize our target mounts.
self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy()
- if "SNAPCACHE" in self.settings:
- self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
- self.mountmap = {
- "proc": "/proc",
- "dev": "/dev",
- "devpts": "/dev/pts",
- "portdir": normpath("/".join([
- self.settings["snapshot_cache_path"],
- self.settings["repo_name"],
- ])),
- "distdir": self.settings["distdir"],
- "port_tmpdir": "tmpfs"}
- else:
- self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
- self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts",
- "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
+
+ self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
+ # initialize our source mounts
+ 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
if os.uname()[0] == "Linux":
self.mounts.append("devpts")
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:22 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:22 UTC (permalink / raw
To: gentoo-commits
commit: 5285c435f483ad2c0d473792a273c5c192e279fb
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 06:14:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 03:58:33 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=5285c435
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 6cc1ae4..d4cbc77 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -22,6 +22,9 @@ TARGET_MOUNTS_DEFAULTS = {
"proc": "/proc",
}
+# for convienience
+pjoin = os.path.join
+
class generic_stage_target(generic_target):
"""
@@ -325,9 +328,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:
@@ -339,7 +343,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/")
@@ -475,10 +479,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"]):
@@ -664,8 +670,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"]):
@@ -711,7 +717,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
@@ -723,8 +729,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
@@ -784,18 +789,19 @@ class generic_stage_target(generic_target):
cmd(unpack_cmd,error_msg,env=self.env)
if "source_path_hash" in self.settings:
- myf=open(self.settings["autoresume_path"]+"unpack","w")
+ myf=open(unpack_resume,"w")
myf.write(self.settings["source_path_hash"])
myf.close()
else:
- touch(self.settings["autoresume_path"]+"unpack")
+ touch(unpack_resume)
else:
print "Resume point detected, skipping unpack operation..."
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ unpack_portage_resume = pjoin(self.settings["autoresume_path"],
"unpack_portage")
+ snapshot_hash=read_from_clst(unpack_portage_resume)
if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
@@ -832,8 +838,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
self.settings["portdir"]) \
- and os.path.exists(self.settings["autoresume_path"]\
- +"unpack_portage") \
+ and os.path.exists(unpack_portage_resume) \
and self.settings["snapshot_path_hash"] == snapshot_hash:
print \
"Valid Resume point detected, skipping unpack of portage tree..."
@@ -858,7 +863,7 @@ class generic_stage_target(generic_target):
myf.close()
else:
print "Setting snapshot autoresume point"
- myf=open(self.settings["autoresume_path"]+"unpack_portage","w")
+ myf=open(unpack_portage_resume,"w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
@@ -866,9 +871,10 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.unlock()
def config_profile_link(self):
+ config_protect_link_resume = pjoin(self.settings["autoresume_path"],
+ "config_profile_link")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "config_profile_link"):
+ and os.path.exists():
print \
"Resume point detected, skipping config_profile_link operation..."
else:
@@ -882,12 +888,13 @@ class generic_stage_target(generic_target):
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
- touch(self.settings["autoresume_path"]+"config_profile_link")
+ touch(config_protect_link_resume)
def setup_confdir(self):
+ setup_confdir_resume = pjoin(self.settings["autoresume_path"],
+ "setup_confdir")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "setup_confdir"):
+ and os.path.exists(setup_confdir_resume):
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
@@ -895,7 +902,7 @@ class generic_stage_target(generic_target):
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
"Error copying /etc/portage",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_confdir")
+ touch(setup_confdir_resume)
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -1016,8 +1023,9 @@ class generic_stage_target(generic_target):
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
+ chroot_setup_resume = pjoin(self.settings["autoresume_path"],
+ "chroot_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
print "Resume point detected, skipping chroot_setup operation..."
else:
print "Setting up chroot..."
@@ -1113,32 +1121,34 @@ class generic_stage_target(generic_target):
cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
"Could not backup /etc/portage/make.conf",env=self.env)
- touch(self.settings["autoresume_path"]+"chroot_setup")
+ touch(chroot_setup_resume)
def fsscript(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
+ fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
+ if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
print "Resume point detected, skipping fsscript operation..."
else:
if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"fsscript")
+ touch(fsscript_resume)
def rcupdate(self):
+ rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
+ and os.path.exists(rcupdate_resume):
print "Resume point detected, skipping rcupdate operation..."
else:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" rc-update",\
"rc-update script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"rcupdate")
+ touch(rcupdate_resume)
def clean(self):
+ clean_resume = pjoin(self.settings["autoresume_path"], "clean")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"clean"):
+ and os.path.exists(clean_resume):
print "Resume point detected, skipping clean operation..."
else:
for x in self.settings["cleanables"]:
@@ -1169,11 +1179,11 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" clean",\
"clean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"clean")
+ touch(clean_resume)
def empty(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"empty"):
+ empty_resume = pjoin(self.settings["autoresume_path"], "empty")
+ if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
print "Resume point detected, skipping empty operation..."
else:
if self.settings["spec_prefix"]+"/empty" in self.settings:
@@ -1197,11 +1207,11 @@ class generic_stage_target(generic_target):
os.makedirs(myemp,0755)
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
- touch(self.settings["autoresume_path"]+"empty")
+ touch(empty_resume)
def remove(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"remove"):
+ remove_resume = pjoin(self.settings["autoresume_path"], "remove")
+ if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
print "Resume point detected, skipping remove operation..."
else:
if self.settings["spec_prefix"]+"/rm" in self.settings:
@@ -1216,29 +1226,29 @@ class generic_stage_target(generic_target):
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" clean","Clean failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"remove")
+ touch(remove_resume)
except:
self.unbind()
raise
def preclean(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"preclean"):
+ preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
+ if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
print "Resume point detected, skipping preclean operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" preclean","preclean script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"preclean")
+ touch(preclean_resume)
except:
self.unbind()
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"capture"):
+ capture_resume = pjoin(self.settings["autoresume_path"], "capture")
+ if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
print "Resume point detected, skipping capture operation..."
else:
""" Capture target in a tarball """
@@ -1259,18 +1269,18 @@ class generic_stage_target(generic_target):
self.gen_contents_file(self.settings["target_path"])
self.gen_digest_file(self.settings["target_path"])
- touch(self.settings["autoresume_path"]+"capture")
+ touch(capture_resume)
def run_local(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"run_local"):
+ run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
+ if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
print "Resume point detected, skipping run_local operation..."
else:
try:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"run_local")
+ touch(run_local_resume)
except CatalystError:
self.unbind()
@@ -1337,8 +1347,8 @@ class generic_stage_target(generic_target):
self.chroot_lock.unlock()
def unmerge(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
+ unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
+ if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
print "Resume point detected, skipping unmerge operation..."
else:
if self.settings["spec_prefix"]+"/unmerge" in self.settings:
@@ -1366,22 +1376,25 @@ class generic_stage_target(generic_target):
except CatalystError:
self.unbind()
raise
- touch(self.settings["autoresume_path"]+"unmerge")
+ touch(unmerge_resume)
def target_setup(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
+ target_setup_resume = pjoin(self.settings["autoresume_path"],
+ "target_setup")
+ if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
print "Resume point detected, skipping target_setup operation..."
else:
print "Setting up filesystems per filesystem type"
cmd("/bin/bash "+self.settings["controller_file"]+\
" target_image_setup "+ self.settings["target_path"],\
"target_image_setup script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"target_setup")
+ touch(target_setup_resume)
def setup_overlay(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
+ setup_overlay_resume = pjoin(self.settings["autoresume_path"],
+ "setup_overlay")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(setup_overlay_resume):
print "Resume point detected, skipping setup_overlay operation..."
else:
if self.settings["spec_prefix"]+"/overlay" in self.settings:
@@ -1391,11 +1404,11 @@ class generic_stage_target(generic_target):
self.settings["target_path"],\
self.settings["spec_prefix"]+"overlay: "+x+\
" copy failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"setup_overlay")
+ touch(setup_overlay_resume)
def create_iso(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
+ create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
+ if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
@@ -1405,15 +1418,16 @@ class generic_stage_target(generic_target):
env=self.env)
self.gen_contents_file(self.settings["iso"])
self.gen_digest_file(self.settings["iso"])
- touch(self.settings["autoresume_path"]+"create_iso")
+ touch(create_iso_resume)
else:
print "WARNING: livecd/iso was not defined."
print "An ISO Image will not be created."
def build_packages(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "build_packages"):
+ build_packages_resume = pjoin(self.settings["autoresume_path"],
+ "build_packages")
+ if "AUTORESUME" in self.settings and \
+ os.path.exists(build_packages_resume):
print "Resume point detected, skipping build_packages operation..."
else:
if self.settings["spec_prefix"]+"/packages" in self.settings:
@@ -1429,7 +1443,7 @@ class generic_stage_target(generic_target):
cmd("/bin/bash "+self.settings["controller_file"]+\
" build_packages "+mypack,\
"Error in attempt to build packages",env=self.env)
- touch(self.settings["autoresume_path"]+"build_packages")
+ touch(build_packages_resume)
except CatalystError:
self.unbind()
raise CatalystError,self.settings["spec_prefix"]+\
@@ -1437,8 +1451,9 @@ class generic_stage_target(generic_target):
def build_kernel(self):
"Build all configured kernels"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
+ build_kernel_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel")
+ if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
print "Resume point detected, skipping build_kernel operation..."
else:
if "boot/kernel" in self.settings:
@@ -1454,7 +1469,7 @@ class generic_stage_target(generic_target):
env=self.env)
for kname in mynames:
self._build_kernel(kname=kname)
- touch(self.settings["autoresume_path"]+"build_kernel")
+ touch(build_kernel_resume)
except CatalystError:
self.unbind()
raise CatalystError,\
@@ -1462,9 +1477,9 @@ class generic_stage_target(generic_target):
def _build_kernel(self, kname):
"Build a single configured kernel by name"
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]\
- +"build_kernel_"+kname):
+ kname_resume = pjoin(self.settings["autoresume_path"],
+ "build_kernel_" + kname)
+ if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
return
self._copy_kernel_config(kname=kname)
@@ -1506,8 +1521,7 @@ class generic_stage_target(generic_target):
cmd("rm -R "+self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/",env=self.env)
- touch(self.settings["autoresume_path"]+\
- "build_kernel_"+kname)
+ touch(kname_resume)
"""
Execute the script that cleans up the kernel build
@@ -1560,29 +1574,30 @@ class generic_stage_target(generic_target):
"/initramfs_overlay"],env=self.env)
def bootloader(self):
- if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
+ bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
+ if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
print "Resume point detected, skipping bootloader operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" bootloader " + self.settings["target_path"],\
"Bootloader script failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"bootloader")
+ touch(bootloader_resume)
except CatalystError:
self.unbind()
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
+ livecd_update_resume = pjoin(self.settings["autoresume_path"],
+ "livecd_update")
if "AUTORESUME" in self.settings \
- and os.path.exists(self.settings["autoresume_path"]+\
- "livecd_update"):
+ and os.path.exists(livecd_update_resume):
print "Resume point detected, skipping build_packages operation..."
else:
try:
cmd("/bin/bash "+self.settings["controller_file"]+\
" livecd-update","livecd-update failed.",env=self.env)
- touch(self.settings["autoresume_path"]+"livecd_update")
+ touch(livecd_update_resume)
except CatalystError:
self.unbind()
^ permalink raw reply related [flat|nested] 68+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/
@ 2013-12-31 4:22 Brian Dolbec
0 siblings, 0 replies; 68+ messages in thread
From: Brian Dolbec @ 2013-12-31 4:22 UTC (permalink / raw
To: gentoo-commits
commit: 87c961969f12351c576e453eb9d95bd88b9c163a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 23:57:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 31 04:20:32 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=87c96196
Add shm targets defaults.
---
catalyst/targets/generic_stage_target.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 6634a08..e3cdab0 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
"port_tmpdir": "/var/tmp/portage",
"port_logdir": "/var/log/portage",
"proc": "/proc",
+ "shm": "/dev/shm",
}
SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
"distdir": "/usr/portage/distfiles",
"portdir": "/usr/portage",
"port_tmpdir": "tmpfs",
+ "shm": "/dev/shm",
}
# for convienience
^ permalink raw reply related [flat|nested] 68+ messages in thread
end of thread, other threads:[~2017-11-22 15:52 UTC | newest]
Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02 5:54 [gentoo-commits] proj/catalyst:pending commit in: catalyst/targets/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2017-11-29 17:20 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2017-11-22 15:52 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2017-03-16 22:57 Brian Dolbec
2017-03-11 7:07 Brian Dolbec
2017-03-10 18:38 Brian Dolbec
2017-03-09 10:02 Brian Dolbec
2017-03-09 9:39 Brian Dolbec
2015-11-12 16:24 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-11-21 1:33 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 20:12 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-01-01 5:59 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 19:25 Brian Dolbec
2015-01-01 5:59 Brian Dolbec
2015-01-01 5:59 Brian Dolbec
2014-09-11 3:08 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02 7:12 Brian Dolbec
2014-09-02 5:54 Brian Dolbec
2014-09-02 2:43 Brian Dolbec
2014-09-02 2:43 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-14 5:58 Brian Dolbec
2014-06-14 5:58 Brian Dolbec
2014-05-05 19:17 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-05-05 19:15 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-02 16:07 Brian Dolbec
2014-03-02 16:07 Brian Dolbec
2014-03-02 16:07 Brian Dolbec
2014-02-22 21:48 Brian Dolbec
2014-02-22 21:48 Brian Dolbec
2014-02-22 21:48 Brian Dolbec
2014-02-22 18:43 Brian Dolbec
2014-02-22 18:43 Brian Dolbec
2014-02-22 18:43 Brian Dolbec
2014-01-22 15:52 Brian Dolbec
2014-01-22 15:52 Brian Dolbec
2014-01-22 15:52 Brian Dolbec
2014-01-03 6:41 Brian Dolbec
2014-01-03 6:12 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-03 5:03 Brian Dolbec
2014-01-02 0:04 Brian Dolbec
2014-01-02 0:04 Brian Dolbec
2014-01-02 0:04 Brian Dolbec
2014-01-02 0:04 Brian Dolbec
2014-01-02 0:04 Brian Dolbec
2014-01-01 22:27 Brian Dolbec
2014-01-01 22:13 Brian Dolbec
2013-12-31 18:56 Anthony G. Basile
2013-12-31 18:14 Brian Dolbec
2013-12-31 18:14 Brian Dolbec
2013-12-31 18:14 Brian Dolbec
2013-12-31 4:48 Brian Dolbec
2013-12-31 4:48 Brian Dolbec
2013-12-31 4:48 Brian Dolbec
2013-12-31 4:39 Brian Dolbec
2013-12-31 4:39 Brian Dolbec
2013-12-31 4:39 Brian Dolbec
2013-12-31 4:22 Brian Dolbec
2013-12-31 4:22 Brian Dolbec
2013-12-31 4:22 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox