Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:pending commit in: etc/, catalyst/targets/, catalyst/base/, examples/, catalyst/
Date: Tue, 01 Sep 2015 05:59:16
Message-Id: 1441086851.f6c3ede7ec389b9b9d39ede27ee1165a8bcc417b.dolsen@gentoo
1 commit: f6c3ede7ec389b9b9d39ede27ee1165a8bcc417b
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 24 07:36:49 2015 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 1 05:54:11 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f6c3ede7
7
8 apply new compress code, normalize paths
9
10 catalyst/base/stagebase.py | 171 +++++++++++++++++++----------------
11 catalyst/defaults.py | 4 +
12 catalyst/main.py | 8 ++
13 catalyst/targets/grp.py | 2 +-
14 catalyst/targets/livecd_stage1.py | 2 +-
15 catalyst/targets/livecd_stage2.py | 6 +-
16 catalyst/targets/netboot.py | 8 +-
17 catalyst/targets/netboot2.py | 2 +-
18 catalyst/targets/stage2.py | 8 +-
19 etc/catalyst.conf | 11 ++-
20 examples/generic_stage_template.spec | 32 ++++++-
21 11 files changed, 159 insertions(+), 95 deletions(-)
22
23 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
24 index 6adc3b9..2e175f1 100644
25 --- a/catalyst/base/stagebase.py
26 +++ b/catalyst/base/stagebase.py
27 @@ -10,6 +10,8 @@ from stat import ST_UID, ST_GID, ST_MODE
28 # for convienience
29 pjoin = os.path.join
30
31 +from decomp.compress import CompressMap
32 +
33 from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
34 PORT_LOGDIR_CLEAN)
35 from catalyst.support import (CatalystError, msg, file_locate, normpath,
36 @@ -259,6 +261,14 @@ class StageBase(TargetBase, ClearBase, GenBase):
37 self.env["PORT_LOGDIR"] = self.settings["port_logdir"]
38 self.env["PORT_LOGDIR_CLEAN"] = PORT_LOGDIR_CLEAN
39
40 + # Initialize our (de)compressor's)
41 + self.decompressor = CompressMap(self.settings["decompress_definitions"],
42 + env=self.env,
43 + search_order=self.settings["decompressor_search_order"])
44 +
45 + # save resources, it is not always needed
46 + self.compressor = None
47 +
48 def override_cbuild(self):
49 if "CBUILD" in self.makeconf:
50 self.settings["CBUILD"]=self.makeconf["CBUILD"]
51 @@ -319,11 +329,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
52 normpath(self.settings["kerncache_path"])
53 else:
54 self.settings["kerncache_path"]=normpath(self.settings["storedir"]+\
55 - "/kerncache/"+self.settings["target_subpath"]+"/")
56 + "/kerncache/"+self.settings["target_subpath"])
57
58 def set_target_path(self):
59 self.settings["target_path"]=normpath(self.settings["storedir"]+\
60 - "/builds/"+self.settings["target_subpath"].rstrip('/')+".tar.bz2")
61 + "/builds/"+self.settings["target_subpath"])
62 if "autoresume" in self.settings["options"]\
63 and self.resume.is_enabled("setup_target_path"):
64 print \
65 @@ -407,7 +417,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
66 "/tmp/" + self.settings["source_subpath"] + "/")
67 else:
68 self.settings["source_path"]=normpath(self.settings["storedir"]+\
69 - "/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
70 + "/builds/"+self.settings["source_subpath"])
71 if os.path.isfile(self.settings["source_path"]):
72 # XXX: Is this even necessary if the previous check passes?
73 if os.path.exists(self.settings["source_path"]):
74 @@ -422,7 +432,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
75 print "\tseedcache in the options of catalyst.conf the source path"
76 print "\twill then be "+\
77 normpath(self.settings["storedir"]+"/builds/"+\
78 - self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
79 + self.settings["source_subpath"]+"\n")
80
81 def set_dest_path(self):
82 if "root_path" in self.settings:
83 @@ -449,7 +459,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
84 else:
85 self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
86 "/snapshots/" + self.settings["snapshot_name"] +
87 - self.settings["snapshot"].rstrip('/')+".tar.bz2")
88 + self.settings["snapshot"])
89
90 if os.path.exists(self.settings["snapshot_path"]):
91 self.settings["snapshot_path_hash"] = \
92 @@ -459,6 +469,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
93 verbose = False)
94
95 def set_snapcache_path(self):
96 + self.settings["snapshot_cache_path"]=\
97 + normpath(pjoin(self.settings["snapshot_cache"],
98 + self.settings["snapshot"]))
99 if "snapcache" in self.settings["options"]:
100 self.settings["snapshot_cache_path"] = \
101 normpath(pjoin(self.settings["snapshot_cache"],
102 @@ -677,47 +690,32 @@ class StageBase(TargetBase, ClearBase, GenBase):
103
104 clst_unpack_hash = self.resume.get("unpack")
105
106 + unpack_info = {
107 + 'source': self.settings["source_path"],
108 + "destination": self.settings["chroot_path"],
109 + 'mode': None,
110 + 'auto-ext': False,
111 + }
112 +
113 + display_msg="\nStarting %(mode)s from %(source)s\nto "+\
114 + "%(destination)s (This may take some time) ...\n"
115 +
116 + error_msg="'%(mode)s' extraction of %(source)s to %(destination)s failed."
117 +
118 if "seedcache" in self.settings["options"]:
119 - if os.path.isdir(self.settings["source_path"]):
120 + if os.path.isdir(unpack_info["source"]):
121 """ SEEDCACHE Is a directory, use rsync """
122 - unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\
123 - " "+self.settings["chroot_path"]
124 - display_msg="\nStarting rsync from "+\
125 - self.settings["source_path"]+"\nto "+\
126 - self.settings["chroot_path"]+\
127 - " (This may take some time) ...\n"
128 - error_msg="Rsync of "+self.settings["source_path"]+" to "+\
129 - self.settings["chroot_path"]+" failed."
130 + unpack_info['mode'] = "rsync"
131 else:
132 """ SEEDCACHE is a not a directory, try untar'ing """
133 print "Referenced SEEDCACHE does not appear to be a directory, trying to untar..."
134 - display_msg="\nStarting tar extract from "+\
135 - self.settings["source_path"]+"\nto "+\
136 - self.settings["chroot_path"]+\
137 - " (This may take some time) ...\n"
138 - if "bz2" == self.settings["chroot_path"][-3:]:
139 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
140 - self.settings["chroot_path"]
141 - else:
142 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
143 - self.settings["chroot_path"]
144 - error_msg="Tarball extraction of "+\
145 - self.settings["source_path"]+" to "+\
146 - self.settings["chroot_path"]+" failed."
147 + unpack_info['mode'] = self.decompressor.determine_mode(
148 + self.settings["source_path"])
149 else:
150 """ No SEEDCACHE, use tar """
151 - display_msg="\nStarting tar extract from "+\
152 - self.settings["source_path"]+"\nto "+\
153 - self.settings["chroot_path"]+\
154 - " (This may take some time) ...\n"
155 - if "bz2" == self.settings["chroot_path"][-3:]:
156 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
157 - self.settings["chroot_path"]
158 - else:
159 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
160 - self.settings["chroot_path"]
161 - error_msg="Tarball extraction of "+self.settings["source_path"]+\
162 - " to "+self.settings["chroot_path"]+" failed."
163 + unpack_info['mode'] = self.decompressor.determine_mode(
164 + unpack_info["source"])
165 + # endif "seedcache"
166
167 if "autoresume" in self.settings["options"]:
168 if os.path.isdir(self.settings["source_path"]) \
169 @@ -785,8 +783,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
170 if "kerncache" in self.settings["options"]:
171 ensure_dirs(self.settings["kerncache_path"],mode=0755)
172
173 - print display_msg
174 - cmd(unpack_cmd,error_msg,env=self.env)
175 + print display_msg %(unpack_info)
176 +
177 + # now run the decompressor
178 + if not self.decompressor.extract(unpack_info):
179 + print error_msg %(unpack_info)
180
181 if "source_path_hash" in self.settings:
182 self.resume.enable("unpack",
183 @@ -800,16 +801,26 @@ class StageBase(TargetBase, ClearBase, GenBase):
184 unpack=True
185 snapshot_hash = self.resume.get("unpack_portage")
186
187 + unpack_errmsg="Error unpacking snapshot using mode %(mode)s"
188 +
189 + unpack_info = {
190 + 'source': self.settings["snapshot_path"],
191 + 'destination': self.settings["snapshot_cache_path"],
192 + 'mode': None,
193 + 'auto-ext': False,
194 + }
195 +
196 + target_portdir = normpath(self.settings["chroot_path"] +
197 + self.settings["repo_basedir"] + "/" + self.settings["repo_name"])
198 + print self.settings["chroot_path"]
199 + print "unpack(), target_portdir = " + target_portdir
200 if "snapcache" in self.settings["options"]:
201 snapshot_cache_hash=\
202 - read_from_clst(self.settings["snapshot_cache_path"] + "/" +
203 - "catalyst-hash")
204 - destdir=self.settings["snapshot_cache_path"]
205 - if "bz2" == self.settings["chroot_path"][-3:]:
206 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["snapshot_path"]+" -C "+destdir
207 - else:
208 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -xpf "+self.settings["snapshot_path"]+" -C "+destdir
209 - unpack_errmsg="Error unpacking snapshot"
210 + read_from_clst(self.settings["snapshot_cache_path"]+\
211 + "catalyst-hash")
212 + unpack_info['mode'] = self.decompressor.determine_mode(
213 + unpack_info['source'])
214 +
215 cleanup_msg="Cleaning up invalid snapshot cache at \n\t"+\
216 self.settings["snapshot_cache_path"]+\
217 " (This can take a long time)..."
218 @@ -820,21 +831,16 @@ class StageBase(TargetBase, ClearBase, GenBase):
219 print "Valid snapshot cache, skipping unpack of portage tree..."
220 unpack=False
221 else:
222 - destdir = normpath(self.settings["chroot_path"] + self.settings["portdir"])
223 cleanup_errmsg="Error removing existing snapshot directory."
224 cleanup_msg=\
225 "Cleaning up existing portage tree (This can take a long time)..."
226 - if "bz2" == self.settings["chroot_path"][-3:]:
227 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -xpf "+self.settings["snapshot_path"]+" -C "+\
228 - self.settings["chroot_path"]+"/usr"
229 - else:
230 - unpack_cmd="tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -xpf "+self.settings["snapshot_path"]+" -C "+\
231 - self.settings["chroot_path"]+"/usr"
232 - unpack_errmsg="Error unpacking snapshot"
233 + unpack_info['destination'] = normpath(
234 + self.settings["chroot_path"] + self.settings["repo_basedir"])
235 + unpack_info['mode'] = self.decompressor.determine_mode(
236 + unpack_info['source'])
237
238 if "autoresume" in self.settings["options"] \
239 - and os.path.exists(self.settings["chroot_path"] +
240 - self.settings["portdir"]) \
241 + and os.path.exists(target_portdir) \
242 and self.resume.is_enabled("unpack_portage") \
243 and self.settings["snapshot_path_hash"] == snapshot_hash:
244 print \
245 @@ -844,14 +850,16 @@ class StageBase(TargetBase, ClearBase, GenBase):
246 if unpack:
247 if "snapcache" in self.settings["options"]:
248 self.snapshot_lock_object.write_lock()
249 - if os.path.exists(destdir):
250 + if os.path.exists(target_portdir):
251 print cleanup_msg
252 - cleanup_cmd="rm -rf "+destdir
253 + cleanup_cmd = "rm -rf " + target_portdir
254 + print "unpack() cleanup_cmd = " + cleanup_cmd
255 cmd(cleanup_cmd,cleanup_errmsg,env=self.env)
256 - ensure_dirs(destdir,mode=0755)
257 + ensure_dirs(target_portdir, mode=0755)
258
259 print "Unpacking portage tree (This can take a long time) ..."
260 - cmd(unpack_cmd,unpack_errmsg,env=self.env)
261 + if not self.decompressor.extract(unpack_info):
262 + print unpack_errmsg %(unpack_info)
263
264 if "snapcache" in self.settings["options"]:
265 myf=open(self.settings["snapshot_cache_path"] +
266 @@ -1243,6 +1251,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
267 raise CatalystError("Build failed, could not execute preclean")
268
269 def capture(self):
270 + # initialize it here so it doesn't use
271 + # resources if it is not needed
272 + if not self.compressor:
273 + self.compressor = CompressMap(self.settings["compress_definitions"],
274 + env=self.env, default_mode=self.settings['compression_mode'])
275 +
276 if "autoresume" in self.settings["options"] \
277 and self.resume.is_enabled("capture"):
278 print "Resume point detected, skipping capture operation..."
279 @@ -1254,16 +1268,24 @@ class StageBase(TargetBase, ClearBase, GenBase):
280 """ Now make sure path exists """
281 ensure_dirs(mypath)
282
283 - print "Creating stage tarball..."
284 -
285 - cmd("tar --xattrs --xattrs-include=security.capability --xattrs-include=user.pax.flags --selinux -I lbzip2 -cpf "+self.settings["target_path"]+" -C "+\
286 - self.settings["stage_path"]+" .",\
287 - "Couldn't create stage tarball",env=self.env)
288 + pack_info = self.compressor.create_infodict(
289 + source=".",
290 + basedir=self.settings["stage_path"],
291 + filename=self.settings["target_path"],
292 + mode=self.settings["compression_mode"],
293 + auto_extension=True
294 + )
295 + target_filename = ".".join([self.settings["target_path"],
296 + self.compressor.extension(pack_info['mode'])])
297
298 - self.gen_contents_file(self.settings["target_path"])
299 - self.gen_digest_file(self.settings["target_path"])
300 + print "Creating stage tarball..."
301
302 - self.resume.enable("capture")
303 + if self.compressor.compress(pack_info):
304 + self.gen_contents_file(target_filename)
305 + self.gen_digest_file(target_filename)
306 + self.resume.enable("capture")
307 + else:
308 + print "Couldn't create stage tarball:", target_filename
309
310 def run_local(self):
311 if "autoresume" in self.settings["options"] \
312 @@ -1365,12 +1387,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
313 for x in self.settings["action_sequence"]:
314 print "--- Running action sequence: "+x
315 sys.stdout.flush()
316 - try:
317 - apply(getattr(self,x))
318 - except Exception as e:
319 - print "--- Exeption running action sequence:" + x
320 - self.mount_safety_check()
321 - raise e
322 + apply(getattr(self,x))
323
324
325 def unmerge(self):
326
327 diff --git a/catalyst/defaults.py b/catalyst/defaults.py
328 index 975e55b..5ce2858 100644
329 --- a/catalyst/defaults.py
330 +++ b/catalyst/defaults.py
331 @@ -16,12 +16,15 @@ valid_config_file_values = required_config_file_values[:]
332 valid_config_file_values.extend([ "distcc", "envscript",
333 "options", "DEBUG", "VERBOSE",
334 "snapshot_cache", "hash_function", "digests", "contents"
335 + "compression_mode", "decompressor_search_order",
336 ])
337
338 verbosity = 1
339
340 confdefaults={
341 "archdir": "%(PythonDir)s/arch",
342 + "compression_mode": 'lbzip2',
343 + "decompressor_search_order": 'lbzip2 bzip2 tar pixz xz gzip squashfs',
344 "distdir": "/usr/portage/distfiles",
345 "hash_function": "crc32",
346 "icecream": "/var/cache/icecream",
347 @@ -33,6 +36,7 @@ confdefaults={
348 "portdir": "/usr/portage",
349 "port_tmpdir": "/var/tmp/portage",
350 "PythonDir": "./catalyst",
351 + "repo_basedir": "/usr",
352 "repo_name": "portage",
353 "sharedir": "/usr/share/catalyst",
354 "shdir": "/usr/share/catalyst/targets/",
355
356 diff --git a/catalyst/main.py b/catalyst/main.py
357 index 3ab4166..0ba81b9 100644
358 --- a/catalyst/main.py
359 +++ b/catalyst/main.py
360 @@ -13,6 +13,7 @@ import os.path
361
362 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
363
364 +from decomp.compress import COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS
365
366 import catalyst.config
367 import catalyst.util
368 @@ -103,6 +104,8 @@ def parse_config(myconfig):
369 if x in myconf:
370 if x == 'options':
371 conf_values[x] = set(myconf[x].split())
372 + elif x in ["decompressor_search_order"]:
373 + conf_values[x] = myconf[x].split()
374 else:
375 conf_values[x]=myconf[x]
376 else:
377 @@ -281,6 +284,11 @@ def main():
378 hash_map = HashMap(HASH_DEFINITIONS)
379 conf_values["hash_map"] = hash_map
380
381 + # initialize our (de)compression definitions
382 + conf_values['decompress_definitions'] = DECOMPRESS_DEFINITIONS
383 + conf_values['compress_definitions'] = COMPRESS_DEFINITIONS
384 + # TODO add capability to config/spec new definitions
385 +
386 # Start checking that digests are valid now that hash_map is initialized
387 if "digests" in conf_values:
388 for i in conf_values["digests"].split():
389
390 diff --git a/catalyst/targets/grp.py b/catalyst/targets/grp.py
391 index 14cffe0..5a10fff 100644
392 --- a/catalyst/targets/grp.py
393 +++ b/catalyst/targets/grp.py
394 @@ -42,7 +42,7 @@ class grp(StageBase):
395 StageBase.__init__(self,spec,addlargs)
396
397 def set_target_path(self):
398 - self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
399 + self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
400 if "autoresume" in self.settings["options"] \
401 and self.resume.is_enabled("setup_target_path"):
402 print "Resume point detected, skipping target path setup operation..."
403
404 diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
405 index 8402e7a..d5645e8 100644
406 --- a/catalyst/targets/livecd_stage1.py
407 +++ b/catalyst/targets/livecd_stage1.py
408 @@ -33,7 +33,7 @@ class livecd_stage1(StageBase):
409 "unbind", "clean","clear_autoresume"]
410
411 def set_target_path(self):
412 - self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+'/')
413 + self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
414 if "autoresume" in self.settings["options"] \
415 and self.resume.is_enabled("setup_target_path"):
416 print "Resume point detected, skipping target path setup operation..."
417
418 diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
419 index 9f0733e..e5ca074 100644
420 --- a/catalyst/targets/livecd_stage2.py
421 +++ b/catalyst/targets/livecd_stage2.py
422 @@ -37,13 +37,13 @@ class livecd_stage2(StageBase):
423 file_locate(self.settings, ["cdtar","controller_file"])
424
425 def set_source_path(self):
426 - self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
427 + self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"])
428 if os.path.isfile(self.settings["source_path"]):
429 self.settings["source_path_hash"] = \
430 self.settings["hash_map"].generate_hash(
431 self.settings["source_path"])
432 else:
433 - self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+'/')
434 + self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"])
435 if not os.path.exists(self.settings["source_path"]):
436 raise CatalystError("Source Path: " +
437 self.settings["source_path"] + " does not exist.",
438 @@ -53,7 +53,7 @@ class livecd_stage2(StageBase):
439 self.settings["spec_prefix"]="livecd"
440
441 def set_target_path(self):
442 - self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
443 + self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
444 if "autoresume" in self.settings["options"] \
445 and self.resume.is_enabled("setup_target_path"):
446 print "Resume point detected, skipping target path setup operation..."
447
448 diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
449 index de8dc85..c41ed59 100644
450 --- a/catalyst/targets/netboot.py
451 +++ b/catalyst/targets/netboot.py
452 @@ -95,10 +95,10 @@ class netboot(StageBase):
453
454 for x in loopy:
455 if "netboot/packages/"+x+"/files" in self.settings:
456 - if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType:
457 - myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
458 - else:
459 - myfiles.append(self.settings["netboot/packages/"+x+"/files"])
460 + if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType:
461 + myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
462 + else:
463 + myfiles.append(self.settings["netboot/packages/"+x+"/files"])
464
465 if "netboot/extra_files" in self.settings:
466 if type(self.settings["netboot/extra_files"]) == types.ListType:
467
468 diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
469 index b492e6a..3305a2a 100644
470 --- a/catalyst/targets/netboot2.py
471 +++ b/catalyst/targets/netboot2.py
472 @@ -52,7 +52,7 @@ class netboot2(StageBase):
473
474 def set_target_path(self):
475 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
476 - self.settings["target_subpath"]+"/")
477 + self.settings["target_subpath"])
478 if "autoresume" in self.settings["options"] \
479 and self.resume.is_enabled("setup_target_path"):
480 print "Resume point detected, skipping target path setup operation..."
481
482 diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
483 index e54b5c9..40dc938 100644
484 --- a/catalyst/targets/stage2.py
485 +++ b/catalyst/targets/stage2.py
486 @@ -19,10 +19,10 @@ class stage2(StageBase):
487 StageBase.__init__(self,spec,addlargs)
488
489 def set_source_path(self):
490 - if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
491 - self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
492 + if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")):
493 + self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")
494 else:
495 - self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
496 + self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"])
497 if os.path.isfile(self.settings["source_path"]):
498 if os.path.exists(self.settings["source_path"]):
499 # XXX: Is this even necessary if the previous check passes?
500 @@ -34,7 +34,7 @@ class stage2(StageBase):
501 print "Source path set to "+self.settings["source_path"]
502 if os.path.isdir(self.settings["source_path"]):
503 print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf"
504 - print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
505 + print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"] + "\n")
506
507 # XXX: How do these override_foo() functions differ from the ones in
508 # StageBase and why aren't they in stage3_target?
509
510 diff --git a/etc/catalyst.conf b/etc/catalyst.conf
511 index 7f56671..aa5d815 100644
512 --- a/etc/catalyst.conf
513 +++ b/etc/catalyst.conf
514 @@ -72,9 +72,18 @@ hash_function="crc32"
515 # (These options can be used together)
516 options="autoresume bindist kerncache pkgcache seedcache snapcache"
517
518 -# portdir specifies the source portage tree used by the snapshot target.
519 +# Source portdir specifies the source portage tree used by the snapshot target.
520 portdir="/usr/portage"
521
522 +# Target portdir setting. It needs to be in 2 parts.
523 +# They will be used separately, then added together where needed.
524 +# eg:
525 +# repo_basedir="/var/lib/repos"
526 +# repo_name="gentoo"
527 +#
528 +repo_basedir="/usr"
529 +repo_name="portage"
530 +
531 # sharedir specifies where all of the catalyst runtime executables
532 # and other shared lib objects are.
533 # Most users do not need to change this.
534
535 diff --git a/examples/generic_stage_template.spec b/examples/generic_stage_template.spec
536 index 45268ca..b43aebe 100644
537 --- a/examples/generic_stage_template.spec
538 +++ b/examples/generic_stage_template.spec
539 @@ -35,16 +35,42 @@ profile:
540
541 # This specifies which snapshot to use for building this target.
542 # example:
543 -# snapshot: 2006.1
544 +# snapshot: 2006.1.tar.bz2
545 snapshot:
546
547 # This specifies where the seed stage comes from for this target, The path is
548 # relative to $clst_sharedir/builds. The rel_type is also used as a path prefix
549 -# for the seed.
550 +# for the seed. It must be a complete filename including the extension.
551 # example:
552 -# default/stage3-x86-2006.1
553 +# default/stage3-x86-2006.1.tar.bz2
554 source_subpath:
555
556 +# The prefered compression/decompression command and algorithm to use
557 +# for creating the final stage tarballs. For decompression the configured
558 +# method will be used if the file's extension is one of it's types listed.
559 +# Otherwise it will pick one that does. Of course you must ensure to have
560 +# the correct package installed that supplies that command/algorithm type.
561 +# available options are:
562 +# Name Compressor Extension
563 +# "rsync" : None
564 +# "lbzip2" : tar.bz2
565 +# "bzip2" : tar.bz2
566 +# "tar" : tar
567 +# "xz" : tar.xz
568 +# "pixz" : tar.xz
569 +# "gzip" : tar.gz
570 +# "squashfs" : squashfs, sfs
571 +#
572 +compression_mode: lbzip2
573 +
574 +# The search order to use for determining the decompressor
575 +# to use on the source file. i.e. check the extensions it is capable of
576 +# decompressing to find a match. Use the list above for the modes available.
577 +#Note: rsync is a special case, do not include it below.
578 +#
579 +decompressor_search_order: lbzip2 bzip2 tar pixz xz gzip squashfs
580 +
581 +
582 # These are the hosts used as distcc slaves when distcc is enabled in your
583 # catalyst.conf. It follows the same syntax as distcc-config --set-hosts and
584 # is entirely optional.