1 |
Just do it once and use the temp variable. |
2 |
Comment out some debug print's. |
3 |
Fix options conversion for export to bash. |
4 |
--- |
5 |
catalyst/base/stagebase.py | 43 ++++++++++++++++++++++--------------------- |
6 |
catalyst/defaults.py | 2 ++ |
7 |
2 files changed, 24 insertions(+), 21 deletions(-) |
8 |
|
9 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
10 |
index bebb5dc..b44a957 100644 |
11 |
--- a/catalyst/base/stagebase.py |
12 |
+++ b/catalyst/base/stagebase.py |
13 |
@@ -631,11 +631,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
14 |
""" |
15 |
self.setup_environment() |
16 |
|
17 |
- if os.path.exists(self.settings["sharedir"]+\ |
18 |
- "/targets/support/kill-chroot-pids.sh"): |
19 |
- cmd("/bin/bash "+self.settings["sharedir"]+\ |
20 |
- "/targets/support/kill-chroot-pids.sh",\ |
21 |
- "kill-chroot-pids script failed.",env=self.env) |
22 |
+ killcmd = normpath(self.settings["sharedir"] + |
23 |
+ self.settings["shdir"] + "/support/kill-chroot-pids.sh") |
24 |
+ if os.path.exists(killcmd): |
25 |
+ cmd(killcmd, "kill-chroot-pids script failed.",env=self.env) |
26 |
|
27 |
def mount_safety_check(self): |
28 |
""" |
29 |
@@ -647,10 +646,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
30 |
if not os.path.exists(self.settings["chroot_path"]): |
31 |
return |
32 |
|
33 |
- print "self.mounts =", self.mounts |
34 |
+ #print "self.mounts =", self.mounts |
35 |
for x in self.mounts: |
36 |
target = normpath(self.settings["chroot_path"] + self.target_mounts[x]) |
37 |
- print "mount_safety_check() x =", x, target |
38 |
+ #print "mount_safety_check() x =", x, target |
39 |
if not os.path.exists(target): |
40 |
continue |
41 |
|
42 |
@@ -1020,8 +1019,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
43 |
"Couldn't umount one or more bind-mounts; aborting for safety." |
44 |
|
45 |
def chroot_setup(self): |
46 |
- self.makeconf=read_makeconf(self.settings["chroot_path"]+\ |
47 |
- "/etc/portage/make.conf") |
48 |
+ self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+ |
49 |
+ self.settings["make.conf"])) |
50 |
self.override_cbuild() |
51 |
self.override_chost() |
52 |
self.override_cflags() |
53 |
@@ -1035,8 +1034,6 @@ class StageBase(TargetBase, ClearBase, GenBase): |
54 |
else: |
55 |
print "Setting up chroot..." |
56 |
|
57 |
- #self.makeconf=read_makeconf(self.settings["chroot_path"]+"/etc/portage/make.conf") |
58 |
- |
59 |
cmd("cp /etc/resolv.conf " + self.settings["chroot_path"] + "/etc/", |
60 |
"Could not copy resolv.conf into place.",env=self.env) |
61 |
|
62 |
@@ -1070,10 +1067,11 @@ class StageBase(TargetBase, ClearBase, GenBase): |
63 |
"Could not copy /etc/hosts",env=self.env) |
64 |
|
65 |
""" Modify and write out make.conf (for the chroot) """ |
66 |
- cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.conf",\ |
67 |
- "Could not remove "+self.settings["chroot_path"]+\ |
68 |
- "/etc/portage/make.conf",env=self.env) |
69 |
- myf=open(self.settings["chroot_path"]+"/etc/portage/make.conf","w") |
70 |
+ makepath = normpath(self.settings["chroot_path"] + |
71 |
+ self.settings["make.conf"]) |
72 |
+ cmd("rm -f " + makepath,\ |
73 |
+ "Could not remove " + makepath, env=self.env) |
74 |
+ myf=open(makepath, "w") |
75 |
myf.write("# These settings were set by the catalyst build script that automatically\n# built this stage.\n") |
76 |
myf.write("# Please consult /usr/share/portage/config/make.conf.example for a more\n# detailed example.\n") |
77 |
if "CFLAGS" in self.settings: |
78 |
@@ -1123,10 +1121,11 @@ class StageBase(TargetBase, ClearBase, GenBase): |
79 |
myf.write('PORTDIR_OVERLAY="/usr/local/portage"\n') |
80 |
|
81 |
myf.close() |
82 |
- cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\ |
83 |
- self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\ |
84 |
- "Could not backup /etc/portage/make.conf",env=self.env) |
85 |
- touch(chroot_setup_resume) |
86 |
+ makepath = normpath(self.settings["chroot_path"] + |
87 |
+ self.settings["make.conf"]) |
88 |
+ cmd("cp " + makepath + " " + makepath + ".catalyst",\ |
89 |
+ "Could not backup " + self.settings["make.conf"],env=self.env) |
90 |
+ touch(self.settings["autoresume_path"]+"chroot_setup") |
91 |
|
92 |
def fsscript(self): |
93 |
fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript") |
94 |
@@ -1289,6 +1288,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
95 |
else: |
96 |
try: |
97 |
if os.path.exists(self.settings["controller_file"]): |
98 |
+ print "run_local() starting controller script..." |
99 |
cmd(self.settings["controller_file"]+" run",\ |
100 |
"run script failed.",env=self.env) |
101 |
touch(run_local_resume) |
102 |
@@ -1324,11 +1324,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
103 |
self.env[varname]=string.join(self.settings[x]) |
104 |
elif type(self.settings[x])==types.BooleanType: |
105 |
if self.settings[x]: |
106 |
- self.env[varname]="true" |
107 |
+ self.env[varname] = "true" |
108 |
else: |
109 |
- self.env[varname]="false" |
110 |
+ self.env[varname] = "false" |
111 |
if "makeopts" in self.settings: |
112 |
self.env["MAKEOPTS"]=self.settings["makeopts"] |
113 |
+ #print "setup_environment(); env =", self.env |
114 |
|
115 |
def run(self): |
116 |
self.chroot_lock.write_lock() |
117 |
diff --git a/catalyst/defaults.py b/catalyst/defaults.py |
118 |
index f6b2163..ce7e919 100644 |
119 |
--- a/catalyst/defaults.py |
120 |
+++ b/catalyst/defaults.py |
121 |
@@ -25,12 +25,14 @@ confdefaults={ |
122 |
"hash_function": "crc32", |
123 |
"icecream": "/var/cache/icecream", |
124 |
"local_overlay": "/usr/local/portage", |
125 |
+ "make.conf": "/etc/portage/make.conf", |
126 |
"options": "", |
127 |
"packagedir": "/usr/portage/packages", |
128 |
"portdir": "/usr/portage", |
129 |
"port_tmpdir": "/var/tmp/portage", |
130 |
"repo_name": "portage", |
131 |
"sharedir": "/usr/lib/catalyst", |
132 |
+ "shdir": "/usr/lib/catalyst/targets/", |
133 |
"snapshot_cache": "/var/tmp/catalyst/snapshot_cache", |
134 |
"snapshot_name": "portage-", |
135 |
"storedir": "/var/tmp/catalyst", |
136 |
-- |
137 |
2.1.0 |