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