* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/
@ 2015-01-01 5:59 Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ Brian Dolbec
0 siblings, 1 reply; 6+ messages in thread
From: Brian Dolbec @ 2015-01-01 5:59 UTC (permalink / raw
To: gentoo-commits
commit: f186361602b69e1c80bea5b43098d7cde7bddc15
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 04:13:13 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=f1863616
Add archdir to settings
---
catalyst/base/stagebase.py | 8 +++-----
catalyst/defaults.py | 2 ++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 96b1c19..daf8e54 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -66,17 +66,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.archmap = {}
self.subarchmap = {}
machinemap = {}
- arch_dir = self.settings["PythonDir"] + "/arch/"
- for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py")]:
- if x == "__init__":
- continue
+ arch_dir = self.settings["archdir"] + "/"
+ for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") and x != "__init__.py"]:
try:
fh=open(arch_dir + x + ".py")
"""
This next line loads the plugin as a module and assigns it to
archmap[x]
"""
- self.archmap[x]=imp.load_module(x,fh,"../arch/" + x + ".py",
+ self.archmap[x]=imp.load_module(x,fh, arch_dir + x + ".py",
(".py", "r", imp.PY_SOURCE))
"""
This next line registers all the subarches supported in the
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 2839a3d..2f4f429 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -21,6 +21,7 @@ valid_config_file_values.extend([ "distcc", "envscript",
verbosity = 1
confdefaults={
+ "archdir": "%(PythonDir)s/arch",
"distdir": "/usr/portage/distfiles",
"hash_function": "crc32",
"icecream": "/var/cache/icecream",
@@ -30,6 +31,7 @@ confdefaults={
"packagedir": "/usr/portage/packages",
"portdir": "/usr/portage",
"port_tmpdir": "/var/tmp/portage",
+ "PythonDir": "./catalyst",
"repo_name": "portage",
"sharedir": "/usr/lib/catalyst",
"shdir": "/usr/lib/catalyst/targets/",
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/
@ 2015-01-01 5:59 Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-01-01 5:59 UTC (permalink / raw
To: gentoo-commits
commit: a519c380faabe8278863d4615e24194d17c78c75
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 25 03:52:44 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=a519c380
Fix typo in error message, clean up useless tracebacks
Remove useless python tracebacks for bash side target failures.
Conflicts:
catalyst/main.py
---
catalyst/base/stagebase.py | 2 +-
catalyst/main.py | 2 --
catalyst/support.py | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index c16ef86..3056ce2 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1296,7 +1296,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
except CatalystError:
self.unbind()
raise CatalystError("Stage build aborting due to error.",
- print_traceback=True)
+ print_traceback=False)
def setup_environment(self):
"""
diff --git a/catalyst/main.py b/catalyst/main.py
index 56e57c6..7fea4e7 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -163,8 +163,6 @@ def build_target(addlargs):
try:
target.run()
except:
- print "Target run() exception: Python traceback output follows:"
- catalyst.util.print_traceback()
print "!!! catalyst: Error encountered during run of target " + \
addlargs["target"]
sys.exit(1)
diff --git a/catalyst/support.py b/catalyst/support.py
index 8c4876f..8f2e5df 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -90,7 +90,7 @@ class CatalystError(Exception):
(type,value)=sys.exc_info()[:2]
if value!=None:
print
- print "Traceback valuse found. listing..."
+ print "Traceback values found. listing..."
print traceback.print_exc(file=sys.stdout)
print
print "!!! catalyst: "+message
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/
@ 2015-01-01 5:59 Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-01-01 5:59 UTC (permalink / raw
To: gentoo-commits
commit: 6f01be26fb22e2b9c89453f9a4d2eeba2babf6e6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 22 08:39:18 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=6f01be26
Rename a make.conf key to make_conf due to bash variable name restrictions
---
catalyst/base/stagebase.py | 10 +++++-----
catalyst/defaults.py | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index b44a957..96b1c19 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1020,7 +1020,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
def chroot_setup(self):
self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+
- self.settings["make.conf"]))
+ self.settings["make_conf"]))
self.override_cbuild()
self.override_chost()
self.override_cflags()
@@ -1068,7 +1068,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
""" Modify and write out make.conf (for the chroot) """
makepath = normpath(self.settings["chroot_path"] +
- self.settings["make.conf"])
+ self.settings["make_conf"])
cmd("rm -f " + makepath,\
"Could not remove " + makepath, env=self.env)
myf=open(makepath, "w")
@@ -1122,9 +1122,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
myf.close()
makepath = normpath(self.settings["chroot_path"] +
- self.settings["make.conf"])
+ self.settings["make_conf"])
cmd("cp " + makepath + " " + makepath + ".catalyst",\
- "Could not backup " + self.settings["make.conf"],env=self.env)
+ "Could not backup " + self.settings["make_conf"],env=self.env)
touch(self.settings["autoresume_path"]+"chroot_setup")
def fsscript(self):
@@ -1172,7 +1172,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
cmd("rm -rf " + self.settings["chroot_path"] + self.settings["local_overlay"],
"Could not remove " + self.settings["local_overlay"], env=self.env)
cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
- "/etc/portage/make.conf",\
+ self.settings["make_conf"],\
"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
""" Clean up old and obsoleted files in /etc """
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index ce7e919..2839a3d 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -25,8 +25,8 @@ confdefaults={
"hash_function": "crc32",
"icecream": "/var/cache/icecream",
"local_overlay": "/usr/local/portage",
- "make.conf": "/etc/portage/make.conf",
- "options": "",
+ "make_conf": "/etc/portage/make.conf",
+ "options": set(),
"packagedir": "/usr/portage/packages",
"portdir": "/usr/portage",
"port_tmpdir": "/var/tmp/portage",
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/
2015-01-01 5:59 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/ Brian Dolbec
@ 2015-02-26 20:12 ` Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-02-26 20:12 UTC (permalink / raw
To: gentoo-commits
commit: f186361602b69e1c80bea5b43098d7cde7bddc15
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 12 04:13:13 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=f1863616
Add archdir to settings
---
catalyst/base/stagebase.py | 8 +++-----
catalyst/defaults.py | 2 ++
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 96b1c19..daf8e54 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -66,17 +66,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.archmap = {}
self.subarchmap = {}
machinemap = {}
- arch_dir = self.settings["PythonDir"] + "/arch/"
- for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py")]:
- if x == "__init__":
- continue
+ arch_dir = self.settings["archdir"] + "/"
+ for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") and x != "__init__.py"]:
try:
fh=open(arch_dir + x + ".py")
"""
This next line loads the plugin as a module and assigns it to
archmap[x]
"""
- self.archmap[x]=imp.load_module(x,fh,"../arch/" + x + ".py",
+ self.archmap[x]=imp.load_module(x,fh, arch_dir + x + ".py",
(".py", "r", imp.PY_SOURCE))
"""
This next line registers all the subarches supported in the
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 2839a3d..2f4f429 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -21,6 +21,7 @@ valid_config_file_values.extend([ "distcc", "envscript",
verbosity = 1
confdefaults={
+ "archdir": "%(PythonDir)s/arch",
"distdir": "/usr/portage/distfiles",
"hash_function": "crc32",
"icecream": "/var/cache/icecream",
@@ -30,6 +31,7 @@ confdefaults={
"packagedir": "/usr/portage/packages",
"portdir": "/usr/portage",
"port_tmpdir": "/var/tmp/portage",
+ "PythonDir": "./catalyst",
"repo_name": "portage",
"sharedir": "/usr/lib/catalyst",
"shdir": "/usr/lib/catalyst/targets/",
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/
2015-02-26 22:18 [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ Brian Dolbec
@ 2015-02-26 20:44 ` Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-02-26 20:44 UTC (permalink / raw
To: gentoo-commits
commit: 2f8312854d9fac7476f8f972660824941dc4c852
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 21:19:28 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 20:08:06 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=2f831285
Move some duplicate code to fileops, extend it's capability to not re-make the directory.
---
catalyst/base/clearbase.py | 71 +++++++++++++++-------------------------------
catalyst/base/resume.py | 26 ++++-------------
catalyst/fileops.py | 43 +++++++++++++++++++++++++++-
3 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/catalyst/base/clearbase.py b/catalyst/base/clearbase.py
index 0ebe299..e38b1a8 100644
--- a/catalyst/base/clearbase.py
+++ b/catalyst/base/clearbase.py
@@ -5,7 +5,7 @@ from stat import ST_UID, ST_GID, ST_MODE
from catalyst.support import cmd, countdown
-from catalyst.fileops import ensure_dirs
+from catalyst.fileops import ensure_dirs, clear_dir
class ClearBase(object):
"""
@@ -16,68 +16,43 @@ class ClearBase(object):
self.resume = None
- def clear_autoresume(self):
+ def clear_autoresume(self, remove=False):
""" Clean resume points since they are no longer needed """
if "autoresume" in self.settings["options"]:
print "Removing AutoResume Points: ..."
self.resume.clear_all()
- def clear_chroot(self):
+ def clear_chroot(self, remove=False):
print 'Clearing the chroot path ...'
- self.clear_dir(self.settings["chroot_path"], 0755, True)
+ clear_dir(self.settings["chroot_path"], 0755, True, remove)
- def clear_packages(self):
+ def clear_packages(self, remove=False):
if "pkgcache" in self.settings["options"]:
print "purging the pkgcache ..."
- self.clear_dir(self.settings["pkgcache_path"])
+ clear_dir(self.settings["pkgcache_path"], remove=remove)
- def clear_kerncache(self):
+ def clear_kerncache(self, remove=False):
if "kerncache" in self.settings["options"]:
print "purging the kerncache ..."
- self.clear_dir(self.settings["kerncache_path"])
+ clear_dir(self.settings["kerncache_path"], remove=remove)
- def purge(self):
+ def purge(self, remove=False):
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()
-
-
- def clear_dir(self, myemp, mode=0755, chg_flags=False):
- '''Universal directory clearing function
- '''
- if not myemp:
- return False
- 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
- """
- try:
- mystat=os.stat(myemp)
- """ There's no easy way to change flags recursively in python """
- if chg_flags and os.uname()[0] == "FreeBSD":
- os.system("chflags -R noschg " + myemp)
- shutil.rmtree(myemp)
- ensure_dirs(myemp, mode=mode)
- os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
- os.chmod(myemp,mystat[ST_MODE])
- except Exception as e:
- print CatalystError("clear_dir(); Exeption: %s" % str(e))
- return False
- return True
+ if any(k in self.settings["options"] for k in ("purge",
+ "purgeonly", "purgetmponly")):
+ print "purge(); clearing autoresume ..."
+ self.clear_autoresume(remove)
+
+ print "purge(); clearing chroot ..."
+ self.clear_chroot(remove)
+
+ if "purgetmponly" not in self.settings["options"]:
+ print "purge(); clearing package cache ..."
+ self.clear_packages(remove)
+
+ print "purge(); clearing kerncache ..."
+ self.clear_kerncache(remove)
diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
index e42c7dc..cf495fc 100644
--- a/catalyst/base/resume.py
+++ b/catalyst/base/resume.py
@@ -16,7 +16,7 @@ import shutil
from stat import ST_UID, ST_GID, ST_MODE
import traceback
-from catalyst.fileops import ensure_dirs, pjoin, listdir_files
+from catalyst.fileops import ensure_dirs, pjoin, listdir_files, clear_dir
from catalyst.support import touch
@@ -139,28 +139,12 @@ class AutoResume(object):
return list(self._points)
- def clear_all(self):
+ def clear_all(self, remove=False):
'''Clear all active resume points
@return boolean
'''
- try:
- print "Emptying directory---", self.basedir
- """
- stat the dir, delete the dir, recreate the dir and set
- the proper perms and ownership
- """
- mystat=os.stat(self.basedir)
- if os.uname()[0] == "FreeBSD":
- cmd("chflags -R noschg " + self.basedir,\
- "Could not remove immutable flag for file "\
- + self.basedir)
- shutil.rmtree(self.basedir)
- ensure_dirs(self.basedir, 0755)
- os.chown(self.basedir,mystat[ST_UID],mystat[ST_GID])
- os.chmod(self.basedir,mystat[ST_MODE])
+ if clear_dir(self.basedir, mode=0755, chg_flags=True, remove=remove):
self._points = {}
- except Exception as e:
- print AutoResumeError(str(e))
- return False
- return True
+ return True
+ return False
diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index e3a4ead..245c83e 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -10,7 +10,13 @@ ensuring directories exist,... imports snakeoils osutils
functions for use throughout catalyst.
'''
-from snakeoil.osutils import (ensure_dirs as snakeoil_ensure_dirs, normpath,
+import os
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+# NOTE: pjoin and listdir_files are imported here for export
+# to other catalyst modules
+from snakeoil.osutils import (ensure_dirs as snakeoil_ensure_dirs,
pjoin, listdir_files)
from catalyst.support import CatalystError
@@ -42,3 +48,38 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0777, minimal=True,
raise CatalystError(
"Failed to create directory: %s" % path, print_traceback=True)
return succeeded
+
+
+def clear_dir(target, mode=0755, chg_flags=False, remove=False):
+ '''Universal directory clearing function
+ '''
+ #print "fileops.clear_dir()"
+ if not target:
+ #print "fileops.clear_dir(), no target... returning"
+ return False
+ if os.path.isdir(target):
+ print "Emptying directory" , target
+ """
+ stat the dir, delete the dir, recreate the dir and set
+ the proper perms and ownership
+ """
+ try:
+ #print "fileops.clear_dir(), os.stat()"
+ mystat=os.stat(target)
+ """ There's no easy way to change flags recursively in python """
+ if chg_flags and os.uname()[0] == "FreeBSD":
+ os.system("chflags -R noschg " + target)
+ #print "fileops.clear_dir(), shutil.rmtree()"
+ shutil.rmtree(target)
+ if not remove:
+ #print "fileops.clear_dir(), ensure_dirs()"
+ ensure_dirs(target, mode=mode)
+ os.chown(target, mystat[ST_UID], mystat[ST_GID])
+ os.chmod(target, mystat[ST_MODE])
+ except Exception as e:
+ print CatalystError("clear_dir(); Exeption: %s" % str(e))
+ return False
+ else:
+ print "fileops.clear_dir(), %s is not a directory" % (target)
+ #print "fileops.clear_dir(), DONE, returning True"
+ return True
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/
@ 2015-09-08 14:14 Brian Dolbec
0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-09-08 14:14 UTC (permalink / raw
To: gentoo-commits
commit: 7536857c1a14d2eec224e80ba96ab9f3091e0d1c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 8 00:35:41 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Sep 8 14:11:48 2015 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7536857c
Make the new compress code handling compatible with existing specs
Clean out old snapshot setting code.
Make file_check() not traceback after printing it's error message.
Fix source auto extension handling in unpack()
catalyst/base/stagebase.py | 53 ++++++++++++++++++++--------------------------
catalyst/support.py | 21 ++++++++++++++++++
2 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index bd6938c..31fbe8b 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -15,7 +15,8 @@ from DeComp.compress import CompressMap
from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
PORT_LOGDIR_CLEAN)
from catalyst.support import (CatalystError, msg, file_locate, normpath,
- touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
+ touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount,
+ file_check)
from catalyst.base.targetbase import TargetBase
from catalyst.base.clearbase import ClearBase
from catalyst.base.genbase import GenBase
@@ -193,7 +194,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
on disk.
"""
#pdb.set_trace()
- file_locate(self.settings,["source_path","snapshot_path","distdir"],\
+ file_locate(self.settings,["distdir"],\
expand=0)
""" If we are using portage_confdir, check that as well. """
if "portage_confdir" in self.settings:
@@ -430,8 +431,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.settings["source_path"] = normpath(self.settings["storedir"] +
"/tmp/" + self.settings["source_subpath"] + "/")
else:
- self.settings["source_path"]=normpath(self.settings["storedir"]+\
- "/builds/"+self.settings["source_subpath"])
+ self.settings["source_path"] = file_check(
+ normpath(self.settings["storedir"] + "/builds/" +
+ self.settings["source_subpath"])
+ )
if os.path.isfile(self.settings["source_path"]):
# XXX: Is this even necessary if the previous check passes?
if os.path.exists(self.settings["source_path"]):
@@ -460,27 +463,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
"/root/*", self.settings["portdir"]]
def set_snapshot_path(self):
- self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
+ self.settings["snapshot_path"]= file_check(normpath(self.settings["storedir"]+\
"/snapshots/" + self.settings["snapshot_name"] +
- self.settings["snapshot"].rstrip('/')+".tar.xz")
-
- if os.path.exists(self.settings["snapshot_path"]):
- self.settings["snapshot_path_hash"] = \
- self.settings["hash_map"].generate_hash(
- self.settings["snapshot_path"],
- hash_ = self.settings["hash_function"],
- verbose = False)
- else:
- self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
- "/snapshots/" + self.settings["snapshot_name"] +
- self.settings["snapshot"])
-
- if os.path.exists(self.settings["snapshot_path"]):
- self.settings["snapshot_path_hash"] = \
- self.settings["hash_map"].generate_hash(
- self.settings["snapshot_path"],
- hash_ = self.settings["hash_function"],
- verbose = False)
+ self.settings["snapshot"]))
+ print "*** SNAPSHOT_PATH set to:", self.settings["snapshot_path"]
+ self.settings["snapshot_path_hash"] = \
+ self.settings["hash_map"].generate_hash(
+ self.settings["snapshot_path"],
+ hash_ = self.settings["hash_function"],
+ verbose = False)
def set_snapcache_path(self):
self.settings["snapshot_cache_path"]=\
@@ -723,12 +714,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:
""" SEEDCACHE is a not a directory, try untar'ing """
print "Referenced SEEDCACHE does not appear to be a directory, trying to untar..."
- unpack_info['mode'] = self.decompressor.determine_mode(
- self.settings["source_path"])
+ unpack_info['source'] = file_check(unpack_info['source'])
else:
""" No SEEDCACHE, use tar """
- unpack_info['mode'] = self.decompressor.determine_mode(
- unpack_info["source"])
+ unpack_info['source'] = file_check(unpack_info['source'])
# endif "seedcache"
if "autoresume" in self.settings["options"]:
@@ -742,19 +731,23 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.settings["source_path_hash"]==clst_unpack_hash:
""" Autoresume is valid, tarball is valid """
_unpack=False
- invalid_snapshot=True
+ invalid_snapshot=False
elif os.path.isdir(self.settings["source_path"]) \
and self.resume.is_disabled("unpack"):
""" Autoresume is invalid, SEEDCACHE """
_unpack=True
- invalid_snapshot=False
+ invalid_snapshot=True
+ # check and reset the unpack_info['source']
+ unpack_info['source'] = file_check(unpack_info['source'])
elif os.path.isfile(self.settings["source_path"]) \
and self.settings["source_path_hash"]!=clst_unpack_hash:
""" Autoresume is invalid, tarball """
_unpack=True
invalid_snapshot=True
+ unpack_info['source'] = file_check(unpack_info['source'])
+
else:
""" No autoresume, SEEDCACHE """
if "seedcache" in self.settings["options"]:
diff --git a/catalyst/support.py b/catalyst/support.py
index 2ac4816..b6705c9 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -1,4 +1,5 @@
+import glob
import sys
import string
import os
@@ -144,6 +145,25 @@ def cmd(mycmd, myexc="", env={}, debug=False, fail_func=None):
print_traceback=False)
+def file_check(filepath):
+ '''Check for the files existence and that only one exists
+ if others are found with various extensions
+ '''
+ if os.path.exists(filepath):
+ return filepath
+ # it didn't exist
+ # so check if there are files of that name with an extension
+ files = glob.glob("%s.*" % filepath)
+ # remove any false positive files
+ files = [x for x in files if not x.endswith(".CONTENTS") and not x.endswith(".DIGESTS")]
+ if len(files) is 1:
+ return files[0]
+ elif len(files) > 1:
+ msg = "Ambiguos Filename: %s\nPlease specify the correct extension as well" % filepath
+ raise CatalystError(msg, print_traceback=False)
+ raise CatalystError("File Not Found: %s" % filepath)
+
+
def file_locate(settings,filelist,expand=1):
#if expand=1, non-absolute paths will be accepted and
# expanded to os.getcwd()+"/"+localpath if file exists
@@ -186,6 +206,7 @@ defined are not preserved. In other words, "foo", "bar", "oni" ordering is prese
""",
print_traceback=True)
+
def parse_makeconf(mylines):
mymakeconf={}
pos=0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-08 14:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 5:59 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/ Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2015-01-01 5:59 [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/ Brian Dolbec
2015-01-01 5:59 Brian Dolbec
2015-02-26 22:18 [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ Brian Dolbec
2015-02-26 20:44 ` [gentoo-commits] proj/catalyst:pending commit in: catalyst/base/, catalyst/ Brian Dolbec
2015-09-08 14:14 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox