1 |
commit: d4408f858c4c3eb71ef0efdef5f23ebf6526dd87 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 1 06:28:19 2013 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 26 08:32:57 2015 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=d4408f85 |
7 |
|
8 |
Fix some paths/normpath usage |
9 |
|
10 |
Use pjoin to join paths. |
11 |
Use os.path.dirname() instead of splitting and rejoining without the filename. |
12 |
Don't remove the trailing slash from the seedcache path in set_source_path(), |
13 |
fix supplied by GMsoft. Rebase it into this original commit that broke it. |
14 |
|
15 |
--- |
16 |
catalyst/base/stagebase.py | 21 ++++++++++----------- |
17 |
catalyst/targets/livecd_stage2.py | 2 +- |
18 |
2 files changed, 11 insertions(+), 12 deletions(-) |
19 |
|
20 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
21 |
index f3cb3e3..edb6032 100644 |
22 |
--- a/catalyst/base/stagebase.py |
23 |
+++ b/catalyst/base/stagebase.py |
24 |
@@ -306,7 +306,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
25 |
if "pkgcache_path" in self.settings: |
26 |
if type(self.settings["pkgcache_path"])!=types.StringType: |
27 |
self.settings["pkgcache_path"]=\ |
28 |
- normpath(string.join(self.settings["pkgcache_path"])) |
29 |
+ normpath(self.settings["pkgcache_path"]) |
30 |
else: |
31 |
self.settings["pkgcache_path"]=\ |
32 |
normpath(self.settings["storedir"]+"/packages/"+\ |
33 |
@@ -316,7 +316,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
34 |
if "kerncache_path" in self.settings: |
35 |
if type(self.settings["kerncache_path"])!=types.StringType: |
36 |
self.settings["kerncache_path"]=\ |
37 |
- normpath(string.join(self.settings["kerncache_path"])) |
38 |
+ normpath(self.settings["kerncache_path"]) |
39 |
else: |
40 |
self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\ |
41 |
"/kerncache/"+self.settings["target_subpath"]+"/") |
42 |
@@ -339,7 +339,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
43 |
# +self.settings["target_path"],env=self.env) |
44 |
self.resume.enable("setup_target_path") |
45 |
|
46 |
- ensure_dirs(self.settings["storedir"] + "/builds/") |
47 |
+ ensure_dirs(self.settings["storedir"] + "/builds") |
48 |
|
49 |
def set_fsscript(self): |
50 |
if self.settings["spec_prefix"]+"/fsscript" in self.settings: |
51 |
@@ -403,8 +403,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
52 |
if "seedcache" in self.settings["options"]\ |
53 |
and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\ |
54 |
self.settings["source_subpath"]+"/")): |
55 |
- self.settings["source_path"]=normpath(self.settings["storedir"]+\ |
56 |
- "/tmp/"+self.settings["source_subpath"]+"/") |
57 |
+ self.settings["source_path"] = normpath(self.settings["storedir"] + |
58 |
+ "/tmp/" + self.settings["source_subpath"] + "/") |
59 |
else: |
60 |
self.settings["source_path"]=normpath(self.settings["storedir"]+\ |
61 |
"/builds/"+self.settings["source_subpath"]+".tar.bz2") |
62 |
@@ -461,8 +461,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
63 |
def set_snapcache_path(self): |
64 |
if "snapcache" in self.settings["options"]: |
65 |
self.settings["snapshot_cache_path"] = \ |
66 |
- normpath(self.settings["snapshot_cache"] + "/" + |
67 |
- self.settings["snapshot"]) |
68 |
+ normpath(pjoin(self.settings["snapshot_cache"], |
69 |
+ self.settings["snapshot"])) |
70 |
self.snapcache_lock=\ |
71 |
LockDir(self.settings["snapshot_cache_path"]) |
72 |
print "Caching snapshot to "+self.settings["snapshot_cache_path"] |
73 |
@@ -824,7 +824,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
74 |
unpack_errmsg="Error unpacking snapshot" |
75 |
|
76 |
if "autoresume" in self.settings["options"] \ |
77 |
- and os.path.exists(self.settings["chroot_path"]+\ |
78 |
+ and os.path.exists(self.settings["chroot_path"] + |
79 |
self.settings["portdir"]) \ |
80 |
and self.resume.is_enabled("unpack_portage") \ |
81 |
and self.settings["snapshot_path_hash"] == snapshot_hash: |
82 |
@@ -1235,10 +1235,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
83 |
and self.resume.is_enabled("capture"): |
84 |
print "Resume point detected, skipping capture operation..." |
85 |
else: |
86 |
- """ Capture target in a tarball """ |
87 |
- mypath=self.settings["target_path"].split("/") |
88 |
+ print """ Capture target in a tarball """ |
89 |
""" Remove filename from path """ |
90 |
- mypath=string.join(mypath[:-1],"/") |
91 |
+ mypath = os.path.dirname(self.settings["target_path"]) |
92 |
|
93 |
""" Now make sure path exists """ |
94 |
ensure_dirs(mypath) |
95 |
|
96 |
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py |
97 |
index 973a734..78bed82 100644 |
98 |
--- a/catalyst/targets/livecd_stage2.py |
99 |
+++ b/catalyst/targets/livecd_stage2.py |
100 |
@@ -43,7 +43,7 @@ class livecd_stage2(StageBase): |
101 |
self.settings["hash_map"].generate_hash( |
102 |
self.settings["source_path"]) |
103 |
else: |
104 |
- self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/") |
105 |
+ self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]) |
106 |
if not os.path.exists(self.settings["source_path"]): |
107 |
raise CatalystError("Source Path: " + |
108 |
self.settings["source_path"] + " does not exist.", |