pmb.core package

Submodules

pmb.core.apkindex_block module

class pmb.core.apkindex_block.ApkindexBlock(arch: Arch, depends: list[str], origin: str | None, pkgname: str, provides: list[str], provider_priority: int | None, timestamp: str | None, version: str)

Bases: object

“timestamp” and “origin” are not set for virtual packages (#1273). We use that information to skip these virtual packages in parse().

arch: Arch

the architecture of the package

depends: list[str]

dependencies for the package

origin: str | None

the origin name of the package

pkgname: str

package name

provider_priority: int | None

provider priority for the package

provides: list[str]

what this package provides

timestamp: str | None

unix timestamp of the package build date/time

version: str

package version

pmb.core.arch module

class pmb.core.arch.Arch(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Supported architectures according to the Alpine APKBUILD format.

aarch64 = 'aarch64'
alpine_triple() str

Get the cross compiler triple for this architecture on Alpine.

armel = 'armel'
armhf = 'armhf'
armv7 = 'armv7'
cpu_emulation_required() bool
static from_machine_type(machine_type: str) Arch
static from_str(arch: str) Arch
is_native() bool
kernel() str
loongarch32 = 'loongarch32'
loongarch64 = 'loongarch64'
loongarchx32 = 'loongarchx32'
mips = 'mips'
mips64 = 'mips64'
mips64el = 'mips64el'
mipsel = 'mipsel'
static native() Arch
noarch = 'noarch'
ppc = 'ppc'
ppc64 = 'ppc64'
ppc64le = 'ppc64le'
qemu() str
riscv32 = 'riscv32'
riscv64 = 'riscv64'
s390x = 's390x'
static supported() set[Arch]

Officially supported host/target architectures for postmarketOS. Only specify architectures supported by Alpine here. For cross-compiling, we need to generate the “musl-$ARCH” and “gcc-$ARCH” packages (use “pmbootstrap aportgen musl-armhf” etc.).

x86 = 'x86'
x86_64 = 'x86_64'

pmb.core.chroot module

class pmb.core.chroot.Chroot(suffix_type: ChrootType, name: str | Arch | None = '')

Bases: object

property arch: Arch
static buildroot(arch: Arch) Chroot
property dirname: str
exists() bool
static from_str(s: str) Chroot

Generate a Suffix from a suffix string like “buildroot_aarch64”

static glob() Generator[Path, None, None]

Glob all initialized chroot directories

is_mounted() bool
static iter_patterns() Generator[str, None, None]

Generate suffix patterns for all valid suffix types

property name: str
static native() Chroot
property path: Path
static rootfs(device: str) Chroot
property type: ChrootType
class pmb.core.chroot.ChrootType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

BUILDROOT = 'buildroot'
IMAGE = 'image'
INSTALLER = 'installer'
NATIVE = 'native'
ROOTFS = 'rootfs'

pmb.core.config module

class pmb.core.config.AutoZapConfig(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

NO = 'no'
SILENTLY = 'silently'
YES = 'yes'
enabled() bool
noisy() bool
class pmb.core.config.Config

Bases: object

aports: list[Path] = [PosixPath('/home/build/.local/var/pmbootstrap/cache_git/pmaports')]
auto_zap_misconfigured_chroots: AutoZapConfig = 'no'
boot_size: int = 256
build_default_device_arch: bool = False
build_pkgs_on_install: bool = True
ccache_size: str = '5G'
device: str = 'qemu-amd64'
extra_packages: str = 'none'
extra_space: int = 0
static get_default(dotted_key: str) Any

Get the default value for a config option, supporting nested dictionaries (e.g. “mirrors.alpine”).

hostname: str = ''
is_default_channel: bool = True
jobs: int = 25
kernel: str = 'stable'
keymap: str = ''
static keys() list[str]
locale: str = 'en_US.UTF-8'
mirrors: Mirrors = {'alpine': 'http://dl-cdn.alpinelinux.org/alpine/', 'alpine_custom': 'none', 'pmaports': 'http://mirror.postmarketos.org/postmarketos/', 'pmaports_custom': 'none', 'systemd': 'http://mirror.postmarketos.org/postmarketos/staging/systemd/', 'systemd_custom': 'none'}
providers: dict[str, str] = {}
qemu_redir_stdio: bool = False
ssh_key_glob: str = '~/.ssh/*.pub'
ssh_keys: bool = False
sudo_timer: bool = False
systemd: SystemdConfig = 'default'
timezone: str = 'GMT'
ui: str = 'console'
ui_extras: bool = False
user: str = 'user'
work: Path = PosixPath('/home/build/.local/var/pmbootstrap')
class pmb.core.config.Mirrors

Bases: TypedDict

alpine: str
alpine_custom: str
pmaports: str
pmaports_custom: str
systemd: str
systemd_custom: str
class pmb.core.config.SystemdConfig(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ALWAYS = 'always'
DEFAULT = 'default'
NEVER = 'never'
static choices() list[str]

pmb.core.context module

Global runtime context

class pmb.core.context.Context(config: Config)

Bases: object

assume_yes: bool = False
ccache: bool = False
command: str = ''
command_timeout: float = 900
config: Config
cross: bool = False
details_to_stdout: bool = False
force: bool = False
go_mod_cache: bool = False
ignore_depends: bool = False
log: Path
no_depends: bool = False
offline: bool = False
quiet: bool = False
sudo_timer: bool = False
pmb.core.context.get_context(allow_failure: bool = False) Context

Get immutable global runtime context.

pmb.core.context.set_context(context: Context) None

Set global runtime context.

pmb.core.dps module

pmb.core.package_metadata module

class pmb.core.package_metadata.PackageMetadata(arch: list[str], depends: list[str], pkgname: str, provides: list[str], version: str)

Bases: object

arch: list[str]
depends: list[str]
static from_apkindex_block(apkindex_block: ApkindexBlock) PackageMetadata
static from_pmaport(pmaport: dict[str, Any]) PackageMetadata
pkgname: str
provides: list[str]
version: str

pmb.core.pkgrepo module

pmb.core.pkgrepo.pkgrepo_glob_one(path: str) Path | None

Search for the file denoted by path in all aports repositories. path can be a glob.

pmb.core.pkgrepo.pkgrepo_iglob(path: str, recursive: bool = False) Generator[Path, None, None]

Yield each matching glob over each aports repository.

pmb.core.pkgrepo.pkgrepo_iter_package_dirs(with_extra_repos: Literal['default', 'enabled', 'disabled'] = 'default') Generator[Path, None, None]

Yield each matching glob over each aports repository. Detect duplicates within the same aports repository but otherwise ignore all but the first. This allows for overriding packages.

pmb.core.pkgrepo.pkgrepo_name(path: Path) str

Return the name of the package repository with the given path. This MUST be used instead of “path.name” as we need special handling for the pmaports repository.

pmb.core.pkgrepo.pkgrepo_name_from_subdir(subdir: Path) str

Return the name of the package repository for the given directory. e.g. “pmaports” for “$WORKDIR/pmaports/main/foobar”

pmb.core.pkgrepo.pkgrepo_names(with_extra_repos: Literal['default', 'enabled', 'disabled'] = 'default') list[str]

Return a list of all the package repository names. We REQUIRE that the last repository is “pmaports”, though the directory may be named differently. So we hardcode the name here.

pmb.core.pkgrepo.pkgrepo_path(name: str) Path

Return the absolute path to the package repository with the given name.

pmb.core.pkgrepo.pkgrepo_relative_path(path: Path) tuple[Path, Path]

Return the path relative to the first aports repository.

Module contents