ocebuild.pipeline.opencore#

Methods for retrieving and handling OpenCore packages.

Module Contents#

Functions#

extract_opencore_archive(→ None)

Extracts the contents of an OpenCore archive to a temporary directory.

extract_ocbinary_archive(→ None)

Extracts OcBinaryData resources to an existing OpenCore archive.

extract_build_entries(→ None)

Prunes and extracts build entries from an OpenCore package.

get_opencore_checksum(→ str)

Computes the SHA256 checksum of the OpenCore binary.

ocebuild.pipeline.opencore.extract_opencore_archive(pkg: ocebuild.third_party.cpython.pathlib.Path, target: Literal[IA32, X64] = 'X64') None[source]#

Extracts the contents of an OpenCore archive to a temporary directory.

Parameters:
  • pkg – Path to an existing OpenCore package.

  • target – The desired target architecture of the OpenCore EFI.

ocebuild.pipeline.opencore.extract_ocbinary_archive(pkg: ocebuild.third_party.cpython.pathlib.Path, oc_pkg: ocebuild.third_party.cpython.pathlib.Path) None[source]#

Extracts OcBinaryData resources to an existing OpenCore archive.

Parameters:
  • pkg – Path to an existing OcBinarData archive.

  • oc_pkg – Path to an existing OpenCore package.

ocebuild.pipeline.opencore.extract_build_entries(opencore_pkg: ocebuild.third_party.cpython.pathlib.Path, resolvers: List[dict], *args, __wrapper: Iterator | None = None, **kwargs) None[source]#

Prunes and extracts build entries from an OpenCore package.

Parameters:
  • opencore_pkg – The path to the OpenCore package.

  • resolvers – The build configuration resolvers.

  • *args – Additional arguments to pass to the optional iterator wrapper.

  • __wrapper – A wrapper function to apply to the iterator. (Optional)

  • **kwargs – Additional keyword arguments to pass to the optional iterator wrapper.

Returns:

A Path to the extracted OpenCore directory.

ocebuild.pipeline.opencore.get_opencore_checksum(file_path: str | ocebuild.third_party.cpython.pathlib.Path, algorithm=sha256) str[source]#

Computes the SHA256 checksum of the OpenCore binary.

This will compute the checksum of the OpenCore.efi binary, substituting the embedded public key when using vaulting. Modifications are made to a copy of the file within a temporary directory, which is validated and deleted after computing the checksum.

Parameters:
  • file_path – The path to the OpenCore binary.

  • algorithm – The hashlib algorithm to use. Defaults to SHA256.

Raises:
  • AssertionError – If the file checksum does not match the expected value.

  • RuntimeError – If the vault header is not found (i.e. the file is malformed).

Returns:

The SHA256 checksum of the OpenCore binary.