craft_parts.overlays.overlays module

Overlay handling helpers.

Relevant OCI documentation available at: https://github.com/opencontainers/image-spec/blob/main/layer.md

craft_parts.overlays.overlays.is_oci_opaque_dir(path)[source]

Verify if the given path corresponds to an opaque directory.

Parameters:

path (Path) – The path of the file to verify.

Return type:

bool

Returns:

Whether the given path is an overlayfs opaque directory.

craft_parts.overlays.overlays.is_oci_whiteout_file(path)[source]

Verify if the given path corresponds to an OCI whiteout file.

Parameters:

path (Path) – The path of the file to verify.

Return type:

bool

Returns:

Whether the given path is an OCI whiteout file.

craft_parts.overlays.overlays.oci_opaque_dir(path)[source]

Return the OCI opaque directory marker.

Parameters:

path (Path) – The directory to mark as opaque.

Return type:

Path

Returns:

The corresponding OCI opaque directory marker path.

craft_parts.overlays.overlays.oci_whited_out_file(whiteout_file)[source]

Find the whited out file corresponding to a whiteout file.

Parameters:

whiteout_file (Path) – The whiteout file to process.

Return type:

Path

Returns:

The file that was whited out.

craft_parts.overlays.overlays.oci_whiteout(path)[source]

Convert the given path to an OCI whiteout file name.

Parameters:

path (Path) – The file path to white out.

Return type:

Path

Returns:

The corresponding OCI whiteout file name.

craft_parts.overlays.overlays.visible_in_layer(lower_dir, upper_dir)[source]

Determine the files and directories that are visible in a layer.

Given a pair of directories containing lower and upper layer entries, list the files and subdirectories in the lower layer that would be directly visible when the layers are stacked (i.e. the visibility is not “blocked” by an entry with the same name that exists in the upper directory). The upper directory may contain OCI whiteout files and opaque dirs.

Parameters:
  • lower_dir (Path) – The lower directory.

  • upper_dir (Path) – The upper directory.

Return type:

Tuple[Set[str], Set[str]]

Returns:

A tuple containing the sets of files and directories that are visible.