Pmaports.cfg reference

From postmarketOS Wiki

pmaports.cfg is present on each branch of pmaports.git and holds various metadata parsed by pmbootstrap.

Example

# Reference: https://postmarketos.org/pmaports.cfg
[pmaports]
version=7
pmbootstrap_min_version=1.29.0
channel=edge
supported_root_filesystems=ext4,f2fs

[repo:systemd]
pmaports_dir=systemd
# Build forks of Alpine packages that support usr_merge
bootstrap_1=apk-tools abuild alpine-base
# Build systemd related pkgs without deps on each other
bootstrap_2=[usr_merge] systemd dbus linux-pam
# Build systemd related pkgs *with* deps on each other
bootstrap_3=[usr_merge] systemd dbus linux-pam
# Marker that bootstrap is done, only needs to be built once
bootstrap_4=[usr_merge] postmarketos-base-systemd

Section reference

pmaports

Variable Description Possibles values
version pmbootstrap compares this with pmb.config.pmaports_min_version and complains if this version isn't at least as high as the version that pmbootstrap requires.

Do not change. This variable was fine when we were only using edge. But now that we have release branches, we have different pmaports branches supported at the same time with different feature sets. These features should be described with supported_* variables (see below). This makes it more descriptive and more flexible (allows backporting only specific features), and by not increasing pmaports_min_version in pmbootstrap, we don't break compatibility with old release channels.

7
pmbootstrap_min_version pmbootstrap compares this with pmb.config.version and complains if this branch of pmaports needs a newer pmbootstrap version 1.17.0
channel One of the release channels defined in channels.cfg. While channels.cfg already defines the pmaports branch related to a given channel, it is needed to save the channel in pmaports.cfg of each branch as well, so we know to which channel a forked branch belongs. edge, v21.06
supported_firewall Set to nftables if the nftables-based firewall is supported (!2042, pmaports!2060). nftables
supported_root_filesystems Comma-separated list of filesystems, which postmarketos-mkinitfs supports. pmbootstrap install --filesystem will complain if trying to use a filesystem that is not supported (!2011, pmaports!1850). ext4,f2fs (Default: ext4)
supported_base_nofde Flag to indicate if postmarketos-base supports a dummy package to satisfy mkinitfs's dependency for an fde unlocker (e.g. osk-sdl). (!2066, pmaports!2242). True
supported_install_boot_label The label of the boot partition for the installer OS. Set to "pmOS_i_boot" to make it fit the 11 character limit for FAT16/FAT32. pmaports!2337, !2083 pmOS_i_boot (Default: pmOS_inst_boot)
supported_mkinitfs_without_flavors Flag to indicate that support for the new mkinitfs is in pmaports, !2093, pmaports!2426 True
supported_arches Comma-separated list of architectures supported on the current branch. Must be a subset of pmbootstrap's pmb.config.build_device_architectures. pmaports!3205 e.g. x86_64,aarch64,armv7
supported_fastboot_depends Comma-separated list of depends needed for the fastboot flashing method. Used to be android-tools,avbtool (default) until 2022-11 where in Alpine edge avbtool became part of android-tools. pmaports#1779 android-tools
supported_heimdall_depends Comma-separated list of depends needed for the heimdall flashing method. Used to be heimdall,avbtool (default) until 2022-11 where in Alpine edge avbtool became part of android-tools. pmaports#1779 heimdall,android-tools
supported_mtkclient_depends Comma-separated list of depends needed for the mtkclient flashing method. This is mtkclient,android-tools. Can be used in the future if needed to override just like the other flasher depends variables above. mtkclient,android-tools
install_user_groups Comma-separated list of groups that the user gets added to in new installations. We used to add the user to the input group by default, see pmaports!4303. It is also possible to add additional groups per UI, by using _pmb_groups in the UI's APKBUILD. audio,netdev,plugdev,video,wheel

repo:<name>

All packages from pmaports used to end up in one binary repository. The repo: sections allow splitting off directories into separate binary repositories. This feature is being built right now, for the systemd support (pmaports#2632). In theory, we could use the feature in the future to split off other directories into separate binary repositories too.

Variable Description Possibles values
pmaports_dir The name of the directory to split off. e.g. systemd
bootstrap_1 Having this key indicates that the repository needs to be bootstrapped with pmbootstrap repo_bootstrap <name>, unlike the main repository which does not need this step. The value indicates the packages that should be built during the first bootstrap step. During each step, a BOOTSTRAP=1 value gets passed to the APKBUILD, so it can use different dependencies etc. depending on the bootstrap step. pmbootstrap clears the chroots between each bootstrap step. The value of each step may start with [usr_merge] to indicate that /usr must be merged before building packages in this step. e.g. apk-tools abuild alpine-base
bootstrap_2 The second bootstrap step, exporting BOOTSTRAP=2 for the APKBUILD. The next one is bootstrap_3 and so on. e.g. [usr_merge] systemd dbus

Using pmaports.cfg options in pmbootstrap code

If pmbootstrap needs to do different things, depending on the pmaports branch, then add a new option to pmaports.cfg. Get and use the value in pmbootstrap code as follows:

import pmb.config.pmaports
...
pmaports_cfg = pmb.config.pmaports.read_config(args)
some_var = pmaports_cfg.get("supported_some_var", "default_value")
# now do something with some_var