pmb.aportgen package

Submodules

pmb.aportgen.busybox_static module

pmb.aportgen.busybox_static.generate(pkgname: str) None

pmb.aportgen.core module

pmb.aportgen.core.format_function(name: str, body: str, remove_indent: int = 4) str

Format the body of a shell function passed to rewrite() below, so it fits the format of the original APKBUILD.

Parameters:

remove_indent – Maximum number of spaces to remove from the beginning of each line of the function body.

pmb.aportgen.core.generate_checksums(tempdir: Path, apkbuild_path: Path) None

Generate new checksums for a given APKBUILD.

Parameters:
  • tempdir – Temporary directory as provided by prepare_tempdir().

  • apkbuild_path – APKBUILD to generate new checksums for.

pmb.aportgen.core.get_upstream_aport(pkgname: str, arch: Arch | None = None, retain_branch: bool = False) Path

Perform a git checkout of Alpine’s aports and get the path to the aport.

Parameters:
  • pkgname – package name

  • arch – Alpine architecture (e.g. “armhf”), defaults to native arch

Returns:

absolute path on disk where the Alpine aport is checked out example: /opt/pmbootstrap_work/cache_git/aports/upstream/main/gcc

pmb.aportgen.core.indent_size(line: str) int

Number of spaces at the beginning of a string.

pmb.aportgen.core.prepare_tempdir() Path

Prepare a temporary directory to do aportgen-related operations within.

Returns:

Path to a temporary directory for aportgen to work within.

pmb.aportgen.core.rewrite(pkgname: str, path_original: Path | str | None = None, fields: dict[str, str] = {}, replace_pkgname: str | None = None, replace_functions: dict[str, str | None] = {}, replace_simple: dict = {}, below_header: str = '', remove_indent: int = 4) None

Append a header to $WORK/aportgen/APKBUILD, delete maintainer/contributor lines (so they won’t be bugged with issues regarding our generated aports), and add reference to the original aport.

Parameters:
  • path_original – The original path of the automatically generated aport.

  • fields – key-value pairs of fields that shall be changed in the APKBUILD. For example: {“pkgdesc”: “my new package”, “subpkgs”: “”}

  • replace_pkgname – When set, $pkgname gets replaced with that string in every line.

  • replace_functions – Function names and new bodies, for example: {“build”: “return 0”} The body can also be None (deletes the function)

  • replace_simple – Lines that fnmatch the pattern, get replaced/deleted. Example: {”test”: “# test”, “mv test.bin”: None}

  • below_header – String that gets directly placed below the header.

  • remove_indent – Number of spaces to remove from function body provided to replace_functions.

pmb.aportgen.device module

pmb.aportgen.device.ask_for_architecture() Arch
pmb.aportgen.device.ask_for_bootimg() Bootimg | None
pmb.aportgen.device.ask_for_chassis() str
pmb.aportgen.device.ask_for_external_storage() bool
pmb.aportgen.device.ask_for_flash_method() str
pmb.aportgen.device.ask_for_manufacturer() str
pmb.aportgen.device.ask_for_name(manufacturer: str) str
pmb.aportgen.device.ask_for_year() str
pmb.aportgen.device.generate(pkgname: str) None
pmb.aportgen.device.generate_apkbuild(pkgname: str, name: str, arch: Arch, flash_method: str) None
pmb.aportgen.device.generate_deviceinfo(pkgname: str, name: str, manufacturer: str, year: str, arch: Arch, chassis: str, has_external_storage: bool, flash_method: str, bootimg: Bootimg | None = None) None
pmb.aportgen.device.generate_deviceinfo_fastboot_content(bootimg: Bootimg | None = None) str
pmb.aportgen.device.generate_modules_initfs() None

pmb.aportgen.gcc module

pmb.aportgen.gcc.generate(pkgname: str) None

pmb.aportgen.grub_efi module

pmb.aportgen.grub_efi.generate(pkgname: str) None

pmb.aportgen.linux module

pmb.aportgen.linux.generate(pkgname: str) None
pmb.aportgen.linux.generate_apkbuild(pkgname: str, deviceinfo: Deviceinfo, patches: list[str]) None

pmb.aportgen.musl module

pmb.aportgen.musl.generate(pkgname: str) None

Module contents

pmb.aportgen.generate(pkgname: str, fork_alpine: bool, fork_alpine_retain_branch: bool = False) None
pmb.aportgen.get_cross_package_arches(pkgname: str) str

Get the arches for which we want to build cross packages.

Parameters:

pkgname – package name, e.g. “gcc-aarch64”, “gcc-x86_64”

Returns:

string of architecture(s) (space separated). It doesn’t necessarily make sense to use Arch here given that this value gets used to write APKBUILD files, where the arch field can have values that aren’t necessarily valid arches like “!armhf”, “noarch”, or “x86 x86_64”.

pmb.aportgen.properties(pkgname: str) tuple[str, str, AportGenEntry]

Get the pmb.config.aportgen properties for the aport generator, based on the pkgname prefix.

Example: “musl-armhf” => (“musl”, “cross”, {“confirm_overwrite”: False})

Parameters:

pkgname – package name

Returns:

(prefix, folder, options)