Gentoo Archives: gentoo-commits

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