craft_parts.overlays.overlay_fs module

Low level interface to OS overlayfs.

class craft_parts.overlays.overlay_fs.OverlayFS(*, lower_dirs, upper_dir, work_dir)[source]

Bases: object

Linux overlayfs operations.

Parameters:
  • lower_dirs (list[Path])

  • upper_dir (Path)

  • work_dir (Path)

mount(mountpoint)[source]

Mount an overlayfs.

Parameters:

mountpoint (Path) – The filesystem mount point.

Raises:

OverlayMountError – on mount error.

Return type:

None

unmount()[source]

Umount an overlayfs.

Raises:

OverlayUnmountError – on unmount error.

Return type:

None

craft_parts.overlays.overlay_fs.is_opaque_dir(path)[source]

Verify if the given path corresponds to an opaque directory.

Overlayfs opaque directories are represented by directories with the extended attribute trusted.overlay.opaque set to y.

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.overlay_fs.is_whiteout_file(path)[source]

Verify if the given path corresponds to a whiteout file.

Overlayfs whiteout files are represented as character devices with major and minor numbers set to 0.

Parameters:

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

Return type:

bool

Returns:

Whether the given path is an overlayfs whiteout.