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