commit: d4408f858c4c3eb71ef0efdef5f23ebf6526dd87
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 1 06:28:19 2013 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 26 08:32:57 2015 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d4408f85
Fix some paths/normpath usage
Use pjoin to join paths.
Use os.path.dirname() instead of splitting and rejoining without the filename.
Don't remove the trailing slash from the seedcache path in set_source_path(),
fix supplied by GMsoft. Rebase it into this original commit that broke it.
---
catalyst/base/stagebase.py | 21 ++++++++++-----------
catalyst/targets/livecd_stage2.py | 2 +-
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index f3cb3e3..edb6032 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -306,7 +306,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "pkgcache_path" in self.settings:
if
type(self.settings["pkgcache_path"])!=types.StringType:
self.settings["pkgcache_path"]=\
-
normpath(string.join(self.settings["pkgcache_path"]))
+ normpath(self.settings["pkgcache_path"])
else:
self.settings["pkgcache_path"]=\
normpath(self.settings["storedir"]+"/packages/"+\
@@ -316,7 +316,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "kerncache_path" in self.settings:
if
type(self.settings["kerncache_path"])!=types.StringType:
self.settings["kerncache_path"]=\
-
normpath(string.join(self.settings["kerncache_path"]))
+
normpath(self.settings["kerncache_path"])
else:
self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\
"/kerncache/"+self.settings["target_subpath"]+"/")
@@ -339,7 +339,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
#
+self.settings["target_path"],env=self.env)
self.resume.enable("setup_target_path")
- ensure_dirs(self.settings["storedir"] + "/builds/")
+ ensure_dirs(self.settings["storedir"] + "/builds")
def set_fsscript(self):
if self.settings["spec_prefix"]+"/fsscript" in self.settings:
@@ -403,8 +403,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "seedcache" in self.settings["options"]\
and
os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\
self.settings["source_subpath"]+"/")):
-
self.settings["source_path"]=normpath(self.settings["storedir"]+\
- "/tmp/"+self.settings["source_subpath"]+"/")
+ self.settings["source_path"] =
normpath(self.settings["storedir"] +
+ "/tmp/" + self.settings["source_subpath"] + "/")
else:
self.settings["source_path"]=normpath(self.settings["storedir"]+\
"/builds/"+self.settings["source_subpath"]+".tar.bz2")
@@ -461,8 +461,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
def set_snapcache_path(self):
if "snapcache" in self.settings["options"]:
self.settings["snapshot_cache_path"] = \
- normpath(self.settings["snapshot_cache"] + "/" +
- self.settings["snapshot"])
+ normpath(pjoin(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"]
@@ -824,7 +824,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
unpack_errmsg="Error unpacking snapshot"
if "autoresume" in self.settings["options"] \
- and
os.path.exists(self.settings["chroot_path"]+\
+ and os.path.exists(self.settings["chroot_path"]
+
self.settings["portdir"]) \
and self.resume.is_enabled("unpack_portage") \
and self.settings["snapshot_path_hash"] ==
snapshot_hash:
@@ -1235,10 +1235,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("capture"):
print "Resume point detected, skipping capture
operation..."
else:
- """ Capture target in a tarball """
- mypath=self.settings["target_path"].split("/")
+ print """ Capture target in a tarball """
""" Remove filename from path """
- mypath=string.join(mypath[:-1],"/")
+ mypath = os.path.dirname(self.settings["target_path"])
""" Now make sure path exists """
ensure_dirs(mypath)
diff --git a/catalyst/targets/livecd_stage2.py
b/catalyst/targets/livecd_stage2.py
index 973a734..78bed82 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -43,7 +43,7 @@ class livecd_stage2(StageBase):
self.settings["hash_map"].generate_hash(
self.settings["source_path"])
else:
-
self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
+
self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"])
if not os.path.exists(self.settings["source_path"]):
raise CatalystError("Source Path: " +
self.settings["source_path"] + " does not
exist.",