pmb.build package

Submodules

pmb.build.autodetect module

pmb.build.autodetect.arch_from_deviceinfo(pkgname, aport: Path) Arch | None

The device- packages are noarch packages. But it only makes sense to build them for the device’s architecture, which is specified in the deviceinfo file.

Returns:

None (no deviceinfo file) arch from the deviceinfo (e.g. “armhf”)

pmb.build.autodetect.chroot(apkbuild: dict[str, str], arch: Arch) Chroot
pmb.build.autodetect.crosscompile(apkbuild, arch: Arch) Literal['native'] | Literal['crossdirect'] | None

Decide the type of compilation necessary to build a given APKBUILD.

pmb.build.checksum module

pmb.build.checksum.update(pkgname)

Fetch all sources and update the checksums in the APKBUILD.

pmb.build.checksum.verify(pkgname)

Fetch all sources and verify their checksums.

pmb.build.envkernel module

pmb.build.envkernel.find_kbuild_output_dir(function_body)

Guess what the kernel build output directory is.

Parses each line of the function word by word, looking for paths which contain the kbuild output directory.

Parameters:

function_body – contents of a function from the kernel APKBUILD

Returns:

kbuild output dir None, when output dir is not found

pmb.build.envkernel.match_kbuild_out(word)
Look for paths in the following formats:

“<prefix>/<kbuild_out>/arch/<arch>/boot” “<prefix>/<kbuild_out>/include/config/kernel.release”

Parameters:

word – space separated string cut out from a line from an APKBUILD function body that might be the kbuild output path

Returns:

kernel build output directory. empty string when a separate build output directory isn’t used. None, when no output directory is found.

pmb.build.envkernel.modify_apkbuild(pkgname: str, aport: Path)

Modify kernel APKBUILD to package build output from envkernel.sh.

pmb.build.envkernel.package_kernel(args: PmbArgs)

Frontend for ‘pmbootstrap build –envkernel’: creates a package from envkernel output.

pmb.build.envkernel.run_abuild(context: Context, pkgname: str, arch: Arch, apkbuild_path: Path, kbuild_out)

Prepare build environment and run abuild.

Parameters:
  • pkgname – package name of a linux kernel aport

  • arch – architecture for the kernel

  • apkbuild_path – path to APKBUILD of the kernel aport

  • kbuild_out – kernel build system output sub-directory

pmb.build.init module

pmb.build.init.init(chroot: ~pmb.core.chroot.Chroot = <pmb.core.chroot.Chroot object>) bool

Initialize a chroot for building packages with abuild.

pmb.build.init.init_abuild_minimal(chroot: ~pmb.core.chroot.Chroot = <pmb.core.chroot.Chroot object>, additional_pkgs: list[str] = [])

Initialize a minimal chroot with abuild where one can do ‘abuild checksum’.

pmb.build.init.init_compiler(context: Context, depends, cross, arch: Arch)

pmb.build.kconfig module

pmb.build.kconfig.extract_and_patch_sources(pkgname: str, arch) None
pmb.build.kconfig.get_arch(apkbuild) Arch

Take the architecture from the APKBUILD or complain if it’s ambiguous.

This function only gets called if –arch is not set.

Parameters:

apkbuild – looks like: {“pkgname”: “linux-…”, “arch”: [“x86_64”, “armhf”, “aarch64”]}

or: {“pkgname”: “linux-…”, “arch”: [“armhf”]}

pmb.build.kconfig.get_outputdir(pkgname: str, apkbuild: dict[str, Any]) Path

Get the folder for the kernel compilation output.

For most APKBUILDs, this is $builddir. But some older ones still use $srcdir/build (see the discussion in #1551).

pmb.build.kconfig.menuconfig(args: PmbArgs, pkgname: str, use_oldconfig) None

pmb.build.newapkbuild module

pmb.build.newapkbuild.newapkbuild(folder, args_passed, force=False)

pmb.build.other module

class pmb.build.other.BuildStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

CANT_BUILD = 'cant_build'
NEW = 'new'
OUTDATED = 'outdated'
UNNECESSARY = 'unnecessary'
necessary()
pmb.build.other.abuild_overrides(apkbuild: Path)

Override some abuild functions by patching the APKBUILD file.

pmb.build.other.configure_abuild(chroot: Chroot, verify=False)

Set the correct JOBS count in abuild.conf.

Parameters:

verify – internally used to test if changing the config has worked.

pmb.build.other.configure_ccache(chroot: ~pmb.core.chroot.Chroot = <pmb.core.chroot.Chroot object>, verify=False)

Set the maximum ccache size.

Parameters:

verify – internally used to test if changing the config has worked.

pmb.build.other.copy_to_buildpath(package, chroot: ~pmb.core.chroot.Chroot = <pmb.core.chroot.Chroot object>, no_override: bool = False)
pmb.build.other.get_status(arch, apkbuild, indexes=None) BuildStatus

Check if the package has already been built.

Compared to abuild’s check, this check also works for different architectures.

Parameters:
  • arch – package target architecture

  • apkbuild – from pmb.parse.apkbuild()

  • indexes – list of APKINDEX.tar.gz paths

Returns:

boolean

pmb.build.other.index_repo(arch=None)

Recreate the APKINDEX.tar.gz for a specific repo, and clear the parsing cache for that file for the current pmbootstrap session (to prevent rebuilding packages twice, in case the rebuild takes less than a second).

Parameters:

arch – when not defined, re-index all repos

Module contents