Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Cc: Brian Dolbec <dolsen@g.o>
Subject: [gentoo-catalyst] [PATCH 3/3] Some options cleanup, unifying their use, reducing redundancy.
Date: Sat, 14 Dec 2013 03:37:26
Message-Id: 1386992217-9464-4-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] rewite-on-master patches round-4 by Brian Dolbec
1 ---
2 catalyst/defaults.py | 22 +++++-
3 catalyst/main.py | 90 ++++++----------------
4 catalyst/targets/generic_stage_target.py | 127 +++++++++++++++----------------
5 catalyst/targets/grp_target.py | 2 +-
6 catalyst/targets/livecd_stage1_target.py | 2 +-
7 catalyst/targets/livecd_stage2_target.py | 8 +-
8 catalyst/targets/netboot2_target.py | 10 +--
9 catalyst/targets/snapshot_target.py | 4 +-
10 catalyst/targets/stage2_target.py | 2 +-
11 catalyst/targets/stage4_target.py | 4 +-
12 10 files changed, 120 insertions(+), 151 deletions(-)
13
14 diff --git a/catalyst/defaults.py b/catalyst/defaults.py
15 index aa1e9e8..6a8050e 100644
16 --- a/catalyst/defaults.py
17 +++ b/catalyst/defaults.py
18 @@ -13,10 +13,9 @@ valid_build_targets = ["stage1_target", "stage2_target", "stage3_target",
19 required_config_file_values = ["storedir", "sharedir", "distdir", "portdir"]
20
21 valid_config_file_values = required_config_file_values[:]
22 -valid_config_file_values.extend(["PKGCACHE", "KERNCACHE", "CCACHE", "DISTCC",
23 - "ICECREAM", "ENVSCRIPT", "AUTORESUME", "FETCH", "CLEAR_AUTORESUME",
24 - "options", "DEBUG", "VERBOSE", "PURGE", "PURGEONLY", "SNAPCACHE",
25 - "snapshot_cache", "hash_function", "digests", "contents", "SEEDCACHE"
26 +valid_config_file_values.extend([ "distcc", "envscript",
27 + "options", "DEBUG", "VERBOSE",
28 + "snapshot_cache", "hash_function", "digests", "contents"
29 ])
30
31 verbosity = 1
32 @@ -81,3 +80,18 @@ confdefaults={
33 "storedir": "/var/tmp/catalyst",
34 }
35
36 +# legend: key: message
37 +option_messages = {
38 + "autoresume": "Autoresuming support enabled.",
39 + "ccache": "Compiler cache support enabled.",
40 + "clear-autoresume": "Cleaning autoresume flags support enabled.",
41 + #"compress": "Compression enabled.",
42 + "distcc": "Distcc support enabled.",
43 + "icecream": "Icecream compiler cluster support enabled.",
44 + "kerncache": "Kernel cache support enabled.",
45 + "pkgcache": "Package cache support enabled.",
46 + "purge": "Purge support enabled.",
47 + "seedcache": "Seed cache support enabled.",
48 + "snapcache": "Snapshot cache support enabled.",
49 + #"tarball": "Tarball creation enabled.",
50 + }
51 diff --git a/catalyst/main.py b/catalyst/main.py
52 index e969896..8fd8a60 100644
53 --- a/catalyst/main.py
54 +++ b/catalyst/main.py
55 @@ -23,7 +23,7 @@ import catalyst.config
56 import catalyst.util
57 from catalyst.support import CatalystError, find_binary, LockInUse
58 from catalyst.defaults import (required_build_targets, valid_build_targets,
59 - hash_definitions, confdefaults
60 + hash_definitions, confdefaults, option_messages
61 )
62
63 from hash_utils import HashMap
64 @@ -113,7 +113,10 @@ def parse_config(myconfig):
65 for x in list(confdefaults):
66 if x in myconf:
67 print "Setting",x,"to config file value \""+myconf[x]+"\""
68 - conf_values[x]=myconf[x]
69 + if x == 'options':
70 + conf_values[x] = set(myconf[x].split())
71 + else:
72 + conf_values[x]=myconf[x]
73 else:
74 print "Setting",x,"to default value \""+confdefaults[x]+"\""
75 conf_values[x]=confdefaults[x]
76 @@ -121,74 +124,23 @@ def parse_config(myconfig):
77 # add our python base directory to use for loading target arch's
78 conf_values["PythonDir"] = __selfpath__
79
80 - # parse out the rest of the options from the config file
81 - if "autoresume" in string.split(conf_values["options"]):
82 - print "Autoresuming support enabled."
83 - conf_values["AUTORESUME"]="1"
84 -
85 - if "bindist" in string.split(conf_values["options"]):
86 - print "Binary redistribution enabled"
87 - conf_values["BINDIST"]="1"
88 - else:
89 - print "Bindist is not enabled in catalyst.conf"
90 - print "Binary redistribution of generated stages/isos may be prohibited by law."
91 - print "Please see the use description for bindist on any package you are including."
92 -
93 - if "ccache" in string.split(conf_values["options"]):
94 - print "Compiler cache support enabled."
95 - conf_values["CCACHE"]="1"
96 -
97 - if "clear-autoresume" in string.split(conf_values["options"]):
98 - print "Cleaning autoresume flags support enabled."
99 - conf_values["CLEAR_AUTORESUME"]="1"
100 -
101 - if "distcc" in string.split(conf_values["options"]):
102 - print "Distcc support enabled."
103 - conf_values["DISTCC"]="1"
104 -
105 - if "icecream" in string.split(conf_values["options"]):
106 - print "Icecream compiler cluster support enabled."
107 - conf_values["ICECREAM"]="1"
108
109 - if "kerncache" in string.split(conf_values["options"]):
110 - print "Kernel cache support enabled."
111 - conf_values["KERNCACHE"]="1"
112 + # print out any options messages
113 + for opt in conf_values['options']:
114 + if opt in option_messages:
115 + print option_messages[opt]
116
117 - if "pkgcache" in string.split(conf_values["options"]):
118 - print "Package cache support enabled."
119 - conf_values["PKGCACHE"]="1"
120 + for key in ["digests", "envscript", "var_tmpfs_portage", "port_logdir"]:
121 + if key in myconf:
122 + conf_values[key] = myconf[key]
123
124 - if "preserve_libs" in string.split(conf_values["options"]):
125 - print "Preserving libs during unmerge."
126 - conf_values["PRESERVE_LIBS"]="1"
127 -
128 - if "purge" in string.split(conf_values["options"]):
129 - print "Purge support enabled."
130 - conf_values["PURGE"]="1"
131 -
132 - if "seedcache" in string.split(conf_values["options"]):
133 - print "Seed cache support enabled."
134 - conf_values["SEEDCACHE"]="1"
135 -
136 - if "snapcache" in string.split(conf_values["options"]):
137 - print "Snapshot cache support enabled."
138 - conf_values["SNAPCACHE"]="1"
139 -
140 - if "digests" in myconf:
141 - conf_values["digests"]=myconf["digests"]
142 if "contents" in myconf:
143 # replace '-' with '_' (for compatibility with existing configs)
144 conf_values["contents"] = myconf["contents"].replace("-", '_')
145
146 if "envscript" in myconf:
147 print "Envscript support enabled."
148 - conf_values["ENVSCRIPT"]=myconf["envscript"]
149
150 - if "var_tmpfs_portage" in myconf:
151 - conf_values["var_tmpfs_portage"]=myconf["var_tmpfs_portage"];
152 -
153 - if "port_logdir" in myconf:
154 - conf_values["port_logdir"]=myconf["port_logdir"];
155
156 def import_modules():
157 # import catalyst's own modules
158 @@ -285,6 +237,10 @@ def main():
159 usage()
160 sys.exit(2)
161
162 + # initialize it if it's not already
163 + if 'options' not in conf_values:
164 + conf_values['options'] = set()
165 +
166 run = False
167 for o, a in opts:
168 if o in ("-h", "--help"):
169 @@ -296,8 +252,8 @@ def main():
170 sys.exit(1)
171
172 if o in ("-d", "--debug"):
173 - conf_values["DEBUG"]="1"
174 - conf_values["VERBOSE"]="1"
175 + conf_values["DEBUG"] = True
176 + conf_values["VERBOSE"] = True
177
178 if o in ("-c", "--config"):
179 myconfig=a
180 @@ -314,7 +270,7 @@ def main():
181 myspecfile=a
182
183 if o in ("-F", "--fetchonly"):
184 - conf_values["FETCH"]="1"
185 + conf_values['options'].add("fetch")
186
187 if o in ("-v", "--verbose"):
188 conf_values["VERBOSE"]="1"
189 @@ -330,16 +286,16 @@ def main():
190 mycmdline.append("version_stamp="+a)
191
192 if o in ("-p", "--purge"):
193 - conf_values["PURGE"] = "1"
194 + conf_values['options'].add("purge")
195
196 if o in ("-P", "--purgeonly"):
197 - conf_values["PURGEONLY"] = "1"
198 + conf_values['options'].add("purgeonly")
199
200 if o in ("-T", "--purgetmponly"):
201 - conf_values["PURGETMPONLY"] = "1"
202 + conf_values['options'].add("purgetmponly")
203
204 if o in ("-a", "--clear-autoresume"):
205 - conf_values["CLEAR_AUTORESUME"] = "1"
206 + conf_values['options'].add("clear-autoresume")
207
208 if not run:
209 print "!!! catalyst: please specify one of either -f or -C\n"
210 diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
211 index 123a9be..bb5e530 100644
212 --- a/catalyst/targets/generic_stage_target.py
213 +++ b/catalyst/targets/generic_stage_target.py
214 @@ -173,11 +173,11 @@ class generic_stage_target(generic_target):
215 file_locate(self.settings,["portage_confdir"],expand=0)
216
217 """ Setup our mount points """
218 - if "SNAPCACHE" in self.settings:
219 - self.mounts=["/proc","/dev","/usr/portage","/usr/portage/distfiles","/var/tmp/portage"]
220 - self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
221 - "/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
222 - "/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
223 + if "snapcache" in self.settings["options"]:
224 + self.mounts=["proc", "dev", 'portdir', 'distdir', 'port_tmpdir']
225 + self.mountmap={"proc":"proc", "dev":"/dev", "pts":"/dev/pts",
226 + "portdir":self.settings["snapshot_cache_path"]+"/" + self.settings["repo_name"],
227 + "distdir":self.settings["distdir"],"port_tmpdir":"tmpfs"}
228 else:
229 self.mounts=["proc","dev", "distdir", "port_tmpdir"]
230 self.mountmap={"proc":"/proc", "dev":"/dev", "pts":"/dev/pts",
231 @@ -191,21 +191,21 @@ class generic_stage_target(generic_target):
232 Configure any user specified options (either in catalyst.conf or on
233 the command line).
234 """
235 - if "PKGCACHE" in self.settings:
236 + if "pkgcache" in self.settings["options"]:
237 self.set_pkgcache_path()
238 print "Location of the package cache is "+\
239 self.settings["pkgcache_path"]
240 self.mounts.append("packagedir")
241 self.mountmap["packagedir"] = self.settings["pkgcache_path"]
242
243 - if "KERNCACHE" in self.settings:
244 + if "kerncache" in self.settings["options"]:
245 self.set_kerncache_path()
246 print "Location of the kerncache is "+\
247 self.settings["kerncache_path"]
248 self.mounts.append("kerncache")
249 self.mountmap["kerncache"]=self.settings["kerncache_path"]
250
251 - if "CCACHE" in self.settings:
252 + if "ccache" in self.settings["options"]:
253 if "CCACHE_DIR" in os.environ:
254 ccdir=os.environ["CCACHE_DIR"]
255 del os.environ["CCACHE_DIR"]
256 @@ -220,9 +220,9 @@ class generic_stage_target(generic_target):
257 """ for the chroot: """
258 self.env["CCACHE_DIR"]="/var/tmp/ccache"
259
260 - if "ICECREAM" in self.settings:
261 - self.mounts.append("/var/cache/icecream")
262 - self.mountmap["/var/cache/icecream"]="/var/cache/icecream"
263 + if "icecream" in self.settings["options"]:
264 + self.mounts.append("icecream")
265 + self.mountmap["icecream"]="/var/cache/icecream"
266 self.env["PATH"]="/usr/lib/icecc/bin:"+self.env["PATH"]
267
268 if "port_logdir" in self.settings:
269 @@ -295,7 +295,7 @@ class generic_stage_target(generic_target):
270 def set_target_path(self):
271 self.settings["target_path"]=normpath(self.settings["storedir"]+\
272 "/builds/"+self.settings["target_subpath"]+".tar.bz2")
273 - if "AUTORESUME" in self.settings\
274 + if "autoresume" in self.settings["options"]\
275 and os.path.exists(self.settings["autoresume_path"]+\
276 "setup_target_path"):
277 print \
278 @@ -373,7 +373,7 @@ class generic_stage_target(generic_target):
279 del self.settings[self.settings["spec_prefix"]+"/fsops"]
280
281 def set_source_path(self):
282 - if "SEEDCACHE" in self.settings\
283 + if "seedcache" in self.settings["options"]\
284 and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\
285 self.settings["source_subpath"]+"/")):
286 self.settings["source_path"]=normpath(self.settings["storedir"]+\
287 @@ -427,7 +427,7 @@ class generic_stage_target(generic_target):
288 hash_function=self.settings["hash_function"],verbose=False)
289
290 def set_snapcache_path(self):
291 - if "SNAPCACHE" in self.settings:
292 + if "snapcache" in self.settings["options"]:
293 self.settings["snapshot_cache_path"]=\
294 normpath(self.settings["snapshot_cache"]+"/"+\
295 self.settings["snapshot"]+"/")
296 @@ -449,7 +449,7 @@ class generic_stage_target(generic_target):
297 "/tmp/"+self.settings["rel_type"]+"/"+".autoresume-"+\
298 self.settings["target"]+"-"+self.settings["subarch"]+"-"+\
299 self.settings["version_stamp"]+"/")
300 - if "AUTORESUME" in self.settings:
301 + if "autoresume" in self.settings["options"]:
302 print "The autoresume path is " + self.settings["autoresume_path"]
303 if not os.path.exists(self.settings["autoresume_path"]):
304 os.makedirs(self.settings["autoresume_path"],0755)
305 @@ -476,8 +476,8 @@ class generic_stage_target(generic_target):
306 "base_dirs","bind","chroot_setup","setup_environment",\
307 "run_local","preclean","unbind","clean"]
308 # if "TARBALL" in self.settings or \
309 -# "FETCH" not in self.settings:
310 - if "FETCH" not in self.settings:
311 +# "fetch" not in self.settings["options"]:
312 + if "fetch" not in self.settings["options"]:
313 self.settings["action_sequence"].append("capture")
314 self.settings["action_sequence"].append("clear_autoresume")
315
316 @@ -636,7 +636,7 @@ class generic_stage_target(generic_target):
317 clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+\
318 "unpack")
319
320 - if "SEEDCACHE" in self.settings:
321 + if "seedcache" in self.settings["options"]:
322 if os.path.isdir(self.settings["source_path"]):
323 """ SEEDCACHE Is a directory, use rsync """
324 unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\
325 @@ -678,7 +678,7 @@ class generic_stage_target(generic_target):
326 error_msg="Tarball extraction of "+self.settings["source_path"]+\
327 " to "+self.settings["chroot_path"]+" failed."
328
329 - if "AUTORESUME" in self.settings:
330 + if "autoresume" in self.settings["options"]:
331 if os.path.isdir(self.settings["source_path"]) \
332 and os.path.exists(self.settings["autoresume_path"]+"unpack"):
333 """ Autoresume is valid, SEEDCACHE is valid """
334 @@ -705,7 +705,7 @@ class generic_stage_target(generic_target):
335 invalid_snapshot=True
336 else:
337 """ No autoresume, SEEDCACHE """
338 - if "SEEDCACHE" in self.settings:
339 + if "seedcache" in self.settings["options"]:
340 """ SEEDCACHE so let's run rsync and let it clean up """
341 if os.path.isdir(self.settings["source_path"]):
342 unpack=True
343 @@ -729,7 +729,7 @@ class generic_stage_target(generic_target):
344 self.mount_safety_check()
345
346 if invalid_snapshot:
347 - if "AUTORESUME" in self.settings:
348 + if "autoresume" in self.settings["options"]:
349 print "No Valid Resume point detected, cleaning up..."
350
351 self.clear_autoresume()
352 @@ -741,11 +741,11 @@ class generic_stage_target(generic_target):
353 if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
354 os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
355
356 - if "PKGCACHE" in self.settings:
357 + if "pkgcache" in self.settings["options"]:
358 if not os.path.exists(self.settings["pkgcache_path"]):
359 os.makedirs(self.settings["pkgcache_path"],0755)
360
361 - if "KERNCACHE" in self.settings:
362 + if "kerncache" in self.settings["options"]:
363 if not os.path.exists(self.settings["kerncache_path"]):
364 os.makedirs(self.settings["kerncache_path"],0755)
365
366 @@ -766,7 +766,7 @@ class generic_stage_target(generic_target):
367 snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
368 "unpack_portage")
369
370 - if "SNAPCACHE" in self.settings:
371 + if "snapcache" in self.settings["options"]:
372 snapshot_cache_hash=\
373 read_from_clst(self.settings["snapshot_cache_path"]+\
374 "catalyst-hash")
375 @@ -798,7 +798,7 @@ class generic_stage_target(generic_target):
376 self.settings["chroot_path"]+"/usr"
377 unpack_errmsg="Error unpacking snapshot"
378
379 - if "AUTORESUME" in self.settings \
380 + if "autoresume" in self.settings["options"] \
381 and os.path.exists(self.settings["chroot_path"]+\
382 self.settings["portdir"]) \
383 and os.path.exists(self.settings["autoresume_path"]\
384 @@ -809,7 +809,7 @@ class generic_stage_target(generic_target):
385 unpack=False
386
387 if unpack:
388 - if "SNAPCACHE" in self.settings:
389 + if "snapcache" in self.settings["options"]:
390 self.snapshot_lock_object.write_lock()
391 if os.path.exists(destdir):
392 print cleanup_msg
393 @@ -821,7 +821,7 @@ class generic_stage_target(generic_target):
394 print "Unpacking portage tree (This can take a long time) ..."
395 cmd(unpack_cmd,unpack_errmsg,env=self.env)
396
397 - if "SNAPCACHE" in self.settings:
398 + if "snapcache" in self.settings["options"]:
399 myf=open(self.settings["snapshot_cache_path"]+"catalyst-hash","w")
400 myf.write(self.settings["snapshot_path_hash"])
401 myf.close()
402 @@ -831,11 +831,11 @@ class generic_stage_target(generic_target):
403 myf.write(self.settings["snapshot_path_hash"])
404 myf.close()
405
406 - if "SNAPCACHE" in self.settings:
407 + if "snapcache" in self.settings["options"]:
408 self.snapshot_lock_object.unlock()
409
410 def config_profile_link(self):
411 - if "AUTORESUME" in self.settings \
412 + if "autoresume" in self.settings["options"] \
413 and os.path.exists(self.settings["autoresume_path"]+\
414 "config_profile_link"):
415 print \
416 @@ -854,7 +854,7 @@ class generic_stage_target(generic_target):
417 touch(self.settings["autoresume_path"]+"config_profile_link")
418
419 def setup_confdir(self):
420 - if "AUTORESUME" in self.settings \
421 + if "autoresume" in self.settings["options"] \
422 and os.path.exists(self.settings["autoresume_path"]+\
423 "setup_confdir"):
424 print "Resume point detected, skipping setup_confdir operation..."
425 @@ -904,7 +904,7 @@ class generic_stage_target(generic_target):
426 os.makedirs(self.mountmap[x],0755)
427
428 src=self.mountmap[x]
429 - if "SNAPCACHE" in self.settings and x == "/usr/portage":
430 + if "snapcache" in self.settings["options"] and x == "portdir":
431 self.snapshot_lock_object.read_lock()
432 if os.uname()[0] == "FreeBSD":
433 if src == "/dev":
434 @@ -954,7 +954,7 @@ class generic_stage_target(generic_target):
435 ouch=1
436 warn("Couldn't umount bind mount: " + mypath + self.mountmap[x])
437
438 - if "SNAPCACHE" in self.settings and x == "/usr/portage":
439 + if "snapcache" in self.settings["options"] and x == "portdir":
440 try:
441 """
442 It's possible the snapshot lock object isn't created yet.
443 @@ -981,7 +981,7 @@ class generic_stage_target(generic_target):
444 self.override_cflags()
445 self.override_cxxflags()
446 self.override_ldflags()
447 - if "AUTORESUME" in self.settings \
448 + if "autoresume" in self.settings["options"] \
449 and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
450 print "Resume point detected, skipping chroot_setup operation..."
451 else:
452 @@ -993,10 +993,10 @@ class generic_stage_target(generic_target):
453 "Could not copy resolv.conf into place.",env=self.env)
454
455 """ Copy over the envscript, if applicable """
456 - if "ENVSCRIPT" in self.settings:
457 - if not os.path.exists(self.settings["ENVSCRIPT"]):
458 + if "envscript" in self.settings:
459 + if not os.path.exists(self.settings["envscript"]):
460 raise CatalystError,\
461 - "Can't find envscript "+self.settings["ENVSCRIPT"]
462 + "Can't find envscript "+self.settings["envscript"]
463
464 print "\nWarning!!!!"
465 print "\tOverriding certain env variables may cause catastrophic failure."
466 @@ -1006,7 +1006,7 @@ class generic_stage_target(generic_target):
467 print "\tCatalyst Maintainers use VERY minimal envscripts if used at all"
468 print "\tYou have been warned\n"
469
470 - cmd("cp "+self.settings["ENVSCRIPT"]+" "+\
471 + cmd("cp "+self.settings["envscript"]+" "+\
472 self.settings["chroot_path"]+"/tmp/envscript",\
473 "Could not copy envscript into place.",env=self.env)
474
475 @@ -1081,7 +1081,7 @@ class generic_stage_target(generic_target):
476 touch(self.settings["autoresume_path"]+"chroot_setup")
477
478 def fsscript(self):
479 - if "AUTORESUME" in self.settings \
480 + if "autoresume" in self.settings["options"] \
481 and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
482 print "Resume point detected, skipping fsscript operation..."
483 else:
484 @@ -1092,7 +1092,7 @@ class generic_stage_target(generic_target):
485 touch(self.settings["autoresume_path"]+"fsscript")
486
487 def rcupdate(self):
488 - if "AUTORESUME" in self.settings \
489 + if "autoresume" in self.settings["options"] \
490 and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
491 print "Resume point detected, skipping rcupdate operation..."
492 else:
493 @@ -1102,7 +1102,7 @@ class generic_stage_target(generic_target):
494 touch(self.settings["autoresume_path"]+"rcupdate")
495
496 def clean(self):
497 - if "AUTORESUME" in self.settings \
498 + if "autoresume" in self.settings["options"] \
499 and os.path.exists(self.settings["autoresume_path"]+"clean"):
500 print "Resume point detected, skipping clean operation..."
501 else:
502 @@ -1137,7 +1137,7 @@ class generic_stage_target(generic_target):
503 touch(self.settings["autoresume_path"]+"clean")
504
505 def empty(self):
506 - if "AUTORESUME" in self.settings \
507 + if "autoresume" in self.settings["options"] \
508 and os.path.exists(self.settings["autoresume_path"]+"empty"):
509 print "Resume point detected, skipping empty operation..."
510 else:
511 @@ -1165,7 +1165,7 @@ class generic_stage_target(generic_target):
512 touch(self.settings["autoresume_path"]+"empty")
513
514 def remove(self):
515 - if "AUTORESUME" in self.settings \
516 + if "autoresume" in self.settings["options"] \
517 and os.path.exists(self.settings["autoresume_path"]+"remove"):
518 print "Resume point detected, skipping remove operation..."
519 else:
520 @@ -1187,7 +1187,7 @@ class generic_stage_target(generic_target):
521 raise
522
523 def preclean(self):
524 - if "AUTORESUME" in self.settings \
525 + if "autoresume" in self.settings["options"] \
526 and os.path.exists(self.settings["autoresume_path"]+"preclean"):
527 print "Resume point detected, skipping preclean operation..."
528 else:
529 @@ -1202,7 +1202,7 @@ class generic_stage_target(generic_target):
530 raise CatalystError, "Build failed, could not execute preclean"
531
532 def capture(self):
533 - if "AUTORESUME" in self.settings \
534 + if "autoresume" in self.settings["options"] \
535 and os.path.exists(self.settings["autoresume_path"]+"capture"):
536 print "Resume point detected, skipping capture operation..."
537 else:
538 @@ -1227,7 +1227,7 @@ class generic_stage_target(generic_target):
539 touch(self.settings["autoresume_path"]+"capture")
540
541 def run_local(self):
542 - if "AUTORESUME" in self.settings \
543 + if "autoresume" in self.settings["options"] \
544 and os.path.exists(self.settings["autoresume_path"]+"run_local"):
545 print "Resume point detected, skipping run_local operation..."
546 else:
547 @@ -1276,10 +1276,10 @@ class generic_stage_target(generic_target):
548 """ Check for mounts right away and abort if we cannot unmount them """
549 self.mount_safety_check()
550
551 - if "CLEAR_AUTORESUME" in self.settings:
552 + if "clear-autoresume" in self.settings["options"]:
553 self.clear_autoresume()
554
555 - if "PURGETMPONLY" in self.settings:
556 + if "purgetmponly" in self.settings["options"]:
557 self.purge()
558 return
559
560 @@ -1287,7 +1287,7 @@ class generic_stage_target(generic_target):
561 self.purge()
562 return
563
564 - if "PURGE" in self.settings:
565 + if "purge" in self.settings["options"]:
566 self.purge()
567
568 for x in self.settings["action_sequence"]:
569 @@ -1302,7 +1302,7 @@ class generic_stage_target(generic_target):
570 self.chroot_lock.unlock()
571
572 def unmerge(self):
573 - if "AUTORESUME" in self.settings \
574 + if "autoresume" in self.settings["options"] \
575 and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
576 print "Resume point detected, skipping unmerge operation..."
577 else:
578 @@ -1334,7 +1334,7 @@ class generic_stage_target(generic_target):
579 touch(self.settings["autoresume_path"]+"unmerge")
580
581 def target_setup(self):
582 - if "AUTORESUME" in self.settings \
583 + if "autoresume" in self.settings["options"] \
584 and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
585 print "Resume point detected, skipping target_setup operation..."
586 else:
587 @@ -1345,7 +1345,7 @@ class generic_stage_target(generic_target):
588 touch(self.settings["autoresume_path"]+"target_setup")
589
590 def setup_overlay(self):
591 - if "AUTORESUME" in self.settings \
592 + if "autoresume" in self.settings["options"] \
593 and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
594 print "Resume point detected, skipping setup_overlay operation..."
595 else:
596 @@ -1359,7 +1359,7 @@ class generic_stage_target(generic_target):
597 touch(self.settings["autoresume_path"]+"setup_overlay")
598
599 def create_iso(self):
600 - if "AUTORESUME" in self.settings \
601 + if "autoresume" in self.settings["options"] \
602 and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
603 print "Resume point detected, skipping create_iso operation..."
604 else:
605 @@ -1376,13 +1376,13 @@ class generic_stage_target(generic_target):
606 print "An ISO Image will not be created."
607
608 def build_packages(self):
609 - if "AUTORESUME" in self.settings \
610 + if "autoresume" in self.settings["options"] \
611 and os.path.exists(self.settings["autoresume_path"]+\
612 "build_packages"):
613 print "Resume point detected, skipping build_packages operation..."
614 else:
615 if self.settings["spec_prefix"]+"/packages" in self.settings:
616 - if "AUTORESUME" in self.settings \
617 + if "autoresume" in self.settings["options"] \
618 and os.path.exists(self.settings["autoresume_path"]+\
619 "build_packages"):
620 print "Resume point detected, skipping build_packages operation..."
621 @@ -1401,8 +1401,7 @@ class generic_stage_target(generic_target):
622 "build aborting due to error."
623
624 def build_kernel(self):
625 - "Build all configured kernels"
626 - if "AUTORESUME" in self.settings \
627 + if "autoresume" in self.settings["options"] \
628 and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
629 print "Resume point detected, skipping build_kernel operation..."
630 else:
631 @@ -1427,7 +1426,7 @@ class generic_stage_target(generic_target):
632
633 def _build_kernel(self, kname):
634 "Build a single configured kernel by name"
635 - if "AUTORESUME" in self.settings \
636 + if "autoresume" in self.settings["options"] \
637 and os.path.exists(self.settings["autoresume_path"]\
638 +"build_kernel_"+kname):
639 print "Resume point detected, skipping build_kernel for "+kname+" operation..."
640 @@ -1525,7 +1524,7 @@ class generic_stage_target(generic_target):
641 "/initramfs_overlay"],env=self.env)
642
643 def bootloader(self):
644 - if "AUTORESUME" in self.settings \
645 + if "autoresume" in self.settings["options"] \
646 and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
647 print "Resume point detected, skipping bootloader operation..."
648 else:
649 @@ -1539,7 +1538,7 @@ class generic_stage_target(generic_target):
650 raise CatalystError,"Script aborting due to error."
651
652 def livecd_update(self):
653 - if "AUTORESUME" in self.settings \
654 + if "autoresume" in self.settings["options"] \
655 and os.path.exists(self.settings["autoresume_path"]+\
656 "livecd_update"):
657 print "Resume point detected, skipping build_packages operation..."
658 @@ -1572,7 +1571,7 @@ class generic_stage_target(generic_target):
659 os.chmod(myemp,mystat[ST_MODE])
660
661 def clear_packages(self):
662 - if "PKGCACHE" in self.settings:
663 + if "pkgcache" in self.settings["options"]:
664 print "purging the pkgcache ..."
665
666 myemp=self.settings["pkgcache_path"]
667 @@ -1590,7 +1589,7 @@ class generic_stage_target(generic_target):
668 os.chmod(myemp,mystat[ST_MODE])
669
670 def clear_kerncache(self):
671 - if "KERNCACHE" in self.settings:
672 + if "kerncache" in self.settings["options"]:
673 print "purging the kerncache ..."
674
675 myemp=self.settings["kerncache_path"]
676 @@ -1609,11 +1608,11 @@ class generic_stage_target(generic_target):
677
678 def clear_autoresume(self):
679 """ Clean resume points since they are no longer needed """
680 - if "AUTORESUME" in self.settings:
681 + if "autoresume" in self.settings["options"]:
682 print "Removing AutoResume Points: ..."
683 myemp=self.settings["autoresume_path"]
684 if os.path.isdir(myemp):
685 - if "AUTORESUME" in self.settings:
686 + if "autoresume" in self.settings["options"]:
687 print "Emptying directory",myemp
688 """
689 stat the dir, delete the dir, recreate the dir and set
690 @@ -1677,7 +1676,7 @@ class generic_stage_target(generic_target):
691
692 def purge(self):
693 countdown(10,"Purging Caches ...")
694 - if any(k in self.settings for k in ("PURGE","PURGEONLY","PURGETMPONLY")):
695 + if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
696 print "clearing autoresume ..."
697 self.clear_autoresume()
698
699 diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
700 index 8e70042..a8309a8 100644
701 --- a/catalyst/targets/grp_target.py
702 +++ b/catalyst/targets/grp_target.py
703 @@ -36,7 +36,7 @@ class grp_target(generic_stage_target):
704
705 def set_target_path(self):
706 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
707 - if "AUTORESUME" in self.settings \
708 + if "autoresume" in self.settings["options"] \
709 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
710 print "Resume point detected, skipping target path setup operation..."
711 else:
712 diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
713 index ac846ec..6273c9e 100644
714 --- a/catalyst/targets/livecd_stage1_target.py
715 +++ b/catalyst/targets/livecd_stage1_target.py
716 @@ -25,7 +25,7 @@ class livecd_stage1_target(generic_stage_target):
717
718 def set_target_path(self):
719 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
720 - if "AUTORESUME" in self.settings \
721 + if "autoresume" in self.settings["options"] \
722 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
723 print "Resume point detected, skipping target path setup operation..."
724 else:
725 diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
726 index 1bfd820..54d06c7 100644
727 --- a/catalyst/targets/livecd_stage2_target.py
728 +++ b/catalyst/targets/livecd_stage2_target.py
729 @@ -46,7 +46,7 @@ class livecd_stage2_target(generic_stage_target):
730
731 def set_target_path(self):
732 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
733 - if "AUTORESUME" in self.settings \
734 + if "autoresume" in self.settings["options"] \
735 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
736 print "Resume point detected, skipping target path setup operation..."
737 else:
738 @@ -88,7 +88,7 @@ class livecd_stage2_target(generic_stage_target):
739 error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
740 invalid_snapshot=False
741
742 - if "AUTORESUME" in self.settings:
743 + if "autoresume" in self.settings["options"]:
744 if os.path.isdir(self.settings["source_path"]) and \
745 os.path.exists(self.settings["autoresume_path"]+"unpack"):
746 print "Resume point detected, skipping unpack operation..."
747 @@ -112,7 +112,7 @@ class livecd_stage2_target(generic_stage_target):
748 if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
749 os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
750
751 - if "PKGCACHE" in self.settings:
752 + if "pkgcache" in self.settings["options"]:
753 if not os.path.exists(self.settings["pkgcache_path"]):
754 os.makedirs(self.settings["pkgcache_path"],0755)
755
756 @@ -134,7 +134,7 @@ class livecd_stage2_target(generic_stage_target):
757 "config_profile_link","setup_confdir","portage_overlay",\
758 "bind","chroot_setup","setup_environment","run_local",\
759 "build_kernel"]
760 - if "FETCH" not in self.settings:
761 + if "fetch" not in self.settings["options"]:
762 self.settings["action_sequence"] += ["bootloader","preclean",\
763 "livecd_update","root_overlay","fsscript","rcupdate","unmerge",\
764 "unbind","remove","empty","target_setup",\
765 diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
766 index 2b3cd20..8809dd0 100644
767 --- a/catalyst/targets/netboot2_target.py
768 +++ b/catalyst/targets/netboot2_target.py
769 @@ -45,7 +45,7 @@ class netboot2_target(generic_stage_target):
770 def set_target_path(self):
771 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
772 self.settings["target_subpath"]+"/")
773 - if "AUTORESUME" in self.settings \
774 + if "autoresume" in self.settings["options"] \
775 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
776 print "Resume point detected, skipping target path setup operation..."
777 else:
778 @@ -63,7 +63,7 @@ class netboot2_target(generic_stage_target):
779 myfiles=[]
780
781 # check for autoresume point
782 - if "AUTORESUME" in self.settings \
783 + if "autoresume" in self.settings["options"] \
784 and os.path.exists(self.settings["autoresume_path"]+"copy_files_to_image"):
785 print "Resume point detected, skipping target path setup operation..."
786 else:
787 @@ -96,7 +96,7 @@ class netboot2_target(generic_stage_target):
788 touch(self.settings["autoresume_path"]+"copy_files_to_image")
789
790 def setup_overlay(self):
791 - if "AUTORESUME" in self.settings \
792 + if "autoresume" in self.settings["options"] \
793 and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
794 print "Resume point detected, skipping setup_overlay operation..."
795 else:
796 @@ -120,7 +120,7 @@ class netboot2_target(generic_stage_target):
797 raise CatalystError,"Failed to move kernel images!"
798
799 def remove(self):
800 - if "AUTORESUME" in self.settings \
801 + if "autoresume" in self.settings["options"] \
802 and os.path.exists(self.settings["autoresume_path"]+"remove"):
803 print "Resume point detected, skipping remove operation..."
804 else:
805 @@ -132,7 +132,7 @@ class netboot2_target(generic_stage_target):
806 os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x)
807
808 def empty(self):
809 - if "AUTORESUME" in self.settings \
810 + if "autoresume" in self.settings["options"] \
811 and os.path.exists(self.settings["autoresume_path"]+"empty"):
812 print "Resume point detected, skipping empty operation..."
813 else:
814 diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
815 index e21bd1a..682f9b5 100644
816 --- a/catalyst/targets/snapshot_target.py
817 +++ b/catalyst/targets/snapshot_target.py
818 @@ -32,11 +32,11 @@ class snapshot_target(generic_stage_target):
819 pass
820
821 def run(self):
822 - if "PURGEONLY" in self.settings:
823 + if "purgeonly" in self.settings["options"]:
824 self.purge()
825 return
826
827 - if "PURGE" in self.settings:
828 + if "purge" in self.settings["options"]:
829 self.purge()
830
831 self.setup()
832 diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
833 index 6377f5d..94d4a1e 100644
834 --- a/catalyst/targets/stage2_target.py
835 +++ b/catalyst/targets/stage2_target.py
836 @@ -16,7 +16,7 @@ class stage2_target(generic_stage_target):
837 generic_stage_target.__init__(self,spec,addlargs)
838
839 def set_source_path(self):
840 - if "SEEDCACHE" in self.settings and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
841 + if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
842 self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
843 else:
844 self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
845 diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
846 index 9168f2e..e2b8a79 100644
847 --- a/catalyst/targets/stage4_target.py
848 +++ b/catalyst/targets/stage4_target.py
849 @@ -32,8 +32,8 @@ class stage4_target(generic_stage_target):
850 "clean"]
851
852 # if "TARBALL" in self.settings or \
853 -# "FETCH" not in self.settings:
854 - if "FETCH" not in self.settings:
855 +# "fetch" not in self.settings['options']:
856 + if "fetch" not in self.settings['options']:
857 self.settings["action_sequence"].append("capture")
858 self.settings["action_sequence"].append("clear_autoresume")
859
860 --
861 1.8.3.2