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/base/, catalyst/targets/
Date: Thu, 26 Feb 2015 04:12:12
Message-Id: 1420091885.5fa2b2a910c45401f132e7ed7e9da9a993762252.dolsen@gentoo
1 commit: 5fa2b2a910c45401f132e7ed7e9da9a993762252
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 12 03:51:52 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=5fa2b2a9
7
8 [1 of 3] Move base stage and target files to thier own sub-pkg
9
10 Fix an indent error in grp_target.py
11
12 ---
13 catalyst/base/__init__.py | 1 +
14 catalyst/{targets => base}/clearbase.py | 0
15 catalyst/{targets => base}/genbase.py | 0
16 .../generic_stage_target.py => base/stagebase.py} | 8 ++---
17 catalyst/{targets => base}/targetbase.py | 0
18 catalyst/targets/embedded_target.py | 12 ++++----
19 catalyst/targets/grp_target.py | 34 +++++++++++++---------
20 catalyst/targets/livecd_stage1_target.py | 21 ++++++++-----
21 catalyst/targets/livecd_stage2_target.py | 13 +++++----
22 catalyst/targets/netboot2_target.py | 17 +++++++----
23 catalyst/targets/netboot_target.py | 15 ++++++----
24 catalyst/targets/snapshot_target.py | 4 +--
25 catalyst/targets/stage1_target.py | 17 ++++++-----
26 catalyst/targets/stage2_target.py | 15 ++++++----
27 catalyst/targets/stage3_target.py | 12 ++++----
28 catalyst/targets/stage4_target.py | 8 ++---
29 catalyst/targets/tinderbox_target.py | 11 ++++---
30 17 files changed, 113 insertions(+), 75 deletions(-)
31
32 diff --git a/catalyst/base/__init__.py b/catalyst/base/__init__.py
33 new file mode 100644
34 index 0000000..8b13789
35 --- /dev/null
36 +++ b/catalyst/base/__init__.py
37 @@ -0,0 +1 @@
38 +
39
40 diff --git a/catalyst/targets/clearbase.py b/catalyst/base/clearbase.py
41 similarity index 100%
42 rename from catalyst/targets/clearbase.py
43 rename to catalyst/base/clearbase.py
44
45 diff --git a/catalyst/targets/genbase.py b/catalyst/base/genbase.py
46 similarity index 100%
47 rename from catalyst/targets/genbase.py
48 rename to catalyst/base/genbase.py
49
50 diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/base/stagebase.py
51 similarity index 99%
52 rename from catalyst/targets/generic_stage_target.py
53 rename to catalyst/base/stagebase.py
54 index 296eee3..bebb5dc 100644
55 --- a/catalyst/targets/generic_stage_target.py
56 +++ b/catalyst/base/stagebase.py
57 @@ -14,13 +14,13 @@ from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
58 PORT_LOGDIR_CLEAN)
59 from catalyst.support import (CatalystError, msg, file_locate, normpath,
60 touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount)
61 -from catalyst.targets.targetbase import TargetBase
62 -from catalyst.targets.clearbase import ClearBase
63 -from catalyst.targets.genbase import GenBase
64 +from catalyst.base.targetbase import TargetBase
65 +from catalyst.base.clearbase import ClearBase
66 +from catalyst.base.genbase import GenBase
67 from catalyst.lock import LockDir
68
69
70 -class generic_stage_target(TargetBase, ClearBase, GenBase):
71 +class StageBase(TargetBase, ClearBase, GenBase):
72 """
73 This class does all of the chroot setup, copying of files, etc. It is
74 the driver class for pretty much everything that Catalyst does.
75
76 diff --git a/catalyst/targets/targetbase.py b/catalyst/base/targetbase.py
77 similarity index 100%
78 rename from catalyst/targets/targetbase.py
79 rename to catalyst/base/targetbase.py
80
81 diff --git a/catalyst/targets/embedded_target.py b/catalyst/targets/embedded_target.py
82 index 7cee7a6..528d545 100644
83 --- a/catalyst/targets/embedded_target.py
84 +++ b/catalyst/targets/embedded_target.py
85 @@ -10,12 +10,12 @@ ROOT=/tmp/submerge emerge --something foo bar .
86 """
87 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
88
89 -import os,string,imp,types,shutil
90 -from catalyst.support import *
91 -from generic_stage_target import *
92 -from stat import *
93
94 -class embedded_target(generic_stage_target):
95 +from catalyst.support import normpath
96 +
97 +from catalyst.base.stagebase import StageBase
98 +
99 +class embedded_target(StageBase):
100 """
101 Builder class for embedded target
102 """
103 @@ -27,7 +27,7 @@ class embedded_target(generic_stage_target):
104 if "embedded/fs-type" in addlargs:
105 self.valid_values.append("embedded/fs-ops")
106
107 - generic_stage_target.__init__(self,spec,addlargs)
108 + StageBase.__init__(self,spec,addlargs)
109 self.set_build_kernel_vars(addlargs)
110
111 def set_action_sequence(self):
112
113 diff --git a/catalyst/targets/grp_target.py b/catalyst/targets/grp_target.py
114 index 033db75..deba80a 100644
115 --- a/catalyst/targets/grp_target.py
116 +++ b/catalyst/targets/grp_target.py
117 @@ -3,11 +3,18 @@ Gentoo Reference Platform (GRP) target
118 """
119 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
120
121 -import os,types,glob
122 -from catalyst.support import *
123 -from generic_stage_target import *
124 +import os
125 +import types
126 +import glob
127
128 -class grp_target(generic_stage_target):
129 +
130 +from catalyst.support import (CatalystError, normpath,
131 + touch, cmd, list_bashify)
132 +
133 +from catalyst.base.stagebase import StageBase
134 +
135 +
136 +class grp_target(StageBase):
137 """
138 The builder class for GRP (Gentoo Reference Platform) builds.
139 """
140 @@ -32,7 +39,7 @@ class grp_target(generic_stage_target):
141 self.required_values.append("grp/"+x+"/packages")
142 self.required_values.append("grp/"+x+"/type")
143
144 - generic_stage_target.__init__(self,spec,addlargs)
145 + StageBase.__init__(self,spec,addlargs)
146
147 def set_target_path(self):
148 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
149 @@ -62,16 +69,15 @@ class grp_target(generic_stage_target):
150 raise CatalystError,"GRP build aborting due to error."
151
152 def set_use(self):
153 - generic_stage_target.set_use(self)
154 - if "BINDIST" in self.settings:
155 - if "use" in self.settings:
156 - self.settings["use"].append("bindist")
157 - else:
158 - self.settings["use"]=["bindist"]
159 + StageBase.set_use(self)
160 + if "use" in self.settings:
161 + self.settings["use"].append("bindist")
162 + else:
163 + self.settings["use"]=["bindist"]
164
165 def set_mounts(self):
166 - self.mounts.append("/tmp/grp")
167 - self.mountmap["/tmp/grp"]=self.settings["target_path"]
168 + self.mounts.append("/tmp/grp")
169 + self.mountmap["/tmp/grp"]=self.settings["target_path"]
170
171 def generate_digests(self):
172 for pkgset in self.settings["grp"]:
173 @@ -108,7 +114,7 @@ class grp_target(generic_stage_target):
174 self.gen_digest_file(normpath(destdir+"/"+i))
175
176 def set_action_sequence(self):
177 - self.settings["action_sequence"]=["unpack","unpack_snapshot",\
178 + self.settings["action_sequence"]=["unpack","unpack_snapshot",\
179 "config_profile_link","setup_confdir","portage_overlay","bind","chroot_setup",\
180 "setup_environment","run_local","unbind",\
181 "generate_digests","clear_autoresume"]
182
183 diff --git a/catalyst/targets/livecd_stage1_target.py b/catalyst/targets/livecd_stage1_target.py
184 index 6273c9e..a19f4ac 100644
185 --- a/catalyst/targets/livecd_stage1_target.py
186 +++ b/catalyst/targets/livecd_stage1_target.py
187 @@ -3,10 +3,17 @@ LiveCD stage1 target
188 """
189 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
190
191 -from catalyst.support import *
192 -from generic_stage_target import *
193 +import os
194 +import types
195 +import string
196
197 -class livecd_stage1_target(generic_stage_target):
198 +from catalyst.support import (normpath,
199 + touch, cmd)
200 +
201 +from catalyst.base.stagebase import StageBase
202 +
203 +
204 +class livecd_stage1_target(StageBase):
205 """
206 Builder class for LiveCD stage1.
207 """
208 @@ -15,7 +22,7 @@ class livecd_stage1_target(generic_stage_target):
209 self.valid_values=self.required_values[:]
210
211 self.valid_values.extend(["livecd/use"])
212 - generic_stage_target.__init__(self,spec,addlargs)
213 + StageBase.__init__(self,spec,addlargs)
214
215 def set_action_sequence(self):
216 self.settings["action_sequence"]=["unpack","unpack_snapshot",\
217 @@ -45,7 +52,7 @@ class livecd_stage1_target(generic_stage_target):
218 self.settings["spec_prefix"]="livecd"
219
220 def set_use(self):
221 - generic_stage_target.set_use(self)
222 + StageBase.set_use(self)
223 if "use" in self.settings:
224 self.settings["use"].append("livecd")
225 if "BINDIST" in self.settings:
226 @@ -56,7 +63,7 @@ class livecd_stage1_target(generic_stage_target):
227 self.settings["use"].append("bindist")
228
229 def set_packages(self):
230 - generic_stage_target.set_packages(self)
231 + StageBase.set_packages(self)
232 if self.settings["spec_prefix"]+"/packages" in self.settings:
233 if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
234 self.settings[self.settings["spec_prefix"]+"/packages"] = \
235 @@ -68,7 +75,7 @@ class livecd_stage1_target(generic_stage_target):
236 if type(self.settings["pkgcache_path"]) != types.StringType:
237 self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
238 else:
239 - generic_stage_target.set_pkgcache_path(self)
240 + StageBase.set_pkgcache_path(self)
241
242 def register(foo):
243 foo.update({"livecd-stage1":livecd_stage1_target})
244
245 diff --git a/catalyst/targets/livecd_stage2_target.py b/catalyst/targets/livecd_stage2_target.py
246 index 11b1219..e7ae212 100644
247 --- a/catalyst/targets/livecd_stage2_target.py
248 +++ b/catalyst/targets/livecd_stage2_target.py
249 @@ -3,11 +3,14 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
250 """
251 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
252
253 -import os,string,types,stat,shutil
254 -from catalyst.support import *
255 -from generic_stage_target import *
256 +import os
257
258 -class livecd_stage2_target(generic_stage_target):
259 +from catalyst.support import (normpath, file_locate, CatalystError, cmd,
260 + read_from_clst, touch)
261 +from catalyst.base.stagebase import StageBase
262 +
263 +
264 +class livecd_stage2_target(StageBase):
265 """
266 Builder class for a LiveCD stage2 build.
267 """
268 @@ -26,7 +29,7 @@ class livecd_stage2_target(generic_stage_target):
269 "livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
270 "gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
271
272 - generic_stage_target.__init__(self,spec,addlargs)
273 + StageBase.__init__(self,spec,addlargs)
274 if "livecd/type" not in self.settings:
275 self.settings["livecd/type"] = "generic-livecd"
276
277
278 diff --git a/catalyst/targets/netboot2_target.py b/catalyst/targets/netboot2_target.py
279 index ea07d76..987afd8 100644
280 --- a/catalyst/targets/netboot2_target.py
281 +++ b/catalyst/targets/netboot2_target.py
282 @@ -3,11 +3,18 @@ netboot target, version 2
283 """
284 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
285
286 -import os,string,types
287 -from catalyst.support import *
288 -from generic_stage_target import *
289 +import os
290 +import types
291 +import shutil
292 +from stat import ST_UID, ST_GID, ST_MODE
293
294 -class netboot2_target(generic_stage_target):
295 +from catalyst.support import (CatalystError, normpath,
296 + touch, cmd, list_bashify)
297 +
298 +from catalyst.base.stagebase import StageBase
299 +
300 +
301 +class netboot2_target(StageBase):
302 """
303 Builder class for a netboot build, version 2
304 """
305 @@ -38,7 +45,7 @@ class netboot2_target(generic_stage_target):
306 except:
307 raise CatalystError,"configuration error in netboot2/packages."
308
309 - generic_stage_target.__init__(self,spec,addlargs)
310 + StageBase.__init__(self,spec,addlargs)
311 self.set_build_kernel_vars()
312 self.settings["merge_path"]=normpath("/tmp/image/")
313
314
315 diff --git a/catalyst/targets/netboot_target.py b/catalyst/targets/netboot_target.py
316 index ae1eb04..c880289 100644
317 --- a/catalyst/targets/netboot_target.py
318 +++ b/catalyst/targets/netboot_target.py
319 @@ -3,11 +3,16 @@ netboot target, version 1
320 """
321 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
322
323 -import os,string,types
324 -from catalyst.support import *
325 -from generic_stage_target import *
326 +import os
327 +import types
328
329 -class netboot_target(generic_stage_target):
330 +from catalyst.support import (CatalystError, normpath,
331 + cmd, list_bashify, file_locate)
332 +
333 +from catalyst.base.stagebase import StageBase
334 +
335 +
336 +class netboot_target(StageBase):
337 """
338 Builder class for a netboot build.
339 """
340 @@ -36,7 +41,7 @@ class netboot_target(generic_stage_target):
341 except:
342 raise CatalystError,"configuration error in netboot/packages."
343
344 - generic_stage_target.__init__(self,spec,addlargs)
345 + StageBase.__init__(self,spec,addlargs)
346 self.set_build_kernel_vars(addlargs)
347 if "netboot/busybox_config" in addlargs:
348 file_locate(self.settings, ["netboot/busybox_config"])
349
350 diff --git a/catalyst/targets/snapshot_target.py b/catalyst/targets/snapshot_target.py
351 index 3289bbd..337ff1d 100644
352 --- a/catalyst/targets/snapshot_target.py
353 +++ b/catalyst/targets/snapshot_target.py
354 @@ -8,8 +8,8 @@ from stat import ST_UID, ST_GID, ST_MODE
355
356
357 from catalyst.support import normpath, cmd
358 -from catalyst.targets.targetbase import TargetBase
359 -from catalyst.targets.genbase import GenBase
360 +from catalyst.base.targetbase import TargetBase
361 +from catalyst.base.genbase import GenBase
362
363 class snapshot_target(TargetBase, GenBase):
364 """
365
366 diff --git a/catalyst/targets/stage1_target.py b/catalyst/targets/stage1_target.py
367 index 8d5a674..0a36432 100644
368 --- a/catalyst/targets/stage1_target.py
369 +++ b/catalyst/targets/stage1_target.py
370 @@ -3,10 +3,13 @@ stage1 target
371 """
372 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
373
374 -from catalyst.support import *
375 -from generic_stage_target import *
376 +import os
377
378 -class stage1_target(generic_stage_target):
379 +from catalyst.support import normpath, list_to_string
380 +from catalyst.base.stagebase import StageBase
381 +
382 +
383 +class stage1_target(StageBase):
384 """
385 Builder class for a stage1 installation tarball build.
386 """
387 @@ -14,7 +17,7 @@ class stage1_target(generic_stage_target):
388 self.required_values=[]
389 self.valid_values=["chost"]
390 self.valid_values.extend(["update_seed","update_seed_command"])
391 - generic_stage_target.__init__(self,spec,addlargs)
392 + StageBase.__init__(self,spec,addlargs)
393
394 def set_stage_path(self):
395 self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
396 @@ -26,11 +29,11 @@ class stage1_target(generic_stage_target):
397 print "stage1 root path is "+self.settings["root_path"]
398
399 def set_cleanables(self):
400 - generic_stage_target.set_cleanables(self)
401 + StageBase.set_cleanables(self)
402 self.settings["cleanables"].extend([\
403 "/usr/share/zoneinfo", "/etc/portage/package*"])
404
405 - # XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
406 + # XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
407
408 def override_chost(self):
409 if "chost" in self.settings:
410 @@ -49,7 +52,7 @@ class stage1_target(generic_stage_target):
411 self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
412
413 def set_portage_overlay(self):
414 - generic_stage_target.set_portage_overlay(self)
415 + StageBase.set_portage_overlay(self)
416 if "portage_overlay" in self.settings:
417 print "\nWARNING !!!!!"
418 print "\tUsing an portage overlay for earlier stages could cause build issues."
419
420 diff --git a/catalyst/targets/stage2_target.py b/catalyst/targets/stage2_target.py
421 index 94d4a1e..783d42e 100644
422 --- a/catalyst/targets/stage2_target.py
423 +++ b/catalyst/targets/stage2_target.py
424 @@ -3,17 +3,20 @@ stage2 target, builds upon previous stage1 tarball
425 """
426 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
427
428 -from catalyst.support import *
429 -from generic_stage_target import *
430 +import os
431
432 -class stage2_target(generic_stage_target):
433 +from catalyst.support import normpath, list_to_string
434 +from catalyst.base.stagebase import StageBase
435 +
436 +
437 +class stage2_target(StageBase):
438 """
439 Builder class for a stage2 installation tarball build.
440 """
441 def __init__(self,spec,addlargs):
442 self.required_values=[]
443 self.valid_values=["chost"]
444 - generic_stage_target.__init__(self,spec,addlargs)
445 + StageBase.__init__(self,spec,addlargs)
446
447 def set_source_path(self):
448 if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
449 @@ -34,7 +37,7 @@ class stage2_target(generic_stage_target):
450 print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n")
451
452 # XXX: How do these override_foo() functions differ from the ones in
453 - # generic_stage_target and why aren't they in stage3_target?
454 + # StageBase and why aren't they in stage3_target?
455
456 def override_chost(self):
457 if "chost" in self.settings:
458 @@ -53,7 +56,7 @@ class stage2_target(generic_stage_target):
459 self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
460
461 def set_portage_overlay(self):
462 - generic_stage_target.set_portage_overlay(self)
463 + StageBase.set_portage_overlay(self)
464 if "portage_overlay" in self.settings:
465 print "\nWARNING !!!!!"
466 print "\tUsing an portage overlay for earlier stages could cause build issues."
467
468 diff --git a/catalyst/targets/stage3_target.py b/catalyst/targets/stage3_target.py
469 index 89edd66..28021b1 100644
470 --- a/catalyst/targets/stage3_target.py
471 +++ b/catalyst/targets/stage3_target.py
472 @@ -3,20 +3,20 @@ stage3 target, builds upon previous stage2/stage3 tarball
473 """
474 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
475
476 -from catalyst.support import *
477 -from generic_stage_target import *
478 +from catalyst.base.stagebase import StageBase
479
480 -class stage3_target(generic_stage_target):
481 +
482 +class stage3_target(StageBase):
483 """
484 Builder class for a stage3 installation tarball build.
485 """
486 def __init__(self,spec,addlargs):
487 self.required_values=[]
488 self.valid_values=[]
489 - generic_stage_target.__init__(self,spec,addlargs)
490 + StageBase.__init__(self,spec,addlargs)
491
492 def set_portage_overlay(self):
493 - generic_stage_target.set_portage_overlay(self)
494 + StageBase.set_portage_overlay(self)
495 if "portage_overlay" in self.settings:
496 print "\nWARNING !!!!!"
497 print "\tUsing an overlay for earlier stages could cause build issues."
498 @@ -24,7 +24,7 @@ class stage3_target(generic_stage_target):
499 print "\tDont say we did not warn you\n"
500
501 def set_cleanables(self):
502 - generic_stage_target.set_cleanables(self)
503 + StageBase.set_cleanables(self)
504
505 def register(foo):
506 foo.update({"stage3":stage3_target})
507
508 diff --git a/catalyst/targets/stage4_target.py b/catalyst/targets/stage4_target.py
509 index e2b8a79..0d725c7 100644
510 --- a/catalyst/targets/stage4_target.py
511 +++ b/catalyst/targets/stage4_target.py
512 @@ -3,10 +3,10 @@ stage4 target, builds upon previous stage3/stage4 tarball
513 """
514 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
515
516 -from catalyst.support import *
517 -from generic_stage_target import *
518 +from catalyst.base.stagebase import StageBase
519
520 -class stage4_target(generic_stage_target):
521 +
522 +class stage4_target(StageBase):
523 """
524 Builder class for stage4.
525 """
526 @@ -18,7 +18,7 @@ class stage4_target(generic_stage_target):
527 "stage4/gk_mainargs","splash_theme",\
528 "portage_overlay","stage4/rcadd","stage4/rcdel",\
529 "stage4/linuxrc","stage4/unmerge","stage4/rm","stage4/empty"])
530 - generic_stage_target.__init__(self,spec,addlargs)
531 + StageBase.__init__(self,spec,addlargs)
532
533 def set_cleanables(self):
534 self.settings["cleanables"]=["/var/tmp/*","/tmp/*"]
535
536 diff --git a/catalyst/targets/tinderbox_target.py b/catalyst/targets/tinderbox_target.py
537 index ea11d3f..1e245f2 100644
538 --- a/catalyst/targets/tinderbox_target.py
539 +++ b/catalyst/targets/tinderbox_target.py
540 @@ -3,10 +3,13 @@ Tinderbox target
541 """
542 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
543
544 -from catalyst.support import *
545 -from generic_stage_target import *
546 +import os
547
548 -class tinderbox_target(generic_stage_target):
549 +from catalyst.support import cmd, list_bashify, CatalystError
550 +from catalyst.base.stagebase import StageBase
551 +
552 +
553 +class tinderbox_target(StageBase):
554 """
555 Builder class for the tinderbox target
556 """
557 @@ -14,7 +17,7 @@ class tinderbox_target(generic_stage_target):
558 self.required_values=["tinderbox/packages"]
559 self.valid_values=self.required_values[:]
560 self.valid_values.extend(["tinderbox/use"])
561 - generic_stage_target.__init__(self,spec,addlargs)
562 + StageBase.__init__(self,spec,addlargs)
563
564 def run_local(self):
565 # tinderbox