diff options
-rw-r--r-- | catalyst/base/stagebase.py | 12 | ||||
-rw-r--r-- | catalyst/config.py | 9 | ||||
-rw-r--r-- | catalyst/defaults.py | 15 | ||||
-rw-r--r-- | catalyst/main.py | 4 | ||||
-rw-r--r-- | examples/generic_stage_template.spec | 13 |
5 files changed, 46 insertions, 7 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 8d326ea8..eeaea6c2 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -146,7 +146,8 @@ class StageBase(TargetBase, ClearBase, GenBase): # Initialize our (de)compressor's) self.decompressor = CompressMap(self.settings["decompress_definitions"], env=self.env, - search_order=self.settings["decompressor_search_order"]) + search_order=self.settings["decompressor_search_order"], + comp_prog=self.settings["comp_prog"]) self.accepted_extensions = self.decompressor.search_order_extensions( self.settings["decompressor_search_order"]) log.notice("Source file specification matching setting is: %s", @@ -691,6 +692,7 @@ class StageBase(TargetBase, ClearBase, GenBase): "destination": self.settings["chroot_path"], 'mode': None, 'auto-ext': False, + 'other_options': self.settings["compressor_options"], } display_msg = ( @@ -806,6 +808,7 @@ class StageBase(TargetBase, ClearBase, GenBase): 'destination': self.settings["snapshot_cache_path"], 'mode': None, 'auto-ext': False, + 'other_options': self.settings["compressor_options"], } target_portdir = normpath(self.settings["chroot_path"] + @@ -1270,7 +1273,8 @@ class StageBase(TargetBase, ClearBase, GenBase): # resources if it is not needed if not self.compressor: self.compressor = CompressMap(self.settings["compress_definitions"], - env=self.env, default_mode=self.settings['compression_mode']) + env=self.env, default_mode=self.settings['compression_mode'], + logger=log) if "autoresume" in self.settings["options"] \ and self.resume.is_enabled("capture"): @@ -1288,7 +1292,9 @@ class StageBase(TargetBase, ClearBase, GenBase): basedir=self.settings["stage_path"], filename=self.settings["target_path"].rstrip('/'), mode=self.settings["compression_mode"], - auto_extension=True + auto_extension=True, + arch=self.settings["compressor_arch"], + other_options=self.settings["compressor_options"], ) target_filename = ".".join([self.settings["target_path"].rstrip('/'), self.compressor.extension(pack_info['mode'])]) diff --git a/catalyst/config.py b/catalyst/config.py index ee73abd2..a3a7200a 100644 --- a/catalyst/config.py +++ b/catalyst/config.py @@ -12,6 +12,7 @@ class ParserBase(object): key_value_separator = "=" multiple_values = False empty_values = True + eval_none = False def __getitem__(self, key): return self.values[key] @@ -103,6 +104,13 @@ class ParserBase(object): log.warning('No value set for key "%s"; deleting', x) del values[x] + if self.eval_none: + # Make sure the list of keys is static since we modify inside the loop. + for x in list(values.keys()): + # reset None values + if isinstance(values[x], str) and values[x].lower() in ['none']: + log.info('None value found for key "%s"; reseting', x) + values[x] = None self.values = values class SpecParser(ParserBase): @@ -110,6 +118,7 @@ class SpecParser(ParserBase): key_value_separator = ':' multiple_values = True empty_values = False + eval_none = True def __init__(self, filename=""): if filename: diff --git a/catalyst/defaults.py b/catalyst/defaults.py index a0e3ea87..8b413f72 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -1,6 +1,14 @@ +import os from DeComp.definitions import DECOMPRESSOR_XATTR_SEARCH_ORDER +from DeComp.definitions import COMPRESSOR_PROGRAM_OPTIONS, XATTRS_OPTIONS + +# Used for the (de)compressor definitions +if os.uname()[0] in ["Linux", "linux"]: + TAR = 'linux' +else: + TAR = 'bsd' # these should never be touched @@ -18,13 +26,16 @@ required_config_file_values = ["storedir", "sharedir", "distdir", "portdir"] valid_config_file_values = required_config_file_values[:] valid_config_file_values.extend([ "distcc", "envscript", "options", "DEBUG", "VERBOSE", - "snapshot_cache", "hash_function", "digests", "contents" - "compression_mode", "decompressor_search_order", + "snapshot_cache", "hash_function", "digests", "contents", "compressor_arch", + "compression_mode", "compressor_options", "decompressor_search_order", ]) confdefaults={ "archdir": "%(PythonDir)s/arch", + "comp_prog": COMPRESSOR_PROGRAM_OPTIONS[TAR], "compression_mode": 'lbzip2_x', + "compressor_arch": None, + "compressor_options": XATTRS_OPTIONS[TAR], "decompressor_search_order": DECOMPRESSOR_XATTR_SEARCH_ORDER, "distdir": "/usr/portage/distfiles", "hash_function": "crc32", diff --git a/catalyst/main.py b/catalyst/main.py index 6608b862..5b6b9aca 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -331,7 +331,8 @@ def _main(parser, opts): log.debug('conf_values[options] = %s', conf_values['options']) # initialize our contents generator - contents_map = ContentsMap(CONTENTS_DEFINITIONS) + contents_map = ContentsMap(CONTENTS_DEFINITIONS, + comp_prog=conf_values['comp_prog']) conf_values["contents_map"] = contents_map # initialze our hash and contents generators @@ -401,6 +402,7 @@ def _main(parser, opts): addlargs={} if myspecfile: + log.notice("Processing spec file: %s", myspecfile) spec = catalyst.config.SpecParser(myspecfile) addlargs.update(spec.get_values()) diff --git a/examples/generic_stage_template.spec b/examples/generic_stage_template.spec index 367a182f..40a3d5c0 100644 --- a/examples/generic_stage_template.spec +++ b/examples/generic_stage_template.spec @@ -63,6 +63,18 @@ source_subpath: # compression_mode: lbzip2 +# Optional arch specification which applies only to the squashfs commpression modes +# default is None +compressor_arch": + +# Optional compressor options to add to the compression command +# Defaults to a predetermined set of xattribute options +# To disable the defaults uncomment the following line +#compressor_options": None +# Or to specify your own (overrides the defaults) +# uncomment this next line and add your own options. +#compressor_options": + # The search order to use for determining the decompressor # to use on the source file. i.e. check the extensions it is capable of # decompressing to find a match. Use the list above for the modes available. @@ -70,7 +82,6 @@ compression_mode: lbzip2 # decompressor_search_order: lbzip2 bzip2 tar pixz xz gzip squashfs - # These are the hosts used as distcc slaves when distcc is enabled in your # catalyst.conf. It follows the same syntax as distcc-config --set-hosts and # is entirely optional. |