1 |
It's uncommon to dump docstrings in the middle of code in the place of |
2 |
comments. Convert them all to standard comments. |
3 |
--- |
4 |
catalyst/base/stagebase.py | 219 ++++++++++++++++++------------------------- |
5 |
catalyst/fileops.py | 8 +- |
6 |
catalyst/targets/snapshot.py | 8 +- |
7 |
3 files changed, 99 insertions(+), 136 deletions(-) |
8 |
|
9 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
10 |
index fcdf729..813e5f1 100644 |
11 |
--- a/catalyst/base/stagebase.py |
12 |
+++ b/catalyst/base/stagebase.py |
13 |
@@ -49,29 +49,27 @@ class StageBase(TargetBase, ClearBase, GenBase): |
14 |
GenBase.__init__(self, myspec) |
15 |
ClearBase.__init__(self, myspec) |
16 |
|
17 |
- """ |
18 |
- The semantics of subarchmap and machinemap changed a bit in 2.0.3 to |
19 |
- work better with vapier's CBUILD stuff. I've removed the "monolithic" |
20 |
- machinemap from this file and split up its contents amongst the |
21 |
- various arch/foo.py files. |
22 |
- |
23 |
- When register() is called on each module in the arch/ dir, it now |
24 |
- returns a tuple instead of acting on the subarchmap dict that is |
25 |
- passed to it. The tuple contains the values that were previously |
26 |
- added to subarchmap as well as a new list of CHOSTs that go along |
27 |
- with that arch. This allows us to build machinemap on the fly based |
28 |
- on the keys in subarchmap and the values of the 2nd list returned |
29 |
- (tmpmachinemap). |
30 |
- |
31 |
- Also, after talking with vapier. I have a slightly better idea of what |
32 |
- certain variables are used for and what they should be set to. Neither |
33 |
- 'buildarch' or 'hostarch' are used directly, so their value doesn't |
34 |
- really matter. They are just compared to determine if we are |
35 |
- cross-compiling. Because of this, they are just set to the name of the |
36 |
- module in arch/ that the subarch is part of to make things simpler. |
37 |
- The entire build process is still based off of 'subarch' like it was |
38 |
- previously. -agaffney |
39 |
- """ |
40 |
+ # The semantics of subarchmap and machinemap changed a bit in 2.0.3 to |
41 |
+ # work better with vapier's CBUILD stuff. I've removed the "monolithic" |
42 |
+ # machinemap from this file and split up its contents amongst the |
43 |
+ # various arch/foo.py files. |
44 |
+ # |
45 |
+ # When register() is called on each module in the arch/ dir, it now |
46 |
+ # returns a tuple instead of acting on the subarchmap dict that is |
47 |
+ # passed to it. The tuple contains the values that were previously |
48 |
+ # added to subarchmap as well as a new list of CHOSTs that go along |
49 |
+ # with that arch. This allows us to build machinemap on the fly based |
50 |
+ # on the keys in subarchmap and the values of the 2nd list returned |
51 |
+ # (tmpmachinemap). |
52 |
+ # |
53 |
+ # Also, after talking with vapier. I have a slightly better idea of what |
54 |
+ # certain variables are used for and what they should be set to. Neither |
55 |
+ # 'buildarch' or 'hostarch' are used directly, so their value doesn't |
56 |
+ # really matter. They are just compared to determine if we are |
57 |
+ # cross-compiling. Because of this, they are just set to the name of the |
58 |
+ # module in arch/ that the subarch is part of to make things simpler. |
59 |
+ # The entire build process is still based off of 'subarch' like it was |
60 |
+ # previously. -agaffney |
61 |
|
62 |
self.makeconf = {} |
63 |
self.archmap = {} |
64 |
@@ -81,16 +79,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
65 |
for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") and x != "__init__.py"]: |
66 |
try: |
67 |
fh=open(arch_dir + x + ".py") |
68 |
- """ |
69 |
- This next line loads the plugin as a module and assigns it to |
70 |
- archmap[x] |
71 |
- """ |
72 |
+ # This next line loads the plugin as a module and assigns it to |
73 |
+ # archmap[x] |
74 |
self.archmap[x]=imp.load_module(x,fh, arch_dir + x + ".py", |
75 |
(".py", "r", imp.PY_SOURCE)) |
76 |
- """ |
77 |
- This next line registers all the subarches supported in the |
78 |
- plugin |
79 |
- """ |
80 |
+ # This next line registers all the subarches supported in the |
81 |
+ # plugin |
82 |
tmpsubarchmap, tmpmachinemap = self.archmap[x].register() |
83 |
self.subarchmap.update(tmpsubarchmap) |
84 |
for machine in tmpmachinemap: |
85 |
@@ -99,11 +93,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
86 |
machinemap[subarch] = x |
87 |
fh.close() |
88 |
except IOError: |
89 |
- """ |
90 |
- This message should probably change a bit, since everything in |
91 |
- the dir should load just fine. If it doesn't, it's probably a |
92 |
- syntax error in the module |
93 |
- """ |
94 |
+ # This message should probably change a bit, since everything in |
95 |
+ # the dir should load just fine. If it doesn't, it's probably a |
96 |
+ # syntax error in the module |
97 |
msg("Can't find/load " + x + ".py plugin in " + arch_dir) |
98 |
|
99 |
if "chost" in self.settings: |
100 |
@@ -126,7 +118,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
101 |
self.settings["crosscompile"]=(self.settings["hostarch"]!=\ |
102 |
self.settings["buildarch"]) |
103 |
|
104 |
- """ Call arch constructor, pass our settings """ |
105 |
+ # Call arch constructor, pass our settings |
106 |
try: |
107 |
self.arch=self.subarchmap[self.settings["subarch"]](self.settings) |
108 |
except KeyError: |
109 |
@@ -138,7 +130,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
110 |
sys.exit(2) |
111 |
|
112 |
print "Using target:",self.settings["target"] |
113 |
- """ Print a nice informational message """ |
114 |
+ # Print a nice informational message |
115 |
if self.settings["buildarch"]==self.settings["hostarch"]: |
116 |
print "Building natively for",self.settings["hostarch"] |
117 |
elif self.settings["crosscompile"]: |
118 |
@@ -148,15 +140,15 @@ class StageBase(TargetBase, ClearBase, GenBase): |
119 |
print "Building on",self.settings["buildarch"],\ |
120 |
"for alternate personality type",self.settings["hostarch"] |
121 |
|
122 |
- """ This must be set first as other set_ options depend on this """ |
123 |
+ # This must be set first as other set_ options depend on this |
124 |
self.set_spec_prefix() |
125 |
|
126 |
- """ Define all of our core variables """ |
127 |
+ # Define all of our core variables |
128 |
self.set_target_profile() |
129 |
self.set_target_subpath() |
130 |
self.set_source_subpath() |
131 |
|
132 |
- """ Set paths """ |
133 |
+ # Set paths |
134 |
self.snapshot_lock_object = None |
135 |
self.set_snapshot_path() |
136 |
self.set_root_path() |
137 |
@@ -190,18 +182,16 @@ class StageBase(TargetBase, ClearBase, GenBase): |
138 |
self.set_portage_overlay() |
139 |
self.set_root_overlay() |
140 |
|
141 |
- """ |
142 |
- This next line checks to make sure that the specified variables exist |
143 |
- on disk. |
144 |
- """ |
145 |
+ # This next line checks to make sure that the specified variables exist |
146 |
+ # on disk. |
147 |
#pdb.set_trace() |
148 |
file_locate(self.settings,["distdir"],\ |
149 |
expand=0) |
150 |
- """ If we are using portage_confdir, check that as well. """ |
151 |
+ # If we are using portage_confdir, check that as well. |
152 |
if "portage_confdir" in self.settings: |
153 |
file_locate(self.settings,["portage_confdir"],expand=0) |
154 |
|
155 |
- """ Setup our mount points """ |
156 |
+ # Setup our mount points. |
157 |
# initialize our target mounts. |
158 |
self.target_mounts = TARGET_MOUNT_DEFAULTS.copy() |
159 |
|
160 |
@@ -224,10 +214,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
161 |
|
162 |
self.set_mounts() |
163 |
|
164 |
- """ |
165 |
- Configure any user specified options (either in catalyst.conf or on |
166 |
- the command line). |
167 |
- """ |
168 |
+ # Configure any user specified options (either in catalyst.conf or on |
169 |
+ # the command line). |
170 |
if "pkgcache" in self.settings["options"]: |
171 |
self.set_pkgcache_path() |
172 |
print "Location of the package cache is "+\ |
173 |
@@ -254,7 +242,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
174 |
ccdir+")") |
175 |
self.mounts.append("ccache") |
176 |
self.mountmap["ccache"] = ccdir |
177 |
- """ for the chroot: """ |
178 |
+ # for the chroot: |
179 |
self.env["CCACHE_DIR"] = self.target_mounts["ccache"] |
180 |
|
181 |
if "icecream" in self.settings["options"]: |
182 |
@@ -359,7 +347,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
183 |
print \ |
184 |
"Resume point detected, skipping target path setup operation..." |
185 |
else: |
186 |
- """ First clean up any existing target stuff """ |
187 |
+ # First clean up any existing target stuff |
188 |
# XXX WTF are we removing the old tarball before we start building the |
189 |
# XXX new one? If the build fails, you don't want to be left with |
190 |
# XXX nothing at all |
191 |
@@ -655,9 +643,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
192 |
def kill_chroot_pids(self): |
193 |
print "Checking for processes running in chroot and killing them." |
194 |
|
195 |
- """ |
196 |
- Force environment variables to be exported so script can see them |
197 |
- """ |
198 |
+ # Force environment variables to be exported so script can see them |
199 |
self.setup_environment() |
200 |
|
201 |
killcmd = normpath(self.settings["sharedir"] + |
202 |
@@ -683,10 +669,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
203 |
continue |
204 |
|
205 |
if ismount(target): |
206 |
- """ Something is still mounted "" """ |
207 |
+ # Something is still mounted |
208 |
try: |
209 |
print target + " is still mounted; performing auto-bind-umount...", |
210 |
- """ Try to umount stuff ourselves """ |
211 |
+ # Try to umount stuff ourselves |
212 |
self.unbind() |
213 |
if ismount(target): |
214 |
raise CatalystError("Auto-unbind failed for " + target) |
215 |
@@ -714,33 +700,33 @@ class StageBase(TargetBase, ClearBase, GenBase): |
216 |
|
217 |
if "seedcache" in self.settings["options"]: |
218 |
if os.path.isdir(unpack_info["source"]): |
219 |
- """ SEEDCACHE Is a directory, use rsync """ |
220 |
+ # SEEDCACHE Is a directory, use rsync |
221 |
unpack_info['mode'] = "rsync" |
222 |
else: |
223 |
- """ SEEDCACHE is a not a directory, try untar'ing """ |
224 |
+ # SEEDCACHE is a not a directory, try untar'ing |
225 |
print "Referenced SEEDCACHE does not appear to be a directory, trying to untar..." |
226 |
unpack_info['source'] = file_check(unpack_info['source']) |
227 |
else: |
228 |
- """ No SEEDCACHE, use tar """ |
229 |
+ # No SEEDCACHE, use tar |
230 |
unpack_info['source'] = file_check(unpack_info['source']) |
231 |
# endif "seedcache" |
232 |
|
233 |
if "autoresume" in self.settings["options"]: |
234 |
if os.path.isdir(self.settings["source_path"]) \ |
235 |
and self.resume.is_enabled("unpack"): |
236 |
- """ Autoresume is valid, SEEDCACHE is valid """ |
237 |
+ # Autoresume is valid, SEEDCACHE is valid |
238 |
_unpack=False |
239 |
invalid_snapshot=False |
240 |
|
241 |
elif os.path.isfile(self.settings["source_path"]) \ |
242 |
and self.settings["source_path_hash"]==clst_unpack_hash: |
243 |
- """ Autoresume is valid, tarball is valid """ |
244 |
+ # Autoresume is valid, tarball is valid |
245 |
_unpack=False |
246 |
invalid_snapshot=False |
247 |
|
248 |
elif os.path.isdir(self.settings["source_path"]) \ |
249 |
and self.resume.is_disabled("unpack"): |
250 |
- """ Autoresume is invalid, SEEDCACHE """ |
251 |
+ # Autoresume is invalid, SEEDCACHE |
252 |
_unpack=True |
253 |
invalid_snapshot=True |
254 |
# check and reset the unpack_info['source'] |
255 |
@@ -748,30 +734,30 @@ class StageBase(TargetBase, ClearBase, GenBase): |
256 |
|
257 |
elif os.path.isfile(self.settings["source_path"]) \ |
258 |
and self.settings["source_path_hash"]!=clst_unpack_hash: |
259 |
- """ Autoresume is invalid, tarball """ |
260 |
+ # Autoresume is invalid, tarball |
261 |
_unpack=True |
262 |
invalid_snapshot=True |
263 |
unpack_info['source'] = file_check(unpack_info['source']) |
264 |
|
265 |
else: |
266 |
- """ No autoresume, SEEDCACHE """ |
267 |
+ # No autoresume, SEEDCACHE |
268 |
if "seedcache" in self.settings["options"]: |
269 |
- """ SEEDCACHE so let's run rsync and let it clean up """ |
270 |
+ # SEEDCACHE so let's run rsync and let it clean up |
271 |
if os.path.isdir(self.settings["source_path"]): |
272 |
_unpack=True |
273 |
invalid_snapshot=False |
274 |
elif os.path.isfile(self.settings["source_path"]): |
275 |
- """ Tarball so unpack and remove anything already there """ |
276 |
+ # Tarball so unpack and remove anything already there |
277 |
_unpack=True |
278 |
invalid_snapshot=True |
279 |
- """ No autoresume, no SEEDCACHE """ |
280 |
+ # No autoresume, no SEEDCACHE |
281 |
else: |
282 |
- """ Tarball so unpack and remove anything already there """ |
283 |
+ # Tarball so unpack and remove anything already there |
284 |
if os.path.isfile(self.settings["source_path"]): |
285 |
_unpack=True |
286 |
invalid_snapshot=True |
287 |
elif os.path.isdir(self.settings["source_path"]): |
288 |
- """ We should never reach this, so something is very wrong """ |
289 |
+ # We should never reach this, so something is very wrong |
290 |
raise CatalystError( |
291 |
"source path is a dir but seedcache is not enabled") |
292 |
|
293 |
@@ -987,7 +973,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
294 |
mypath=self.settings["chroot_path"] |
295 |
myrevmounts=self.mounts[:] |
296 |
myrevmounts.reverse() |
297 |
- """ Unmount in reverse order for nested bind-mounts """ |
298 |
+ # Unmount in reverse order for nested bind-mounts |
299 |
for x in myrevmounts: |
300 |
target = normpath(mypath + self.target_mounts[x]) |
301 |
if not os.path.exists(target): |
302 |
@@ -1011,20 +997,16 @@ class StageBase(TargetBase, ClearBase, GenBase): |
303 |
|
304 |
if "snapcache" in self.settings["options"] and x == "/usr/portage": |
305 |
try: |
306 |
- """ |
307 |
- It's possible the snapshot lock object isn't created yet. |
308 |
- This is because mount safety check calls unbind before the |
309 |
- target is fully initialized |
310 |
- """ |
311 |
+ # It's possible the snapshot lock object isn't created yet. |
312 |
+ # This is because mount safety check calls unbind before the |
313 |
+ # target is fully initialized |
314 |
self.snapshot_lock_object.unlock() |
315 |
except Exception: |
316 |
pass |
317 |
if ouch: |
318 |
- """ |
319 |
- if any bind mounts really failed, then we need to raise |
320 |
- this to potentially prevent an upcoming bash stage cleanup script |
321 |
- from wiping our bind mounts. |
322 |
- """ |
323 |
+ # if any bind mounts really failed, then we need to raise |
324 |
+ # this to potentially prevent an upcoming bash stage cleanup script |
325 |
+ # from wiping our bind mounts. |
326 |
raise CatalystError( |
327 |
"Couldn't umount one or more bind-mounts; aborting for safety.") |
328 |
|
329 |
@@ -1048,7 +1030,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
330 |
cmd("cp /etc/resolv.conf " + self.settings["chroot_path"] + "/etc/", |
331 |
"Could not copy resolv.conf into place.",env=self.env) |
332 |
|
333 |
- """ Copy over the envscript, if applicable """ |
334 |
+ # Copy over the envscript, if applicable |
335 |
if "envscript" in self.settings: |
336 |
if not os.path.exists(self.settings["envscript"]): |
337 |
raise CatalystError( |
338 |
@@ -1067,10 +1049,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
339 |
self.settings["chroot_path"]+"/tmp/envscript",\ |
340 |
"Could not copy envscript into place.",env=self.env) |
341 |
|
342 |
- """ |
343 |
- Copy over /etc/hosts from the host in case there are any |
344 |
- specialties in there |
345 |
- """ |
346 |
+ # Copy over /etc/hosts from the host in case there are any |
347 |
+ # specialties in there |
348 |
if os.path.exists(self.settings["chroot_path"]+"/etc/hosts"): |
349 |
cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+\ |
350 |
self.settings["chroot_path"]+"/etc/hosts.catalyst",\ |
351 |
@@ -1078,7 +1058,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
352 |
cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts",\ |
353 |
"Could not copy /etc/hosts",env=self.env) |
354 |
|
355 |
- """ Modify and write out make.conf (for the chroot) """ |
356 |
+ # Modify and write out make.conf (for the chroot) |
357 |
makepath = normpath(self.settings["chroot_path"] + |
358 |
self.settings["make_conf"]) |
359 |
cmd("rm -f " + makepath,\ |
360 |
@@ -1124,7 +1104,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
361 |
myf.write("# WARNING: Changing your CHOST is not something that should be done lightly.\n# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.\n") |
362 |
myf.write('CHOST="'+self.settings["CHOST"]+'"\n') |
363 |
|
364 |
- """ Figure out what our USE vars are for building """ |
365 |
+ # Figure out what our USE vars are for building |
366 |
myusevars=[] |
367 |
if "HOSTUSE" in self.settings: |
368 |
myusevars.extend(self.settings["HOSTUSE"]) |
369 |
@@ -1155,7 +1135,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
370 |
myf.write('DISTDIR="%s"\n' % self.settings['distdir']) |
371 |
myf.write('PKGDIR="%s"\n' % self.settings['packagedir']) |
372 |
|
373 |
- """ Setup the portage overlay """ |
374 |
+ # Setup the portage overlay |
375 |
if "portage_overlay" in self.settings: |
376 |
myf.write('PORTDIR_OVERLAY="/usr/local/portage"\n') |
377 |
|
378 |
@@ -1193,13 +1173,13 @@ class StageBase(TargetBase, ClearBase, GenBase): |
379 |
cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+\ |
380 |
x,env=self.env) |
381 |
|
382 |
- """ Put /etc/hosts back into place """ |
383 |
+ # Put /etc/hosts back into place |
384 |
if os.path.exists(self.settings["chroot_path"]+"/etc/hosts.catalyst"): |
385 |
cmd("mv -f "+self.settings["chroot_path"]+"/etc/hosts.catalyst "+\ |
386 |
self.settings["chroot_path"]+"/etc/hosts",\ |
387 |
"Could not replace /etc/hosts",env=self.env) |
388 |
|
389 |
- """ Remove our overlay """ |
390 |
+ # Remove our overlay |
391 |
if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]): |
392 |
cmd("rm -rf " + self.settings["chroot_path"] + self.settings["local_overlay"], |
393 |
"Could not remove " + self.settings["local_overlay"], env=self.env) |
394 |
@@ -1207,7 +1187,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
395 |
self.settings["make_conf"],\ |
396 |
"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env) |
397 |
|
398 |
- """ Clean up old and obsoleted files in /etc """ |
399 |
+ # Clean up old and obsoleted files in /etc |
400 |
if os.path.exists(self.settings["stage_path"]+"/etc"): |
401 |
cmd("find "+self.settings["stage_path"]+\ |
402 |
"/etc -maxdepth 1 -name \"*-\" | xargs rm -f",\ |
403 |
@@ -1235,10 +1215,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
404 |
print x,"not a directory or does not exist, skipping 'empty' operation." |
405 |
continue |
406 |
print "Emptying directory",x |
407 |
- """ |
408 |
- stat the dir, delete the dir, recreate the dir and set |
409 |
- the proper perms and ownership |
410 |
- """ |
411 |
+ # stat the dir, delete the dir, recreate the dir and set |
412 |
+ # the proper perms and ownership |
413 |
mystat=os.stat(myemp) |
414 |
shutil.rmtree(myemp) |
415 |
ensure_dirs(myemp, mode=0755) |
416 |
@@ -1253,10 +1231,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
417 |
else: |
418 |
if self.settings["spec_prefix"]+"/rm" in self.settings: |
419 |
for x in self.settings[self.settings["spec_prefix"]+"/rm"]: |
420 |
- """ |
421 |
- We're going to shell out for all these cleaning |
422 |
- operations, so we get easy glob handling. |
423 |
- """ |
424 |
+ # We're going to shell out for all these cleaning |
425 |
+ # operations, so we get easy glob handling. |
426 |
print "livecd: removing "+x |
427 |
os.system("rm -rf "+self.settings["chroot_path"]+x) |
428 |
try: |
429 |
@@ -1294,11 +1270,11 @@ class StageBase(TargetBase, ClearBase, GenBase): |
430 |
and self.resume.is_enabled("capture"): |
431 |
print "Resume point detected, skipping capture operation..." |
432 |
else: |
433 |
- print """ Capture target in a tarball """ |
434 |
- """ Remove filename from path """ |
435 |
+ print "Capture target in a tarball" |
436 |
+ # Remove filename from path |
437 |
mypath = os.path.dirname(self.settings["target_path"]) |
438 |
|
439 |
- """ Now make sure path exists """ |
440 |
+ # Now make sure path exists |
441 |
ensure_dirs(mypath) |
442 |
|
443 |
pack_info = self.compressor.create_infodict( |
444 |
@@ -1354,12 +1330,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
445 |
for opt in self.settings[x]: |
446 |
self.env['clst_' + opt.upper()] = "true" |
447 |
continue |
448 |
- """ Sanitize var names by doing "s|/-.|_|g" """ |
449 |
+ # Sanitize var names by doing "s|/-.|_|g" |
450 |
varname = "clst_" + x.replace("/", "_") |
451 |
varname = varname.replace("-", "_") |
452 |
varname = varname.replace(".", "_") |
453 |
if type(self.settings[x])==types.StringType: |
454 |
- """ Prefix to prevent namespace clashes """ |
455 |
+ # Prefix to prevent namespace clashes |
456 |
#os.environ[varname]=self.settings[x] |
457 |
self.env[varname]=self.settings[x] |
458 |
elif type(self.settings[x])==types.ListType: |
459 |
@@ -1400,10 +1376,10 @@ class StageBase(TargetBase, ClearBase, GenBase): |
460 |
def run(self): |
461 |
self.chroot_lock.write_lock() |
462 |
|
463 |
- """ Kill any pids in the chroot "" """ |
464 |
+ # Kill any pids in the chroot |
465 |
self.kill_chroot_pids() |
466 |
|
467 |
- """ Check for mounts right away and abort if we cannot unmount them """ |
468 |
+ # Check for mounts right away and abort if we cannot unmount them |
469 |
self.mount_safety_check() |
470 |
|
471 |
if "clear-autoresume" in self.settings["options"]: |
472 |
@@ -1460,14 +1436,12 @@ class StageBase(TargetBase, ClearBase, GenBase): |
473 |
self.settings[self.settings["spec_prefix"]+"/unmerge"][:] |
474 |
|
475 |
for x in range(0,len(myunmerge)): |
476 |
- """ |
477 |
- Surround args with quotes for passing to bash, allows |
478 |
- things like "<" to remain intact |
479 |
- """ |
480 |
+ # Surround args with quotes for passing to bash, allows |
481 |
+ # things like "<" to remain intact |
482 |
myunmerge[x]="'"+myunmerge[x]+"'" |
483 |
myunmerge = ' '.join(myunmerge) |
484 |
|
485 |
- """ Before cleaning, unmerge stuff """ |
486 |
+ # Before cleaning, unmerge stuff |
487 |
try: |
488 |
cmd(self.settings["controller_file"]+\ |
489 |
" unmerge "+ myunmerge,"Unmerge script failed.",\ |
490 |
@@ -1508,7 +1482,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
491 |
and self.resume.is_enabled("create_iso"): |
492 |
print "Resume point detected, skipping create_iso operation..." |
493 |
else: |
494 |
- """ Create the ISO """ |
495 |
+ # Create the ISO |
496 |
if "iso" in self.settings: |
497 |
cmd(self.settings["controller_file"]+" iso "+\ |
498 |
self.settings["iso"],"ISO creation script failed.",\ |
499 |
@@ -1557,9 +1531,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
500 |
mynames=self.settings["boot/kernel"] |
501 |
if type(mynames)==types.StringType: |
502 |
mynames=[mynames] |
503 |
- """ |
504 |
- Execute the script that sets up the kernel build environment |
505 |
- """ |
506 |
+ # Execute the script that sets up the kernel build environment |
507 |
cmd(self.settings["controller_file"]+\ |
508 |
" pre-kmerge ","Runscript pre-kmerge failed",\ |
509 |
env=self.env) |
510 |
@@ -1580,10 +1552,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
511 |
return |
512 |
self._copy_kernel_config(kname=kname) |
513 |
|
514 |
- """ |
515 |
- If we need to pass special options to the bootloader |
516 |
- for this kernel put them into the environment |
517 |
- """ |
518 |
+ # If we need to pass special options to the bootloader |
519 |
+ # for this kernel put them into the environment |
520 |
if "boot/kernel/"+kname+"/kernelopts" in self.settings: |
521 |
myopts=self.settings["boot/kernel/"+kname+\ |
522 |
"/kernelopts"] |
523 |
@@ -1605,7 +1575,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
524 |
|
525 |
self._copy_initramfs_overlay(kname=kname) |
526 |
|
527 |
- """ Execute the script that builds the kernel """ |
528 |
+ # Execute the script that builds the kernel |
529 |
cmd("/bin/bash "+self.settings["controller_file"]+\ |
530 |
" kernel "+kname,\ |
531 |
"Runscript kernel build failed",env=self.env) |
532 |
@@ -1619,10 +1589,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
533 |
|
534 |
self.resume.is_enabled("build_kernel_"+kname) |
535 |
|
536 |
- """ |
537 |
- Execute the script that cleans up the kernel build |
538 |
- environment |
539 |
- """ |
540 |
+ # Execute the script that cleans up the kernel build environment |
541 |
cmd("/bin/bash "+self.settings["controller_file"]+\ |
542 |
" post-kmerge ", |
543 |
"Runscript post-kmerge failed",env=self.env) |
544 |
diff --git a/catalyst/fileops.py b/catalyst/fileops.py |
545 |
index 5a1d0f3..2aa39f6 100644 |
546 |
--- a/catalyst/fileops.py |
547 |
+++ b/catalyst/fileops.py |
548 |
@@ -67,14 +67,12 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False): |
549 |
return False |
550 |
if os.path.isdir(target): |
551 |
print "Emptying directory" , target |
552 |
- """ |
553 |
- stat the dir, delete the dir, recreate the dir and set |
554 |
- the proper perms and ownership |
555 |
- """ |
556 |
+ # stat the dir, delete the dir, recreate the dir and set |
557 |
+ # the proper perms and ownership |
558 |
try: |
559 |
#print "fileops.clear_dir(), os.stat()" |
560 |
mystat=os.stat(target) |
561 |
- """ There's no easy way to change flags recursively in python """ |
562 |
+ # There's no easy way to change flags recursively in python |
563 |
if chg_flags and os.uname()[0] == "FreeBSD": |
564 |
os.system("chflags -R noschg " + target) |
565 |
#print "fileops.clear_dir(), shutil.rmtree()" |
566 |
diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py |
567 |
index a117a21..6007aaa 100644 |
568 |
--- a/catalyst/targets/snapshot.py |
569 |
+++ b/catalyst/targets/snapshot.py |
570 |
@@ -98,12 +98,10 @@ class snapshot(TargetBase, GenBase): |
571 |
myemp=self.settings["tmp_path"] |
572 |
if os.path.isdir(myemp): |
573 |
print "Emptying directory",myemp |
574 |
- """ |
575 |
- stat the dir, delete the dir, recreate the dir and set |
576 |
- the proper perms and ownership |
577 |
- """ |
578 |
+ # stat the dir, delete the dir, recreate the dir and set |
579 |
+ # the proper perms and ownership |
580 |
mystat=os.stat(myemp) |
581 |
- """ There's no easy way to change flags recursively in python """ |
582 |
+ # There's no easy way to change flags recursively in python |
583 |
if os.uname()[0] == "FreeBSD": |
584 |
os.system("chflags -R noschg "+myemp) |
585 |
shutil.rmtree(myemp) |
586 |
-- |
587 |
2.5.2 |