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 05:54:56
Message-Id: 1409637114.a3db5b61645150b244d4736ca842bb02283ff67a.dol-sen@gentoo
1 commit: a3db5b61645150b244d4736ca842bb02283ff67a
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 05:51:54 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a3db5b61
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 | 142 ++++++++++++++++++-------------
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, 142 insertions(+), 150 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..0b506e2 100644
246 --- a/catalyst/targets/generic_stage_target.py
247 +++ b/catalyst/targets/generic_stage_target.py
248 @@ -189,7 +189,7 @@ class generic_stage_target(generic_target):
249 self.mountmap = SOURCE_MOUNT_DEFAULTS.copy()
250 # update them from settings
251 self.mountmap["distdir"] = self.settings["distdir"]
252 - if "SNAPCACHE" not in self.settings:
253 + if "snapcache" not in self.settings["options"]:
254 self.mounts.remove("portdir")
255 self.mountmap["portdir"] = None
256 else:
257 @@ -207,21 +207,21 @@ class generic_stage_target(generic_target):
258 Configure any user specified options (either in catalyst.conf or on
259 the command line).
260 """
261 - if "PKGCACHE" in self.settings:
262 + if "pkgcache" in self.settings["options"]:
263 self.set_pkgcache_path()
264 print "Location of the package cache is "+\
265 self.settings["pkgcache_path"]
266 self.mounts.append("packagedir")
267 self.mountmap["packagedir"] = self.settings["pkgcache_path"]
268
269 - if "KERNCACHE" in self.settings:
270 + if "kerncache" in self.settings["options"]:
271 self.set_kerncache_path()
272 print "Location of the kerncache is "+\
273 self.settings["kerncache_path"]
274 self.mounts.append("kerncache")
275 self.mountmap["kerncache"] = self.settings["kerncache_path"]
276
277 - if "CCACHE" in self.settings:
278 + if "ccache" in self.settings["options"]:
279 if "CCACHE_DIR" in os.environ:
280 ccdir=os.environ["CCACHE_DIR"]
281 del os.environ["CCACHE_DIR"]
282 @@ -236,7 +236,7 @@ class generic_stage_target(generic_target):
283 """ for the chroot: """
284 self.env["CCACHE_DIR"] = self.target_mounts["ccache"]
285
286 - if "ICECREAM" in self.settings:
287 + if "icecream" in self.settings["options"]:
288 self.mounts.append("icecream")
289 self.mountmap["icecream"] = self.settings["icecream"]
290 self.env["PATH"] = self.target_mounts["icecream"] + ":" + \
291 @@ -314,7 +314,7 @@ class generic_stage_target(generic_target):
292 "/builds/"+self.settings["target_subpath"]+".tar.bz2")
293 setup_target_path_resume = pjoin(self.settings["autoresume_path"],
294 "setup_target_path")
295 - if "AUTORESUME" in self.settings and \
296 + if "autoresume" in self.settings["options"] and \
297 os.path.exists(setup_target_path_resume):
298 print \
299 "Resume point detected, skipping target path setup operation..."
300 @@ -391,7 +391,7 @@ class generic_stage_target(generic_target):
301 del self.settings[self.settings["spec_prefix"]+"/fsops"]
302
303 def set_source_path(self):
304 - if "SEEDCACHE" in self.settings\
305 + if "seedcache" in self.settings["options"]\
306 and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\
307 self.settings["source_subpath"]+"/")):
308 self.settings["source_path"]=normpath(self.settings["storedir"]+\
309 @@ -450,7 +450,7 @@ class generic_stage_target(generic_target):
310 verbose = False)
311
312 def set_snapcache_path(self):
313 - if "SNAPCACHE" in self.settings:
314 + if "snapcache" in self.settings["options"]:
315 self.settings["snapshot_cache_path"] = \
316 normpath(self.settings["snapshot_cache"] + "/" +
317 self.settings["snapshot"])
318 @@ -474,7 +474,7 @@ class generic_stage_target(generic_target):
319 %(self.settings["target"], self.settings["subarch"],
320 self.settings["version_stamp"])
321 ))
322 - if "AUTORESUME" in self.settings:
323 + if "autoresume" in self.settings["options"]:
324 print "The autoresume path is " + self.settings["autoresume_path"]
325 if not os.path.exists(self.settings["autoresume_path"]):
326 os.makedirs(self.settings["autoresume_path"],0755)
327 @@ -501,8 +501,8 @@ class generic_stage_target(generic_target):
328 "base_dirs","bind","chroot_setup","setup_environment",\
329 "run_local","preclean","unbind","clean"]
330 # if "TARBALL" in self.settings or \
331 -# "FETCH" not in self.settings:
332 - if "FETCH" not in self.settings:
333 +# "fetch" not in self.settings["options"]:
334 + if "fetch" not in self.settings["options"]:
335 self.settings["action_sequence"].append("capture")
336 self.settings["action_sequence"].append("clear_autoresume")
337
338 @@ -662,7 +662,7 @@ class generic_stage_target(generic_target):
339 unpack_resume = pjoin(self.settings["autoresume_path"], "unpack")
340 clst_unpack_hash=read_from_clst(unpack_resume)
341
342 - if "SEEDCACHE" in self.settings:
343 + if "seedcache" in self.settings["options"]:
344 if os.path.isdir(self.settings["source_path"]):
345 """ SEEDCACHE Is a directory, use rsync """
346 unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\
347 @@ -704,7 +704,7 @@ class generic_stage_target(generic_target):
348 error_msg="Tarball extraction of "+self.settings["source_path"]+\
349 " to "+self.settings["chroot_path"]+" failed."
350
351 - if "AUTORESUME" in self.settings:
352 + if "autoresume" in self.settings["options"]:
353 if os.path.isdir(self.settings["source_path"]) \
354 and os.path.exists(unpack_resume):
355 """ Autoresume is valid, SEEDCACHE is valid """
356 @@ -730,7 +730,7 @@ class generic_stage_target(generic_target):
357 invalid_snapshot=True
358 else:
359 """ No autoresume, SEEDCACHE """
360 - if "SEEDCACHE" in self.settings:
361 + if "seedcache" in self.settings["options"]:
362 """ SEEDCACHE so let's run rsync and let it clean up """
363 if os.path.isdir(self.settings["source_path"]):
364 unpack=True
365 @@ -754,7 +754,7 @@ class generic_stage_target(generic_target):
366 self.mount_safety_check()
367
368 if invalid_snapshot:
369 - if "AUTORESUME" in self.settings:
370 + if "autoresume" in self.settings["options"]:
371 print "No Valid Resume point detected, cleaning up..."
372
373 self.clear_autoresume()
374 @@ -766,11 +766,11 @@ class generic_stage_target(generic_target):
375 if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
376 os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
377
378 - if "PKGCACHE" in self.settings:
379 + if "pkgcache" in self.settings["options"]:
380 if not os.path.exists(self.settings["pkgcache_path"]):
381 os.makedirs(self.settings["pkgcache_path"],0755)
382
383 - if "KERNCACHE" in self.settings:
384 + if "kerncache" in self.settings["options"]:
385 if not os.path.exists(self.settings["kerncache_path"]):
386 os.makedirs(self.settings["kerncache_path"],0755)
387
388 @@ -792,7 +792,7 @@ class generic_stage_target(generic_target):
389 "unpack_portage")
390 snapshot_hash=read_from_clst(unpack_portage_resume)
391
392 - if "SNAPCACHE" in self.settings:
393 + if "snapcache" in self.settings["options"]:
394 snapshot_cache_hash=\
395 read_from_clst(self.settings["snapshot_cache_path"] + "/" +
396 "catalyst-hash")
397 @@ -824,7 +824,7 @@ class generic_stage_target(generic_target):
398 self.settings["chroot_path"]+"/usr"
399 unpack_errmsg="Error unpacking snapshot"
400
401 - if "AUTORESUME" in self.settings \
402 + if "autoresume" in self.settings["options"] \
403 and os.path.exists(self.settings["chroot_path"]+\
404 self.settings["portdir"]) \
405 and os.path.exists(unpack_portage_resume) \
406 @@ -834,7 +834,7 @@ class generic_stage_target(generic_target):
407 unpack=False
408
409 if unpack:
410 - if "SNAPCACHE" in self.settings:
411 + if "snapcache" in self.settings["options"]:
412 self.snapshot_lock_object.write_lock()
413 if os.path.exists(destdir):
414 print cleanup_msg
415 @@ -846,7 +846,7 @@ class generic_stage_target(generic_target):
416 print "Unpacking portage tree (This can take a long time) ..."
417 cmd(unpack_cmd,unpack_errmsg,env=self.env)
418
419 - if "SNAPCACHE" in self.settings:
420 + if "snapcache" in self.settings["options"]:
421 myf=open(self.settings["snapshot_cache_path"] +
422 "/" + "catalyst-hash","w")
423 myf.write(self.settings["snapshot_path_hash"])
424 @@ -857,13 +857,13 @@ class generic_stage_target(generic_target):
425 myf.write(self.settings["snapshot_path_hash"])
426 myf.close()
427
428 - if "SNAPCACHE" in self.settings:
429 + if "snapcache" in self.settings["options"]:
430 self.snapshot_lock_object.unlock()
431
432 def config_profile_link(self):
433 config_protect_link_resume = pjoin(self.settings["autoresume_path"],
434 "config_profile_link")
435 - if "AUTORESUME" in self.settings \
436 + if "autoresume" in self.settings["options"] \
437 and os.path.exists(config_protect_link_resume):
438 print \
439 "Resume point detected, skipping config_profile_link operation..."
440 @@ -883,7 +883,7 @@ class generic_stage_target(generic_target):
441 def setup_confdir(self):
442 setup_confdir_resume = pjoin(self.settings["autoresume_path"],
443 "setup_confdir")
444 - if "AUTORESUME" in self.settings \
445 + if "autoresume" in self.settings["options"] \
446 and os.path.exists(setup_confdir_resume):
447 print "Resume point detected, skipping setup_confdir operation..."
448 else:
449 @@ -935,7 +935,7 @@ class generic_stage_target(generic_target):
450
451 src=self.mountmap[x]
452 #print "bind(); src =", src
453 - if "SNAPCACHE" in self.settings and x == "portdir":
454 + if "snapcache" in self.settings["options"] and x == "portdir":
455 self.snapshot_lock_object.read_lock()
456 if os.uname()[0] == "FreeBSD":
457 if src == "/dev":
458 @@ -989,7 +989,7 @@ class generic_stage_target(generic_target):
459 ouch=1
460 warn("Couldn't umount bind mount: " + target)
461
462 - if "SNAPCACHE" in self.settings and x == "/usr/portage":
463 + if "snapcache" in self.settings["options"] and x == "/usr/portage":
464 try:
465 """
466 It's possible the snapshot lock object isn't created yet.
467 @@ -1018,7 +1018,8 @@ class generic_stage_target(generic_target):
468 self.override_ldflags()
469 chroot_setup_resume = pjoin(self.settings["autoresume_path"],
470 "chroot_setup")
471 - if "AUTORESUME" in self.settings and os.path.exists(chroot_setup_resume):
472 + if "autoresume" in self.settings["options"] \
473 + and os.path.exists(chroot_setup_resume):
474 print "Resume point detected, skipping chroot_setup operation..."
475 else:
476 print "Setting up chroot..."
477 @@ -1029,10 +1030,10 @@ class generic_stage_target(generic_target):
478 "Could not copy resolv.conf into place.",env=self.env)
479
480 """ Copy over the envscript, if applicable """
481 - if "ENVSCRIPT" in self.settings:
482 - if not os.path.exists(self.settings["ENVSCRIPT"]):
483 + if "envscript" in self.settings:
484 + if not os.path.exists(self.settings["envscript"]):
485 raise CatalystError,\
486 - "Can't find envscript "+self.settings["ENVSCRIPT"]
487 + "Can't find envscript "+self.settings["envscript"]
488
489 print "\nWarning!!!!"
490 print "\tOverriding certain env variables may cause catastrophic failure."
491 @@ -1042,7 +1043,7 @@ class generic_stage_target(generic_target):
492 print "\tCatalyst Maintainers use VERY minimal envscripts if used at all"
493 print "\tYou have been warned\n"
494
495 - cmd("cp "+self.settings["ENVSCRIPT"]+" "+\
496 + cmd("cp "+self.settings["envscript"]+" "+\
497 self.settings["chroot_path"]+"/tmp/envscript",\
498 "Could not copy envscript into place.",env=self.env)
499
500 @@ -1118,7 +1119,8 @@ class generic_stage_target(generic_target):
501
502 def fsscript(self):
503 fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
504 - if "AUTORESUME" in self.settings and os.path.exists(fsscript_resume):
505 + if "autoresume" in self.settings["options"] \
506 + and os.path.exists(fsscript_resume):
507 print "Resume point detected, skipping fsscript operation..."
508 else:
509 if "fsscript" in self.settings:
510 @@ -1129,7 +1131,7 @@ class generic_stage_target(generic_target):
511
512 def rcupdate(self):
513 rcupdate_resume = pjoin(self.settings["autoresume_path"], "rcupdate")
514 - if "AUTORESUME" in self.settings \
515 + if "autoresume" in self.settings["options"] \
516 and os.path.exists(rcupdate_resume):
517 print "Resume point detected, skipping rcupdate operation..."
518 else:
519 @@ -1140,7 +1142,7 @@ class generic_stage_target(generic_target):
520
521 def clean(self):
522 clean_resume = pjoin(self.settings["autoresume_path"], "clean")
523 - if "AUTORESUME" in self.settings \
524 + if "autoresume" in self.settings["options"] \
525 and os.path.exists(clean_resume):
526 print "Resume point detected, skipping clean operation..."
527 else:
528 @@ -1176,7 +1178,8 @@ class generic_stage_target(generic_target):
529
530 def empty(self):
531 empty_resume = pjoin(self.settings["autoresume_path"], "empty")
532 - if "AUTORESUME" in self.settings and os.path.exists(empty_resume):
533 + if "autoresume" in self.settings["options"] \
534 + and os.path.exists(empty_resume):
535 print "Resume point detected, skipping empty operation..."
536 else:
537 if self.settings["spec_prefix"]+"/empty" in self.settings:
538 @@ -1204,7 +1207,8 @@ class generic_stage_target(generic_target):
539
540 def remove(self):
541 remove_resume = pjoin(self.settings["autoresume_path"], "remove")
542 - if "AUTORESUME" in self.settings and os.path.exists(remove_resume):
543 + if "autoresume" in self.settings["options"] \
544 + and os.path.exists(remove_resume):
545 print "Resume point detected, skipping remove operation..."
546 else:
547 if self.settings["spec_prefix"]+"/rm" in self.settings:
548 @@ -1226,7 +1230,8 @@ class generic_stage_target(generic_target):
549
550 def preclean(self):
551 preclean_resume = pjoin(self.settings["autoresume_path"], "preclean")
552 - if "AUTORESUME" in self.settings and os.path.exists(preclean_resume):
553 + if "autoresume" in self.settings["options"] \
554 + and os.path.exists(preclean_resume):
555 print "Resume point detected, skipping preclean operation..."
556 else:
557 try:
558 @@ -1241,7 +1246,8 @@ class generic_stage_target(generic_target):
559
560 def capture(self):
561 capture_resume = pjoin(self.settings["autoresume_path"], "capture")
562 - if "AUTORESUME" in self.settings and os.path.exists(capture_resume):
563 + if "autoresume" in self.settings["options"] \
564 + and os.path.exists(capture_resume):
565 print "Resume point detected, skipping capture operation..."
566 else:
567 """ Capture target in a tarball """
568 @@ -1266,7 +1272,8 @@ class generic_stage_target(generic_target):
569
570 def run_local(self):
571 run_local_resume = pjoin(self.settings["autoresume_path"], "run_local")
572 - if "AUTORESUME" in self.settings and os.path.exists(run_local_resume):
573 + if "autoresume" in self.settings["options"] \
574 + and os.path.exists(run_local_resume):
575 print "Resume point detected, skipping run_local operation..."
576 else:
577 try:
578 @@ -1285,7 +1292,14 @@ class generic_stage_target(generic_target):
579 fixed. We need this to use the os.system() call since we can't
580 specify our own environ
581 """
582 - for x in self.settings.keys():
583 + #print "setup_environment(); settings =", list(self.settings)
584 + for x in list(self.settings):
585 + #print "setup_environment(); processing:", x
586 + if x == "options":
587 + #self.env['clst_' + x] = ' '.join(self.settings[x])
588 + for opt in self.settings[x]:
589 + self.env['clst_' + opt.upper()] = "true"
590 + continue
591 """ Sanitize var names by doing "s|/-.|_|g" """
592 varname="clst_"+string.replace(x,"/","_")
593 varname=string.replace(varname,"-","_")
594 @@ -1314,10 +1328,10 @@ class generic_stage_target(generic_target):
595 """ Check for mounts right away and abort if we cannot unmount them """
596 self.mount_safety_check()
597
598 - if "CLEAR_AUTORESUME" in self.settings:
599 + if "clear-autoresume" in self.settings["options"]:
600 self.clear_autoresume()
601
602 - if "PURGETMPONLY" in self.settings:
603 + if "purgetmponly" in self.settings["options"]:
604 self.purge()
605 return
606
607 @@ -1325,7 +1339,7 @@ class generic_stage_target(generic_target):
608 self.purge()
609 return
610
611 - if "PURGE" in self.settings:
612 + if "purge" in self.settings["options"]:
613 self.purge()
614
615 for x in self.settings["action_sequence"]:
616 @@ -1341,7 +1355,8 @@ class generic_stage_target(generic_target):
617
618 def unmerge(self):
619 unmerge_resume = pjoin(self.settings["autoresume_path"], "unmerge")
620 - if "AUTORESUME" in self.settings and os.path.exists(unmerge_resume):
621 + if "autoresume" in self.settings["options"] \
622 + and os.path.exists(unmerge_resume):
623 print "Resume point detected, skipping unmerge operation..."
624 else:
625 if self.settings["spec_prefix"]+"/unmerge" in self.settings:
626 @@ -1374,7 +1389,8 @@ class generic_stage_target(generic_target):
627 def target_setup(self):
628 target_setup_resume = pjoin(self.settings["autoresume_path"],
629 "target_setup")
630 - if "AUTORESUME" in self.settings and os.path.exists(target_setup_resume):
631 + if "autoresume" in self.settings["options"] \
632 + and os.path.exists(target_setup_resume):
633 print "Resume point detected, skipping target_setup operation..."
634 else:
635 print "Setting up filesystems per filesystem type"
636 @@ -1386,8 +1402,8 @@ class generic_stage_target(generic_target):
637 def setup_overlay(self):
638 setup_overlay_resume = pjoin(self.settings["autoresume_path"],
639 "setup_overlay")
640 - if "AUTORESUME" in self.settings and \
641 - os.path.exists(setup_overlay_resume):
642 + if "autoresume" in self.settings["options"] \
643 + and os.path.exists(setup_overlay_resume):
644 print "Resume point detected, skipping setup_overlay operation..."
645 else:
646 if self.settings["spec_prefix"]+"/overlay" in self.settings:
647 @@ -1401,7 +1417,8 @@ class generic_stage_target(generic_target):
648
649 def create_iso(self):
650 create_iso_resume = pjoin(self.settings["autoresume_path"], "create_iso")
651 - if "AUTORESUME" in self.settings and os.path.exists(create_iso_resume):
652 + if "autoresume" in self.settings["options"] \
653 + and os.path.exists(create_iso_resume):
654 print "Resume point detected, skipping create_iso operation..."
655 else:
656 """ Create the ISO """
657 @@ -1419,12 +1436,12 @@ class generic_stage_target(generic_target):
658 def build_packages(self):
659 build_packages_resume = pjoin(self.settings["autoresume_path"],
660 "build_packages")
661 - if "AUTORESUME" in self.settings and \
662 - os.path.exists(build_packages_resume):
663 + if "autoresume" in self.settings["options"] \
664 + and os.path.exists(build_packages_resume):
665 print "Resume point detected, skipping build_packages operation..."
666 else:
667 if self.settings["spec_prefix"]+"/packages" in self.settings:
668 - if "AUTORESUME" in self.settings \
669 + if "autoresume" in self.settings["options"] \
670 and os.path.exists(self.settings["autoresume_path"]+\
671 "build_packages"):
672 print "Resume point detected, skipping build_packages operation..."
673 @@ -1443,10 +1460,11 @@ class generic_stage_target(generic_target):
674 "build aborting due to error."
675
676 def build_kernel(self):
677 - "Build all configured kernels"
678 + '''Build all configured kernels'''
679 build_kernel_resume = pjoin(self.settings["autoresume_path"],
680 "build_kernel")
681 - if "AUTORESUME" in self.settings and os.path.exists(build_kernel_resume):
682 + if "autoresume" in self.settings["options"] \
683 + and os.path.exists(build_kernel_resume):
684 print "Resume point detected, skipping build_kernel operation..."
685 else:
686 if "boot/kernel" in self.settings:
687 @@ -1472,7 +1490,8 @@ class generic_stage_target(generic_target):
688 "Build a single configured kernel by name"
689 kname_resume = pjoin(self.settings["autoresume_path"],
690 "build_kernel_" + kname)
691 - if "AUTORESUME" in self.settings and os.path.exists(kname_resume):
692 + if "autoresume" in self.settings["options"] \
693 + and os.path.exists(kname_resume):
694 print "Resume point detected, skipping build_kernel for "+kname+" operation..."
695 return
696 self._copy_kernel_config(kname=kname)
697 @@ -1568,7 +1587,8 @@ class generic_stage_target(generic_target):
698
699 def bootloader(self):
700 bootloader_resume = pjoin(self.settings["autoresume_path"], "bootloader")
701 - if "AUTORESUME" in self.settings and os.path.exists(bootloader_resume):
702 + if "autoresume" in self.settings["options"] \
703 + and os.path.exists(bootloader_resume):
704 print "Resume point detected, skipping bootloader operation..."
705 else:
706 try:
707 @@ -1583,7 +1603,7 @@ class generic_stage_target(generic_target):
708 def livecd_update(self):
709 livecd_update_resume = pjoin(self.settings["autoresume_path"],
710 "livecd_update")
711 - if "AUTORESUME" in self.settings \
712 + if "autoresume" in self.settings["options"] \
713 and os.path.exists(livecd_update_resume):
714 print "Resume point detected, skipping build_packages operation..."
715 else:
716 @@ -1615,7 +1635,7 @@ class generic_stage_target(generic_target):
717 os.chmod(myemp,mystat[ST_MODE])
718
719 def clear_packages(self):
720 - if "PKGCACHE" in self.settings:
721 + if "pkgcache" in self.settings["options"]:
722 print "purging the pkgcache ..."
723
724 myemp=self.settings["pkgcache_path"]
725 @@ -1633,7 +1653,7 @@ class generic_stage_target(generic_target):
726 os.chmod(myemp,mystat[ST_MODE])
727
728 def clear_kerncache(self):
729 - if "KERNCACHE" in self.settings:
730 + if "kerncache" in self.settings["options"]:
731 print "purging the kerncache ..."
732
733 myemp=self.settings["kerncache_path"]
734 @@ -1652,11 +1672,11 @@ class generic_stage_target(generic_target):
735
736 def clear_autoresume(self):
737 """ Clean resume points since they are no longer needed """
738 - if "AUTORESUME" in self.settings:
739 + if "autoresume" in self.settings["options"]:
740 print "Removing AutoResume Points: ..."
741 myemp=self.settings["autoresume_path"]
742 if os.path.isdir(myemp):
743 - if "AUTORESUME" in self.settings:
744 + if "autoresume" in self.settings["options"]:
745 print "Emptying directory",myemp
746 """
747 stat the dir, delete the dir, recreate the dir and set
748 @@ -1720,7 +1740,7 @@ class generic_stage_target(generic_target):
749
750 def purge(self):
751 countdown(10,"Purging Caches ...")
752 - if any(k in self.settings for k in ("PURGE","PURGEONLY","PURGETMPONLY")):
753 + if any(k in self.settings["options"] for k in ("purge","purgeonly","purgetmponly")):
754 print "clearing autoresume ..."
755 self.clear_autoresume()
756
757
758 diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
759 index 8e70042..a8309a8 100644
760 --- a/catalyst/targets/grp_target.py
761 +++ b/catalyst/targets/grp_target.py
762 @@ -36,7 +36,7 @@ class grp_target(generic_stage_target):
763
764 def set_target_path(self):
765 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
766 - if "AUTORESUME" in self.settings \
767 + if "autoresume" in self.settings["options"] \
768 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
769 print "Resume point detected, skipping target path setup operation..."
770 else:
771
772 diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
773 index ac846ec..6273c9e 100644
774 --- a/catalyst/targets/livecd_stage1_target.py
775 +++ b/catalyst/targets/livecd_stage1_target.py
776 @@ -25,7 +25,7 @@ class livecd_stage1_target(generic_stage_target):
777
778 def set_target_path(self):
779 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
780 - if "AUTORESUME" in self.settings \
781 + if "autoresume" in self.settings["options"] \
782 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
783 print "Resume point detected, skipping target path setup operation..."
784 else:
785
786 diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
787 index e784844..11b1219 100644
788 --- a/catalyst/targets/livecd_stage2_target.py
789 +++ b/catalyst/targets/livecd_stage2_target.py
790 @@ -48,7 +48,7 @@ class livecd_stage2_target(generic_stage_target):
791
792 def set_target_path(self):
793 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
794 - if "AUTORESUME" in self.settings \
795 + if "autoresume" in self.settings["options"] \
796 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
797 print "Resume point detected, skipping target path setup operation..."
798 else:
799 @@ -90,7 +90,7 @@ class livecd_stage2_target(generic_stage_target):
800 error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
801 invalid_snapshot=False
802
803 - if "AUTORESUME" in self.settings:
804 + if "autoresume" in self.settings["options"]:
805 if os.path.isdir(self.settings["source_path"]) and \
806 os.path.exists(self.settings["autoresume_path"]+"unpack"):
807 print "Resume point detected, skipping unpack operation..."
808 @@ -114,7 +114,7 @@ class livecd_stage2_target(generic_stage_target):
809 if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
810 os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
811
812 - if "PKGCACHE" in self.settings:
813 + if "pkgcache" in self.settings["options"]:
814 if not os.path.exists(self.settings["pkgcache_path"]):
815 os.makedirs(self.settings["pkgcache_path"],0755)
816
817 @@ -136,7 +136,7 @@ class livecd_stage2_target(generic_stage_target):
818 "config_profile_link","setup_confdir","portage_overlay",\
819 "bind","chroot_setup","setup_environment","run_local",\
820 "build_kernel"]
821 - if "FETCH" not in self.settings:
822 + if "fetch" not in self.settings["options"]:
823 self.settings["action_sequence"] += ["bootloader","preclean",\
824 "livecd_update","root_overlay","fsscript","rcupdate","unmerge",\
825 "unbind","remove","empty","target_setup",\
826
827 diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
828 index 2b3cd20..8809dd0 100644
829 --- a/catalyst/targets/netboot2_target.py
830 +++ b/catalyst/targets/netboot2_target.py
831 @@ -45,7 +45,7 @@ class netboot2_target(generic_stage_target):
832 def set_target_path(self):
833 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
834 self.settings["target_subpath"]+"/")
835 - if "AUTORESUME" in self.settings \
836 + if "autoresume" in self.settings["options"] \
837 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
838 print "Resume point detected, skipping target path setup operation..."
839 else:
840 @@ -63,7 +63,7 @@ class netboot2_target(generic_stage_target):
841 myfiles=[]
842
843 # check for autoresume point
844 - if "AUTORESUME" in self.settings \
845 + if "autoresume" in self.settings["options"] \
846 and os.path.exists(self.settings["autoresume_path"]+"copy_files_to_image"):
847 print "Resume point detected, skipping target path setup operation..."
848 else:
849 @@ -96,7 +96,7 @@ class netboot2_target(generic_stage_target):
850 touch(self.settings["autoresume_path"]+"copy_files_to_image")
851
852 def setup_overlay(self):
853 - if "AUTORESUME" in self.settings \
854 + if "autoresume" in self.settings["options"] \
855 and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"):
856 print "Resume point detected, skipping setup_overlay operation..."
857 else:
858 @@ -120,7 +120,7 @@ class netboot2_target(generic_stage_target):
859 raise CatalystError,"Failed to move kernel images!"
860
861 def remove(self):
862 - if "AUTORESUME" in self.settings \
863 + if "autoresume" in self.settings["options"] \
864 and os.path.exists(self.settings["autoresume_path"]+"remove"):
865 print "Resume point detected, skipping remove operation..."
866 else:
867 @@ -132,7 +132,7 @@ class netboot2_target(generic_stage_target):
868 os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x)
869
870 def empty(self):
871 - if "AUTORESUME" in self.settings \
872 + if "autoresume" in self.settings["options"] \
873 and os.path.exists(self.settings["autoresume_path"]+"empty"):
874 print "Resume point detected, skipping empty operation..."
875 else:
876
877 diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
878 index d1b9e40..50133ec 100644
879 --- a/catalyst/targets/snapshot_target.py
880 +++ b/catalyst/targets/snapshot_target.py
881 @@ -32,11 +32,11 @@ class snapshot_target(generic_stage_target):
882 pass
883
884 def run(self):
885 - if "PURGEONLY" in self.settings:
886 + if "purgeonly" in self.settings["options"]:
887 self.purge()
888 return
889
890 - if "PURGE" in self.settings:
891 + if "purge" in self.settings["options"]:
892 self.purge()
893
894 self.setup()
895
896 diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
897 index 6377f5d..94d4a1e 100644
898 --- a/catalyst/targets/stage2_target.py
899 +++ b/catalyst/targets/stage2_target.py
900 @@ -16,7 +16,7 @@ class stage2_target(generic_stage_target):
901 generic_stage_target.__init__(self,spec,addlargs)
902
903 def set_source_path(self):
904 - if "SEEDCACHE" in self.settings and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
905 + if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
906 self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
907 else:
908 self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
909
910 diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
911 index 9168f2e..e2b8a79 100644
912 --- a/catalyst/targets/stage4_target.py
913 +++ b/catalyst/targets/stage4_target.py
914 @@ -32,8 +32,8 @@ class stage4_target(generic_stage_target):
915 "clean"]
916
917 # if "TARBALL" in self.settings or \
918 -# "FETCH" not in self.settings:
919 - if "FETCH" not in self.settings:
920 +# "fetch" not in self.settings['options']:
921 + if "fetch" not in self.settings['options']:
922 self.settings["action_sequence"].append("capture")
923 self.settings["action_sequence"].append("clear_autoresume")