Gentoo Archives: gentoo-commits

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