pkgcore.merge.engine module¶
core engine for livefs modifications
- class pkgcore.merge.engine.MergeEngine(mode, tempdir, hooks, csets, preserves, observer, offset=None, disable_plugins=False, parallelism=None)[source]¶
Bases:
object
- add_cset(cset_name, func)[source]¶
Regiser a cset generator for use.
The cset will be released from memory when it’s no longer used.
- Parameters:
cset_name – what to call the generated cset
func – callable to get the cset
- add_preserved_cset(cset_name, func)[source]¶
Register a cset generator for use.
The cset will stay in memory until the engine finishes all steps.
- Parameters:
cset_name – what to call the generated cset
func – callable to get the cset
- add_trigger(hook_name, trigger, required_csets)[source]¶
Register a
pkgcore.merge.triggers.base
instance to be executed.- Parameters:
hook_name – engine step to hook the trigger into
trigger –
pkgcore.merge.triggers.base
to add
- static alias_cset(alias, engine, csets)¶
alias a cset to another
- allow_reuse = True¶
- static generate_offset_cset(engine, csets, cset_generator)[source]¶
Generate a cset with offset applied.
- static get_pkg_contents(engine, csets, pkg)[source]¶
Generate the cset of what files shall be merged to the livefs.
- static get_remove_cset(engine, csets)[source]¶
Generate the cset of what files shall be removed from the livefs.
- static get_replace_cset(engine, csets)[source]¶
Return the cset of what will be replaced going from old->new pkg.
- classmethod install(tempdir, pkg, offset=None, observer=None, disable_plugins=False)[source]¶
Generate a MergeEngine instance configured for installing a pkg.
- Parameters:
tempdir – tempspace for the merger to use; this space it must control alone, no sharing.
pkg –
pkgcore.package.metadata.package
instance to installoffset – any livefs offset to force for modifications
disable_plugins – if enabled, run just the triggers passed in
- Returns:
- install_csets = {'install': functools.partial(<function alias_cset>, 'new_cset'), 'install_existing': 'get_install_livefs_intersect', 'new_cset': functools.partial(<function alias_cset>, 'raw_new_cset'), 'replace': functools.partial(<function alias_cset>, 'new_cset'), 'resolved_install': <function map_new_cset_livefs>}¶
- install_csets_preserve = ['new_cset']¶
- install_hooks = {'final': [], 'merge': [], 'post_merge': [], 'pre_merge': [], 'sanity_check': []}¶
- regenerate_csets()[source]¶
Internal function, reset non preserverd csets.
Used in transitioning between hook points
- classmethod replace(tempdir, old, new, offset=None, observer=None, disable_plugins=False)[source]¶
Generate a MergeEngine instance configured for replacing a pkg.
- Parameters:
tempdir – tempspace for the merger to use; this space it must control alone, no sharing.
old –
pkgcore.package.metadata.package
instance to replace, must be from a livefs vdbnew –
pkgcore.package.metadata.package
instanceoffset – any livefs offset to force for modifications
disable_plugins – if enabled, run just the triggers passed in
- Returns:
- replace_cset(name, new_cset)[source]¶
Replace the cset referenced by this engine.
Use only if you know what you’re doing.
- Parameters:
name – name of the cset
- New_cset:
a contentsSet instance to use
- replace_csets = {'install': functools.partial(<function alias_cset>, 'new_cset'), 'install_existing': 'get_install_livefs_intersect', 'modifying': <function MergeEngine.<lambda>>, 'new_cset': functools.partial(<function alias_cset>, 'raw_new_cset'), 'old_cset': 'get_uninstall_livefs_intersect', 'replace': 'get_replace_cset', 'resolved_install': <function map_new_cset_livefs>, 'uninstall': 'get_remove_cset', 'uninstall_existing': functools.partial(<function alias_cset>, 'uninstall')}¶
- replace_csets_preserve = ['new_cset', 'old_cset']¶
- replace_hooks = {'final': [], 'merge': [], 'post_merge': [], 'post_unmerge': [], 'pre_merge': [], 'pre_unmerge': [], 'sanity_check': [], 'unmerge': []}¶
- classmethod uninstall(tempdir, pkg, offset=None, observer=None, disable_plugins=False)[source]¶
Generate a MergeEngine instance configured for uninstalling a pkg.
- Parameters:
tempdir – tempspace for the merger to use; this space it must control alone, no sharing.
pkg –
pkgcore.package.metadata.package
instance to uninstall, must be from a livefs vdboffset – any livefs offset to force for modifications
disable_plugins – if enabled, run just the triggers passed in
- Returns:
- uninstall_csets = {'old_cset': 'get_uninstall_livefs_intersect', 'uninstall': functools.partial(<function alias_cset>, 'old_cset'), 'uninstall_existing': functools.partial(<function alias_cset>, 'uninstall')}¶
- uninstall_csets_preserve = ['old_cset']¶
- uninstall_hooks = {'final': [], 'post_unmerge': [], 'pre_unmerge': [], 'sanity_check': [], 'unmerge': []}¶