craft_parts.executor.migration module¶
Handle the execution of built-in or user specified step commands.
Clean files added by a part to a shared directory.
- Parameters:
part_name (
str
) – The name of the part that added the files.shared_dir (
Path
) – The shared directory to remove files from.part_states (
dict
[str
,StepState
]) – A dictionary mapping each part to the part’s state for the step corresponding to the area being cleaned.overlay_migration_state (
MigrationState
|None
) – The state of the overlay migration to step.
- Return type:
None
Remove migrated overlay files from a shared directory.
- Parameters:
state_file – The migration state file.
shared_dir (
Path
) – The shared directory to remove files from.part_states (
dict
[str
,StepState
]) – A dictionary mapping each part to the part’s state for the step corresponding to the area being cleaned.overlay_migration_state (
MigrationState
|None
)
- Return type:
None
- craft_parts.executor.migration.filter_dangling_whiteouts(files, dirs, *, base_dir)[source]¶
Remove dangling whiteout file and directory names.
Names corresponding to dangling files and directories (i.e. without a backing file in the base layer to be whited out) are to be removed from the provided sets of files and directory names.
- Parameters:
files (
set
[str
]) – The set of files to be verified.dirs (
set
[str
]) – The set of directories to be verified.base_dir (
Path
|None
)
- Return type:
set
[str
]- Returns:
The set of filtered out whiteout files.
- craft_parts.executor.migration.migrate_files(*, files, dirs, srcdir, destdir, missing_ok=False, follow_symlinks=False, oci_translation=False, fixup_func=<function <lambda>>, permissions=None)[source]¶
Copy or link files from a directory to another.
Files and directories are migrated from one step to the next during the lifecycle processing. Whenever possible, files are hard-linked instead of copied.
- Parameters:
files (
set
[str
]) – The set of files to migrate.dirs (
set
[str
]) – The set of directories to migrate.srcdir (
Path
) – The directory containing entries to migrate.destdir (
Path
) – The directory to migrate entries to.missing_ok (
bool
) – Ignore entries that don’t exist.follow_symlinks (
bool
) – Migrate symlink targets.oci_translation (
bool
) – Convert to OCI whiteout files and opaque dirs.fixup_func (
Callable
[...
,None
]) – A function to run on each migrated file.permissions (
Optional
[list
[Permissions
]]) – A list of permissions definitions to take into account when migrating the files (the original files are not modified).
- Return type:
tuple
[set
[str
],set
[str
]]- Returns:
A tuple containing sets of migrated files and directories.