1 |
commit: f61ad05ca3539de7454b22c602cb6f30b6ea8f87 |
2 |
Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 6 03:35:34 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 6 03:36:29 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f61ad05c |
7 |
|
8 |
stagebase.py: Whitespace cleanups |
9 |
|
10 |
Add spaces around '=', after ',' |
11 |
Some long line cleanup. |
12 |
|
13 |
Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo.org> |
14 |
|
15 |
catalyst/base/stagebase.py | 540 +++++++++++++++++++++++---------------------- |
16 |
1 file changed, 274 insertions(+), 266 deletions(-) |
17 |
|
18 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
19 |
index 2fd8925..9a36fd3 100644 |
20 |
--- a/catalyst/base/stagebase.py |
21 |
+++ b/catalyst/base/stagebase.py |
22 |
@@ -32,15 +32,15 @@ class StageBase(TargetBase, ClearBase, GenBase): |
23 |
the driver class for pretty much everything that Catalyst does. |
24 |
""" |
25 |
def __init__(self,myspec,addlargs): |
26 |
- self.required_values.extend(["version_stamp","target","subarch",\ |
27 |
- "rel_type","profile","snapshot","source_subpath"]) |
28 |
- |
29 |
- self.valid_values.extend(["version_stamp","target","subarch", |
30 |
- "rel_type","profile","snapshot","source_subpath", |
31 |
- "portage_confdir","portage_prefix","portage_overlay", |
32 |
- "cflags","cxxflags","fcflags","fflags","ldflags","asflags", |
33 |
- "cbuild","hostuse","catalyst_use", |
34 |
- "distcc_hosts","makeopts","pkgcache_path","kerncache_path", |
35 |
+ self.required_values.extend(["version_stamp", "target", "subarch", |
36 |
+ "rel_type", "profile", "snapshot", "source_subpath"]) |
37 |
+ |
38 |
+ self.valid_values.extend(["version_stamp", "target", "subarch", |
39 |
+ "rel_type", "profile", "snapshot", "source_subpath", |
40 |
+ "portage_confdir", "portage_prefix", "portage_overlay", |
41 |
+ "cflags", "cxxflags", "fcflags", "fflags", "ldflags", "asflags", |
42 |
+ "cbuild", "hostuse", "catalyst_use", |
43 |
+ "distcc_hosts", "makeopts", "pkgcache_path", "kerncache_path", |
44 |
"compression_mode", "decompression_mode"]) |
45 |
|
46 |
self.set_valid_build_kernel_vars(addlargs) |
47 |
@@ -75,16 +75,18 @@ class StageBase(TargetBase, ClearBase, GenBase): |
48 |
self.subarchmap = {} |
49 |
machinemap = {} |
50 |
arch_dir = self.settings["archdir"] + "/" |
51 |
- for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") and x != "__init__.py"]: |
52 |
+ for x in [ |
53 |
+ x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") |
54 |
+ and x != "__init__.py"]: |
55 |
log.debug("Begin loading arch modules...") |
56 |
try: |
57 |
- fh=open(arch_dir + x + ".py") |
58 |
- # This next line loads the plugin as a module and assigns it to |
59 |
- # archmap[x] |
60 |
- self.archmap[x]=imp.load_module(x,fh, arch_dir + x + ".py", |
61 |
+ fh = open(arch_dir + x + ".py") |
62 |
+ # This next line loads the plugin as a module and |
63 |
+ # assigns it to archmap[x] |
64 |
+ self.archmap[x] = imp.load_module(x, fh, arch_dir + x + ".py", |
65 |
(".py", "r", imp.PY_SOURCE)) |
66 |
- # This next line registers all the subarches supported in the |
67 |
- # plugin |
68 |
+ # This next line registers all the subarches |
69 |
+ # supported in the plugin |
70 |
tmpsubarchmap, tmpmachinemap = self.archmap[x].register() |
71 |
self.subarchmap.update(tmpsubarchmap) |
72 |
for machine in tmpmachinemap: |
73 |
@@ -102,26 +104,26 @@ class StageBase(TargetBase, ClearBase, GenBase): |
74 |
if "chost" in self.settings: |
75 |
hostmachine = self.settings["chost"].split("-")[0] |
76 |
if hostmachine not in machinemap: |
77 |
- raise CatalystError("Unknown host machine type "+hostmachine) |
78 |
- self.settings["hostarch"]=machinemap[hostmachine] |
79 |
+ raise CatalystError("Unknown host machine type " + hostmachine) |
80 |
+ self.settings["hostarch"] = machinemap[hostmachine] |
81 |
else: |
82 |
hostmachine = self.settings["subarch"] |
83 |
if hostmachine in machinemap: |
84 |
hostmachine = machinemap[hostmachine] |
85 |
- self.settings["hostarch"]=hostmachine |
86 |
+ self.settings["hostarch"] = hostmachine |
87 |
if "cbuild" in self.settings: |
88 |
buildmachine = self.settings["cbuild"].split("-")[0] |
89 |
else: |
90 |
buildmachine = os.uname()[4] |
91 |
if buildmachine not in machinemap: |
92 |
- raise CatalystError("Unknown build machine type "+buildmachine) |
93 |
- self.settings["buildarch"]=machinemap[buildmachine] |
94 |
- self.settings["crosscompile"]=(self.settings["hostarch"]!=\ |
95 |
+ raise CatalystError("Unknown build machine type " + buildmachine) |
96 |
+ self.settings["buildarch"] = machinemap[buildmachine] |
97 |
+ self.settings["crosscompile"] = (self.settings["hostarch"] != \ |
98 |
self.settings["buildarch"]) |
99 |
|
100 |
# Call arch constructor, pass our settings |
101 |
try: |
102 |
- self.arch=self.subarchmap[self.settings["subarch"]](self.settings) |
103 |
+ self.arch = self.subarchmap[self.settings["subarch"]](self.settings) |
104 |
except KeyError: |
105 |
log.critical( |
106 |
'Invalid subarch: %s\n' |
107 |
@@ -131,7 +133,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
108 |
|
109 |
log.notice('Using target: %s', self.settings['target']) |
110 |
# Print a nice informational message |
111 |
- if self.settings["buildarch"]==self.settings["hostarch"]: |
112 |
+ if self.settings["buildarch"] == self.settings["hostarch"]: |
113 |
log.info('Building natively for %s', self.settings['hostarch']) |
114 |
elif self.settings["crosscompile"]: |
115 |
log.info('Cross-compiling on %s for different machine type %s', |
116 |
@@ -145,10 +147,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
117 |
|
118 |
# Initialize our (de)compressor's) |
119 |
self.decompressor = CompressMap(self.settings["decompress_definitions"], |
120 |
- env=self.env, |
121 |
- search_order=self.settings["decompressor_search_order"], |
122 |
- comp_prog=self.settings["comp_prog"], |
123 |
- decomp_opt=self.settings["decomp_opt"]) |
124 |
+ env = self.env, |
125 |
+ search_order = self.settings["decompressor_search_order"], |
126 |
+ comp_prog = self.settings["comp_prog"], |
127 |
+ decomp_opt = self.settings["decomp_opt"]) |
128 |
self.accepted_extensions = self.decompressor.search_order_extensions( |
129 |
self.settings["decompressor_search_order"]) |
130 |
log.notice("Source file specification matching setting is: %s", |
131 |
@@ -197,14 +199,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
132 |
self.set_portage_overlay() |
133 |
self.set_root_overlay() |
134 |
|
135 |
- # This next line checks to make sure that the specified variables exist |
136 |
- # on disk. |
137 |
+ # This next line checks to make sure that the specified variables exist on disk. |
138 |
#pdb.set_trace() |
139 |
- file_locate(self.settings,["distdir"],\ |
140 |
- expand=0) |
141 |
+ file_locate(self.settings, ["distdir"], expand = 0) |
142 |
# If we are using portage_confdir, check that as well. |
143 |
if "portage_confdir" in self.settings: |
144 |
- file_locate(self.settings,["portage_confdir"],expand=0) |
145 |
+ file_locate(self.settings, ["portage_confdir"], expand = 0) |
146 |
|
147 |
# Setup our mount points. |
148 |
# initialize our target mounts. |
149 |
@@ -245,14 +245,13 @@ class StageBase(TargetBase, ClearBase, GenBase): |
150 |
|
151 |
if "ccache" in self.settings["options"]: |
152 |
if "CCACHE_DIR" in os.environ: |
153 |
- ccdir=os.environ["CCACHE_DIR"] |
154 |
+ ccdir = os.environ["CCACHE_DIR"] |
155 |
del os.environ["CCACHE_DIR"] |
156 |
else: |
157 |
- ccdir="/root/.ccache" |
158 |
+ ccdir = "/root/.ccache" |
159 |
if not os.path.isdir(ccdir): |
160 |
raise CatalystError( |
161 |
- "Compiler cache support can't be enabled (can't find "+\ |
162 |
- ccdir+")") |
163 |
+ "Compiler cache support can't be enabled (can't find " + ccdir+")") |
164 |
self.mounts.append("ccache") |
165 |
self.mountmap["ccache"] = ccdir |
166 |
# for the chroot: |
167 |
@@ -261,8 +260,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
168 |
if "icecream" in self.settings["options"]: |
169 |
self.mounts.append("icecream") |
170 |
self.mountmap["icecream"] = self.settings["icecream"] |
171 |
- self.env["PATH"] = self.target_mounts["icecream"] + ":" + \ |
172 |
- self.env["PATH"] |
173 |
+ self.env["PATH"] = self.target_mounts["icecream"] + ":" + self.env["PATH"] |
174 |
|
175 |
if "port_logdir" in self.settings: |
176 |
self.mounts.append("port_logdir") |
177 |
@@ -272,81 +270,81 @@ class StageBase(TargetBase, ClearBase, GenBase): |
178 |
|
179 |
def override_cbuild(self): |
180 |
if "CBUILD" in self.makeconf: |
181 |
- self.settings["CBUILD"]=self.makeconf["CBUILD"] |
182 |
+ self.settings["CBUILD"] = self.makeconf["CBUILD"] |
183 |
|
184 |
def override_chost(self): |
185 |
if "CHOST" in self.makeconf: |
186 |
- self.settings["CHOST"]=self.makeconf["CHOST"] |
187 |
+ self.settings["CHOST"] = self.makeconf["CHOST"] |
188 |
|
189 |
def override_cflags(self): |
190 |
if "CFLAGS" in self.makeconf: |
191 |
- self.settings["CFLAGS"]=self.makeconf["CFLAGS"] |
192 |
+ self.settings["CFLAGS"] = self.makeconf["CFLAGS"] |
193 |
|
194 |
def override_cxxflags(self): |
195 |
if "CXXFLAGS" in self.makeconf: |
196 |
- self.settings["CXXFLAGS"]=self.makeconf["CXXFLAGS"] |
197 |
+ self.settings["CXXFLAGS"] = self.makeconf["CXXFLAGS"] |
198 |
|
199 |
def override_fcflags(self): |
200 |
if "FCFLAGS" in self.makeconf: |
201 |
- self.settings["FCFLAGS"]=self.makeconf["FCFLAGS"] |
202 |
+ self.settings["FCFLAGS"] = self.makeconf["FCFLAGS"] |
203 |
|
204 |
def override_fflags(self): |
205 |
if "FFLAGS" in self.makeconf: |
206 |
- self.settings["FFLAGS"]=self.makeconf["FFLAGS"] |
207 |
+ self.settings["FFLAGS"] = self.makeconf["FFLAGS"] |
208 |
|
209 |
def override_ldflags(self): |
210 |
if "LDFLAGS" in self.makeconf: |
211 |
- self.settings["LDFLAGS"]=self.makeconf["LDFLAGS"] |
212 |
+ self.settings["LDFLAGS"] = self.makeconf["LDFLAGS"] |
213 |
|
214 |
def override_asflags(self): |
215 |
if "ASFLAGS" in self.makeconf: |
216 |
- self.settings["ASFLAGS"]=self.makeconf["ASFLAGS"] |
217 |
+ self.settings["ASFLAGS"] = self.makeconf["ASFLAGS"] |
218 |
|
219 |
def set_install_mask(self): |
220 |
if "install_mask" in self.settings: |
221 |
if not isinstance(self.settings['install_mask'], str): |
222 |
- self.settings["install_mask"]=\ |
223 |
+ self.settings["install_mask"] = \ |
224 |
' '.join(self.settings["install_mask"]) |
225 |
|
226 |
def set_spec_prefix(self): |
227 |
- self.settings["spec_prefix"]=self.settings["target"] |
228 |
+ self.settings["spec_prefix"] = self.settings["target"] |
229 |
|
230 |
def set_target_profile(self): |
231 |
- self.settings["target_profile"]=self.settings["profile"] |
232 |
+ self.settings["target_profile"] = self.settings["profile"] |
233 |
|
234 |
def set_target_subpath(self): |
235 |
- self.settings["target_subpath"]=self.settings["rel_type"]+"/"+\ |
236 |
- self.settings["target"]+"-"+self.settings["subarch"]+"-"+\ |
237 |
- self.settings["version_stamp"] +'/' |
238 |
+ self.settings["target_subpath"] = self.settings["rel_type"] + "/" + \ |
239 |
+ self.settings["target"] + "-" + self.settings["subarch"] + "-" + \ |
240 |
+ self.settings["version_stamp"] + '/' |
241 |
|
242 |
def set_source_subpath(self): |
243 |
if not isinstance(self.settings['source_subpath'], str): |
244 |
raise CatalystError( |
245 |
- "source_subpath should have been a string. Perhaps you have " +\ |
246 |
+ "source_subpath should have been a string. Perhaps you have " + \ |
247 |
"something wrong in your spec file?") |
248 |
|
249 |
def set_pkgcache_path(self): |
250 |
if "pkgcache_path" in self.settings: |
251 |
if not isinstance(self.settings['pkgcache_path'], str): |
252 |
- self.settings["pkgcache_path"]=\ |
253 |
+ self.settings["pkgcache_path"] = \ |
254 |
normpath(self.settings["pkgcache_path"]) |
255 |
else: |
256 |
- self.settings["pkgcache_path"]=\ |
257 |
- normpath(self.settings["storedir"]+"/packages/"+\ |
258 |
- self.settings["target_subpath"]+"/") |
259 |
+ self.settings["pkgcache_path"] = \ |
260 |
+ normpath(self.settings["storedir"] + "/packages/" + \ |
261 |
+ self.settings["target_subpath"] + "/") |
262 |
|
263 |
def set_kerncache_path(self): |
264 |
if "kerncache_path" in self.settings: |
265 |
if not isinstance(self.settings['kerncache_path'], str): |
266 |
- self.settings["kerncache_path"]=\ |
267 |
+ self.settings["kerncache_path"] = \ |
268 |
normpath(self.settings["kerncache_path"]) |
269 |
else: |
270 |
- self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\ |
271 |
- "/kerncache/"+self.settings["target_subpath"]) |
272 |
+ self.settings["kerncache_path"] = normpath(self.settings["storedir"] + \ |
273 |
+ "/kerncache/" + self.settings["target_subpath"]) |
274 |
|
275 |
def set_target_path(self): |
276 |
- self.settings["target_path"]=normpath(self.settings["storedir"]+\ |
277 |
- "/builds/"+self.settings["target_subpath"]) |
278 |
+ self.settings["target_path"] = normpath(self.settings["storedir"] + \ |
279 |
+ "/builds/" + self.settings["target_subpath"]) |
280 |
if "autoresume" in self.settings["options"]\ |
281 |
and self.resume.is_enabled("setup_target_path"): |
282 |
log.notice('Resume point detected, skipping target path setup operation...') |
283 |
@@ -355,67 +353,67 @@ class StageBase(TargetBase, ClearBase, GenBase): |
284 |
ensure_dirs(self.settings["storedir"] + "/builds") |
285 |
|
286 |
def set_fsscript(self): |
287 |
- if self.settings["spec_prefix"]+"/fsscript" in self.settings: |
288 |
- self.settings["fsscript"]=\ |
289 |
- self.settings[self.settings["spec_prefix"]+"/fsscript"] |
290 |
- del self.settings[self.settings["spec_prefix"]+"/fsscript"] |
291 |
+ if self.settings["spec_prefix"] + "/fsscript" in self.settings: |
292 |
+ self.settings["fsscript"] = \ |
293 |
+ self.settings[self.settings["spec_prefix"] + "/fsscript"] |
294 |
+ del self.settings[self.settings["spec_prefix"] + "/fsscript"] |
295 |
|
296 |
def set_rcadd(self): |
297 |
- if self.settings["spec_prefix"]+"/rcadd" in self.settings: |
298 |
- self.settings["rcadd"]=\ |
299 |
- self.settings[self.settings["spec_prefix"]+"/rcadd"] |
300 |
- del self.settings[self.settings["spec_prefix"]+"/rcadd"] |
301 |
+ if self.settings["spec_prefix"] + "/rcadd" in self.settings: |
302 |
+ self.settings["rcadd"] = \ |
303 |
+ self.settings[self.settings["spec_prefix"] + "/rcadd"] |
304 |
+ del self.settings[self.settings["spec_prefix"] + "/rcadd"] |
305 |
|
306 |
def set_rcdel(self): |
307 |
- if self.settings["spec_prefix"]+"/rcdel" in self.settings: |
308 |
- self.settings["rcdel"]=\ |
309 |
- self.settings[self.settings["spec_prefix"]+"/rcdel"] |
310 |
- del self.settings[self.settings["spec_prefix"]+"/rcdel"] |
311 |
+ if self.settings["spec_prefix"] + "/rcdel" in self.settings: |
312 |
+ self.settings["rcdel"] = \ |
313 |
+ self.settings[self.settings["spec_prefix"] + "/rcdel"] |
314 |
+ del self.settings[self.settings["spec_prefix"] + "/rcdel"] |
315 |
|
316 |
def set_cdtar(self): |
317 |
- if self.settings["spec_prefix"]+"/cdtar" in self.settings: |
318 |
- self.settings["cdtar"]=\ |
319 |
- normpath(self.settings[self.settings["spec_prefix"]+"/cdtar"]) |
320 |
- del self.settings[self.settings["spec_prefix"]+"/cdtar"] |
321 |
+ if self.settings["spec_prefix"] + "/cdtar" in self.settings: |
322 |
+ self.settings["cdtar"] = \ |
323 |
+ normpath(self.settings[self.settings["spec_prefix"] + "/cdtar"]) |
324 |
+ del self.settings[self.settings["spec_prefix"] + "/cdtar"] |
325 |
|
326 |
def set_iso(self): |
327 |
- if self.settings["spec_prefix"]+"/iso" in self.settings: |
328 |
- if self.settings[self.settings["spec_prefix"]+"/iso"].startswith('/'): |
329 |
- self.settings["iso"]=\ |
330 |
- normpath(self.settings[self.settings["spec_prefix"]+"/iso"]) |
331 |
+ if self.settings["spec_prefix"] + "/iso" in self.settings: |
332 |
+ if self.settings[self.settings["spec_prefix"] + "/iso"].startswith('/'): |
333 |
+ self.settings["iso"] = \ |
334 |
+ normpath(self.settings[self.settings["spec_prefix"] + "/iso"]) |
335 |
else: |
336 |
# This automatically prepends the build dir to the ISO output path |
337 |
# if it doesn't start with a / |
338 |
self.settings["iso"] = normpath(self.settings["storedir"] + \ |
339 |
"/builds/" + self.settings["rel_type"] + "/" + \ |
340 |
- self.settings[self.settings["spec_prefix"]+"/iso"]) |
341 |
- del self.settings[self.settings["spec_prefix"]+"/iso"] |
342 |
+ self.settings[self.settings["spec_prefix"] + "/iso"]) |
343 |
+ del self.settings[self.settings["spec_prefix"] + "/iso"] |
344 |
|
345 |
def set_fstype(self): |
346 |
- if self.settings["spec_prefix"]+"/fstype" in self.settings: |
347 |
- self.settings["fstype"]=\ |
348 |
- self.settings[self.settings["spec_prefix"]+"/fstype"] |
349 |
- del self.settings[self.settings["spec_prefix"]+"/fstype"] |
350 |
+ if self.settings["spec_prefix"] + "/fstype" in self.settings: |
351 |
+ self.settings["fstype"] = \ |
352 |
+ self.settings[self.settings["spec_prefix"] + "/fstype"] |
353 |
+ del self.settings[self.settings["spec_prefix"] + "/fstype"] |
354 |
|
355 |
if "fstype" not in self.settings: |
356 |
- self.settings["fstype"]="normal" |
357 |
+ self.settings["fstype"] = "normal" |
358 |
for x in self.valid_values: |
359 |
- if x == self.settings["spec_prefix"]+"/fstype": |
360 |
+ if x == self.settings["spec_prefix"] + "/fstype": |
361 |
log.info('%s/fstype is being set to the default of "normal"', |
362 |
self.settings['spec_prefix']) |
363 |
|
364 |
def set_fsops(self): |
365 |
if "fstype" in self.settings: |
366 |
self.valid_values.append("fsops") |
367 |
- if self.settings["spec_prefix"]+"/fsops" in self.settings: |
368 |
- self.settings["fsops"]=\ |
369 |
- self.settings[self.settings["spec_prefix"]+"/fsops"] |
370 |
- del self.settings[self.settings["spec_prefix"]+"/fsops"] |
371 |
+ if self.settings["spec_prefix"] + "/fsops" in self.settings: |
372 |
+ self.settings["fsops"] = \ |
373 |
+ self.settings[self.settings["spec_prefix"] + "/fsops"] |
374 |
+ del self.settings[self.settings["spec_prefix"] + "/fsops"] |
375 |
|
376 |
def set_source_path(self): |
377 |
if "seedcache" in self.settings["options"]\ |
378 |
- and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\ |
379 |
- self.settings["source_subpath"]+"/")): |
380 |
+ and os.path.isdir(normpath(self.settings["storedir"] + "/tmp/" + |
381 |
+ self.settings["source_subpath"] + "/")): |
382 |
self.settings["source_path"] = normpath(self.settings["storedir"] + |
383 |
"/tmp/" + self.settings["source_subpath"] + "/") |
384 |
else: |
385 |
@@ -436,23 +434,23 @@ class StageBase(TargetBase, ClearBase, GenBase): |
386 |
self.settings["source_path_hash"] = \ |
387 |
self.settings["hash_map"].generate_hash( |
388 |
self.settings["source_path"], |
389 |
- hash_=self.settings["hash_function"]) |
390 |
+ hash_ = self.settings["hash_function"]) |
391 |
log.notice('Source path set to %s', self.settings['source_path']) |
392 |
|
393 |
def set_dest_path(self): |
394 |
if "root_path" in self.settings: |
395 |
- self.settings["destpath"]=normpath(self.settings["chroot_path"]+\ |
396 |
+ self.settings["destpath"] = normpath(self.settings["chroot_path"] + |
397 |
self.settings["root_path"]) |
398 |
else: |
399 |
- self.settings["destpath"]=normpath(self.settings["chroot_path"]) |
400 |
+ self.settings["destpath"] = normpath(self.settings["chroot_path"]) |
401 |
|
402 |
def set_cleanables(self): |
403 |
- self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/tmp/*",\ |
404 |
+ self.settings["cleanables"] = ["/etc/resolv.conf", "/var/tmp/*", "/tmp/*", |
405 |
"/root/*", self.settings["portdir"]] |
406 |
|
407 |
def set_snapshot_path(self): |
408 |
- self.settings["snapshot_path"]= file_check( |
409 |
- normpath(self.settings["storedir"]+\ |
410 |
+ self.settings["snapshot_path"] = file_check( |
411 |
+ normpath(self.settings["storedir"] + |
412 |
"/snapshots/" + self.settings["snapshot_name"] + |
413 |
self.settings["snapshot"]), |
414 |
self.accepted_extensions, |
415 |
@@ -462,17 +460,17 @@ class StageBase(TargetBase, ClearBase, GenBase): |
416 |
self.settings["snapshot_path_hash"] = \ |
417 |
self.settings["hash_map"].generate_hash( |
418 |
self.settings["snapshot_path"], |
419 |
- hash_=self.settings["hash_function"]) |
420 |
+ hash_ = self.settings["hash_function"]) |
421 |
|
422 |
def set_snapcache_path(self): |
423 |
- self.settings["snapshot_cache_path"]=\ |
424 |
+ self.settings["snapshot_cache_path"] = \ |
425 |
normpath(pjoin(self.settings["snapshot_cache"], |
426 |
self.settings["snapshot"])) |
427 |
if "snapcache" in self.settings["options"]: |
428 |
self.settings["snapshot_cache_path"] = \ |
429 |
normpath(pjoin(self.settings["snapshot_cache"], |
430 |
self.settings["snapshot"])) |
431 |
- self.snapcache_lock=\ |
432 |
+ self.snapcache_lock = \ |
433 |
LockDir(self.settings["snapshot_cache_path"]) |
434 |
log.info('Setting snapshot cache to %s', self.settings['snapshot_cache_path']) |
435 |
|
436 |
@@ -481,9 +479,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
437 |
NOTE: the trailing slash has been removed |
438 |
Things *could* break if you don't use a proper join() |
439 |
""" |
440 |
- self.settings["chroot_path"]=normpath(self.settings["storedir"]+\ |
441 |
- "/tmp/"+self.settings["target_subpath"].rstrip('/')) |
442 |
- self.chroot_lock=LockDir(self.settings["chroot_path"]) |
443 |
+ self.settings["chroot_path"] = normpath(self.settings["storedir"] + |
444 |
+ "/tmp/" + self.settings["target_subpath"].rstrip('/')) |
445 |
+ self.chroot_lock = LockDir(self.settings["chroot_path"]) |
446 |
|
447 |
def set_autoresume_path(self): |
448 |
self.settings["autoresume_path"] = normpath(pjoin( |
449 |
@@ -497,19 +495,19 @@ class StageBase(TargetBase, ClearBase, GenBase): |
450 |
self.resume = AutoResume(self.settings["autoresume_path"], mode=0o755) |
451 |
|
452 |
def set_controller_file(self): |
453 |
- self.settings["controller_file"]=normpath(self.settings["sharedir"]+\ |
454 |
- "/targets/"+self.settings["target"]+"/"+self.settings["target"]+\ |
455 |
- "-controller.sh") |
456 |
+ self.settings["controller_file"] = normpath(self.settings["sharedir"] + |
457 |
+ "/targets/" + self.settings["target"] + "/" + self.settings["target"] |
458 |
+ + "-controller.sh") |
459 |
|
460 |
def set_iso_volume_id(self): |
461 |
- if self.settings["spec_prefix"]+"/volid" in self.settings: |
462 |
- self.settings["iso_volume_id"]=\ |
463 |
- self.settings[self.settings["spec_prefix"]+"/volid"] |
464 |
- if len(self.settings["iso_volume_id"])>32: |
465 |
+ if self.settings["spec_prefix"] + "/volid" in self.settings: |
466 |
+ self.settings["iso_volume_id"] = \ |
467 |
+ self.settings[self.settings["spec_prefix"] + "/volid"] |
468 |
+ if len(self.settings["iso_volume_id"]) > 32: |
469 |
raise CatalystError( |
470 |
"ISO volume ID must not exceed 32 characters.") |
471 |
else: |
472 |
- self.settings["iso_volume_id"]="catalyst "+self.settings["snapshot"] |
473 |
+ self.settings["iso_volume_id"] = "catalyst "+self.settings["snapshot"] |
474 |
|
475 |
def set_default_action_sequence(self): |
476 |
""" Default action sequence for run method. |
477 |
@@ -524,10 +522,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
478 |
|
479 |
def set_action_sequence(self): |
480 |
"""Set basic stage1, 2, 3 action sequences""" |
481 |
- self.settings["action_sequence"]=["unpack","unpack_snapshot",\ |
482 |
- "setup_confdir","portage_overlay",\ |
483 |
- "base_dirs","bind","chroot_setup","setup_environment",\ |
484 |
- "run_local","preclean","unbind","clean"] |
485 |
+ self.settings["action_sequence"] = ["unpack"," unpack_snapshot", |
486 |
+ "setup_confdir", "portage_overlay", |
487 |
+ "base_dirs", "bind", "chroot_setup", "setup_environment", |
488 |
+ "run_local", "preclean", "unbind", "clean"] |
489 |
self.set_completion_action_sequences() |
490 |
|
491 |
def set_completion_action_sequences(self): |
492 |
@@ -543,20 +541,20 @@ class StageBase(TargetBase, ClearBase, GenBase): |
493 |
return |
494 |
|
495 |
def set_use(self): |
496 |
- if self.settings["spec_prefix"]+"/use" in self.settings: |
497 |
- self.settings["use"]=\ |
498 |
- self.settings[self.settings["spec_prefix"]+"/use"] |
499 |
- del self.settings[self.settings["spec_prefix"]+"/use"] |
500 |
+ if self.settings["spec_prefix"] + "/use" in self.settings: |
501 |
+ self.settings["use"] = \ |
502 |
+ self.settings[self.settings["spec_prefix"] + "/use"] |
503 |
+ del self.settings[self.settings["spec_prefix"] + "/use"] |
504 |
if "use" not in self.settings: |
505 |
- self.settings["use"]="" |
506 |
+ self.settings["use"] = "" |
507 |
if isinstance(self.settings['use'], str): |
508 |
- self.settings["use"]=self.settings["use"].split() |
509 |
+ self.settings["use"] = self.settings["use"].split() |
510 |
|
511 |
def set_catalyst_use(self): |
512 |
if self.settings["spec_prefix"] + "/catalyst_use" in self.settings: |
513 |
self.settings["catalyst_use"] = \ |
514 |
- self.settings[self.settings["spec_prefix"]+"/catalyst_use"] |
515 |
- del self.settings[self.settings["spec_prefix"]+"/catalyst_use"] |
516 |
+ self.settings[self.settings["spec_prefix"] + "/catalyst_use"] |
517 |
+ del self.settings[self.settings["spec_prefix"] + "/catalyst_use"] |
518 |
if "catalyst_use" not in self.settings: |
519 |
self.settings["catalyst_use"] = "" |
520 |
if isinstance(self.settings['catalyst_use'], str): |
521 |
@@ -567,7 +565,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
522 |
self.settings["catalyst_use"].append("bindist") |
523 |
|
524 |
def set_stage_path(self): |
525 |
- self.settings["stage_path"]=normpath(self.settings["chroot_path"]) |
526 |
+ self.settings["stage_path"] = normpath(self.settings["chroot_path"]) |
527 |
|
528 |
def set_mounts(self): |
529 |
pass |
530 |
@@ -576,86 +574,86 @@ class StageBase(TargetBase, ClearBase, GenBase): |
531 |
pass |
532 |
|
533 |
def set_rm(self): |
534 |
- if self.settings["spec_prefix"]+"/rm" in self.settings: |
535 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/rm'], str): |
536 |
- self.settings[self.settings["spec_prefix"]+"/rm"]=\ |
537 |
- self.settings[self.settings["spec_prefix"]+"/rm"].split() |
538 |
+ if self.settings["spec_prefix"] + "/rm" in self.settings: |
539 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/rm'], str): |
540 |
+ self.settings[self.settings["spec_prefix"] + "/rm"] = \ |
541 |
+ self.settings[self.settings["spec_prefix"] + "/rm"].split() |
542 |
|
543 |
def set_linuxrc(self): |
544 |
- if self.settings["spec_prefix"]+"/linuxrc" in self.settings: |
545 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/linuxrc'], str): |
546 |
- self.settings["linuxrc"]=\ |
547 |
- self.settings[self.settings["spec_prefix"]+"/linuxrc"] |
548 |
- del self.settings[self.settings["spec_prefix"]+"/linuxrc"] |
549 |
+ if self.settings["spec_prefix"] + "/linuxrc" in self.settings: |
550 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/linuxrc'], str): |
551 |
+ self.settings["linuxrc"] = \ |
552 |
+ self.settings[self.settings["spec_prefix"] + "/linuxrc"] |
553 |
+ del self.settings[self.settings["spec_prefix"] + "/linuxrc"] |
554 |
|
555 |
def set_busybox_config(self): |
556 |
- if self.settings["spec_prefix"]+"/busybox_config" in self.settings: |
557 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/busybox_config'], str): |
558 |
- self.settings["busybox_config"]=\ |
559 |
- self.settings[self.settings["spec_prefix"]+"/busybox_config"] |
560 |
- del self.settings[self.settings["spec_prefix"]+"/busybox_config"] |
561 |
+ if self.settings["spec_prefix"] + "/busybox_config" in self.settings: |
562 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/busybox_config'], str): |
563 |
+ self.settings["busybox_config"] = \ |
564 |
+ self.settings[self.settings["spec_prefix"] + "/busybox_config"] |
565 |
+ del self.settings[self.settings["spec_prefix"] + "/busybox_config"] |
566 |
|
567 |
def set_portage_overlay(self): |
568 |
if "portage_overlay" in self.settings: |
569 |
if isinstance(self.settings['portage_overlay'], str): |
570 |
- self.settings["portage_overlay"]=\ |
571 |
+ self.settings["portage_overlay"] = \ |
572 |
self.settings["portage_overlay"].split() |
573 |
log.info('portage_overlay directories are set to: %s', |
574 |
' '.join(self.settings['portage_overlay'])) |
575 |
|
576 |
# def set_portage_prefix(self): |
577 |
# if "portage_prefix" in self.settings: |
578 |
-# self.settings["portage_prefix"]= |
579 |
+# self.settings["portage_prefix"] = "" |
580 |
|
581 |
def set_overlay(self): |
582 |
- if self.settings["spec_prefix"]+"/overlay" in self.settings: |
583 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/overlay'], str): |
584 |
- self.settings[self.settings["spec_prefix"]+"/overlay"]=\ |
585 |
- self.settings[self.settings["spec_prefix"]+\ |
586 |
+ if self.settings["spec_prefix"] + "/overlay" in self.settings: |
587 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/overlay'], str): |
588 |
+ self.settings[self.settings["spec_prefix"] + "/overlay"] = \ |
589 |
+ self.settings[self.settings["spec_prefix"] + \ |
590 |
"/overlay"].split() |
591 |
|
592 |
def set_root_overlay(self): |
593 |
- if self.settings["spec_prefix"]+"/root_overlay" in self.settings: |
594 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/root_overlay'], str): |
595 |
- self.settings[self.settings["spec_prefix"]+"/root_overlay"]=\ |
596 |
- self.settings[self.settings["spec_prefix"]+\ |
597 |
+ if self.settings["spec_prefix"] + "/root_overlay" in self.settings: |
598 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/root_overlay'], str): |
599 |
+ self.settings[self.settings["spec_prefix"] + "/root_overlay"] = \ |
600 |
+ self.settings[self.settings["spec_prefix"] + \ |
601 |
"/root_overlay"].split() |
602 |
|
603 |
def set_root_path(self): |
604 |
""" ROOT= variable for emerges """ |
605 |
- self.settings["root_path"]="/" |
606 |
+ self.settings["root_path"] = "/" |
607 |
|
608 |
def set_valid_build_kernel_vars(self,addlargs): |
609 |
if "boot/kernel" in addlargs: |
610 |
if isinstance(addlargs['boot/kernel'], str): |
611 |
- loopy=[addlargs["boot/kernel"]] |
612 |
+ loopy = [addlargs["boot/kernel"]] |
613 |
else: |
614 |
- loopy=addlargs["boot/kernel"] |
615 |
+ loopy = addlargs["boot/kernel"] |
616 |
|
617 |
for x in loopy: |
618 |
- self.valid_values.append("boot/kernel/"+x+"/aliases") |
619 |
- self.valid_values.append("boot/kernel/"+x+"/config") |
620 |
- self.valid_values.append("boot/kernel/"+x+"/console") |
621 |
- self.valid_values.append("boot/kernel/"+x+"/extraversion") |
622 |
- self.valid_values.append("boot/kernel/"+x+"/gk_action") |
623 |
- self.valid_values.append("boot/kernel/"+x+"/gk_kernargs") |
624 |
- self.valid_values.append("boot/kernel/"+x+"/initramfs_overlay") |
625 |
- self.valid_values.append("boot/kernel/"+x+"/machine_type") |
626 |
- self.valid_values.append("boot/kernel/"+x+"/sources") |
627 |
- self.valid_values.append("boot/kernel/"+x+"/softlevel") |
628 |
- self.valid_values.append("boot/kernel/"+x+"/use") |
629 |
- self.valid_values.append("boot/kernel/"+x+"/packages") |
630 |
- self.valid_values.append("boot/kernel/"+x+"/kernelopts") |
631 |
- if "boot/kernel/"+x+"/packages" in addlargs: |
632 |
- if isinstance(addlargs['boot/kernel/'+x+'/packages'], str): |
633 |
- addlargs["boot/kernel/"+x+"/packages"]=\ |
634 |
- [addlargs["boot/kernel/"+x+"/packages"]] |
635 |
+ self.valid_values.append("boot/kernel/" + x + "/aliases") |
636 |
+ self.valid_values.append("boot/kernel/" + x + "/config") |
637 |
+ self.valid_values.append("boot/kernel/" + x + "/console") |
638 |
+ self.valid_values.append("boot/kernel/" + x + "/extraversion") |
639 |
+ self.valid_values.append("boot/kernel/" + x + "/gk_action") |
640 |
+ self.valid_values.append("boot/kernel/" + x + "/gk_kernargs") |
641 |
+ self.valid_values.append("boot/kernel/" + x + "/initramfs_overlay") |
642 |
+ self.valid_values.append("boot/kernel/" + x + "/machine_type") |
643 |
+ self.valid_values.append("boot/kernel/" + x + "/sources") |
644 |
+ self.valid_values.append("boot/kernel/" + x + "/softlevel") |
645 |
+ self.valid_values.append("boot/kernel/" + x + "/use") |
646 |
+ self.valid_values.append("boot/kernel/" + x + "/packages") |
647 |
+ self.valid_values.append("boot/kernel/" + x + "/kernelopts") |
648 |
+ if "boot/kernel/" + x + "/packages" in addlargs: |
649 |
+ if isinstance(addlargs['boot/kernel/' + x + '/packages'], str): |
650 |
+ addlargs["boot/kernel/" + x + "/packages"] = \ |
651 |
+ [addlargs["boot/kernel/" + x + "/packages"]] |
652 |
|
653 |
def set_build_kernel_vars(self): |
654 |
- if self.settings["spec_prefix"]+"/gk_mainargs" in self.settings: |
655 |
- self.settings["gk_mainargs"]=\ |
656 |
- self.settings[self.settings["spec_prefix"]+"/gk_mainargs"] |
657 |
- del self.settings[self.settings["spec_prefix"]+"/gk_mainargs"] |
658 |
+ if self.settings["spec_prefix"] + "/gk_mainargs" in self.settings: |
659 |
+ self.settings["gk_mainargs"] = \ |
660 |
+ self.settings[self.settings["spec_prefix"] + "/gk_mainargs"] |
661 |
+ del self.settings[self.settings["spec_prefix"] + "/gk_mainargs"] |
662 |
|
663 |
def kill_chroot_pids(self): |
664 |
log.info('Checking for processes running in chroot and killing them.') |
665 |
@@ -666,7 +664,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
666 |
killcmd = normpath(self.settings["sharedir"] + |
667 |
self.settings["shdir"] + "/support/kill-chroot-pids.sh") |
668 |
if os.path.exists(killcmd): |
669 |
- cmd([killcmd], env=self.env) |
670 |
+ cmd([killcmd], env = self.env) |
671 |
|
672 |
def mount_safety_check(self): |
673 |
""" |
674 |
@@ -699,22 +697,22 @@ class StageBase(TargetBase, ClearBase, GenBase): |
675 |
raise CatalystError("Unable to auto-unbind " + target) |
676 |
|
677 |
def unpack(self): |
678 |
- _unpack=True |
679 |
+ _unpack = True |
680 |
|
681 |
clst_unpack_hash = self.resume.get("unpack") |
682 |
|
683 |
unpack_info = self.decompressor.create_infodict( |
684 |
- source=self.settings["source_path"], |
685 |
- destination=self.settings["chroot_path"], |
686 |
- arch=self.settings["compressor_arch"], |
687 |
- other_options=self.settings["compressor_options"], |
688 |
+ source = self.settings["source_path"], |
689 |
+ destination = self.settings["chroot_path"], |
690 |
+ arch = self.settings["compressor_arch"], |
691 |
+ other_options = self.settings["compressor_options"], |
692 |
) |
693 |
|
694 |
display_msg = ( |
695 |
'Starting %(mode)s from %(source)s\nto ' |
696 |
'%(destination)s (this may take some time) ..') |
697 |
|
698 |
- error_msg="'%(mode)s' extraction of %(source)s to %(destination)s failed." |
699 |
+ error_msg = "'%(mode)s' extraction of %(source)s to %(destination)s failed." |
700 |
|
701 |
if "seedcache" in self.settings["options"]: |
702 |
if os.path.isdir(unpack_info["source"]): |
703 |
@@ -733,26 +731,26 @@ class StageBase(TargetBase, ClearBase, GenBase): |
704 |
if os.path.isdir(self.settings["source_path"]) \ |
705 |
and self.resume.is_enabled("unpack"): |
706 |
# Autoresume is valid, SEEDCACHE is valid |
707 |
- _unpack=False |
708 |
- invalid_snapshot=False |
709 |
+ _unpack = False |
710 |
+ invalid_snapshot = False |
711 |
|
712 |
elif os.path.isfile(self.settings["source_path"]) \ |
713 |
- and self.settings["source_path_hash"]==clst_unpack_hash: |
714 |
+ and self.settings["source_path_hash"] == clst_unpack_hash: |
715 |
# Autoresume is valid, tarball is valid |
716 |
- _unpack=False |
717 |
- invalid_snapshot=False |
718 |
+ _unpack = False |
719 |
+ invalid_snapshot = False |
720 |
|
721 |
elif os.path.isdir(self.settings["source_path"]) \ |
722 |
and self.resume.is_disabled("unpack"): |
723 |
# Autoresume is invalid, SEEDCACHE |
724 |
- _unpack=True |
725 |
- invalid_snapshot=True |
726 |
+ _unpack = True |
727 |
+ invalid_snapshot = True |
728 |
|
729 |
elif os.path.isfile(self.settings["source_path"]) \ |
730 |
- and self.settings["source_path_hash"]!=clst_unpack_hash: |
731 |
+ and self.settings["source_path_hash"] != clst_unpack_hash: |
732 |
# Autoresume is invalid, tarball |
733 |
- _unpack=True |
734 |
- invalid_snapshot=True |
735 |
+ _unpack = True |
736 |
+ invalid_snapshot = True |
737 |
unpack_info['source'] = file_check(unpack_info['source']) |
738 |
|
739 |
else: |
740 |
@@ -760,18 +758,18 @@ class StageBase(TargetBase, ClearBase, GenBase): |
741 |
if "seedcache" in self.settings["options"]: |
742 |
# SEEDCACHE so let's run rsync and let it clean up |
743 |
if os.path.isdir(self.settings["source_path"]): |
744 |
- _unpack=True |
745 |
- invalid_snapshot=False |
746 |
+ _unpack = True |
747 |
+ invalid_snapshot = False |
748 |
elif os.path.isfile(self.settings["source_path"]): |
749 |
# Tarball so unpack and remove anything already there |
750 |
- _unpack=True |
751 |
- invalid_snapshot=True |
752 |
+ _unpack = True |
753 |
+ invalid_snapshot = True |
754 |
# No autoresume, no SEEDCACHE |
755 |
else: |
756 |
# Tarball so unpack and remove anything already there |
757 |
if os.path.isfile(self.settings["source_path"]): |
758 |
- _unpack=True |
759 |
- invalid_snapshot=True |
760 |
+ _unpack = True |
761 |
+ invalid_snapshot = True |
762 |
elif os.path.isdir(self.settings["source_path"]): |
763 |
# We should never reach this, so something is very wrong |
764 |
raise CatalystError( |
765 |
@@ -790,13 +788,13 @@ class StageBase(TargetBase, ClearBase, GenBase): |
766 |
|
767 |
ensure_dirs(self.settings["chroot_path"]) |
768 |
|
769 |
- ensure_dirs(self.settings["chroot_path"]+"/tmp",mode=1777) |
770 |
+ ensure_dirs(self.settings["chroot_path"] + "/tmp", mode=1777) |
771 |
|
772 |
if "pkgcache" in self.settings["options"]: |
773 |
- ensure_dirs(self.settings["pkgcache_path"],mode=0o755) |
774 |
+ ensure_dirs(self.settings["pkgcache_path"], mode=0o755) |
775 |
|
776 |
if "kerncache" in self.settings["options"]: |
777 |
- ensure_dirs(self.settings["kerncache_path"],mode=0o755) |
778 |
+ ensure_dirs(self.settings["kerncache_path"], mode=0o755) |
779 |
|
780 |
log.notice('%s', display_msg % unpack_info) |
781 |
|
782 |
@@ -806,23 +804,23 @@ class StageBase(TargetBase, ClearBase, GenBase): |
783 |
|
784 |
if "source_path_hash" in self.settings: |
785 |
self.resume.enable("unpack", |
786 |
- data=self.settings["source_path_hash"]) |
787 |
+ data = self.settings["source_path_hash"]) |
788 |
else: |
789 |
self.resume.enable("unpack") |
790 |
else: |
791 |
log.notice('Resume point detected, skipping unpack operation...') |
792 |
|
793 |
def unpack_snapshot(self): |
794 |
- unpack=True |
795 |
+ unpack = True |
796 |
snapshot_hash = self.resume.get("unpack_portage") |
797 |
|
798 |
- unpack_errmsg="Error unpacking snapshot using mode %(mode)s" |
799 |
+ unpack_errmsg = "Error unpacking snapshot using mode %(mode)s" |
800 |
|
801 |
unpack_info = self.decompressor.create_infodict( |
802 |
- source=self.settings["snapshot_path"], |
803 |
- destination=self.settings["snapshot_cache_path"], |
804 |
- arch=self.settings["compressor_arch"], |
805 |
- other_options=self.settings["compressor_options"], |
806 |
+ source = self.settings["snapshot_path"], |
807 |
+ destination = self.settings["snapshot_cache_path"], |
808 |
+ arch = self.settings["compressor_arch"], |
809 |
+ other_options = self.settings["compressor_options"], |
810 |
) |
811 |
|
812 |
target_portdir = normpath(self.settings["chroot_path"] + |
813 |
@@ -836,15 +834,15 @@ class StageBase(TargetBase, ClearBase, GenBase): |
814 |
unpack_info['mode'] = self.decompressor.determine_mode( |
815 |
unpack_info['source']) |
816 |
|
817 |
- cleanup_msg="Cleaning up invalid snapshot cache at \n\t"+\ |
818 |
- self.settings["snapshot_cache_path"]+\ |
819 |
+ cleanup_msg = "Cleaning up invalid snapshot cache at \n\t" + \ |
820 |
+ self.settings["snapshot_cache_path"] + \ |
821 |
" (this can take a long time)..." |
822 |
|
823 |
- if self.settings["snapshot_path_hash"]==snapshot_cache_hash: |
824 |
+ if self.settings["snapshot_path_hash"] == snapshot_cache_hash: |
825 |
log.info('Valid snapshot cache, skipping unpack of portage tree...') |
826 |
- unpack=False |
827 |
+ unpack = False |
828 |
else: |
829 |
- cleanup_msg=\ |
830 |
+ cleanup_msg = \ |
831 |
'Cleaning up existing portage tree (this can take a long time)...' |
832 |
unpack_info['destination'] = normpath( |
833 |
self.settings["chroot_path"] + self.settings["repo_basedir"]) |
834 |
@@ -875,7 +873,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
835 |
else: |
836 |
log.info('Setting snapshot autoresume point') |
837 |
self.resume.enable("unpack_portage", |
838 |
- data=self.settings["snapshot_path_hash"]) |
839 |
+ data = self.settings["snapshot_path_hash"]) |
840 |
|
841 |
if "snapcache" in self.settings["options"]: |
842 |
self.snapcache_lock.unlock() |
843 |
@@ -888,7 +886,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
844 |
# TODO: zmedico and I discussed making this a directory and pushing |
845 |
# in a parent file, as well as other user-specified configuration. |
846 |
log.info('Configuring profile link...') |
847 |
- clear_path(self.settings['chroot_path'] + |
848 |
+ clear_path(self.settings['chroot_path'] + \ |
849 |
self.settings['port_conf'] + '/make.profile') |
850 |
ensure_dirs(self.settings['chroot_path'] + self.settings['port_conf']) |
851 |
cmd(['ln', '-sf', |
852 |
@@ -920,15 +918,15 @@ class StageBase(TargetBase, ClearBase, GenBase): |
853 |
if os.path.exists(x): |
854 |
log.info('Copying overlay dir %s', x) |
855 |
ensure_dirs(self.settings['chroot_path'] + self.settings['local_overlay']) |
856 |
- cmd("cp -a "+x+"/* "+self.settings["chroot_path"]+\ |
857 |
- self.settings["local_overlay"],\ |
858 |
+ cmd("cp -a " + x + "/* " + self.settings["chroot_path"] + |
859 |
+ self.settings["local_overlay"], |
860 |
env=self.env) |
861 |
|
862 |
def root_overlay(self): |
863 |
""" Copy over the root_overlay """ |
864 |
- if self.settings["spec_prefix"]+"/root_overlay" in self.settings: |
865 |
- for x in self.settings[self.settings["spec_prefix"]+\ |
866 |
- "/root_overlay"]: |
867 |
+ if self.settings["spec_prefix"] + "/root_overlay" in self.settings: |
868 |
+ for x in self.settings[self.settings["spec_prefix"] + |
869 |
+ "/root_overlay"]: |
870 |
if os.path.exists(x): |
871 |
log.info('Copying root_overlay: %s', x) |
872 |
cmd(['rsync', '-a', x + '/', self.settings['chroot_path']], |
873 |
@@ -947,7 +945,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
874 |
if self.mountmap[x] not in ["tmpfs", "shmfs"]: |
875 |
ensure_dirs(self.mountmap[x], mode=0o755) |
876 |
|
877 |
- src=self.mountmap[x] |
878 |
+ src = self.mountmap[x] |
879 |
log.debug('bind(); src = %s', src) |
880 |
if "snapcache" in self.settings["options"] and x == "portdir": |
881 |
self.snapcache_lock.read_lock() |
882 |
@@ -973,9 +971,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
883 |
log.debug('bind(); finished :D') |
884 |
|
885 |
def unbind(self): |
886 |
- ouch=0 |
887 |
- mypath=self.settings["chroot_path"] |
888 |
- myrevmounts=self.mounts[:] |
889 |
+ ouch = 0 |
890 |
+ mypath = self.settings["chroot_path"] |
891 |
+ myrevmounts = self.mounts[:] |
892 |
myrevmounts.reverse() |
893 |
# Unmount in reverse order for nested bind-mounts |
894 |
for x in myrevmounts: |
895 |
@@ -997,7 +995,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
896 |
try: |
897 |
cmd(['umount', target]) |
898 |
except CatalystError: |
899 |
- ouch=1 |
900 |
+ ouch = 1 |
901 |
log.warning("Couldn't umount bind mount: %s", target) |
902 |
|
903 |
if "snapcache" in self.settings["options"] and x == "/usr/portage": |
904 |
@@ -1016,7 +1014,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
905 |
"Couldn't umount one or more bind-mounts; aborting for safety.") |
906 |
|
907 |
def chroot_setup(self): |
908 |
- self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+ |
909 |
+ self.makeconf = read_makeconf(normpath(self.settings["chroot_path"] + |
910 |
self.settings["make_conf"])) |
911 |
self.override_cbuild() |
912 |
self.override_chost() |
913 |
@@ -1062,7 +1060,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
914 |
makepath = normpath(self.settings["chroot_path"] + |
915 |
self.settings["make_conf"]) |
916 |
clear_path(makepath) |
917 |
- myf=open(makepath, "w") |
918 |
+ myf = open(makepath, "w") |
919 |
myf.write("# These settings were set by the catalyst build script " |
920 |
"that automatically\n# built this stage.\n") |
921 |
myf.write("# Please consult " |
922 |
@@ -1090,17 +1088,17 @@ class StageBase(TargetBase, ClearBase, GenBase): |
923 |
myf.write("# This should not be changed unless you know exactly" |
924 |
" what you are doing. You\n# should probably be " |
925 |
"using a different stage, instead.\n") |
926 |
- myf.write('CBUILD="'+self.settings["CBUILD"]+'"\n') |
927 |
+ myf.write('CBUILD="' + self.settings["CBUILD"] + '"\n') |
928 |
|
929 |
if "CHOST" in self.settings: |
930 |
myf.write("# WARNING: Changing your CHOST is not something " |
931 |
"that should be done lightly.\n# Please consult " |
932 |
"https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable " |
933 |
"before changing.\n") |
934 |
- myf.write('CHOST="'+self.settings["CHOST"]+'"\n') |
935 |
+ myf.write('CHOST="' + self.settings["CHOST"] + '"\n') |
936 |
|
937 |
# Figure out what our USE vars are for building |
938 |
- myusevars=[] |
939 |
+ myusevars = [] |
940 |
if "HOSTUSE" in self.settings: |
941 |
myusevars.extend(self.settings["HOSTUSE"]) |
942 |
|
943 |
@@ -1119,14 +1117,16 @@ class StageBase(TargetBase, ClearBase, GenBase): |
944 |
'package.use in the profile and portage_confdir.\n' |
945 |
"You've been warned!", self.settings['spec_prefix']) |
946 |
|
947 |
- myuseexpandvars={} |
948 |
+ myuseexpandvars = {} |
949 |
if "HOSTUSEEXPAND" in self.settings: |
950 |
for hostuseexpand in self.settings["HOSTUSEEXPAND"]: |
951 |
- myuseexpandvars.update({hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) |
952 |
+ myuseexpandvars.update( |
953 |
+ {hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) |
954 |
|
955 |
if myuseexpandvars: |
956 |
for hostuseexpand in myuseexpandvars: |
957 |
- myf.write(hostuseexpand + '="' + ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') |
958 |
+ myf.write(hostuseexpand + '="' + |
959 |
+ ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') |
960 |
|
961 |
myf.write('PORTDIR="%s"\n' % self.settings['portdir']) |
962 |
myf.write('DISTDIR="%s"\n' % self.settings['distdir']) |
963 |
@@ -1189,7 +1189,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
964 |
try: |
965 |
with open(make_conf) as f: |
966 |
data = f.readlines() |
967 |
- data = ''.join(x for x in data if not x.startswith('PORTDIR_OVERLAY')) |
968 |
+ data = ''.join(x for x in data |
969 |
+ if not x.startswith('PORTDIR_OVERLAY')) |
970 |
with open(make_conf, 'w') as f: |
971 |
f.write(data) |
972 |
except OSError as e: |
973 |
@@ -1210,15 +1211,18 @@ class StageBase(TargetBase, ClearBase, GenBase): |
974 |
and self.resume.is_enabled("empty"): |
975 |
log.notice('Resume point detected, skipping empty operation...') |
976 |
else: |
977 |
- if self.settings["spec_prefix"]+"/empty" in self.settings: |
978 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/empty'], str): |
979 |
- self.settings[self.settings["spec_prefix"]+"/empty"]=\ |
980 |
- self.settings[self.settings["spec_prefix"]+\ |
981 |
+ if self.settings["spec_prefix"] + "/empty" in self.settings: |
982 |
+ if isinstance( |
983 |
+ self.settings[self.settings['spec_prefix'] + '/empty'], |
984 |
+ str): |
985 |
+ self.settings[self.settings["spec_prefix"] + "/empty"] = \ |
986 |
+ self.settings[self.settings["spec_prefix"] + \ |
987 |
"/empty"].split() |
988 |
- for x in self.settings[self.settings["spec_prefix"]+"/empty"]: |
989 |
- myemp=self.settings["destpath"]+x |
990 |
+ for x in self.settings[self.settings["spec_prefix"] + "/empty"]: |
991 |
+ myemp = self.settings["destpath"] + x |
992 |
if not os.path.isdir(myemp) or os.path.islink(myemp): |
993 |
- log.warning('not a directory or does not exist, skipping "empty" operation: %s', x) |
994 |
+ log.warning('not a directory or does not exist, ' |
995 |
+ 'skipping "empty" operation: %s', x) |
996 |
continue |
997 |
log.info('Emptying directory %s', x) |
998 |
clear_dir(myemp) |
999 |
@@ -1229,8 +1233,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1000 |
and self.resume.is_enabled("remove"): |
1001 |
log.notice('Resume point detected, skipping remove operation...') |
1002 |
else: |
1003 |
- if self.settings["spec_prefix"]+"/rm" in self.settings: |
1004 |
- for x in self.settings[self.settings["spec_prefix"]+"/rm"]: |
1005 |
+ if self.settings["spec_prefix"] + "/rm" in self.settings: |
1006 |
+ for x in self.settings[self.settings["spec_prefix"] + "/rm"]: |
1007 |
# We're going to shell out for all these cleaning |
1008 |
# operations, so we get easy glob handling. |
1009 |
log.notice('livecd: removing %s', x) |
1010 |
@@ -1377,7 +1381,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1011 |
self.env[varname] = "false" |
1012 |
|
1013 |
if "makeopts" in self.settings: |
1014 |
- self.env["MAKEOPTS"]=self.settings["makeopts"] |
1015 |
+ self.env["MAKEOPTS"] = self.settings["makeopts"] |
1016 |
log.debug('setup_environment(); env = %r', self.env) |
1017 |
|
1018 |
def run(self): |
1019 |
@@ -1431,10 +1435,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1020 |
and self.resume.is_enabled("unmerge"): |
1021 |
log.notice('Resume point detected, skipping unmerge operation...') |
1022 |
else: |
1023 |
- if self.settings["spec_prefix"]+"/unmerge" in self.settings: |
1024 |
- if isinstance(self.settings[self.settings['spec_prefix']+'/unmerge'], str): |
1025 |
- self.settings[self.settings["spec_prefix"]+"/unmerge"]=\ |
1026 |
- [self.settings[self.settings["spec_prefix"]+"/unmerge"]] |
1027 |
+ if self.settings["spec_prefix"] + "/unmerge" in self.settings: |
1028 |
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/unmerge'], str): |
1029 |
+ self.settings[self.settings["spec_prefix"] + "/unmerge"] = \ |
1030 |
+ [self.settings[self.settings["spec_prefix"] + "/unmerge"]] |
1031 |
|
1032 |
# Before cleaning, unmerge stuff |
1033 |
try: |
1034 |
@@ -1462,8 +1466,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1035 |
and self.resume.is_enabled("setup_overlay"): |
1036 |
log.notice('Resume point detected, skipping setup_overlay operation...') |
1037 |
else: |
1038 |
- if self.settings["spec_prefix"]+"/overlay" in self.settings: |
1039 |
- for x in self.settings[self.settings["spec_prefix"]+"/overlay"]: |
1040 |
+ if self.settings["spec_prefix"] + "/overlay" in self.settings: |
1041 |
+ for x in self.settings[self.settings["spec_prefix"] + "/overlay"]: |
1042 |
if os.path.exists(x): |
1043 |
cmd(['rsync', '-a', x + '/', self.settings['target_path']], |
1044 |
env=self.env) |
1045 |
@@ -1482,7 +1486,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1046 |
self.gen_digest_file(self.settings["iso"]) |
1047 |
self.resume.enable("create_iso") |
1048 |
else: |
1049 |
- log.warning('livecd/iso was not defined. An ISO Image will not be created.') |
1050 |
+ log.warning('livecd/iso was not defined. ' |
1051 |
+ 'An ISO Image will not be created.') |
1052 |
|
1053 |
def build_packages(self): |
1054 |
build_packages_resume = pjoin(self.settings["autoresume_path"], |
1055 |
@@ -1491,11 +1496,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1056 |
and self.resume.is_enabled("build_packages"): |
1057 |
log.notice('Resume point detected, skipping build_packages operation...') |
1058 |
else: |
1059 |
- if self.settings["spec_prefix"]+"/packages" in self.settings: |
1060 |
+ if self.settings["spec_prefix"] + "/packages" in self.settings: |
1061 |
target_pkgs = self.settings["spec_prefix"] + '/packages' |
1062 |
if "autoresume" in self.settings["options"] \ |
1063 |
and self.resume.is_enabled("build_packages"): |
1064 |
- log.notice('Resume point detected, skipping build_packages operation...') |
1065 |
+ log.notice('Resume point detected, skipping build_packages ' |
1066 |
+ 'operation...') |
1067 |
else: |
1068 |
command = [self.settings['controller_file'], 'build_packages'] |
1069 |
if isinstance(self.settings[target_pkgs], str): |
1070 |
@@ -1508,7 +1514,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1071 |
self.resume.enable("build_packages") |
1072 |
except CatalystError: |
1073 |
self.unbind() |
1074 |
- raise CatalystError(self.settings["spec_prefix"]+\ |
1075 |
+ raise CatalystError( |
1076 |
+ self.settings["spec_prefix"] + |
1077 |
"build aborting due to error.") |
1078 |
|
1079 |
def build_kernel(self): |
1080 |
@@ -1519,14 +1526,14 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1081 |
else: |
1082 |
if "boot/kernel" in self.settings: |
1083 |
try: |
1084 |
- mynames=self.settings["boot/kernel"] |
1085 |
+ mynames = self.settings["boot/kernel"] |
1086 |
if isinstance(mynames, str): |
1087 |
- mynames=[mynames] |
1088 |
+ mynames = [mynames] |
1089 |
# Execute the script that sets up the kernel build environment |
1090 |
cmd([self.settings['controller_file'], 'pre-kmerge'], |
1091 |
env=self.env) |
1092 |
for kname in mynames: |
1093 |
- self._build_kernel(kname=kname) |
1094 |
+ self._build_kernel(kname = kname) |
1095 |
self.resume.enable("build_kernel") |
1096 |
except CatalystError: |
1097 |
self.unbind() |
1098 |
@@ -1537,8 +1544,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1099 |
def _build_kernel(self, kname): |
1100 |
"Build a single configured kernel by name" |
1101 |
if "autoresume" in self.settings["options"] \ |
1102 |
- and self.resume.is_enabled("build_kernel_"+kname): |
1103 |
- log.notice('Resume point detected, skipping build_kernel for %s operation...', kname) |
1104 |
+ and self.resume.is_enabled("build_kernel_" + kname): |
1105 |
+ log.notice('Resume point detected, skipping build_kernel ' |
1106 |
+ 'for %s operation...', kname) |
1107 |
return |
1108 |
self._copy_kernel_config(kname=kname) |
1109 |
|
1110 |
@@ -1550,9 +1558,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1111 |
|
1112 |
if not isinstance(myopts, str): |
1113 |
myopts = ' '.join(myopts) |
1114 |
- self.env[kname+"_kernelopts"]=myopts |
1115 |
+ self.env[kname + "_kernelopts"] = myopts |
1116 |
else: |
1117 |
- self.env[kname+"_kernelopts"]="" |
1118 |
+ self.env[kname + "_kernelopts"] = "" |
1119 |
|
1120 |
key = 'boot/kernel/' + kname + '/extraversion' |
1121 |
self.settings.setdefault(key, '') |
1122 |
@@ -1564,11 +1572,11 @@ class StageBase(TargetBase, ClearBase, GenBase): |
1123 |
cmd([self.settings['controller_file'], 'kernel', kname], |
1124 |
env=self.env) |
1125 |
|
1126 |
- if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings: |
1127 |
+ if "boot/kernel/" + kname + "/initramfs_overlay" in self.settings: |
1128 |
log.notice('Cleaning up temporary overlay dir') |
1129 |
clear_dir(self.settings['chroot_path'] + '/tmp/initramfs_overlay/') |
1130 |
|
1131 |
- self.resume.is_enabled("build_kernel_"+kname) |
1132 |
+ self.resume.is_enabled("build_kernel_" + kname) |
1133 |
|
1134 |
# Execute the script that cleans up the kernel build environment |
1135 |
cmd([self.settings['controller_file'], 'post-kmerge'], |